From d5587171522c2d5344a848ce84e08bce9c5b11e0 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Sun, 20 Nov 2022 23:41:40 +0100 Subject: [PATCH] Try to recreate some UI in popup --- src/popup/App.vue | 8 ++ src/popup/js/ExecAction.ts | 85 ------------------ src/popup/panels/PopupVideoSettings.vue | 114 ++++++++++-------------- 3 files changed, 53 insertions(+), 154 deletions(-) delete mode 100644 src/popup/js/ExecAction.ts diff --git a/src/popup/App.vue b/src/popup/App.vue index e82e1af..10e06da 100644 --- a/src/popup/App.vue +++ b/src/popup/App.vue @@ -27,6 +27,14 @@
side menu
+
+ +
         ---- site:
         {{site}}
diff --git a/src/popup/js/ExecAction.ts b/src/popup/js/ExecAction.ts
deleted file mode 100644
index 0fefe5b..0000000
--- a/src/popup/js/ExecAction.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-import { browser } from '../../../node_modules/webextension-polyfill-ts/lib/index';
-import Settings from '../../ext/lib/Settings';
-
-class ExecAction {
-  settings: Settings;
-  site: any;
-
-  constructor(settings, site) {
-    this.settings = settings;
-    this.site = site;
-  }
-
-  setSettings(settings) {
-    this.settings = settings;
-  }
-  setSite(site) {
-    this.site = site;
-  }
-
-  async exec(action, scope, frame) {
-    for (var cmd of action.cmd) {
-      if (scope === 'page') {
-        const message = {
-          forwardToContentScript: true,
-          targetFrame: frame,
-          frame: frame,
-          cmd: cmd.action,
-          arg: cmd.arg,
-          customArg: cmd.customArg
-        }
-        browser.runtime.sendMessage(message);
-      } else {
-
-        // set-ar-persistence sends stuff to content scripts as well (!)
-        // it's important to do that BEFORE the save step
-        if (cmd.action === 'set-ar-persistence') {
-          // even when setting global defaults, we only send message to the current tab in
-          // order to avoid problems related to
-          const message = {
-            forwardToActive: true,
-            targetFrame: frame,
-            frame: frame,
-            cmd: cmd.action,
-            arg: cmd.arg,
-          }
-          // this hopefully delays settings.save() until current crops are saved on the site
-          // and thus avoid any fucky-wuckies
-          await browser.runtime.sendMessage(message);
-        }
-
-        let site = this.site;
-        if (scope === 'global') {
-          site = '@global';
-        } else if (!this.site) {
-          site = window.location.hostname;
-        }
-
-        if (scope === 'site' && !this.settings.active.sites[site]) {
-          this.settings.active.sites[site] = this.settings.getDefaultOption();
-        }
-
-        if (cmd.action === "set-stretch") {
-          this.settings.active.sites[site].stretch = cmd.arg;
-        } else if (cmd.action === "set-alignment") {
-          this.settings.active.sites[site].videoAlignment = cmd.arg;
-        } else if (cmd.action === "set-extension-mode") {
-          this.settings.active.sites[site].mode = cmd.arg;
-        } else if (cmd.action === "set-autoar-mode") {
-          this.settings.active.sites[site].autoar = cmd.arg;
-        } else if (cmd.action === 'set-keyboard') {
-          this.settings.active.sites[site].keyboardShortcutsEnabled = cmd.arg;
-        } else if (cmd.action === 'set-ar-persistence') {
-          this.settings.active.sites[site]['cropModePersistence'] = cmd.arg;
-          this.settings.saveWithoutReload();
-        }
-
-        if (cmd.action !== 'set-ar-persistence') {
-          this.settings.save();
-        }
-      }
-    }
-  }
-}
-
-export default ExecAction;
diff --git a/src/popup/panels/PopupVideoSettings.vue b/src/popup/panels/PopupVideoSettings.vue
index 4e5d8cd..ff40745 100644
--- a/src/popup/panels/PopupVideoSettings.vue
+++ b/src/popup/panels/PopupVideoSettings.vue
@@ -1,74 +1,50 @@
 
+
+