summaryrefslogtreecommitdiff
path: root/init.js
blob: 18733dcbda06519e956d73c595356b785f7a4cdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require(['dojo/_base/kernel', 'dojo/ready'], function  (dojo, ready) {
	ready(function () {
		window.addEventListener("focus", function() {
			App.findAll("video").forEach((vid) => {
				if (vid.getAttribute("autoplay") == 1 && vid.paused)
					vid.play();
			})
		});

		window.addEventListener("blur", function() {
			App.findAll("video").forEach((vid) => {
				if (vid.getAttribute("autoplay") == 1 && !vid.paused)
					vid.pause();
			})
		});
	});
});