diff options
| author | mrmr1993 | 2017-11-11 16:19:57 +0000 |
|---|---|---|
| committer | mrmr1993 | 2017-11-20 19:42:23 +0000 |
| commit | 48e556d2ea209c22485ee07710dbac2f32fe481f (patch) | |
| tree | d15b9f20e18e8d890916e32731cdec6a2e7ce9c5 /content_scripts | |
| parent | 291f52bc319e6790d8fbb1e0384c8c5d023e61c7 (diff) | |
| download | vimium-48e556d2ea209c22485ee07710dbac2f32fe481f.tar.bz2 | |
Inline installKeyboardBlocker
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/link_hints.coffee | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 0b44ea45..e3e96ffe 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -385,7 +385,9 @@ class LinkHintsMode clickEl.focus() linkActivator clickEl - installKeyboardBlocker = (startKeyboardBlocker) -> + # If we're using a keyboard blocker, then the frame with the focus sends the "exit" message, otherwise the + # frame containing the matched link does. + if userMightOverType if linkMatched.isLocalMarker {top: viewportTop, left: viewportLeft} = DomUtils.getViewportTopLeft() for rect in clickEl.getClientRects() @@ -393,15 +395,11 @@ class LinkHintsMode do (flashEl) -> HintCoordinator.onExit.push -> DomUtils.removeElement flashEl if windowIsFocused() - startKeyboardBlocker (isSuccess) -> HintCoordinator.sendMessage "exit", {isSuccess} - - # If we're using a keyboard blocker, then the frame with the focus sends the "exit" message, otherwise the - # frame containing the matched link does. - if userMightOverType - if Settings.get "waitForEnterForFilteredHints" - installKeyboardBlocker (callback) -> new WaitForEnter callback - else - installKeyboardBlocker (callback) -> new TypingProtector 200, callback + callback = (isSuccess) -> HintCoordinator.sendMessage "exit", {isSuccess} + if Settings.get "waitForEnterForFilteredHints" + new WaitForEnter callback + else + new TypingProtector 200, callback else if linkMatched.isLocalMarker DomUtils.flashRect linkMatched.rect HintCoordinator.sendMessage "exit", isSuccess: true |
