aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2014-10-25 15:54:20 +0100
committerStephen Blott2014-10-25 15:54:20 +0100
commitf5fa44f552a7223e978880b79dba8a1076befab0 (patch)
tree25ceac77577c85df5776426a6115b47678de55c8 /content_scripts
parente98f3f678237c1841d9626f17e560b6cb8327dc8 (diff)
parent238893e6cf02dbdfb85d274f77368dbd7d039a3d (diff)
downloadvimium-f5fa44f552a7223e978880b79dba8a1076befab0.tar.bz2
Merge pull request #784 from deiga/patch-3
Add links-hint mode to download links
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/link_hints.coffee12
1 files changed, 11 insertions, 1 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index 24314b26..24bd7126 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: true,
+ ctrlKey: false,
+ metaKey: false })
else # OPEN_IN_CURRENT_TAB
HUD.show("Open link in current tab")
@linkActivator = (link) -> DomUtils.simulateClick.bind(DomUtils, link)()