Show warning when some frames on a given site are disabled
This commit is contained in:
parent
67d45d265b
commit
5329f0a600
@ -290,7 +290,7 @@ class Settings {
|
|||||||
// }
|
// }
|
||||||
try{
|
try{
|
||||||
// if site is not defined, we use default mode:
|
// if site is not defined, we use default mode:
|
||||||
if (! this.active.sites[site]) {
|
if (! this.active.sites[site] || this.active.sites[site].mode === ExtensionMode.Default) {
|
||||||
return this.active.sites['@global'].mode === ExtensionMode.Enabled;
|
return this.active.sites['@global'].mode === ExtensionMode.Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,7 @@
|
|||||||
<div id="tab-content" class="flex-grow h100 overflow-y-auto">
|
<div id="tab-content" class="flex-grow h100 overflow-y-auto">
|
||||||
<VideoPanel v-if="settings && settings.active && selectedTab === 'video'"
|
<VideoPanel v-if="settings && settings.active && selectedTab === 'video'"
|
||||||
class=""
|
class=""
|
||||||
|
:someSitesDisabledWarning="canShowVideoTab.warning"
|
||||||
:settings="settings"
|
:settings="settings"
|
||||||
:frame="selectedFrame"
|
:frame="selectedFrame"
|
||||||
:zoom="currentZoom"
|
:zoom="currentZoom"
|
||||||
@ -193,28 +194,7 @@ export default {
|
|||||||
settings: new Settings(undefined, () => this.updateConfig()),
|
settings: new Settings(undefined, () => this.updateConfig()),
|
||||||
siteTabDisabled: false,
|
siteTabDisabled: false,
|
||||||
videoTabDisabled: false,
|
videoTabDisabled: false,
|
||||||
}
|
canShowVideoTab: {canShow: true, warning: true},
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
canShowVideoTab() {
|
|
||||||
let canShow = false;
|
|
||||||
let warning = false;
|
|
||||||
let t;
|
|
||||||
|
|
||||||
if (!this.settings) {
|
|
||||||
return {canShow: true, warning: false};
|
|
||||||
}
|
|
||||||
for (const site of this.activeSites) {
|
|
||||||
t = this.settings.canStartExtension(site.host);
|
|
||||||
canShow = canShow || t;
|
|
||||||
warning = warning || !t;
|
|
||||||
}
|
|
||||||
if (t === undefined) {
|
|
||||||
// something isn't the way it should be. Show sites.
|
|
||||||
return {canShow: true, warning: true};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {canShow, warning}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
@ -282,6 +262,29 @@ export default {
|
|||||||
},
|
},
|
||||||
async updateConfig() {
|
async updateConfig() {
|
||||||
|
|
||||||
|
// when this runs, a site could have been enabled or disabled
|
||||||
|
// this means we must update canShowVideoTab
|
||||||
|
this.updateCanShowVideoTab();
|
||||||
|
},
|
||||||
|
updateCanShowVideoTab() {
|
||||||
|
let canShow = false;
|
||||||
|
let warning = false;
|
||||||
|
let t;
|
||||||
|
|
||||||
|
if (!this.settings) {
|
||||||
|
this.canShowVideoTab = {canShow: true, warning: false};
|
||||||
|
}
|
||||||
|
for (const site of this.activeSites) {
|
||||||
|
t = this.settings.canStartExtension(site.host);
|
||||||
|
canShow = canShow || t;
|
||||||
|
warning = warning || !t;
|
||||||
|
}
|
||||||
|
if (t === undefined) {
|
||||||
|
// something isn't the way it should be. Show sites.
|
||||||
|
this.canShowVideoTab = {canShow: true, warning: true};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.canShowVideoTab = {canShow: canShow, warning: warning};
|
||||||
},
|
},
|
||||||
processReceivedMessage(message, port) {
|
processReceivedMessage(message, port) {
|
||||||
if (Debug.debug && Debug.comms) {
|
if (Debug.debug && Debug.comms) {
|
||||||
@ -418,6 +421,9 @@ return true;
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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)})`;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="" style="padding-bottom: 20px">
|
<div class="" style="padding-bottom: 20px">
|
||||||
|
<div v-if="someSitesDisabledWarning" class="warning-lite">
|
||||||
|
Some sites embedded on this page are disabled. Extension will not work on videos embedded from disabled sites.
|
||||||
|
</div>
|
||||||
<div v-if="aspectRatioActions.length">
|
<div v-if="aspectRatioActions.length">
|
||||||
<div class="label">Cropping mode:</div>
|
<div class="label">Cropping mode:</div>
|
||||||
<div class="flex flex-row flex-wrap">
|
<div class="flex flex-row flex-wrap">
|
||||||
@ -127,7 +130,8 @@ export default {
|
|||||||
props: [
|
props: [
|
||||||
'settings',
|
'settings',
|
||||||
'frame',
|
'frame',
|
||||||
'zoom'
|
'zoom',
|
||||||
|
'someSitesDisabledWarning'
|
||||||
],
|
],
|
||||||
created() {
|
created() {
|
||||||
this.exec = new ExecAction(this.settings);
|
this.exec = new ExecAction(this.settings);
|
||||||
@ -175,4 +179,10 @@ export default {
|
|||||||
.input-slider {
|
.input-slider {
|
||||||
width: 480px;
|
width: 480px;
|
||||||
}
|
}
|
||||||
|
.warning-lite {
|
||||||
|
padding-right: 16px;
|
||||||
|
padding-bottom: 16px;
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -297,15 +297,17 @@ small {
|
|||||||
color: #d6ba4a;
|
color: #d6ba4a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.warning {
|
.warning, .warning-lite {
|
||||||
color: #d6ba4a;
|
color: #d6ba4a;
|
||||||
padding-left: 35px;
|
padding-left: 35px;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.warning::before {
|
.warning::before, .warning-lite::before {
|
||||||
content: "⚠ ";
|
content: "⚠ ";
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.warning::before {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 2.5em;
|
font-size: 2.5em;
|
||||||
margin-left: -35px;
|
margin-left: -35px;
|
||||||
|
Loading…
Reference in New Issue
Block a user