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;
|
||||
},
|
||||
async created() {
|
||||
try {
|
||||
this.logger = new Logger();
|
||||
await this.logger.init({
|
||||
allowLogging: true,
|
||||
@ -199,7 +200,6 @@ export default {
|
||||
this.site = config.site;
|
||||
// this.selectedSite = this.selectedSite || config.site.host;
|
||||
this.siteSettings = this.settings.getSiteSettings(this.site.host);
|
||||
|
||||
this.eventBus.setupPopupTunnelWorkaround({
|
||||
origin: CommsOrigin.Popup,
|
||||
comms: {
|
||||
@ -208,7 +208,6 @@ export default {
|
||||
});
|
||||
|
||||
this.loadFrames(this.site);
|
||||
|
||||
}
|
||||
},
|
||||
);
|
||||
@ -240,6 +239,9 @@ export default {
|
||||
this.requestSite();
|
||||
await this.sleep(5000);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[Popup.vue::created()] An error happened:', e)
|
||||
}
|
||||
},
|
||||
async updated() {
|
||||
const body = document.getElementsByTagName('body')[0];
|
||||
@ -288,62 +290,26 @@ export default {
|
||||
selectTab(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) {
|
||||
return frameId === '__playing' || frameId === '__all';
|
||||
},
|
||||
loadFrames() {
|
||||
this.activeSites = [{
|
||||
this.activeFrames = [{
|
||||
host: this.site.host,
|
||||
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
|
||||
// if (!this.activeSites.find(x => x.host === videoTab.frames[frame].host)) {
|
||||
// this.activeSites.push({
|
||||
// host: videoTab.frames[frame].host,
|
||||
// isIFrame: undefined // maybe one day
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// update whether video tab can be shown
|
||||
// this.updateCanShowVideoTab();
|
||||
for (const frame in this.site.frames) {
|
||||
if (!this.activeFrames.find(x => x.host === this.site.frames[frame].host)) {
|
||||
this.activeFrames.push({
|
||||
id: `${this.site.id}-${frame}`,
|
||||
label: this.site.frames[frame].host,
|
||||
host: this.site.frames[frame].host,
|
||||
...this.site.frames[frame],
|
||||
})
|
||||
};
|
||||
}
|
||||
},
|
||||
getRandomColor() {
|
||||
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