From 79ff1b71262561364bf63bd89f2622abf3eef465 Mon Sep 17 00:00:00 2001 From: brook hong Date: Mon, 1 Jan 2024 18:07:37 +0800 Subject: [PATCH] add command/shortcut to clear urls in queue. --- src/background/start.js | 3 +++ src/content_scripts/common/default.js | 3 +++ src/content_scripts/ui/command.js | 3 +++ src/pages/l10n.json | 1 + 4 files changed, 10 insertions(+) diff --git a/src/background/start.js b/src/background/start.js index 023a2b5c8..331a0a38b 100644 --- a/src/background/start.js +++ b/src/background/start.js @@ -1595,6 +1595,9 @@ function start(browser) { queueURLs: _queueURLs }; }; + self.clearQueueURLs = function(message, sender, sendResponse) { + _queueURLs = []; + }; self.getVoices = function(message, sender, sendResponse) { chrome.tts.getVoices(function(voices) { diff --git a/src/content_scripts/common/default.js b/src/content_scripts/common/default.js index edfe0de1b..540a4d30c 100644 --- a/src/content_scripts/common/default.js +++ b/src/content_scripts/common/default.js @@ -205,6 +205,9 @@ module.exports = function(api) { }); } }); + mapkey(';cq', '#7Clear all URLs in queue to be opened', function() { + RUNTIME('clearQueueURLs'); + }); mapkey('ys', "#7Copy current page's source", function() { var aa = document.documentElement.cloneNode(true); Clipboard.write(aa.outerHTML); diff --git a/src/content_scripts/ui/command.js b/src/content_scripts/ui/command.js index b348a9204..92025f0d6 100644 --- a/src/content_scripts/ui/command.js +++ b/src/content_scripts/ui/command.js @@ -116,6 +116,9 @@ export default (normal, command, omnibar) => { }); }); }); + command('clearQueueURLs', 'clear URLs in queue waiting for open', function(args) { + RUNTIME('clearQueueURLs'); + }); command('timeStamp', 'print time stamp in human readable format', function(args) { var dt = new Date(parseInt(args[0])); omnibar.listWords([dt.toString()]); diff --git a/src/pages/l10n.json b/src/pages/l10n.json index d98e21ec5..a49aff891 100644 --- a/src/pages/l10n.json +++ b/src/pages/l10n.json @@ -12,6 +12,7 @@ "Change scroll target": "切换滚动目标", "Choose a tab": "选择标签页", "Chrome URLs": "Chrome内置功能", + "Clear all URLs in queue to be opened": "清除等待打开的URL", "Click on an Image or a button": "点击图片或按钮", "Click on node under cursor.": "点击光标下的元素", "Click on the next link on current page": "点击当前页上的下一页链接",