From 2741021d2967866e5d5b2d8bc9673b44a99e4e61 Mon Sep 17 00:00:00 2001 From: Timo Sand Date: Wed, 6 Mar 2013 13:01:09 +0000 Subject: Added command to move tab to the left and right --- background_scripts/main.coffee | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'background_scripts/main.coffee') 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)) -- cgit v1.2.3