-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
38 lines (32 loc) · 1.29 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(() => {
let timer = null;
document.querySelector('.plugin_fulldisplay').addEventListener('click', (e) => {
e.preventDefault();
e.stopPropagation();
const page = document.querySelector(JSINFO.fulldisplay.pageSelector);
page.requestFullscreen();
page.classList.add('fulldisplay');
page.style.zoom = JSINFO.fulldisplay.zoom;
if (JSINFO.fulldisplay.refresh) {
timer = window.setInterval(async () => {
const result = await fetch(window.location.href);
if (result.ok) {
const text = await result.text();
const parser = new DOMParser();
const doc = parser.parseFromString(text, 'text/html');
page.innerHTML = doc.querySelector(JSINFO.fulldisplay.pageSelector).innerHTML;
}
}, JSINFO.fulldisplay.refresh * 1000);
}
});
document.addEventListener('fullscreenchange', (e) => {
if (document.fullscreenElement) return;
const page = document.querySelector(JSINFO.fulldisplay.pageSelector);
page.classList.remove('fulldisplay');
page.style.zoom = '';
if (timer) {
window.clearInterval(timer);
timer = null;
}
});
})();