Move popup to vue
This commit is contained in:
parent
bd1a904fd5
commit
5b0fcef15c
@ -213,16 +213,18 @@ import Donate from '../common/misc/Donate.vue';
|
|||||||
import Debug from '../ext/conf/Debug';
|
import Debug from '../ext/conf/Debug';
|
||||||
import BrowserDetect from '../ext/conf/BrowserDetect';
|
import BrowserDetect from '../ext/conf/BrowserDetect';
|
||||||
import Comms from '../ext/lib/comms/Comms';
|
import Comms from '../ext/lib/comms/Comms';
|
||||||
import VideoPanel from './panels/VideoPanel';
|
import VideoPanel from './panels/VideoPanel.vue';
|
||||||
import PerformancePanel from './panels/PerformancePanel';
|
import PerformancePanel from './panels/PerformancePanel.vue';
|
||||||
import Settings from '../ext/lib/Settings';
|
import Settings from '../ext/lib/Settings';
|
||||||
import PopupExec from './js/PopupExec';
|
import PopupExec from './js/PopupExec';
|
||||||
import DefaultSettingsPanel from './panels/DefaultSettingsPanel';
|
import DefaultSettingsPanel from './panels/DefaultSettingsPanel.vue';
|
||||||
import AboutPanel from './panels/AboutPanel';
|
import AboutPanel from './panels/AboutPanel.vue';
|
||||||
import ExtensionMode from '../common/enums/ExtensionMode.enum';
|
import ExtensionMode from '../common/enums/ExtensionMode.enum';
|
||||||
import Logger from '../ext/lib/Logger';
|
import Logger from '../ext/lib/Logger';
|
||||||
import {ChromeShittinessMitigations as CSM} from '../common/js/ChromeShittinessMitigations';
|
import {ChromeShittinessMitigations as CSM} from '../common/js/ChromeShittinessMitigations';
|
||||||
|
import { browser } from 'webextension-polyfill-ts';
|
||||||
|
|
||||||
|
import Vue from '*.vue';
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@ -260,7 +262,7 @@ export default Vue.extend({
|
|||||||
await this.settings.init();
|
await this.settings.init();
|
||||||
this.settingsInitialized = true;
|
this.settingsInitialized = true;
|
||||||
|
|
||||||
const port = BrowserDetect.firefox ? browser.runtime.connect({name: 'popup-port'}) : chrome.runtime.connect({name: 'popup-port'});
|
const port = browser.runtime.connect(null, {name: 'popup-port'});
|
||||||
port.onMessage.addListener( (m,p) => this.processReceivedMessage(m,p));
|
port.onMessage.addListener( (m,p) => this.processReceivedMessage(m,p));
|
||||||
CSM.setProperty('port', port);
|
CSM.setProperty('port', port);
|
||||||
|
|
||||||
@ -272,12 +274,12 @@ export default Vue.extend({
|
|||||||
cmd: 'unmark-player',
|
cmd: 'unmark-player',
|
||||||
forwardToAll: true,
|
forwardToAll: true,
|
||||||
});
|
});
|
||||||
if (BrowserDetect.anyChromium) {
|
// if (BrowserDetect.anyChromium) {
|
||||||
chrome.extension.getBackgroundPage().sendUnmarkPlayer({
|
// chrome.extension.getBackgroundPage().sendUnmarkPlayer({
|
||||||
cmd: 'unmark-player',
|
// cmd: 'unmark-player',
|
||||||
forwardToAll: true,
|
// forwardToAll: true,
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
// get info about current site from background script
|
// get info about current site from background script
|
||||||
@ -318,7 +320,7 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async sleep(t) {
|
async sleep(t) {
|
||||||
return new Promise( (resolve,reject) => {
|
return new Promise<void>( (resolve,reject) => {
|
||||||
setTimeout(() => resolve(), t);
|
setTimeout(() => resolve(), t);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -333,9 +335,7 @@ export default Vue.extend({
|
|||||||
this.logger.log('error','popup','[popup::getSite] sending get-current-site failed for some reason. Reason:', e);
|
this.logger.log('error','popup','[popup::getSite] sending get-current-site failed for some reason. Reason:', e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getRandomColor() {
|
|
||||||
return `rgb(${Math.floor(Math.random() * 128)}, ${Math.floor(Math.random() * 128)}, ${Math.floor(Math.random() * 128)})`;
|
|
||||||
},
|
|
||||||
selectTab(tab) {
|
selectTab(tab) {
|
||||||
this.selectedTab = tab;
|
this.selectedTab = tab;
|
||||||
if (tab === 'whats-new') {
|
if (tab === 'whats-new') {
|
||||||
@ -344,9 +344,6 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
this.toggleSideMenu(false);
|
this.toggleSideMenu(false);
|
||||||
},
|
},
|
||||||
selectFrame(frame) {
|
|
||||||
this.selectedFrame = frame;
|
|
||||||
},
|
|
||||||
async updateConfig() {
|
async updateConfig() {
|
||||||
// when this runs, a site could have been enabled or disabled
|
// when this runs, a site could have been enabled or disabled
|
||||||
// this means we must update canShowVideoTab
|
// this means we must update canShowVideoTab
|
||||||
@ -387,7 +384,7 @@ export default Vue.extend({
|
|||||||
if (this.site) {
|
if (this.site) {
|
||||||
if (!this.site.host) {
|
if (!this.site.host) {
|
||||||
// dunno why this fix is needed, but sometimes it is
|
// dunno why this fix is needed, but sometimes it is
|
||||||
this.site.host = site.tabHostname;
|
this.site.host = message.site.tabHostname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.site || this.site.host !== message.site.host) {
|
if (!this.site || this.site.host !== message.site.host) {
|
||||||
@ -538,8 +535,8 @@ export default Vue.extend({
|
|||||||
updateZoom(nz){
|
updateZoom(nz){
|
||||||
this.currentZoom = nz;
|
this.currentZoom = nz;
|
||||||
},
|
},
|
||||||
selectFrame(id){
|
selectFrame(frame) {
|
||||||
this.selectedFrame = id;
|
this.selectedFrame = frame;
|
||||||
},
|
},
|
||||||
selectSite(host) {
|
selectSite(host) {
|
||||||
this.selectedSite = host;
|
this.selectedSite = host;
|
||||||
|
@ -36,19 +36,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import Comms from '../../ext/lib/comms/Comms';
|
import Comms from '../../ext/lib/comms/Comms';
|
||||||
import ShortcutButton from '../../common/components/ShortcutButton';
|
import ShortcutButton from '../../common/components/ShortcutButton.vue';
|
||||||
import BrowserDetect from '../../ext/conf/BrowserDetect';
|
import BrowserDetect from '../../ext/conf/BrowserDetect';
|
||||||
|
import { browser } from 'webextension-polyfill-ts';
|
||||||
|
|
||||||
export default {
|
import Vue from 'vue'
|
||||||
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
ShortcutButton,
|
ShortcutButton,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// reminder — webextension-polyfill doesn't seem to work in vue!
|
// reminder — webextension-polyfill doesn't seem to work in vue!
|
||||||
addonVersion: BrowserDetect.firefox ? browser.runtime.getManifest().version : chrome.runtime.getManifest().version,
|
addonVersion: browser.runtime.getManifest().version,
|
||||||
loggingEnabled: false,
|
loggingEnabled: false,
|
||||||
loggerSettings: '',
|
loggerSettings: '',
|
||||||
loggerSettingsError: false,
|
loggerSettingsError: false,
|
||||||
@ -103,6 +105,5 @@ Browser-related stuff (please ensure this section is correct):
|
|||||||
Comms.sendMessage({cmd: 'hide-logger', forwardToActive: true});
|
Comms.sendMessage({cmd: 'hide-logger', forwardToActive: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -122,13 +122,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import ExecAction from '../js/ExecAction';
|
import ExecAction from '../js/ExecAction';
|
||||||
import KeyboardShortcutParser from '../../common/js/KeyboardShortcutParser';
|
import KeyboardShortcutParser from '../../common/js/KeyboardShortcutParser';
|
||||||
import ShortcutButton from '../../common/components/ShortcutButton';
|
import ShortcutButton from '../../common/components/ShortcutButton.vue';
|
||||||
import ComputeActionsMixin from '../../common/mixins/ComputeActionsMixin';
|
import ComputeActionsMixin from '../../common/mixins/ComputeActionsMixin';
|
||||||
|
|
||||||
export default {
|
import Vue from 'vue'
|
||||||
|
export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
}
|
}
|
||||||
@ -190,10 +191,10 @@ export default {
|
|||||||
return KeyboardShortcutParser.parseShortcut(action.scopes[this.scope].shortcut[0]);
|
return KeyboardShortcutParser.parseShortcut(action.scopes[this.scope].shortcut[0]);
|
||||||
},
|
},
|
||||||
wipeSettings() {
|
wipeSettings() {
|
||||||
settings.setDefaultSettings();
|
this.settings.setDefaultSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -6,10 +6,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
|
import Vue from 'vue'
|
||||||
|
export default Vue.extend({
|
||||||
export default {
|
|
||||||
props: {
|
props: {
|
||||||
performance: Object,
|
performance: Object,
|
||||||
},
|
},
|
||||||
@ -18,7 +17,7 @@ export default {
|
|||||||
deep: true,
|
deep: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -126,14 +126,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import ShortcutButton from '../../common/components/ShortcutButton.vue';
|
import ShortcutButton from '../../common/components/ShortcutButton.vue';
|
||||||
import QsElement from '../../common/components/QsElement.vue';
|
import QsElement from '../../common/components/QsElement.vue';
|
||||||
import QuerySelectorSetting from '../../common/components/QuerySelectorSetting.vue';
|
import QuerySelectorSetting from '../../common/components/QuerySelectorSetting.vue';
|
||||||
import ExtensionMode from '../../common/enums/ExtensionMode.enum';
|
import ExtensionMode from '../../common/enums/ExtensionMode.enum';
|
||||||
import VideoAlignmentType from '../../common/enums/VideoAlignmentType.enum';
|
import VideoAlignmentType from '../../common/enums/VideoAlignmentType.enum';
|
||||||
import StretchType from '../../common/enums/StretchType.enum';
|
import StretchType from '../../common/enums/StretchType.enum';
|
||||||
export default {
|
|
||||||
|
import Vue from 'vue'
|
||||||
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
QuerySelectorSetting,
|
QuerySelectorSetting,
|
||||||
ShortcutButton,
|
ShortcutButton,
|
||||||
@ -249,8 +251,7 @@ export default {
|
|||||||
this.settings.save();
|
this.settings.save();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -16,16 +16,18 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
|
||||||
|
<script lang="ts">
|
||||||
import BrowserDetect from '../../ext/conf/BrowserDetect';
|
import BrowserDetect from '../../ext/conf/BrowserDetect';
|
||||||
|
|
||||||
export default {
|
import Vue from 'vue'
|
||||||
|
export default Vue.extend({
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
BrowserDetect: BrowserDetect
|
BrowserDetect: BrowserDetect
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
Loading…
Reference in New Issue
Block a user