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.");
|
console.log(`[CommsClient::registerVideo] <${this.commsId}>`, "Registering video for current page.");
|
||||||
}
|
}
|
||||||
if (this.pageInfo) {
|
if (this.pageInfo) {
|
||||||
if (this.pageInfo.videos.length) {
|
if (this.pageInfo.hasVideo()) {
|
||||||
this.port.postMessage({cmd: "has-video"});
|
this.port.postMessage({cmd: "has-video"});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,7 +9,7 @@ if(Debug.debug)
|
|||||||
|
|
||||||
|
|
||||||
class PageInfo {
|
class PageInfo {
|
||||||
constructor(comms, settings, extensionMode){
|
constructor(comms, settings, extensionMode, readOnly = false){
|
||||||
this.hasVideos = false;
|
this.hasVideos = false;
|
||||||
this.siteDisabled = false;
|
this.siteDisabled = false;
|
||||||
this.videos = [];
|
this.videos = [];
|
||||||
@ -28,6 +28,8 @@ class PageInfo {
|
|||||||
this.scheduleUrlCheck();
|
this.scheduleUrlCheck();
|
||||||
|
|
||||||
this.currentZoomScale = 1;
|
this.currentZoomScale = 1;
|
||||||
|
|
||||||
|
console.log("PAGEINFO: STARTING IN READ ONLY MODE?", readOnly)
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
@ -93,6 +95,11 @@ class PageInfo {
|
|||||||
return document.getElementsByTagName('video');
|
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){
|
rescan(rescanReason){
|
||||||
const oldVideoCount = this.videos.length;
|
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 lacks either of the two properties, we skip all further checks cos pointless
|
||||||
if(video.offsetWidth && video.offsetHeight){
|
if(video.offsetWidth && video.offsetHeight){
|
||||||
this.hasVideos = true;
|
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 {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -147,6 +165,7 @@ class PageInfo {
|
|||||||
if (Debug.debug && Debug.periodic && Debug.videoRescan) {
|
if (Debug.debug && Debug.periodic && Debug.videoRescan) {
|
||||||
console.log("[PageInfo::rescan] found new video candidate:", video, "NOTE:: Video initialization starts here:\n--------------------------------\n")
|
console.log("[PageInfo::rescan] found new video candidate:", video, "NOTE:: Video initialization starts here:\n--------------------------------\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
v = new VideoData(video, this.settings, this);
|
v = new VideoData(video, this.settings, this);
|
||||||
// console.log("[PageInfo::rescan] v is:", v)
|
// console.log("[PageInfo::rescan] v is:", v)
|
||||||
v.initArDetection();
|
v.initArDetection();
|
||||||
|
@ -65,15 +65,23 @@ class UW {
|
|||||||
console.log("[uw::init] Extension mode:" + (extensionMode < 0 ? "disabled" : extensionMode == '1' ? 'basic' : 'full'));
|
console.log("[uw::init] Extension mode:" + (extensionMode < 0 ? "disabled" : extensionMode == '1' ? 'basic' : 'full'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(extensionMode === ExtensionMode.Disabled){
|
const isSiteDisabled = extensionMode === ExtensionMode.Disabled
|
||||||
if(Debug.debug) {
|
|
||||||
|
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")
|
console.log("[uw::init] EXTENSION DISABLED, THEREFORE WONT BE STARTED")
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
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){
|
if(Debug.debug){
|
||||||
console.log("[uw.js::setup] pageInfo initialized. Here's the object:", this.pageInfo);
|
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)
|
console.log("[uw.js::setup] will try to initate ActionHandler. Settings are:", this.settings, this.settings.active)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.actionHandler = new ActionHandler(this.pageInfo);
|
// start action handler only if extension is enabled for this site
|
||||||
this.actionHandler.init();
|
if (!isSiteDisabled) {
|
||||||
|
this.actionHandler = new ActionHandler(this.pageInfo);
|
||||||
if(Debug.debug) {
|
this.actionHandler.init();
|
||||||
console.log("[uw.js::setup] ActionHandler initiated:", this.actionHandler);
|
|
||||||
|
if(Debug.debug) {
|
||||||
|
console.log("[uw.js::setup] ActionHandler initiated:", this.actionHandler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user