diff options
| author | Stephen Blott | 2017-11-24 15:28:08 +0000 |
|---|---|---|
| committer | Stephen Blott | 2017-11-24 15:28:08 +0000 |
| commit | b53999b4ce7ec03b3994c52ae33cb904ce686603 (patch) | |
| tree | 81b8d3b1e8404e320a8fb1afc7b3b388dc1dbedb | |
| parent | 07e49297b567f1b836de4733140909daf6b47438 (diff) | |
| download | vimium-b53999b4ce7ec03b3994c52ae33cb904ce686603.tar.bz2 | |
Localise the logic for handling flash elements.
| -rw-r--r-- | content_scripts/link_hints.coffee | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 9ab917d1..a7a46e99 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -385,16 +385,18 @@ class LinkHintsMode clickEl.focus() linkActivator clickEl + # If flash elements are created, then this function can be used later to remove them. + removeFlashElements = -> if linkMatched.isLocalMarker {top: viewportTop, left: viewportLeft} = DomUtils.getViewportTopLeft() flashElements = for rect in clickEl.getClientRects() DomUtils.addFlashRect Rect.translate rect, viewportLeft, viewportTop + removeFlashElements = -> DomUtils.removeElement flashEl for flashEl in flashElements # 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 flashElements? - HintCoordinator.onExit.push -> DomUtils.removeElement flashEl for flashEl in flashElements + HintCoordinator.onExit.push removeFlashElements if windowIsFocused() callback = (isSuccess) -> HintCoordinator.sendMessage "exit", {isSuccess} if Settings.get "waitForEnterForFilteredHints" @@ -402,7 +404,7 @@ class LinkHintsMode else new TypingProtector 200, callback else if linkMatched.isLocalMarker - Utils.setTimeout 400, -> DomUtils.removeElement flashEl for flashEl in flashElements + Utils.setTimeout 400, removeFlashElements HintCoordinator.sendMessage "exit", isSuccess: true # |
