-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
37 lines (30 loc) · 1.14 KB
/
content.js
File metadata and controls
37 lines (30 loc) · 1.14 KB
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
(() => {
const hostName = window.location.hostname;
const currentUrl = window.location.href;
const isRezkaHost = /rezka/i.test(hostName);
console.log('[HDRezka Plugin] Bootstrap start', { hostName, currentUrl, isRezkaHost });
if (!isRezkaHost) {
console.log('[HDRezka Plugin] Skip page: hostname does not contain rezka');
return;
}
function initRezkaPlugin() {
console.log('[HDRezka Plugin] Init start', { hostName, currentUrl });
if (window.HDRezkaPlayback && typeof window.HDRezkaPlayback.init === 'function') {
console.log('[HDRezka Plugin] Playback init');
window.HDRezkaPlayback.init();
}
if (window.HDRezkaFavorites && typeof window.HDRezkaFavorites.init === 'function') {
console.log('[HDRezka Plugin] Favorites init');
window.HDRezkaFavorites.init();
}
if (window.HDRezkaUi && typeof window.HDRezkaUi.init === 'function') {
console.log('[HDRezka Plugin] UI init');
window.HDRezkaUi.init();
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initRezkaPlugin, { once: true });
} else {
initRezkaPlugin();
}
})();