diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-09-14 03:39:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-14 03:39:10 +0200 |
commit | 2bbf987a0a352a36ef0cc7f06fe366b60593e89c (patch) | |
tree | 09cc297d12db8fe3ea7bc174e6a1ddaddc10e841 /app/javascript/packs | |
parent | af00220d795670e10bc8c7378837c4a5a287b556 (diff) |
Redesign video player (#4911)
* Redesign video player * Use new video player on static public pages too * Use media gallery component on static public pages too * Pause video when hiding it * Full-screen sizing on WebKit * Add aria labels to video player buttons * Display link card on public status page * Fix fullscreen from modal sizing issue * Remove contain: strict property to fix fullscreen from columns
Diffstat (limited to 'app/javascript/packs')
-rw-r--r-- | app/javascript/packs/public.js | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index ca6f9eac6..6f72a8050 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -24,6 +24,11 @@ function main() { const emojify = require('../mastodon/emoji').default; const { getLocale } = require('../mastodon/locales'); const { localeData } = getLocale(); + const VideoContainer = require('../mastodon/containers/video_container').default; + const MediaGalleryContainer = require('../mastodon/containers/media_gallery_container').default; + const CardContainer = require('../mastodon/containers/card_container').default; + const React = require('react'); + const ReactDOM = require('react-dom'); localeData.forEach(IntlRelativeFormat.__addLocaleData); @@ -65,22 +70,21 @@ function main() { window.open(e.target.href, 'mastodon-intent', 'width=400,height=400,resizable=no,menubar=no,status=no,scrollbars=yes'); }); }); - }); - delegate(document, '.video-player video', 'click', ({ target }) => { - if (target.paused) { - target.play(); - } else { - target.pause(); - } - }); + [].forEach.call(document.querySelectorAll('[data-component="Video"]'), (content) => { + const props = JSON.parse(content.getAttribute('data-props')); + ReactDOM.render(<VideoContainer locale={locale} {...props} />, content); + }); - delegate(document, '.activity-stream .media-spoiler-wrapper .media-spoiler', 'click', function() { - this.parentNode.classList.add('media-spoiler-wrapper__visible'); - }); + [].forEach.call(document.querySelectorAll('[data-component="MediaGallery"]'), (content) => { + const props = JSON.parse(content.getAttribute('data-props')); + ReactDOM.render(<MediaGalleryContainer locale={locale} {...props} />, content); + }); - delegate(document, '.activity-stream .media-spoiler-wrapper .spoiler-button', 'click', function() { - this.parentNode.classList.remove('media-spoiler-wrapper__visible'); + [].forEach.call(document.querySelectorAll('[data-component="Card"]'), (content) => { + const props = JSON.parse(content.getAttribute('data-props')); + ReactDOM.render(<CardContainer locale={locale} {...props} />, content); + }); }); delegate(document, '.webapp-btn', 'click', ({ target, button }) => { |