aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-01-30 15:47:04 +0000
committerStephen Blott2016-01-30 15:47:04 +0000
commitb95f7c1ed5ddbfafae1fc5197cd4d7cb99aaf1f8 (patch)
tree178c7160a295d8fd562bd70503505afbfac72e95
parent9002a937d24f62f729978b0b2477396cb0f0de90 (diff)
downloadvimium-b95f7c1ed5ddbfafae1fc5197cd4d7cb99aaf1f8.tar.bz2
Exit link hints if there are no links.
If there are no links on a page, then link-hints mode should exit immediately. Fixes #1395.
-rw-r--r--content_scripts/link_hints.coffee5
1 files changed, 5 insertions, 0 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index 07deaf61..60093bc7 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -58,6 +58,11 @@ class LinkHintsMode
# ancestors.
length = (el) -> el.element.innerHTML?.length ? 0
elements.sort (a,b) -> length(a) - length b
+
+ if elements.length == 0
+ HUD.showForDuration "No links to select.", 2000
+ return
+
hintMarkers = (@createMarkerFor(el) for el in elements)
@markerMatcher = new (if Settings.get "filterLinkHints" then FilterHints else AlphabetHints)
@markerMatcher.fillInMarkers hintMarkers