Process iframe data in the popup, remove vestigal code
This commit is contained in:
parent
269dddc92e
commit
150a0a8a90
@ -171,6 +171,7 @@ export default {
|
|||||||
this.tabs.find(x => x.id === 'changelog').highlight = !this.settings.active?.whatsNewChecked;
|
this.tabs.find(x => x.id === 'changelog').highlight = !this.settings.active?.whatsNewChecked;
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
|
try {
|
||||||
this.logger = new Logger();
|
this.logger = new Logger();
|
||||||
await this.logger.init({
|
await this.logger.init({
|
||||||
allowLogging: true,
|
allowLogging: true,
|
||||||
@ -199,7 +200,6 @@ export default {
|
|||||||
this.site = config.site;
|
this.site = config.site;
|
||||||
// this.selectedSite = this.selectedSite || config.site.host;
|
// this.selectedSite = this.selectedSite || config.site.host;
|
||||||
this.siteSettings = this.settings.getSiteSettings(this.site.host);
|
this.siteSettings = this.settings.getSiteSettings(this.site.host);
|
||||||
|
|
||||||
this.eventBus.setupPopupTunnelWorkaround({
|
this.eventBus.setupPopupTunnelWorkaround({
|
||||||
origin: CommsOrigin.Popup,
|
origin: CommsOrigin.Popup,
|
||||||
comms: {
|
comms: {
|
||||||
@ -208,7 +208,6 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.loadFrames(this.site);
|
this.loadFrames(this.site);
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -240,6 +239,9 @@ export default {
|
|||||||
this.requestSite();
|
this.requestSite();
|
||||||
await this.sleep(5000);
|
await this.sleep(5000);
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('[Popup.vue::created()] An error happened:', e)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async updated() {
|
async updated() {
|
||||||
const body = document.getElementsByTagName('body')[0];
|
const body = document.getElementsByTagName('body')[0];
|
||||||
@ -288,62 +290,26 @@ export default {
|
|||||||
selectTab(tab) {
|
selectTab(tab) {
|
||||||
this.selectedTab = tab;
|
this.selectedTab = tab;
|
||||||
},
|
},
|
||||||
processReceivedMessage(message, port) {
|
|
||||||
this.logger.log('info', 'popup', '[popup::processReceivedMessage] received message:', message)
|
|
||||||
|
|
||||||
if (message.command === 'set-current-site'){
|
|
||||||
if (this.site) {
|
|
||||||
if (!this.site.host) {
|
|
||||||
// dunno why this fix is needed, but sometimes it is
|
|
||||||
this.site.host = site.tabHostname;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.site = message.site;
|
|
||||||
|
|
||||||
// update activeSites
|
|
||||||
// this.activeSites = this.activeSites.filter(x => x.host !== message.site);
|
|
||||||
|
|
||||||
// add current site
|
|
||||||
// this.activeSites = unshift({
|
|
||||||
// host: message.site.host,
|
|
||||||
// isIFrame: false, // currently unused
|
|
||||||
// });
|
|
||||||
this.selectedSite = this.selectedSite || message.site.host;
|
|
||||||
|
|
||||||
this.loadFrames(this.site);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
|
|
||||||
isDefaultFrame(frameId) {
|
isDefaultFrame(frameId) {
|
||||||
return frameId === '__playing' || frameId === '__all';
|
return frameId === '__playing' || frameId === '__all';
|
||||||
},
|
},
|
||||||
loadFrames() {
|
loadFrames() {
|
||||||
this.activeSites = [{
|
this.activeFrames = [{
|
||||||
host: this.site.host,
|
host: this.site.host,
|
||||||
isIFrame: false, // not used tho. Maybe one day
|
isIFrame: false, // not used tho. Maybe one day
|
||||||
}];
|
}];
|
||||||
this.selectedSite = this.selectedSite || this.site.host;
|
|
||||||
|
|
||||||
// for (const frame in videoTab.frames) {
|
|
||||||
// this.activeFrames.push({
|
|
||||||
// id: `${this.site.id}-${frame}`,
|
|
||||||
// label: videoTab.frames[frame].host,
|
|
||||||
// ...this.frameStore[frame],
|
|
||||||
// })
|
|
||||||
|
|
||||||
// // only add each host once at most
|
for (const frame in this.site.frames) {
|
||||||
// if (!this.activeSites.find(x => x.host === videoTab.frames[frame].host)) {
|
if (!this.activeFrames.find(x => x.host === this.site.frames[frame].host)) {
|
||||||
// this.activeSites.push({
|
this.activeFrames.push({
|
||||||
// host: videoTab.frames[frame].host,
|
id: `${this.site.id}-${frame}`,
|
||||||
// isIFrame: undefined // maybe one day
|
label: this.site.frames[frame].host,
|
||||||
// });
|
host: this.site.frames[frame].host,
|
||||||
// }
|
...this.site.frames[frame],
|
||||||
// }
|
})
|
||||||
|
};
|
||||||
// update whether video tab can be shown
|
}
|
||||||
// this.updateCanShowVideoTab();
|
|
||||||
},
|
},
|
||||||
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