This commit is contained in:
Tamius Han 2019-06-14 21:53:48 +02:00
parent 2df3c3c9be
commit bc89a9c116
4 changed files with 19 additions and 21 deletions

View File

@ -4,23 +4,22 @@ const _prod = false;
var Debug = { var Debug = {
// performanceMetrics: true, // should not be affected by debug.debug in order to allow benchmarking of the impact logging in console has // 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: true,
// debug: false, keyboard: true,
// keyboard: true,
resizer: true, resizer: true,
// debugArDetect: true, debugArDetect: true,
// scaler: true, scaler: true,
// debugStorage: false, // debugStorage: false,
debugStorage: true, debugStorage: true,
// comms: false, // comms: false,
// comms: true, comms: true,
// showArDetectCanvas: true, // showArDetectCanvas: true,
// flushStoredSettings: true, // flushStoredSettings: true,
// flushStoredSettings: false, // flushStoredSettings: false,
playerDetect: true, playerDetect: true,
// periodic: true, // periodic: true,
// videoRescan: true, videoRescan: true,
// mousemove: true, // mousemove: true,
// arDetect: { // arDetect: {
// edgeDetect: true // edgeDetect: true

View File

@ -214,6 +214,7 @@ class CommsServer {
processReceivedMessage_nonpersistent(message, sender, sendResponse){ processReceivedMessage_nonpersistent(message, sender, sendResponse){
if (Debug.debug && Debug.comms) { if (Debug.debug && Debug.comms) {
console.log("%c[CommsServer.js::processMessage_nonpersistent] Received message from background script!", "background-color: #11D; color: #aad", message, sender); console.log("%c[CommsServer.js::processMessage_nonpersistent] Received message from background script!", "background-color: #11D; color: #aad", message, sender);
}
if (message.cmd === 'inject-css') { if (message.cmd === 'inject-css') {
this.server.injectCss(message.cssString, sender); this.server.injectCss(message.cssString, sender);

View File

@ -99,10 +99,6 @@ class PageInfo {
if (videos.length) { if (videos.length) {
return videos; return videos;
} else {
if (Debug.debug) {
console.log("[PageInfo::getVideos] Finding videos by querySelector failed. Trying fallback mode as well.");
}
} }
} }
return document.getElementsByTagName('video'); return document.getElementsByTagName('video');
@ -118,6 +114,9 @@ class PageInfo {
this.hasVideos = false; this.hasVideos = false;
if(rescanReason == RescanReason.PERIODIC){ if(rescanReason == RescanReason.PERIODIC){
if (Debug.debug && Debug.videoRescan && Debug.periodic) {
console.log("[PageInfo::rescan] Scheduling normal rescan:")
}
this.scheduleRescan(RescanReason.PERIODIC); this.scheduleRescan(RescanReason.PERIODIC);
} }
return; return;
@ -229,12 +228,11 @@ class PageInfo {
var ths = this; var ths = this;
this.rescanTimer = setTimeout(function(rescanReason){
this.rescanTimer = setTimeout(function(rr){
ths.rescanTimer = null; ths.rescanTimer = null;
ths.rescan(rr); ths.rescan(rescanReason);
ths = null; ths = null;
}, rescanReason === this.settings.active.pageInfo.timeouts.rescan, RescanReason.PERIODIC) }, this.settings.active.pageInfo.timeouts.rescan, RescanReason.PERIODIC)
} catch(e) { } catch(e) {
if(Debug.debug){ if(Debug.debug){
console.log("[PageInfo::scheduleRescan] scheduling rescan failed. Here's why:",e) console.log("[PageInfo::scheduleRescan] scheduling rescan failed. Here's why:",e)
@ -255,16 +253,16 @@ class PageInfo {
ths.ghettoUrlCheck(); ths.ghettoUrlCheck();
ths = null; ths = null;
}, this.settings.active.pageInfo.timeouts.urlCheck) }, this.settings.active.pageInfo.timeouts.urlCheck)
}catch(e){ } catch(e){
if(Debug.debug){ 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() { ghettoUrlCheck() {
if (this.lastUrl != window.location.href){ if (this.lastUrl != window.location.href){
if(Debug.debug){ if(Debug.debug && Debug.periodic){
console.log("[PageInfo::ghettoUrlCheck] URL has changed. Triggering a rescan!"); console.log("[PageInfo::ghettoUrlCheck] URL has changed. Triggering a rescan!");
} }

View File

@ -225,8 +225,8 @@ class PlayerData {
} }
collectionHas(collection, element) { collectionHas(collection, element) {
for (let i = 0, len = a.length; i < len; i++) { for (let i = 0, len = collection.length; i < len; i++) {
if (a[i] == b) { if (collection[i] == element) {
return true; return true;
} }
} }