From ddc747805e08eaad52bf58950b1d2df9bdd2da9c Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Wed, 10 Jun 2015 14:43:00 +0100 Subject: Account for words at start of filter text. We gove these a higher score because it makes it easier for the user to pick a link if they can just start typing at the beginning. --- content_scripts/link_hints.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'content_scripts/link_hints.coffee') diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index ae9d3f8f..3dbb4f23 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -586,11 +586,11 @@ class FilterHints searchWordScores = for searchWord in searchWords linkWordScores = - for linkWord in linkWords + for linkWord, idx in linkWords if linkWord == searchWord - 5 + if idx == 0 then 8 else 6 else if linkWord.startsWith searchWord - 2 + if idx == 0 then 4 else 2 else if 0 <= linkWord.indexOf searchWord 1 else -- cgit v1.2.3