File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ TabOperations =
106106 index : request .tab .index + 1
107107 active : true
108108 windowId : request .tab .windowId
109+ tabConfig .active = request .active if request .active ?
109110 # Firefox does not support "about:newtab" in chrome.tabs.create.
110111 delete tabConfig[" url" ] if tabConfig[" url" ] == Settings .defaults .newTabUrl
111112 chrome .tabs .create tabConfig, (tab ) ->
Original file line number Diff line number Diff line change 1111# The "name" property below is a short-form name to appear in the link-hints mode's name. It's for debug only.
1212#
1313isMac = KeyboardUtils .platform == " Mac"
14+ simulateClickDefaultAction = true
1415OPEN_IN_CURRENT_TAB =
1516 name : " curr-tab"
1617 indicator : " Open link in current tab"
@@ -384,7 +385,16 @@ class LinkHintsMode
384385 window .focus ()
385386 DomUtils .simulateSelect clickEl
386387 else
387- clickActivator = (modifiers ) -> (link ) -> DomUtils .simulateClick link, modifiers
388+ clickActivator = (modifiers ) -> (link ) ->
389+ defaultActionsTriggered = DomUtils .simulateClick link, modifiers
390+ if simulateClickDefaultAction and
391+ defaultActionsTriggered[3 ] and link .tagName ? .toLowerCase () == " a" and
392+ modifiers? and modifiers .metaKey == isMac and modifiers .ctrlKey == not isMac
393+ # We've clicked a link that *should* open in a new tab. If simulateClickDefaultAction is true,
394+ # we assume the popup-blocker is active, and simulate opening the new tab ourselves.
395+ chrome .runtime .sendMessage {handler : " openUrlInNewTab" , url : link .href , active :
396+ modifiers .shiftKey == true }
397+
388398 linkActivator = @mode .linkActivator ? clickActivator @mode .clickModifiers
389399 # TODO: Are there any other input elements which should not receive focus?
390400 if clickEl .nodeName .toLowerCase () in [" input" , " select" ] and clickEl .type not in [" button" , " submit" ]
You can’t perform that action at this time.
0 commit comments