aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/main.coffee
diff options
context:
space:
mode:
authorTimo Sand2013-03-06 13:01:09 +0000
committerTimo Sand2014-05-09 10:11:14 +0300
commit2741021d2967866e5d5b2d8bc9673b44a99e4e61 (patch)
tree3e38baf867e80c54c44bf367fe116ed6b10ef623 /background_scripts/main.coffee
parent1aa7ba3a5810742d14edfb738120b70f4a0f7619 (diff)
downloadvimium-2741021d2967866e5d5b2d8bc9673b44a99e4e61.tar.bz2
Added command to move tab to the left and right
Diffstat (limited to 'background_scripts/main.coffee')
-rw-r--r--background_scripts/main.coffee6
1 files changed, 6 insertions, 0 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index b2b4669c..a15d8d0a 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -217,6 +217,10 @@ repeatFunction = (func, totalCount, currentCount, frameId) ->
-> repeatFunction(func, totalCount, currentCount + 1, frameId),
frameId)
+moveTab = (callback, direction) ->
+ chrome.tabs.getSelected(null, (tab) ->
+ chrome.tabs.move(tab.id, {index: tab.index + direction }, callback))
+
# Start action functions
# These are commands which are bound to keystroke which must be handled by the background page. They are
@@ -234,6 +238,8 @@ BackgroundCommands =
previousTab: (callback) -> selectTab(callback, "previous")
firstTab: (callback) -> selectTab(callback, "first")
lastTab: (callback) -> selectTab(callback, "last")
+ moveTabLeft: (callback) -> moveTab(callback, -1)
+ moveTabRight: (callback) -> moveTab(callback, 1)
removeTab: ->
chrome.tabs.getSelected(null, (tab) ->
chrome.tabs.remove(tab.id))