ultrawidify/js/uw.js

70 lines
1.9 KiB
JavaScript
Raw Normal View History

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;
2018-08-07 23:31:28 +02:00
var settings;
async function init(){
2017-12-17 22:56:07 +01:00
if(Debug.debug)
console.log("[uw::main] loading configuration ...");
2017-12-17 22:56:07 +01:00
2018-08-22 23:16:08 +02:00
settings = new Settings();
await settings.init();
comms = new CommsClient('content-client-port', settings);
2017-12-17 22:56:07 +01:00
// load settings
2018-08-07 23:31:28 +02:00
// 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");
2018-08-22 23:16:08 +02:00
2018-08-07 23:31:28 +02:00
console.log("SETTINGS SHOULD BE LOADED NOW!", settings)
// če smo razširitev onemogočili v nastavitvah, ne naredimo ničesar
// If extension is soft-disabled, don't do shit
2018-08-07 23:31:28 +02:00
if(! settings.canStartExtension()){
if(Debug.debug) {
console.log("[uw::init] EXTENSION DISABLED, THEREFORE WONT BE STARTED")
}
return;
}
2018-08-29 00:41:26 +02:00
try {
pageInfo = new PageInfo(comms, settings);
} catch (e) {
console.log("[uw::init] FAILED TO START EXTENSION. Error:", e);
}
if(Debug.debug){
console.log("[uw.js::setup] pageInfo initialized. Here's the object:", pageInfo);
2017-12-31 18:26:59 +01:00
}
}
init();