diff options
| -rw-r--r-- | background_scripts/commands.coffee | 5 | ||||
| -rw-r--r-- | content_scripts/link_hints.coffee | 12 | 
2 files changed, 15 insertions, 2 deletions
| diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 4b3130c8..45a220dc 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -110,7 +110,7 @@ Commands =    # from Vimium will uncover these gems.    advancedCommands: [      "scrollToLeft", "scrollToRight", "moveTabToNewWindow", -    "goUp", "goToRoot", "focusInput", "LinkHints.activateModeWithQueue", +    "goUp", "goToRoot", "focusInput", "LinkHints.activateModeWithQueue", "LinkHints.activateModeToDownloadLink",      "LinkHints.activateModeToOpenIncognito", "goNext", "goPrevious", "Marks.activateCreateMode",      "Marks.activateGotoMode", "moveTabLeft", "moveTabRight",      "closeTabsOnLeft","closeTabsOnRight", "closeOtherTabs"] @@ -146,6 +146,8 @@ defaultKeyMappings =    "F":     "LinkHints.activateModeToOpenInNewTab"    "<a-f>": "LinkHints.activateModeWithQueue" +  "af": "LinkHints.activateModeToDownloadLink" +    "/": "enterFindMode"    "n": "performFind"    "N": "performBackwardsFind" @@ -228,6 +230,7 @@ commandDescriptions =    "LinkHints.activateModeToOpenIncognito": ["Open a link in incognito window"] +  "LinkHints.activateModeToDownloadLink": ["Download link url"]    enterFindMode: ["Enter find mode"]    performFind: ["Cycle forward to the next find match"]    performBackwardsFind: ["Cycle backward to the previous find match"] diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 24314b26..1cba822d 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -14,6 +14,7 @@ OPEN_IN_NEW_FG_TAB = {}  OPEN_WITH_QUEUE = {}  COPY_LINK_URL = {}  OPEN_INCOGNITO = {} +DOWNLOAD_LINK_URL = {}  LinkHints =    hintMarkerContainingDiv: null @@ -52,6 +53,7 @@ LinkHints =    activateModeToCopyLinkUrl: -> @activateMode(COPY_LINK_URL)    activateModeWithQueue: -> @activateMode(OPEN_WITH_QUEUE)    activateModeToOpenIncognito: -> @activateMode(OPEN_INCOGNITO) +  activateModeToDownloadLink: -> @activateMode(DOWNLOAD_LINK_URL)    activateMode: (mode = OPEN_IN_CURRENT_TAB) ->      # we need documentElement to be ready in order to append links @@ -93,7 +95,8 @@ LinkHints =          DomUtils.simulateClick(link, {            shiftKey: @mode is OPEN_IN_NEW_FG_TAB,            metaKey: KeyboardUtils.platform == "Mac", -          ctrlKey: KeyboardUtils.platform != "Mac" }) +          ctrlKey: KeyboardUtils.platform != "Mac", +          altKey: false})      else if @mode is COPY_LINK_URL        HUD.show("Copy link URL to Clipboard")        @linkActivator = (link) -> @@ -105,6 +108,13 @@ LinkHints =          chrome.runtime.sendMessage(            handler: 'openUrlInIncognito'            url: link.href) +    else if @mode is DOWNLOAD_LINK_URL +      HUD.show("Download link URL") +      @linkActivator = (link) -> +        DomUtils.simulateClick(link, { +          altKey: KeyboardUtils.platform == "Mac", +          ctrlKey: false, +          metaKey: false })      else # OPEN_IN_CURRENT_TAB        HUD.show("Open link in current tab")        @linkActivator = (link) -> DomUtils.simulateClick.bind(DomUtils, link)() | 
