diff options
| -rw-r--r-- | background_scripts/main.coffee | 18 | ||||
| -rw-r--r-- | content_scripts/mode.coffee | 4 | ||||
| -rw-r--r-- | content_scripts/mode_visual_edit.coffee | 2 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 4 |
4 files changed, 11 insertions, 17 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index e15081eb..d034ffb0 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -84,9 +84,6 @@ root.isEnabledForUrl = isEnabledForUrl = (request) -> passKeys: rule?.passKeys or "" } -saveHelpDialogSettings = (request) -> - Settings.set("helpDialog_showAdvancedCommands", request.showAdvancedCommands) - # Retrieves the help dialog HTML template from a file, and populates it with the latest keybindings. # This is called by options.coffee. root.helpDialogHtml = (showUnboundCommands, showCommandNames, customTitle) -> @@ -324,7 +321,7 @@ selectTab = (callback, direction) -> selectionChangedHandlers.push(callback) chrome.tabs.update(toSelect.id, { selected: true }))) -updateOpenTabs = (tab) -> +updateOpenTabs = (tab, deleteFrames = false) -> # Chrome might reuse the tab ID of a recently removed tab. if tabInfoMap[tab.id]?.deletor clearTimeout tabInfoMap[tab.id].deletor @@ -336,7 +333,7 @@ updateOpenTabs = (tab) -> scrollY: null deletor: null # Frames are recreated on refresh - delete frameIdsForTab[tab.id] + delete frameIdsForTab[tab.id] if deleteFrames setBrowserActionIcon = (tabId,path) -> chrome.browserAction.setIcon({ tabId: tabId, path: path }) @@ -369,6 +366,9 @@ root.updateActiveState = updateActiveState = (tabId) -> disabledIcon = "icons/browser_action_disabled.png" partialIcon = "icons/browser_action_partial.png" chrome.tabs.get tabId, (tab) -> + # Default to disabled state in case we can't connect to Vimium, primarily for the "New Tab" page. + setBrowserActionIcon(tabId,disabledIcon) + setBadge badge: "" chrome.tabs.sendMessage tabId, { name: "getActiveState" }, (response) -> if response isCurrentlyEnabled = response.enabled @@ -385,10 +385,7 @@ root.updateActiveState = updateActiveState = (tabId) -> # Propagate the new state only if it has changed. if (isCurrentlyEnabled != enabled || currentPasskeys != passKeys) chrome.tabs.sendMessage(tabId, { name: "setState", enabled: enabled, passKeys: passKeys, incognito: tab.incognito }) - else - # We didn't get a response from the front end, so Vimium isn't running. - setBrowserActionIcon(tabId,disabledIcon) - setBadge {badge: ""} + handleUpdateScrollPosition = (request, sender) -> updateScrollPosition(sender.tab, request.scrollX, request.scrollY) @@ -619,7 +616,7 @@ unregisterFrame = (request, sender) -> tabId = sender.tab.id if frameIdsForTab[tabId]? if request.tab_is_closing - updateOpenTabs sender.tab + updateOpenTabs sender.tab, true else frameIdsForTab[tabId] = frameIdsForTab[tabId].filter (id) -> id != request.frameId @@ -651,7 +648,6 @@ sendRequestHandlers = copyToClipboard: copyToClipboard pasteFromClipboard: pasteFromClipboard isEnabledForUrl: isEnabledForUrl - saveHelpDialogSettings: saveHelpDialogSettings selectSpecificTab: selectSpecificTab refreshCompleter: refreshCompleter createMark: Marks.create.bind(Marks) diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee index cc358bc2..7877d97c 100644 --- a/content_scripts/mode.coffee +++ b/content_scripts/mode.coffee @@ -163,9 +163,7 @@ class Mode @updateBadge: -> if document.hasFocus() handlerStack.bubbleEvent "updateBadge", badge = badge: "" - chrome.runtime.sendMessage - handler: "setBadge" - badge: badge.badge + chrome.runtime.sendMessage { handler: "setBadge", badge: badge.badge }, -> # Debugging routines. logModes: -> diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee index 16872140..a5758a64 100644 --- a/content_scripts/mode_visual_edit.coffee +++ b/content_scripts/mode_visual_edit.coffee @@ -347,7 +347,7 @@ class Movement extends CountPrefix unless @options.parentMode or options.oneMovementOnly do => executeFind = (count, findBackwards) => - if query = getFindModeQuery() + if query = getFindModeQuery findBackwards initialRange = @selection.getRangeAt(0).cloneRange() for [0...count] unless window.find query, Utils.hasUpperCase(query), findBackwards, true, false, true, false diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 741b54af..5bad1148 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -829,7 +829,7 @@ getNextQueryFromRegexMatches = (stepSize) -> findModeQuery.regexMatches[findModeQuery.activeRegexIndex] -window.getFindModeQuery = -> +window.getFindModeQuery = (backwards) -> # check if the query has been changed by a script in another frame mostRecentQuery = FindModeHistory.getQuery() if (mostRecentQuery != findModeQuery.rawQuery) @@ -842,7 +842,7 @@ window.getFindModeQuery = -> findModeQuery.parsedQuery findAndFocus = (backwards) -> - query = getFindModeQuery() + query = getFindModeQuery backwards findModeQueryHasResults = executeFind(query, { backwards: backwards, caseSensitive: !findModeQuery.ignoreCase }) |
