if(Debug.debug){ console.log("\n\n\n\n\n\n ——— Sᴛλʀᴛɪɴɢ Uʟᴛʀᴀᴡɪᴅɪꜰʏ ———\n << ʟᴏᴀᴅɪɴɢ ᴍᴀɪɴ ꜰɪʟᴇ >>\n\n\n\n"); try { if(window.self !== window.top){ console.log("%cWe aren't in an iframe.", "color: #afc, background: #174"); } else{ console.log("%cWe are in an iframe!", "color: #fea, background: #d31", window.self, window.top); } } catch (e) { console.log("%cWe are in an iframe!", "color: #fea, background: #d31"); } } class VideoManager { refresh(){ } } // load all settings from localStorage: async function main(){ if(Debug.debug) console.log("[uw::main] loading configuration ..."); // load settings var isSlave = true; await Settings.init(isSlave); var scpromise = SitesConf.init(); var kbpromise = Keybinds.init(); // reset current css stuff in GlobalVars GlobalVars.correctedVideoDimensions.top = null; GlobalVars.correctedVideoDimensions.left = null; GlobalVars.correctedVideoDimensions.width = null; GlobalVars.correctedVideoDimensions.height = null; GlobalVars.currentCss = {top: null, left: null}; // počakamo, da so nastavitve naložene // wait for settings to load await scpromise; await kbpromise; // globalVars: lastAr type = original GlobalVars.lastAr = {type: "original"}; if(Debug.debug) console.log("[uw::main] configuration should be loaded now"); // start autoar and setup everything if(Debug.debug) console.log("[uw::main] | document is ready. Starting ar script ..."); if(! SitesConf.isEnabled(window.location.hostname)){ if(Debug.debug) console.log("[uw:main] | site", window.location.hostname, "is blacklisted."); return; } // if(SitesConf.isArEnabled(window.location.hostname)){ // if(Debug.debug) // console.log("[uw::main] Aspect ratio detection is enabled. Starting ArDetect"); // ArDetect.arSetup(); // } // console.log("[uw::main] ExtensionConf:", ExtensionConf); if(ExtensionConf.arDetect.mode == "blacklist"){ if(Debug.debug) console.log("[uw::main] Aspect ratio detection is enabled (mode=",ExtensionConf.arDetect.mode,"). Starting ArDetect"); ArDetect.arSetup(); } else{ if(Debug.debug) console.log("[uw::main] Aspect ratio detection is disabled. Mode:", ExtensionConf.arDetect.mode); } browser.runtime.onMessage.addListener(receiveMessage); setInterval( ghettoOnChange, 100); setInterval( ghettoUrlWatcher, 500); // ko se na ticevki zamenja video, console.log pravi da ultrawidify spremeni razmerje stranic. preglej element // in pogled na predvajalnik pravita, da se to ni zgodilo. Iz tega sledi, da nam ticevka povozi css, ki smo ga // vsilili. To super duper ni kul, zato uvedemo nekaj protiukrepov. // // when you change a video on youtube, console.log says that ultrawidify changes aspect ratio. inspect element // and a look at youtube player, on the other hand, say this didn't happen. It seems that youtube overrides our // css, and this is super duper uncool. Therefore, extra checks and measures. setInterval( Resizer.antiCssOverride, 200); } // tukaj gledamo, ali se je velikost predvajalnika spremenila. Če se je, ponovno prožimo resizer // here we check (in the most ghetto way) whether player size has changed. If it has, we retrigger resizer. var _video_recheck_counter = 5; var _video_recheck_period = 1; // on this many retries function ghettoOnChange(){ if(_video_recheck_counter++ > _video_recheck_period){ _video_recheck_counter = 0; if ( GlobalVars.video == null || GlobalVars.video == undefined || GlobalVars.video.videoWidth == 0 || GlobalVars.video.videoHeight == 0 ){ var video = document.getElementsByTagName("video")[0]; if ( video !== undefined && video !== null && video.videoWidth > 0 && video.videoHeight > 0 ){ if(Debug.debug){ console.log("%c[uw::ghettoOnChange] detected video. registering!", "color: #99f, background: #000"); console.log("[uw::ghettoOnChange] just for shits and giggles, let's see what's happened with GlobalVars.playerDimensions:", GlobalVars.playerDimensions) } // zaznali smo novo