aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/completion.coffee9
1 files changed, 7 insertions, 2 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index 47cc2a23..7cd47a00 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -204,7 +204,10 @@ class BookmarkCompleter
if @currentSearch.queryTerms.length > 0
@bookmarks.filter (bookmark) =>
suggestionTitle = if usePathAndTitle then bookmark.pathAndTitle else bookmark.title
- RankingUtils.matches(@currentSearch.queryTerms, bookmark.url, suggestionTitle)
+ bookmark.hasJavascriptPrefix ?= Utils.hasJavascriptPrefix bookmark.url
+ bookmark.shortUrl ?= "javascript:..." if bookmark.hasJavascriptPrefix
+ suggestionUrl = bookmark.shortUrl ? bookmark.url
+ RankingUtils.matches(@currentSearch.queryTerms, suggestionUrl, suggestionTitle)
else
[]
suggestions = results.map (bookmark) =>
@@ -214,6 +217,8 @@ class BookmarkCompleter
url: bookmark.url
title: if usePathAndTitle then bookmark.pathAndTitle else bookmark.title
relevancyFunction: @computeRelevancy
+ shortUrl: bookmark.shortUrl
+ deDuplicate: not bookmark.shortUrl?
onComplete = @currentSearch.onComplete
@currentSearch = null
onComplete suggestions
@@ -248,7 +253,7 @@ class BookmarkCompleter
bookmark.children.forEach((child) => @traverseBookmarksRecursive child, results, bookmark) if bookmark.children
computeRelevancy: (suggestion) ->
- RankingUtils.wordRelevancy(suggestion.queryTerms, suggestion.url, suggestion.title)
+ RankingUtils.wordRelevancy(suggestion.queryTerms, suggestion.shortUrl ? suggestion.url, suggestion.title)
class HistoryCompleter
filter: ({ queryTerms, seenTabToOpenCompletionList }, onComplete) ->