ultrawidify/js/uw.js
2018-08-02 23:24:22 +02:00

59 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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");
}
}
var pageInfo;
var comms;
async function init(){
if(Debug.debug)
console.log("[uw::main] loading configuration ...");
comms = new CommsClient('content-client-port');
// load settings
var settingsLoaded = await comms.requestSettings();
if(!settingsLoaded){
if(Debug.debug) {
console.log("[uw::main] failed to get settings (settingsLoaded=",settingsLoaded,") Waiting for settings the old fashioned way");
}
comms.requestSettings_fallback();
await comms.waitForSettings();
if(Debug.debug){
console.log("[uw::main] settings loaded.");
}
}
if(Debug.debug)
console.log("[uw::main] configuration should be loaded now");
// če smo razširitev onemogočili v nastavitvah, ne naredimo ničesar
// If extension is soft-disabled, don't do shit
if(! canStartExtension()){
if(Debug.debug) {
console.log("[uw::init] EXTENSION DISABLED, THEREFORE WONT BE STARTED")
}
return;
}
pageInfo = new PageInfo();
comms.setPageInfo(pageInfo);
if(Debug.debug){
console.log("[uw.js::setup] pageInfo initialized. Here's the object:", pageInfo);
}
}
init();