aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-04-17 11:57:30 +0100
committerStephen Blott2016-04-17 11:57:30 +0100
commitb87ed872263c46919f3098fca3a00705c015b736 (patch)
treebdfd1c47ec5af1501b58fbbba81f130b2e25f8c4
parentcefbb461a3b564845a61893fcbe5faa0084c6f4c (diff)
parentc4850e7bfa5b894f448d06919f902b7e888b2cc0 (diff)
downloadvimium-b87ed872263c46919f3098fca3a00705c015b736.tar.bz2
Merge pull request #2089 from smblott-github/do-not-show-javascript-URLs
Simplify javascript: URLs in vomnibar.
-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) ->