diff options
Diffstat (limited to 'background_scripts/main.coffee')
| -rw-r--r-- | background_scripts/main.coffee | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index a8f851c0..431d9a31 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -290,29 +290,29 @@ BackgroundCommands = chrome.tabs.sendMessage(tab.id, { name: "focusFrame", frameId: frames[newIndex].id, highlight: true })) - closeTabsToLeft: -> removeTabsRelative "before" - closeTabsToRight: -> removeTabsRelative "after" + closeTabsOnLeft: -> removeTabsRelative "before" + closeTabsOnRight: -> removeTabsRelative "after" closeOtherTabs: -> removeTabsRelative "both" # Remove tabs before, after, or either side of the currently active tab removeTabsRelative = (direction) -> chrome.tabs.query {currentWindow: true}, (tabs) -> - chrome.tabs.query {currentWindow: true, active: true}, (activeTabArr) -> - activeTabIndex = activeTabArr[0].index + chrome.tabs.query {currentWindow: true, active: true}, (activeTabs) -> + activeTabIndex = activeTabs[0].index - switch direction + shouldDelete = switch direction when "before" - shouldDelete = (index) -> index < activeTabIndex + (index) -> index < activeTabIndex when "after" - shouldDelete = (index) -> index > activeTabIndex + (index) -> index > activeTabIndex when "both" - shouldDelete = (index) -> index != activeTabIndex + (index) -> index != activeTabIndex - removeTabIds = [] + toRemove = [] for tab in tabs if not tab.pinned and shouldDelete tab.index - removeTabIds.push tab.id - chrome.tabs.remove removeTabIds + toRemove.push tab.id + chrome.tabs.remove toRemove # Selects a tab before or after the currently selected tab. # - direction: "next", "previous", "first" or "last". |
