Functionality that lists embedded videos has been restored. TODO: css, make it work
This commit is contained in:
parent
e1467cd6d7
commit
b49f8c6d26
@ -9,7 +9,7 @@ class CommsServer {
|
|||||||
|
|
||||||
var ths = this;
|
var ths = this;
|
||||||
|
|
||||||
console.log("[CommsServer::ctor] INIT! are we in ff?", BrowserDetect.firefox, "BrowserDetect says ...", BrowserDetect)
|
// console.log("[CommsServer::ctor] INIT! are we in ff?", BrowserDetect.firefox, "BrowserDetect says ...", BrowserDetect)
|
||||||
|
|
||||||
if (BrowserDetect.firefox) {
|
if (BrowserDetect.firefox) {
|
||||||
browser.runtime.onConnect.addListener(p => ths.onConnect(p));
|
browser.runtime.onConnect.addListener(p => ths.onConnect(p));
|
||||||
@ -21,14 +21,14 @@ class CommsServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async toObject(obj) {
|
async toObject(obj) {
|
||||||
console.log("CLONING OBJECT", obj);
|
// console.log("(not actually) CLONING OBJECT", obj);
|
||||||
try {
|
// try {
|
||||||
const r = JSON.parse(JSON.stringify(obj));
|
// const r = JSON.parse(JSON.stringify(obj));
|
||||||
return r;
|
// return r;
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
console.log("ERROR WHILE CLONING", obj);
|
// console.log("ERROR WHILE CLONING", obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCurrentTabHostname() {
|
async getCurrentTabHostname() {
|
||||||
@ -166,7 +166,7 @@ class CommsServer {
|
|||||||
if (message.cmd === 'announce-zoom') {
|
if (message.cmd === 'announce-zoom') {
|
||||||
// forward off to the popup, no use for this here
|
// forward off to the popup, no use for this here
|
||||||
try {
|
try {
|
||||||
this.popupPort.postMessage(this.toObject({cmd: 'set-current-zoom', zoom: message.zoom}));
|
this.popupPort.postMessage({cmd: 'set-current-zoom', zoom: message.zoom});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// can't forward stuff to popup if it isn't open
|
// can't forward stuff to popup if it isn't open
|
||||||
}
|
}
|
||||||
@ -177,11 +177,11 @@ class CommsServer {
|
|||||||
if (message.cmd === 'get-current-site') {
|
if (message.cmd === 'get-current-site') {
|
||||||
console.log("CCCCC - ss");
|
console.log("CCCCC - ss");
|
||||||
console.log("[find server] set-current-site — getting site", this.server.getVideoTab(), this.toObject(this.server.getVideoTab()))
|
console.log("[find server] set-current-site — getting site", this.server.getVideoTab(), this.toObject(this.server.getVideoTab()))
|
||||||
port.postMessage(this.toObject({
|
port.postMessage({
|
||||||
cmd: 'set-current-site',
|
cmd: 'set-current-site',
|
||||||
site: this.server.getVideoTab(),
|
site: this.server.getVideoTab(),
|
||||||
tabHostname: await this.getCurrentTabHostname()
|
tabHostname: await this.getCurrentTabHostname()
|
||||||
}));
|
});
|
||||||
console.log("CCCCC -s as")
|
console.log("CCCCC -s as")
|
||||||
}
|
}
|
||||||
if (message.cmd === 'popup-set-selected-tab') {
|
if (message.cmd === 'popup-set-selected-tab') {
|
||||||
@ -194,9 +194,9 @@ class CommsServer {
|
|||||||
if(Debug.debug) {
|
if(Debug.debug) {
|
||||||
console.log("CommsServer: received get-config. Active settings?", this.settings.active, "\n(settings:", this.settings, ")")
|
console.log("CommsServer: received get-config. Active settings?", this.settings.active, "\n(settings:", this.settings, ")")
|
||||||
}
|
}
|
||||||
port.postMessage(this.toObject(
|
port.postMessage(
|
||||||
{cmd: "set-config", conf: this.settings.active, site: this.server.currentSite}
|
{cmd: "set-config", conf: this.settings.active, site: this.server.currentSite}
|
||||||
));
|
);
|
||||||
} else if (message.cmd === 'has-video') {
|
} else if (message.cmd === 'has-video') {
|
||||||
this.server.registerVideo(port.sender);
|
this.server.registerVideo(port.sender);
|
||||||
} else if (message.cmd === 'noVideo') {
|
} else if (message.cmd === 'noVideo') {
|
||||||
|
@ -161,6 +161,7 @@ export default {
|
|||||||
processReceivedMessage(message, port) {
|
processReceivedMessage(message, port) {
|
||||||
if (Debug.debug) {
|
if (Debug.debug) {
|
||||||
console.log("[popup.js] received message set-c", message);
|
console.log("[popup.js] received message set-c", message);
|
||||||
|
console.log("[popup.js] message cloned set-c", JSON.parse(JSON.stringify(message)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(message.cmd === 'set-current-site'){
|
if(message.cmd === 'set-current-site'){
|
||||||
@ -179,9 +180,13 @@ export default {
|
|||||||
} else if (message.cmd === 'set-current-zoom') {
|
} else if (message.cmd === 'set-current-zoom') {
|
||||||
this.setCurrentZoom(message.zoom);
|
this.setCurrentZoom(message.zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
console.log("this?", this, "this.site:", JSON.parse(JSON.stringify(this.site)));
|
||||||
},
|
},
|
||||||
loadFrames(videoTab) {
|
loadFrames(videoTab) {
|
||||||
console.log('set-c loading frames', videoTab)
|
console.log("set-c loading frames \n\n\n------------------------------------------------------------------\n\n\n1\n\n")
|
||||||
|
console.log('set-c loading frames', videoTab, JSON.parse(JSON.stringify(videoTab)))
|
||||||
if (videoTab.selected) {
|
if (videoTab.selected) {
|
||||||
this.selectedSubitem = videoTab.selected;
|
this.selectedSubitem = videoTab.selected;
|
||||||
// selectedSubitemLoaded = true;
|
// selectedSubitemLoaded = true;
|
||||||
@ -189,11 +194,14 @@ export default {
|
|||||||
|
|
||||||
this.activeFrames = [];
|
this.activeFrames = [];
|
||||||
|
|
||||||
if (site.frames.length < 2) {
|
if (videoTab.frames.length < 2 || Object.keys(videoTab.frames).length < 2) {
|
||||||
this.selectedFrame = '__all';
|
this.selectedFrame = '__all';
|
||||||
|
console.log("set-c NOT ENOUGH FRAMES ______________________________________\n", videoTab.frames.length, Object.keys(videoTab.frames), Object.keys(videoTab.frames).length )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log("set-c loading frames \n\n\n------------------------------------------------------------------\n\n\n2\n\n")
|
||||||
|
|
||||||
|
try {
|
||||||
for (const frame in videoTab.frames) {
|
for (const frame in videoTab.frames) {
|
||||||
|
|
||||||
if (frame && !this.frameStore[frame]) {
|
if (frame && !this.frameStore[frame]) {
|
||||||
@ -204,7 +212,7 @@ export default {
|
|||||||
|
|
||||||
this.frameStore[frame] = fs;
|
this.frameStore[frame] = fs;
|
||||||
|
|
||||||
port.postMessage(this.toObject({
|
this.port.postMessage(this.toObject({
|
||||||
cmd: 'mark-player',
|
cmd: 'mark-player',
|
||||||
targetTab: videoTab.id,
|
targetTab: videoTab.id,
|
||||||
targetFrame: frame,
|
targetFrame: frame,
|
||||||
@ -212,9 +220,23 @@ export default {
|
|||||||
color: fs.color
|
color: fs.color
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
console.log("set-c loading frames \n\n\n------------------------------------------------------------------\n\n\n22\n\n")
|
||||||
}
|
}
|
||||||
this.activeFrames = [{id: '__all', label: 'All'},{id: '__playing', label: 'Currently playing'}].concat(videoTab.frames);
|
} catch (e) {
|
||||||
console.log("set-c", this.activeFrames)
|
console.log("set-c loading frames \n\n\n------------------------------------------------------------------\n\n\ne", e, "\n\n")
|
||||||
|
|
||||||
|
}
|
||||||
|
console.log("set-c loading frames \n\n\n------------------------------------------------------------------\n\n\n3\n\n")
|
||||||
|
|
||||||
|
this.activeFrames = [{id: '__all', label: 'All'},{id: '__playing', label: 'Currently playing'}];
|
||||||
|
for (const frame in videoTab.frames) {
|
||||||
|
this.activeFrames.push({
|
||||||
|
label: videoTab.frames[frame].host,
|
||||||
|
...this.frameStore[frame],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("set-c active frmaes", this.activeFrames, JSON.parse(JSON.stringify(this.activeFrames)))
|
||||||
},
|
},
|
||||||
getRandomColor() {
|
getRandomColor() {
|
||||||
return `rgb(${Math.floor(Math.random() * 128)}, ${Math.floor(Math.random() * 128)}, ${Math.floor(Math.random() * 128)})`;
|
return `rgb(${Math.floor(Math.random() * 128)}, ${Math.floor(Math.random() * 128)}, ${Math.floor(Math.random() * 128)})`;
|
||||||
|
Loading…
Reference in New Issue
Block a user