aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2017-11-25 07:55:20 +0000
committerStephen Blott2017-11-25 07:55:24 +0000
commit042347150e455e73641c2af8bdc1084d6605fc62 (patch)
treee3e45232c0e9002978f316ade8dc2e8460a422da
parent58f45ac17938e2984b3d3b83c8aed452f1287498 (diff)
downloadvimium-042347150e455e73641c2af8bdc1084d6605fc62.tar.bz2
Use mkRepeatCommand in main.coffee.
Tweak of #2601.
-rw-r--r--background_scripts/main.coffee4
-rw-r--r--content_scripts/mode_normal.coffee3
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) ->