Don't duplicate overlays for frame marks

This commit is contained in:
Tamius Han 2018-12-07 22:57:35 +01:00
parent 6ef744bfa5
commit 236852bc78

View File

@ -20,6 +20,9 @@ var _changeAr_button_shortcuts = { "autoar":"none", "reset":"none", "219":"none"
var comms = new Comms(); var comms = new Comms();
var settings = new Settings(undefined, () => updateConfig()); var settings = new Settings(undefined, () => updateConfig());
var frameStore = {};
var frameStoreCount = 0;
var site = undefined; var site = undefined;
// aside from hostname, this can have two additional values: // aside from hostname, this can have two additional values:
@ -103,13 +106,26 @@ function loadFrames(videoTab) {
tablist['siteSettings'].tab.insertSubitem(newItem); tablist['siteSettings'].tab.insertSubitem(newItem);
tablist['videoSettings'].tab.insertSubitem(newItem); tablist['videoSettings'].tab.insertSubitem(newItem);
port.postMessage({
cmd: 'mark-player',
targetTab: videoTab.id, if (frame && !frameStore[frame]) {
targetFrame: videoTab.frames[frame].id, var fs = {
name: videoTab.frames[frame].id, name: frameStoreCount++,
color: '#fa6' color: this.getRandomColor()
}); }
frameStore[frame] = fs;
port.postMessage({
cmd: 'mark-player',
targetTab: videoTab.id,
targetFrame: frame,
name: fs.name,
color: fs.color
});
}
} }
if (! selectedSubitem.siteSettings || !tablist['siteSettings'].tab.existsSubitem(selectedSubitem.siteSettings)) { if (! selectedSubitem.siteSettings || !tablist['siteSettings'].tab.existsSubitem(selectedSubitem.siteSettings)) {
@ -201,6 +217,9 @@ function configurePopupTabs(site) {
return; return;
} }
function getRandomColor() {
return `rgb(${Math.floor(Math.random() * 128)}, ${Math.floor(Math.random() * 128)}, ${Math.floor(Math.random() * 128)})`;
}
function basicCommandHandler(cmdArray, scope) { function basicCommandHandler(cmdArray, scope) {
@ -277,7 +296,6 @@ function selectButton(action, arg, buttons) {
if (buttons[cmd]) { if (buttons[cmd]) {
buttons[cmd].select(); buttons[cmd].select();
} }
console.log("SSSSSSSSSSSSSSSSSSS\nselecting button:", cmd, "\nbuttons", buttons)
} }
function configureGlobalTab() { function configureGlobalTab() {