summaryrefslogtreecommitdiffstats
path: root/application/palemoon/components/statusbar/content-thunk.js
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-10-01 14:34:08 +0200
committerGitHub <noreply@github.com>2018-10-01 14:34:08 +0200
commitab881a3bf513e591b6cc2966560cdab2b63a0f2a (patch)
treefef75d382fc6216a093eeaf80560473dff19d883 /application/palemoon/components/statusbar/content-thunk.js
parent38e8ee1e6ddaa0cfd5fd9476264cbdcbc65c8035 (diff)
parent35a1adb07652813c886413e7c0eccda7c81d01d0 (diff)
downloadUXP-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.js23
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);
+