diff --git a/src/ext/conf/Debug.js b/src/ext/conf/Debug.js index c3f5be7..728e8f8 100644 --- a/src/ext/conf/Debug.js +++ b/src/ext/conf/Debug.js @@ -4,23 +4,22 @@ const _prod = false; var Debug = { // performanceMetrics: true, // should not be affected by debug.debug in order to allow benchmarking of the impact logging in console has - // init: true, + init: true, debug: true, - // debug: false, - // keyboard: true, + keyboard: true, resizer: true, - // debugArDetect: true, - // scaler: true, + debugArDetect: true, + scaler: true, // debugStorage: false, debugStorage: true, // comms: false, - // comms: true, + comms: true, // showArDetectCanvas: true, // flushStoredSettings: true, // flushStoredSettings: false, playerDetect: true, // periodic: true, - // videoRescan: true, + videoRescan: true, // mousemove: true, // arDetect: { // edgeDetect: true diff --git a/src/ext/lib/comms/CommsServer.js b/src/ext/lib/comms/CommsServer.js index f56ca1f..b8f44d0 100644 --- a/src/ext/lib/comms/CommsServer.js +++ b/src/ext/lib/comms/CommsServer.js @@ -214,7 +214,8 @@ class CommsServer { processReceivedMessage_nonpersistent(message, sender, sendResponse){ if (Debug.debug && Debug.comms) { console.log("%c[CommsServer.js::processMessage_nonpersistent] Received message from background script!", "background-color: #11D; color: #aad", message, sender); - + } + if (message.cmd === 'inject-css') { this.server.injectCss(message.cssString, sender); return; diff --git a/src/ext/lib/video-data/PageInfo.js b/src/ext/lib/video-data/PageInfo.js index 9e31006..e27ea5e 100644 --- a/src/ext/lib/video-data/PageInfo.js +++ b/src/ext/lib/video-data/PageInfo.js @@ -99,10 +99,6 @@ class PageInfo { if (videos.length) { return videos; - } else { - if (Debug.debug) { - console.log("[PageInfo::getVideos] Finding videos by querySelector failed. Trying fallback mode as well."); - } } } return document.getElementsByTagName('video'); @@ -118,6 +114,9 @@ class PageInfo { this.hasVideos = false; if(rescanReason == RescanReason.PERIODIC){ + if (Debug.debug && Debug.videoRescan && Debug.periodic) { + console.log("[PageInfo::rescan] Scheduling normal rescan:") + } this.scheduleRescan(RescanReason.PERIODIC); } return; @@ -229,12 +228,11 @@ class PageInfo { var ths = this; - - this.rescanTimer = setTimeout(function(rr){ + this.rescanTimer = setTimeout(function(rescanReason){ ths.rescanTimer = null; - ths.rescan(rr); + ths.rescan(rescanReason); ths = null; - }, rescanReason === this.settings.active.pageInfo.timeouts.rescan, RescanReason.PERIODIC) + }, this.settings.active.pageInfo.timeouts.rescan, RescanReason.PERIODIC) } catch(e) { if(Debug.debug){ console.log("[PageInfo::scheduleRescan] scheduling rescan failed. Here's why:",e) @@ -255,16 +253,16 @@ class PageInfo { ths.ghettoUrlCheck(); ths = null; }, this.settings.active.pageInfo.timeouts.urlCheck) - }catch(e){ + } catch(e){ if(Debug.debug){ - console.log("[PageInfo::scheduleUrlCheck] scheduling URL check failed. Here's why:",e) + console.error("[PageInfo::scheduleUrlCheck] scheduling URL check failed. Here's why:",e) } } } ghettoUrlCheck() { if (this.lastUrl != window.location.href){ - if(Debug.debug){ + if(Debug.debug && Debug.periodic){ console.log("[PageInfo::ghettoUrlCheck] URL has changed. Triggering a rescan!"); } diff --git a/src/ext/lib/video-data/PlayerData.js b/src/ext/lib/video-data/PlayerData.js index 44c32fb..a3ce545 100644 --- a/src/ext/lib/video-data/PlayerData.js +++ b/src/ext/lib/video-data/PlayerData.js @@ -225,8 +225,8 @@ class PlayerData { } collectionHas(collection, element) { - for (let i = 0, len = a.length; i < len; i++) { - if (a[i] == b) { + for (let i = 0, len = collection.length; i < len; i++) { + if (collection[i] == element) { return true; } }