aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2016-02-21 06:55:39 +0000
committerStephen Blott2016-02-21 06:55:39 +0000
commit970b0bc108c1f42ce65d4353b7f209748ceeecf8 (patch)
treea9a3fe7d70c4ea554cdde419c49949af1d4dee6a /background_scripts
parentc4af8a5fb217f50e3089f0f01d3a18d7d2155848 (diff)
parent26f54711eadfa3c534adbf7a1bdf1feb1be9009d (diff)
downloadvimium-970b0bc108c1f42ce65d4353b7f209748ceeecf8.tar.bz2
Merge branch 'rework-duplicateTab'
Conflicts: background_scripts/commands.coffee
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/commands.coffee2
-rw-r--r--background_scripts/main.coffee9
2 files changed, 6 insertions, 5 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index 4e8c48ca..b4c503c1 100644
--- a/background_scripts/commands.coffee
+++ b/background_scripts/commands.coffee
@@ -338,7 +338,7 @@ commandDescriptions =
lastTab: ["Go to the last tab", { background: true, passCountToFunction: true }]
createTab: ["Create new tab", { background: true, repeatLimit: 20 }]
- duplicateTab: ["Duplicate current tab", { background: true, repeatLimit: 20 }]
+ duplicateTab: ["Duplicate current tab", { background: true, passCountToFunction: true, repeatLimit: 20 }]
removeTab: ["Close current tab", { background: true, passCountToFunction: true, repeatLimit:
# Require confirmation to remove more tabs than we can restore.
(if chrome.session then chrome.session.MAX_SESSION_RESULTS else 25) }]
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 3eb8ef76..4964b73c 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -270,10 +270,11 @@ BackgroundCommands =
# "pages/blank.html" does not work in incognito mode, so fall back to "chrome://newtab" instead.
url = if tab.incognito then "chrome://newtab" else chrome.runtime.getURL url
TabOperations.openUrlInNewTab { url }, callback
- duplicateTab: (callback) ->
- chrome.tabs.getSelected(null, (tab) ->
- chrome.tabs.duplicate(tab.id)
- selectionChangedHandlers.push(callback))
+ duplicateTab: (count) ->
+ chrome.tabs.getSelected null, (tab) ->
+ createTab = (tab) ->
+ chrome.tabs.duplicate tab.id, createTab if 0 < count--
+ createTab tab
moveTabToNewWindow: (count) ->
chrome.tabs.query {currentWindow: true}, (tabs) ->
chrome.tabs.query {currentWindow: true, active: true}, (activeTabs) ->