aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrmr19932017-11-24 15:01:37 +0000
committermrmr19932017-11-24 15:01:37 +0000
commit4a95a750c0642212c7907f3e8673013d473b2618 (patch)
tree4b447bb819546503755a521d1f833528f41acb54
parent4f5667c427a1d14fc8c6eb3477eb58c69b467bf9 (diff)
downloadvimium-4a95a750c0642212c7907f3e8673013d473b2618.tar.bz2
Flash the clicked element for alphabet hints
-rw-r--r--content_scripts/link_hints.coffee8
-rw-r--r--lib/dom_utils.coffee2
2 files changed, 6 insertions, 4 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index d919dae1..814ae3b7 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -387,13 +387,14 @@ class LinkHintsMode
if linkMatched.isLocalMarker
{top: viewportTop, left: viewportLeft} = DomUtils.getViewportTopLeft()
- for rect in clickEl.getClientRects()
- flashEl = DomUtils.addFlashRect Rect.translate rect, viewportLeft, viewportTop
- do (flashEl) -> HintCoordinator.onExit.push -> DomUtils.removeElement flashEl
+ flashElements = for rect in clickEl.getClientRects()
+ DomUtils.addFlashRect Rect.translate rect, viewportLeft, viewportTop
# 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
if windowIsFocused()
callback = (isSuccess) -> HintCoordinator.sendMessage "exit", {isSuccess}
if Settings.get "waitForEnterForFilteredHints"
@@ -401,6 +402,7 @@ class LinkHintsMode
else
new TypingProtector 200, callback
else if linkMatched.isLocalMarker
+ Utils.setTimeout 400, -> DomUtils.removeElement flashEl for flashEl in flashElements
HintCoordinator.sendMessage "exit", isSuccess: true
#
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index 67d5a44c..df2c2b56 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -311,7 +311,7 @@ DomUtils =
flashEl
# momentarily flash a rectangular border to give user some visual feedback
- flashRect: (rect) ->
+ flashRect: (rect, callback) ->
flashEl = @addFlashRect rect
setTimeout((-> DomUtils.removeElement flashEl), 400)