2018-01-24 23:15:54 +01:00
|
|
|
|
if(Debug.debug){
|
2017-09-24 01:54:46 +02:00
|
|
|
|
console.log("\n\n\n\n\n\n ——— Sᴛλʀᴛɪɴɢ Uʟᴛʀᴀᴡɪᴅɪꜰʏ ———\n << ʟᴏᴀᴅɪɴɢ ᴍᴀɪɴ ꜰɪʟᴇ >>\n\n\n\n");
|
2018-01-24 23:15:54 +01:00
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-13 13:49:25 +02:00
|
|
|
|
|
2018-05-26 23:08:49 +02:00
|
|
|
|
var pageInfo;
|
|
|
|
|
var comms;
|
2018-08-07 23:31:28 +02:00
|
|
|
|
var settings;
|
2018-05-13 13:49:25 +02:00
|
|
|
|
|
2018-05-13 21:05:11 +02:00
|
|
|
|
async function init(){
|
2017-12-17 22:56:07 +01:00
|
|
|
|
if(Debug.debug)
|
2017-12-29 23:34:40 +01:00
|
|
|
|
console.log("[uw::main] loading configuration ...");
|
2017-12-17 22:56:07 +01:00
|
|
|
|
|
2018-05-26 23:08:49 +02:00
|
|
|
|
comms = new CommsClient('content-client-port');
|
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
settings = new Settings();
|
|
|
|
|
await settings.init();
|
2017-12-29 23:34:40 +01:00
|
|
|
|
|
2018-08-07 23:31:28 +02:00
|
|
|
|
console.log("SETTINGS SHOULD BE LOADED NOW!", settings)
|
|
|
|
|
|
2018-06-27 23:55:37 +02:00
|
|
|
|
// č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()){
|
2018-06-27 23:55:37 +02:00
|
|
|
|
if(Debug.debug) {
|
|
|
|
|
console.log("[uw::init] EXTENSION DISABLED, THEREFORE WONT BE STARTED")
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-07 23:31:28 +02:00
|
|
|
|
pageInfo = new PageInfo(comms, settings);
|
2018-05-26 23:08:49 +02:00
|
|
|
|
comms.setPageInfo(pageInfo);
|
2018-05-13 21:05:11 +02:00
|
|
|
|
|
|
|
|
|
if(Debug.debug){
|
|
|
|
|
console.log("[uw.js::setup] pageInfo initialized. Here's the object:", pageInfo);
|
2017-12-31 18:26:59 +01:00
|
|
|
|
}
|
2018-05-24 20:50:37 +02:00
|
|
|
|
}
|
|
|
|
|
init();
|