diff options
| -rw-r--r-- | background_scripts/commands.coffee | 4 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 7 | ||||
| -rw-r--r-- | content_scripts/link_hints.coffee | 8 |
3 files changed, 18 insertions, 1 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index d7c332f9..b85afbdb 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -108,7 +108,7 @@ Commands = advancedCommands: [ "scrollToLeft", "scrollToRight", "goUp", "focusInput", "LinkHints.activateModeWithQueue", - "goPrevious", "goNext", "Marks.activateCreateMode", "Marks.activateGotoMode"] + "LinkHints.activateModeToOpenIncognitoWindow", "goPrevious", "goNext", "Marks.activateCreateMode", "Marks.activateGotoMode"] defaultKeyMappings = "?": "showHelp" @@ -212,6 +212,8 @@ commandDescriptions = 'LinkHints.activateModeToOpenInNewTab': ["Open a link in a new tab"] 'LinkHints.activateModeWithQueue': ["Open multiple links in a new tab"] + "LinkHints.activateModeToOpenIncognitoWindow": ["Open a link in incognito window"] + enterFindMode: ["Enter find mode"] performFind: ["Cycle forward to the next find match"] performBackwardsFind: ["Cycle backward to the previous find match"] diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index d9229f12..5818df48 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -162,6 +162,9 @@ openUrlInNewTab = (request) -> chrome.tabs.getSelected(null, (tab) -> chrome.tabs.create({ url: Utils.convertToUrl(request.url), index: tab.index + 1, selected: true })) +openUrlInIncognitoWindow = (request) -> + chrome.windows.create({ url: Utils.convertToUrl(request.url), incognito: true}) + # # Called when the user has clicked the close icon on the "Vimium has been updated" message. # We should now dismiss that message in all tabs. @@ -398,6 +401,7 @@ getActualKeyStrokeLength = (key) -> key.length populateValidFirstKeys = -> + console.log 'Command registry:', Commands.keyToCommandRegistry for key of Commands.keyToCommandRegistry if (getActualKeyStrokeLength(key) == 2) validFirstKeys[splitKeyIntoFirstAndSecond(key).first] = true @@ -456,6 +460,8 @@ checkKeyQueue = (keysToCheck, tabId, frameId) -> command = splitHash.command count = splitHash.count + console.log 'Command:', command + return keysToCheck if command.length == 0 count = 1 if isNaN(count) @@ -546,6 +552,7 @@ sendRequestHandlers = getCompletionKeys: getCompletionKeysRequest, getCurrentTabUrl: getCurrentTabUrl, openUrlInNewTab: openUrlInNewTab, + openUrlInIncognitoWindow: openUrlInIncognitoWindow, openUrlInCurrentTab: openUrlInCurrentTab, openOptionsPageInNewTab: openOptionsPageInNewTab, registerFrame: registerFrame, diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 1f5e5d05..c34692b6 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -12,6 +12,7 @@ OPEN_IN_CURRENT_TAB = {} OPEN_IN_NEW_TAB = {} OPEN_WITH_QUEUE = {} COPY_LINK_URL = {} +OPEN_INCOGNITO_WINDOW = {} LinkHints = hintMarkerContainingDiv: null @@ -48,6 +49,7 @@ LinkHints = activateModeToOpenInNewTab: -> @activateMode(OPEN_IN_NEW_TAB) activateModeToCopyLinkUrl: -> @activateMode(COPY_LINK_URL) activateModeWithQueue: -> @activateMode(OPEN_WITH_QUEUE) + activateModeToOpenIncognitoWindow: -> @activateMode(OPEN_INCOGNITO_WINDOW) activateMode: (mode = OPEN_IN_CURRENT_TAB) -> # we need documentElement to be ready in order to append links @@ -90,6 +92,12 @@ LinkHints = HUD.show("Copy link URL to Clipboard") @linkActivator = (link) -> chrome.extension.sendRequest({handler: "copyToClipboard", data: link.href}) + else if @mode is OPEN_INCOGNITO_WINDOW + HUD.show("Open link in incognito window") + + @linkActivator = (link) -> + console.log 'Incognito:', link + openUrlInIncognitoWindow({ url: link.href}) else # OPEN_IN_CURRENT_TAB HUD.show("Open link in current tab") # When we're opening the link in the current tab, don't navigate to the selected link immediately |
