diff options
| -rw-r--r-- | background_scripts/main.coffee | 15 | ||||
| -rw-r--r-- | pages/options.coffee | 3 |
2 files changed, 10 insertions, 8 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 835b8a9a..d4b14f3c 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -237,11 +237,12 @@ repeatFunction = (func, totalCount, currentCount, frameId) -> -> repeatFunction(func, totalCount, currentCount + 1, frameId), frameId) -moveTab = (callback, direction) -> - chrome.tabs.getSelected(null, (tab) -> - # Use Math.max to prevent -1 as the new index, otherwise the tab of index n will wrap to the far RHS when - # moved left by exactly (n+1) places. - chrome.tabs.move(tab.id, {index: Math.max(0, tab.index + direction) }, callback)) +moveTab = (count) -> + chrome.tabs.getAllInWindow null, (tabs) -> + 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 # Start action functions @@ -304,8 +305,8 @@ BackgroundCommands = chrome.tabs.getSelected(null, (tab) -> chrome.tabs.sendMessage(tab.id, { name: "toggleHelpDialog", dialogHtml: helpDialogHtml(), frameId:frameId })) - moveTabLeft: (count) -> moveTab(null, -count) - moveTabRight: (count) -> moveTab(null, count) + moveTabLeft: (count) -> moveTab -count + moveTabRight: (count) -> moveTab count nextFrame: (count,frameId) -> chrome.tabs.getSelected null, (tab) -> frameIdsForTab[tab.id] = cycleToFrame frameIdsForTab[tab.id], frameId, count diff --git a/pages/options.coffee b/pages/options.coffee index ea4301a9..21e81c8f 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -229,7 +229,6 @@ initOptionsPage = -> element.className = element.className + " example info" element.innerHTML = "Leave empty to reset this option." - maintainLinkHintsView() window.onbeforeunload = -> "You have unsaved changes to options." unless $("saveOptions").disabled document.addEventListener "keyup", (event) -> @@ -259,6 +258,8 @@ initOptionsPage = -> for name, type of options new type(name,onUpdated) + maintainLinkHintsView() + initPopupPage = -> chrome.tabs.getSelected null, (tab) -> exclusions = null |
