diff options
author | Andrew Dolgov <[email protected]> | 2021-01-25 09:55:33 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-01-25 09:55:33 +0300 |
commit | f55946e525ba80aeb3f089260fbb5e51d82057ae (patch) | |
tree | f1a36c2034a7a229d0d750b452233eb85de1f46e /init.js |
initial
Diffstat (limited to 'init.js')
-rw-r--r-- | init.js | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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(); + }) + }); + }); +}); |