diff options
| author | Stephen Blott | 2017-09-30 07:13:04 +0100 |
|---|---|---|
| committer | GitHub | 2017-09-30 07:13:04 +0100 |
| commit | e3e4347038c7580241e44c0d8b0f2febc3796c8c (patch) | |
| tree | 7a0cb01be2685b5569fe4e3ae63d12f85ba6b9ba | |
| parent | c18d4f065c9529c62a82bc2a3bd518da318d89ff (diff) | |
| parent | 2c0963dbc44bd03abbaa4ae8424d893df57ff8b2 (diff) | |
| download | vimium-e3e4347038c7580241e44c0d8b0f2febc3796c8c.tar.bz2 | |
Merge pull request #2681 from mrmr1993/ff-link-hints-new-tabs
FF: Simulate default click action for <a target="_blank">s
| -rw-r--r-- | lib/dom_utils.coffee | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 65a14c34..c2d83b1d 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -276,8 +276,7 @@ DomUtils = # but Webkit will. Dispatching a click on an input box does not seem to focus it; we do that separately element.dispatchEvent(mouseEvent) - simulateClickDefaultAction: (element, modifiers) -> - return unless modifiers? + simulateClickDefaultAction: (element, modifiers = {}) -> return unless element.tagName?.toLowerCase() == "a" and element.href? {ctrlKey, shiftKey, metaKey, altKey} = modifiers @@ -295,6 +294,8 @@ DomUtils = else if shiftKey == true and metaKey == false and ctrlKey == false and altKey == false # Open in new window. chrome.runtime.sendMessage {handler: "openUrlInNewWindow", url: element.href} + else if element.target == "_blank" + chrome.runtime.sendMessage {handler: "openUrlInNewTab", url: element.href, active: true} return |
