浏览代码

fix #2239: add a global toggle hotkey

tophf 11 月之前
父节点
当前提交
741311c4c1
共有 3 个文件被更改,包括 7 次插入0 次删除
  1. 3 0
      src/_locales/en/messages.yml
  2. 2 0
      src/background/utils/icon.js
  3. 2 0
      src/manifest.yml

+ 3 - 0
src/_locales/en/messages.yml

@@ -1011,6 +1011,9 @@ titleSearchHintV2:
 
 
     * Regular expressions: <code>/\w+?/</code>, <code>/\w+?/gi</code>,
     * Regular expressions: <code>/\w+?/</code>, <code>/\w+?/gi</code>,
     <code>name:/\w+?/</code>, <code>name+re:"\w+? with space"</code>
     <code>name:/\w+?/</code>, <code>name+re:"\w+? with space"</code>
+toggleInjection:
+  description: Label for a keyboard shortcut.
+  message: Toggle userscript injection
 trackEdits:
 trackEdits:
   description: Button in a script installation dialog.
   description: Button in a script installation dialog.
   message: Track external edits
   message: Track external edits

+ 2 - 0
src/background/utils/icon.js

@@ -245,6 +245,8 @@ export function handleHotkeyOrMenu(id, tab) {
     openDashboard('');
     openDashboard('');
   } else if (id === 'newScript') {
   } else if (id === 'newScript') {
     commands.OpenEditor();
     commands.OpenEditor();
+  } else if (id === 'toggleInjection') {
+    setOption(IS_APPLIED, !isApplied);
   } else if (id === 'updateScripts') {
   } else if (id === 'updateScripts') {
     commands.CheckUpdate();
     commands.CheckUpdate();
   } else if (id === 'updateScriptsInTab') {
   } else if (id === 'updateScriptsInTab') {

+ 2 - 0
src/manifest.yml

@@ -42,6 +42,8 @@ permissions:
   - cookies
   - cookies
 commands:
 commands:
   _execute_browser_action: {}
   _execute_browser_action: {}
+  toggleInjection:
+    description: __MSG_toggleInjection__
   dashboard:
   dashboard:
     description: __MSG_menuDashboard__
     description: __MSG_menuDashboard__
   settings:
   settings: