aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/main.coffee
diff options
context:
space:
mode:
authorStephen Blott2014-10-26 12:37:50 +0000
committerStephen Blott2014-10-26 12:37:50 +0000
commit33406947a1b776c1aca7701668220e1967f6bb5c (patch)
treeadd72c16cd4f326f5a8f1b657eabd0baea9c0383 /background_scripts/main.coffee
parent62fc0d277962d52c4d0cb34fcea4364b23162717 (diff)
parenta86cfb88b033a094de1783546898895b7fbe0cf5 (diff)
downloadvimium-33406947a1b776c1aca7701668220e1967f6bb5c.tar.bz2
Merge branch 'limitedRepeats' of github.com:mrmr1993/vimium into mrmr1993-limitedRepeats
Diffstat (limited to 'background_scripts/main.coffee')
-rw-r--r--background_scripts/main.coffee21
1 files changed, 18 insertions, 3 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 14ce7b0f..33425d90 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -244,9 +244,10 @@ BackgroundCommands =
previousTab: (callback) -> selectTab(callback, "previous")
firstTab: (callback) -> selectTab(callback, "first")
lastTab: (callback) -> selectTab(callback, "last")
- removeTab: ->
+ removeTab: (callback) ->
chrome.tabs.getSelected(null, (tab) ->
- chrome.tabs.remove(tab.id))
+ chrome.tabs.remove(tab.id)
+ selectionChangedHandlers.push(callback))
restoreTab: (callback) ->
# TODO: remove if-else -block when adopted into stable
if chrome.sessions
@@ -531,7 +532,21 @@ checkKeyQueue = (keysToCheck, tabId, frameId) ->
if (Commands.keyToCommandRegistry[command])
registryEntry = Commands.keyToCommandRegistry[command]
- if !registryEntry.isBackgroundCommand
+ runCommand = true
+
+ if registryEntry.noRepeat
+ count = 1
+ else if registryEntry.repeatLimit and count > registryEntry.repeatLimit
+ runCommand = confirm """
+ You have asked Vimium to perform #{count} repeats of the command:
+ #{Commands.availableCommands[registryEntry.command].description}
+
+ Are you sure you want to continue?
+ """
+
+ if not runCommand
+ # Do nothing, use has chosen not to execute the command
+ else if not registryEntry.isBackgroundCommand
chrome.tabs.sendMessage(tabId,
name: "executePageCommand",
command: registryEntry.command,