diff options
| author | Timo Sand | 2013-03-06 13:01:09 +0000 | 
|---|---|---|
| committer | Timo Sand | 2014-05-09 10:11:14 +0300 | 
| commit | 2741021d2967866e5d5b2d8bc9673b44a99e4e61 (patch) | |
| tree | 3e38baf867e80c54c44bf367fe116ed6b10ef623 /background_scripts | |
| parent | 1aa7ba3a5810742d14edfb738120b70f4a0f7619 (diff) | |
| download | vimium-2741021d2967866e5d5b2d8bc9673b44a99e4e61.tar.bz2 | |
Added command to move tab to the left and right
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/commands.coffee | 10 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 6 | 
2 files changed, 14 insertions, 2 deletions
| diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index e2211be1..628b7273 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -100,7 +100,7 @@ Commands =        ["goBack", "goForward"]      tabManipulation:        ["nextTab", "previousTab", "firstTab", "lastTab", "createTab", "duplicateTab", "removeTab", -       "restoreTab", "moveTabToNewWindow", "togglePinTab"] +       "restoreTab", "moveTabToNewWindow", "togglePinTab", "moveTabLeft", "moveTabRight"]      misc:        ["showHelp"] @@ -111,7 +111,7 @@ Commands =      "scrollToLeft", "scrollToRight", "moveTabToNewWindow",      "goUp", "goToRoot", "focusInput", "LinkHints.activateModeWithQueue",      "LinkHints.activateModeToOpenIncognito", "goNext", "goPrevious", "Marks.activateCreateMode", -    "Marks.activateGotoMode"] +    "Marks.activateGotoMode", "moveTabLeft", "moveTabRight"]  defaultKeyMappings =    "?": "showHelp" @@ -164,6 +164,9 @@ defaultKeyMappings =    "g0": "firstTab"    "g$": "lastTab" +  "Ml": "moveTabLeft" +  "Mr": "moveTabRight" +    "W": "moveTabToNewWindow"    "t": "createTab"    "yt": "duplicateTab" @@ -250,6 +253,9 @@ commandDescriptions =    moveTabToNewWindow: ["Move tab to new window", { background: true }]    togglePinTab: ["Pin/unpin current tab", { background: true }] +  moveTabLeft: ["Move tab to the left", { background: true }] +  moveTabRight: ["Move tab to the right", { background: true }] +    "Vomnibar.activate": ["Open URL, bookmark, or history entry"]    "Vomnibar.activateInNewTab": ["Open URL, bookmark, history entry, in a new tab"]    "Vomnibar.activateTabSelection": ["Search through your open tabs"] 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)) | 
