diff options
| author | Phil Crosby | 2014-05-11 16:26:48 -0700 |
|---|---|---|
| committer | Phil Crosby | 2014-05-11 16:26:48 -0700 |
| commit | 9fdd122abde7c55926b6d58e135f1bcb3024c0a2 (patch) | |
| tree | d13d6b1e850553c629124b6b775e0e82ddb46e20 /background_scripts/main.coffee | |
| parent | 70feaf233034f2cec8d20adf3a99ddc50b399156 (diff) | |
| parent | 85406049e7048081f004ad8b01c8ec3818ed1974 (diff) | |
| download | vimium-9fdd122abde7c55926b6d58e135f1bcb3024c0a2.tar.bz2 | |
Merge pull request #796 from deiga/tab-movement-commands
Added command to move tab to the left and right
Diffstat (limited to 'background_scripts/main.coffee')
| -rw-r--r-- | background_scripts/main.coffee | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index ab633d8e..666c37e0 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)) |
