From f55946e525ba80aeb3f089260fbb5e51d82057ae Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 25 Jan 2021 09:55:33 +0300 Subject: initial --- init.js | 17 +++++++++++++++++ init.php | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 init.js create mode 100644 init.php 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(); + }) + }); + }); +}); diff --git a/init.php b/init.php new file mode 100644 index 0000000..9183799 --- /dev/null +++ b/init.php @@ -0,0 +1,23 @@ +host = $host; + } + + function get_js() { + return file_get_contents(__DIR__ . "/init.js"); + } + + function api_version() { + return 2; + } + +} -- cgit v1.2.3