Revert "Move popup to vue"

This reverts commit 5b0fcef15c.
This commit is contained in:
Tamius Han 2021-03-14 00:34:47 +01:00
parent 0dc196127e
commit e272d1d4d4
6 changed files with 44 additions and 45 deletions

View File

@ -213,18 +213,16 @@ import Donate from '../common/misc/Donate.vue';
import Debug from '../ext/conf/Debug';
import BrowserDetect from '../ext/conf/BrowserDetect';
import Comms from '../ext/lib/comms/Comms';
import VideoPanel from './panels/VideoPanel.vue';
import PerformancePanel from './panels/PerformancePanel.vue';
import VideoPanel from './panels/VideoPanel';
import PerformancePanel from './panels/PerformancePanel';
import Settings from '../ext/lib/Settings';
import PopupExec from './js/PopupExec';
import DefaultSettingsPanel from './panels/DefaultSettingsPanel.vue';
import AboutPanel from './panels/AboutPanel.vue';
import DefaultSettingsPanel from './panels/DefaultSettingsPanel';
import AboutPanel from './panels/AboutPanel';
import ExtensionMode from '../common/enums/ExtensionMode.enum';
import Logger from '../ext/lib/Logger';
import {ChromeShittinessMitigations as CSM} from '../common/js/ChromeShittinessMitigations';
import { browser } from 'webextension-polyfill-ts';
import Vue from '*.vue';
export default Vue.extend({
data () {
return {
@ -262,7 +260,7 @@ export default Vue.extend({
await this.settings.init();
this.settingsInitialized = true;
const port = browser.runtime.connect(null, {name: 'popup-port'});
const port = BrowserDetect.firefox ? browser.runtime.connect({name: 'popup-port'}) : chrome.runtime.connect({name: 'popup-port'});
port.onMessage.addListener( (m,p) => this.processReceivedMessage(m,p));
CSM.setProperty('port', port);
@ -274,12 +272,12 @@ export default Vue.extend({
cmd: 'unmark-player',
forwardToAll: true,
});
// if (BrowserDetect.anyChromium) {
// chrome.extension.getBackgroundPage().sendUnmarkPlayer({
// cmd: 'unmark-player',
// forwardToAll: true,
// });
// }
if (BrowserDetect.anyChromium) {
chrome.extension.getBackgroundPage().sendUnmarkPlayer({
cmd: 'unmark-player',
forwardToAll: true,
});
}
});
// get info about current site from background script
@ -320,7 +318,7 @@ export default Vue.extend({
},
methods: {
async sleep(t) {
return new Promise<void>( (resolve,reject) => {
return new Promise( (resolve,reject) => {
setTimeout(() => resolve(), t);
});
},
@ -335,7 +333,9 @@ export default Vue.extend({
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) {
this.selectedTab = tab;
if (tab === 'whats-new') {
@ -344,6 +344,9 @@ export default Vue.extend({
}
this.toggleSideMenu(false);
},
selectFrame(frame) {
this.selectedFrame = frame;
},
async updateConfig() {
// when this runs, a site could have been enabled or disabled
// this means we must update canShowVideoTab
@ -384,7 +387,7 @@ export default Vue.extend({
if (this.site) {
if (!this.site.host) {
// dunno why this fix is needed, but sometimes it is
this.site.host = message.site.tabHostname;
this.site.host = site.tabHostname;
}
}
if (!this.site || this.site.host !== message.site.host) {
@ -535,8 +538,8 @@ export default Vue.extend({
updateZoom(nz){
this.currentZoom = nz;
},
selectFrame(frame) {
this.selectedFrame = frame;
selectFrame(id){
this.selectedFrame = id;
},
selectSite(host) {
this.selectedSite = host;

View File

@ -36,21 +36,19 @@
</div>
</template>
<script lang="ts">
<script>
import Comms from '../../ext/lib/comms/Comms';
import ShortcutButton from '../../common/components/ShortcutButton.vue';
import ShortcutButton from '../../common/components/ShortcutButton';
import BrowserDetect from '../../ext/conf/BrowserDetect';
import { browser } from 'webextension-polyfill-ts';
import Vue from 'vue'
export default Vue.extend({
export default {
components: {
ShortcutButton,
},
data() {
return {
// reminder webextension-polyfill doesn't seem to work in vue!
addonVersion: browser.runtime.getManifest().version,
addonVersion: BrowserDetect.firefox ? browser.runtime.getManifest().version : chrome.runtime.getManifest().version,
loggingEnabled: false,
loggerSettings: '',
loggerSettingsError: false,
@ -105,5 +103,6 @@ Browser-related stuff (please ensure this section is correct):
Comms.sendMessage({cmd: 'hide-logger', forwardToActive: true});
}
}
})
}
</script>

View File

@ -122,14 +122,13 @@
</div>
</template>
<script lang="ts">
<script>
import ExecAction from '../js/ExecAction';
import KeyboardShortcutParser from '../../common/js/KeyboardShortcutParser';
import ShortcutButton from '../../common/components/ShortcutButton.vue';
import ShortcutButton from '../../common/components/ShortcutButton';
import ComputeActionsMixin from '../../common/mixins/ComputeActionsMixin';
import Vue from 'vue'
export default Vue.extend({
export default {
data() {
return {
}
@ -191,10 +190,10 @@ export default Vue.extend({
return KeyboardShortcutParser.parseShortcut(action.scopes[this.scope].shortcut[0]);
},
wipeSettings() {
this.settings.setDefaultSettings();
settings.setDefaultSettings();
}
}
})
}
</script>
<style>

View File

@ -6,9 +6,10 @@
</div>
</template>
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
<script>
export default {
props: {
performance: Object,
},
@ -17,7 +18,7 @@ export default Vue.extend({
deep: true,
}
}
})
}
</script>
<style>

View File

@ -126,16 +126,14 @@
</div>
</template>
<script lang="ts">
<script>
import ShortcutButton from '../../common/components/ShortcutButton.vue';
import QsElement from '../../common/components/QsElement.vue';
import QuerySelectorSetting from '../../common/components/QuerySelectorSetting.vue';
import ExtensionMode from '../../common/enums/ExtensionMode.enum';
import VideoAlignmentType from '../../common/enums/VideoAlignmentType.enum';
import StretchType from '../../common/enums/StretchType.enum';
import Vue from 'vue'
export default Vue.extend({
export default {
components: {
QuerySelectorSetting,
ShortcutButton,
@ -251,7 +249,8 @@ export default Vue.extend({
this.settings.save();
},
}
})
}
</script>
<style>

View File

@ -16,18 +16,16 @@
</ul>
</div>
</template>
<script lang="ts">
<script>
import BrowserDetect from '../../ext/conf/BrowserDetect';
import Vue from 'vue'
export default Vue.extend({
export default {
data () {
return {
BrowserDetect: BrowserDetect
}
},
})
}
</script>
<style>