ultrawidify/js/uw.js

68 lines
1.7 KiB
JavaScript
Raw Normal View History

if(Debug.debug)
console.log("\n\n\n\n\n\n ——— Sᴛλʀᴛɪɴɢ Uʟᴛʀᴀɪɪʏ ———\n << ʟᴏᴀᴅɪɴɢ ᴍᴀɪɴ ꜰɪʟᴇ >>\n\n\n\n");
2017-12-02 21:09:08 +01:00
// load all settings from localStorage:
2017-12-17 22:56:07 +01:00
async function main(){
if(Debug.debug)
console.log("loading configuration ...");
// load settings
Settings.init();
var scpromise = SitesConf.init();
var kbpromise = Keybinds.init();
ExtensionConf.init();
console.log(scpromise);
// počakamo, da so nastavitve naložene
// wait for settings to load
await scpromise;
await kbpromise;
2017-12-17 22:56:07 +01:00
if(Debug.debug)
console.log("configuration should be loaded now");
// start autoar and setup everything
2017-12-02 21:09:08 +01:00
2017-12-17 22:56:07 +01:00
// $(document).ready(function() {
if(Debug.debug)
console.log("uw::document.ready | document is ready. Starting ar script ...");
2017-12-17 22:56:07 +01:00
2017-12-02 21:09:08 +01:00
if(SitesConf.getMode(window.location.hostname) == "blacklist" ){
if(Debug.debug)
console.log("uw::document.ready | site", window.location.hostname, "is blacklisted.");
return;
}
2017-12-17 22:56:07 +01:00
if( ExtensionConf.mode == "none" ){
2017-12-02 21:09:08 +01:00
if(Debug.debug)
console.log("uw::document.ready | Extension is soft-disabled via popup");
return;
}
2017-12-17 22:56:07 +01:00
if( ExtensionConf.mode == "whitelist" && SitesConf.getMode(window.location.hostname) != "whitelist"){
2017-12-02 21:09:08 +01:00
if(Debug.debug)
console.log("uw::document.ready | extension is set to run on whitelisted sites only, but site ", window.location.hostname, "is not on whitelist.");
return;
}
ArDetect.arSetup();
2017-01-02 17:45:51 +01:00
document.addEventListener("mozfullscreenchange", function( event ) {
if(FullScreenDetect.isFullScreen()){
// full screen is on
}
else{
Resizer.reset();
}
});
2017-12-17 22:56:07 +01:00
// });
}
main();