From 042347150e455e73641c2af8bdc1084d6605fc62 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 25 Nov 2017 07:55:20 +0000 Subject: Use mkRepeatCommand in main.coffee. Tweak of #2601. --- background_scripts/main.coffee | 4 ++-- content_scripts/mode_normal.coffee | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 4e36907a..75b9dbd5 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -114,7 +114,7 @@ TabOperations = canUseOpenerTabId = not (Utils.isFirefox() and Utils.compareVersions(Utils.firefoxVersion(), "57") < 0) tabConfig.openerTabId = request.tab.id if canUseOpenerTabId - chrome.tabs.create tabConfig, callback + chrome.tabs.create tabConfig, -> callback request # Opens request.url in new window and switches to it. openUrlInNewWindow: (request, callback = (->)) -> @@ -430,7 +430,7 @@ sendRequestHandlers = # getCurrentTabUrl is used by the content scripts to get their full URL, because window.location cannot help # with Chrome-specific URLs like "view-source:http:..". getCurrentTabUrl: ({tab}) -> tab.url - openUrlInNewTab: (request) -> TabOperations.openUrlInNewTab request + openUrlInNewTab: mkRepeatCommand (request, callback) -> TabOperations.openUrlInNewTab request, callback openUrlInNewWindow: (request) -> TabOperations.openUrlInNewWindow request openUrlInIncognito: (request) -> chrome.windows.create incognito: true, url: Utils.convertToUrl request.url openUrlInCurrentTab: TabOperations.openUrlInCurrentTab diff --git a/content_scripts/mode_normal.coffee b/content_scripts/mode_normal.coffee index e91feecf..1fe0618e 100644 --- a/content_scripts/mode_normal.coffee +++ b/content_scripts/mode_normal.coffee @@ -97,8 +97,7 @@ NormalModeCommands = openCopiedUrlInNewTab: (count) -> HUD.pasteFromClipboard (url) -> - for i in [0...count] by 1 - chrome.runtime.sendMessage { handler: "openUrlInNewTab", url } + chrome.runtime.sendMessage { handler: "openUrlInNewTab", url, count } openCopiedUrlInCurrentTab: -> HUD.pasteFromClipboard (url) -> -- cgit v1.2.3