diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-10-01 14:34:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-01 14:34:08 +0200 |
commit | ab881a3bf513e591b6cc2966560cdab2b63a0f2a (patch) | |
tree | fef75d382fc6216a093eeaf80560473dff19d883 /application/palemoon/components/statusbar/content-thunk.js | |
parent | 38e8ee1e6ddaa0cfd5fd9476264cbdcbc65c8035 (diff) | |
parent | 35a1adb07652813c886413e7c0eccda7c81d01d0 (diff) | |
download | UXP-ab881a3bf513e591b6cc2966560cdab2b63a0f2a.tar UXP-ab881a3bf513e591b6cc2966560cdab2b63a0f2a.tar.gz UXP-ab881a3bf513e591b6cc2966560cdab2b63a0f2a.tar.lz UXP-ab881a3bf513e591b6cc2966560cdab2b63a0f2a.tar.xz UXP-ab881a3bf513e591b6cc2966560cdab2b63a0f2a.zip |
Merge pull request #804 from JustOff/PR_s4e_FullScreenVideo
[PALEMOON] Use message manager to detect full-screen HTML5 video in S4E module
Diffstat (limited to 'application/palemoon/components/statusbar/content-thunk.js')
-rw-r--r-- | application/palemoon/components/statusbar/content-thunk.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/application/palemoon/components/statusbar/content-thunk.js b/application/palemoon/components/statusbar/content-thunk.js new file mode 100644 index 000000000..fe1fbabad --- /dev/null +++ b/application/palemoon/components/statusbar/content-thunk.js @@ -0,0 +1,23 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +function handleVideoDetect(message) +{ + let isVideo = false; + + let fsEl = content.document.mozFullScreenElement; + if(fsEl) + { + isVideo = ( + fsEl.nodeName == "VIDEO" + || (fsEl.nodeName == "IFRAME" && fsEl.contentDocument && fsEl.contentDocument.getElementsByTagName("VIDEO").length > 0) + || fsEl.getElementsByTagName("VIDEO").length > 0 + ); + } + + sendAsyncMessage("status4evar@caligonstudios.com:video-detect-answer", {isVideo: isVideo}); +} + +addMessageListener("status4evar@caligonstudios.com:video-detect", handleVideoDetect); + |