Allow re-enabling of sites in embedded frames
This commit is contained in:
parent
2b281b292f
commit
4260e36ade
@ -160,7 +160,7 @@ class CommsClient {
|
||||
console.log(`[CommsClient::registerVideo] <${this.commsId}>`, "Registering video for current page.");
|
||||
}
|
||||
if (this.pageInfo) {
|
||||
if (this.pageInfo.videos.length) {
|
||||
if (this.pageInfo.hasVideo()) {
|
||||
this.port.postMessage({cmd: "has-video"});
|
||||
}
|
||||
} else {
|
||||
|
@ -9,7 +9,7 @@ if(Debug.debug)
|
||||
|
||||
|
||||
class PageInfo {
|
||||
constructor(comms, settings, extensionMode){
|
||||
constructor(comms, settings, extensionMode, readOnly = false){
|
||||
this.hasVideos = false;
|
||||
this.siteDisabled = false;
|
||||
this.videos = [];
|
||||
@ -28,6 +28,8 @@ class PageInfo {
|
||||
this.scheduleUrlCheck();
|
||||
|
||||
this.currentZoomScale = 1;
|
||||
|
||||
console.log("PAGEINFO: STARTING IN READ ONLY MODE?", readOnly)
|
||||
}
|
||||
|
||||
destroy() {
|
||||
@ -93,6 +95,11 @@ class PageInfo {
|
||||
return document.getElementsByTagName('video');
|
||||
}
|
||||
|
||||
hasVideo() {
|
||||
console.log("DO WE HAVE VIDEO?", this.readOnly ? this.hasVideos : this.videos.length)
|
||||
return this.readOnly ? this.hasVideos : this.videos.length;
|
||||
}
|
||||
|
||||
rescan(rescanReason){
|
||||
const oldVideoCount = this.videos.length;
|
||||
|
||||
@ -124,6 +131,17 @@ class PageInfo {
|
||||
// if video lacks either of the two properties, we skip all further checks cos pointless
|
||||
if(video.offsetWidth && video.offsetHeight){
|
||||
this.hasVideos = true;
|
||||
|
||||
if (this.readOnly) {
|
||||
console.log("FOUDN A VIDEO")
|
||||
// in lite mode, we're done. This is all the info we want, but we want to actually start doing
|
||||
// things that interfere with the website. We still want to be runnig a rescan, tho.
|
||||
|
||||
if(rescanReason == RescanReason.PERIODIC){
|
||||
this.scheduleRescan(RescanReason.PERIODIC);
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@ -147,6 +165,7 @@ class PageInfo {
|
||||
if (Debug.debug && Debug.periodic && Debug.videoRescan) {
|
||||
console.log("[PageInfo::rescan] found new video candidate:", video, "NOTE:: Video initialization starts here:\n--------------------------------\n")
|
||||
}
|
||||
|
||||
v = new VideoData(video, this.settings, this);
|
||||
// console.log("[PageInfo::rescan] v is:", v)
|
||||
v.initArDetection();
|
||||
|
@ -65,15 +65,23 @@ class UW {
|
||||
console.log("[uw::init] Extension mode:" + (extensionMode < 0 ? "disabled" : extensionMode == '1' ? 'basic' : 'full'));
|
||||
}
|
||||
|
||||
if(extensionMode === ExtensionMode.Disabled){
|
||||
if(Debug.debug) {
|
||||
const isSiteDisabled = extensionMode === ExtensionMode.Disabled
|
||||
|
||||
if (isSiteDisabled) {
|
||||
if (this.settings.getExtensionMode('@global') === ExtensionMode.Disabled) {
|
||||
if (Debug.debug) {
|
||||
console.log("[uw::init] EXTENSION DISABLED, THEREFORE WONT BE STARTED")
|
||||
}
|
||||
console.log("[uw::init] EXTENSION DISABLED, THEREFORE WONT BE STARTED")
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.pageInfo = new PageInfo(this.comms, this.settings, extensionMode);
|
||||
if (isSiteDisabled) {
|
||||
console.log("STARTING EXTENSION IN READ ONLY MODE")
|
||||
}
|
||||
this.pageInfo = new PageInfo(this.comms, this.settings, extensionMode, isSiteDisabled);
|
||||
if(Debug.debug){
|
||||
console.log("[uw.js::setup] pageInfo initialized. Here's the object:", this.pageInfo);
|
||||
}
|
||||
@ -83,11 +91,14 @@ class UW {
|
||||
console.log("[uw.js::setup] will try to initate ActionHandler. Settings are:", this.settings, this.settings.active)
|
||||
}
|
||||
|
||||
this.actionHandler = new ActionHandler(this.pageInfo);
|
||||
this.actionHandler.init();
|
||||
|
||||
if(Debug.debug) {
|
||||
console.log("[uw.js::setup] ActionHandler initiated:", this.actionHandler);
|
||||
// start action handler only if extension is enabled for this site
|
||||
if (!isSiteDisabled) {
|
||||
this.actionHandler = new ActionHandler(this.pageInfo);
|
||||
this.actionHandler.init();
|
||||
|
||||
if(Debug.debug) {
|
||||
console.log("[uw.js::setup] ActionHandler initiated:", this.actionHandler);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user