summaryrefslogtreecommitdiff
path: root/init.js
diff options
context:
space:
mode:
Diffstat (limited to 'init.js')
-rw-r--r--init.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/init.js b/init.js
new file mode 100644
index 0000000..4a31399
--- /dev/null
+++ b/init.js
@@ -0,0 +1,17 @@
+require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
+ ready(function () {
+ Event.observe(window, "focus", function() {
+ $$("video").forEach((vid) => {
+ if (vid.getAttribute("autoplay") == 1 && vid.paused)
+ vid.play();
+ })
+ });
+
+ Event.observe(window, "blur", function() {
+ $$("video").forEach((vid) => {
+ if (vid.getAttribute("autoplay") == 1 && !vid.paused)
+ vid.pause();
+ })
+ });
+ });
+});