diff --git a/js/modules/Resizer.js b/js/modules/Resizer.js index 7ddcd45..3fb4423 100644 --- a/js/modules/Resizer.js +++ b/js/modules/Resizer.js @@ -374,7 +374,7 @@ var _res_antiCssOverride = function(){ stuffChecked++; } - if(stuffChecked == stufTToCheck){ + if(stuffChecked == stuffToCheck){ if(Debug.debug){ console.log("[Resizer::_res_antiCssOverride] My spaghett rests untouched. (nobody overrode our CSS, doing nothing)"); } diff --git a/js/uw-bg.js b/js/uw-bg.js index 45f5568..c9ab394 100644 --- a/js/uw-bg.js +++ b/js/uw-bg.js @@ -41,6 +41,8 @@ async function main(){ var tabs = await Comms.getActiveTab(); BgVars.currentSite = extractHostname(tabs[0].url); + // + setInterval(_uwbg_check4videos, 5000); } async function _uwbg_onTabSwitched(activeInfo){ @@ -105,7 +107,9 @@ async function _uwbg_registerVideo(tabId){ } return; } - + if(Debug.debug){ + console.log("%c[uw-bg::_uwbg_registerVideo] request came from currently active tab!", "color: #afd, background: #000"); + } BgVars.hasVideos = true; // todo: change extension icon depending on whether there's a video on the page or not diff --git a/js/uw.js b/js/uw.js index aeebd15..c9570e1 100644 --- a/js/uw.js +++ b/js/uw.js @@ -102,6 +102,10 @@ function ghettoOnChange(){ video !== null && video.videoWidth > 0 && video.videoHeight > 0 ){ + if(Debug.debug){ + console.log("%c[uw::ghettoOnChange] detected video. registering!", "color: #99f, background: #000"); + } + GlobalVars.video = video; Comms.sendToBackgroundScript({"cmd":"register-video"}); } diff --git a/res/popup/js/popup.js b/res/popup/js/popup.js index 7f9ca67..e6feba7 100644 --- a/res/popup/js/popup.js +++ b/res/popup/js/popup.js @@ -75,13 +75,17 @@ function check4videos(){ Comms.sendToBackgroundScript({cmd: "has-videos"}) .then(response => { if(Debug.debug){ - console.log("[popup.js::check4videos] received response:",response, "has video?", response.response); + console.log("[popup.js::check4videos] received response:",response, "has video?", response.response.hasVideos); } if(response.response.hasVideos){ hasVideos = true; // openMenu(selectedMenu); hideWarning("no-videos-warning"); } + else{ + // brute force error mitigation. + setTimeout(check4videos, 2000); + } }) .catch(error => { if(Debug.debug)