From abc24123a9bec8f07d019d31c08a8740e695401d Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Wed, 10 Jun 2015 20:01:12 +0100 Subject: Refactor moveTab for clarity... ... as suggested by @mrmr1993 in #1728. --- background_scripts/main.coffee | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 272c3aa6..d4b14f3c 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -239,9 +239,7 @@ repeatFunction = (func, totalCount, currentCount, frameId) -> moveTab = (count) -> chrome.tabs.getAllInWindow null, (tabs) -> - pinnedCount = 0 - for tab in tabs - pinnedCount += 1 if tab.pinned + pinnedCount = (tabs.filter (tab) -> tab.pinned).length chrome.tabs.getSelected null, (tab) -> chrome.tabs.move tab.id, index: Math.max pinnedCount, Math.min tabs.length - 1, tab.index + count -- cgit v1.2.3