From c4850e7bfa5b894f448d06919f902b7e888b2cc0 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 17 Apr 2016 09:35:47 +0100 Subject: There's no need for a new suggestion property... We do not need "displayUrl", we can re-use "shortUrl" instead. It does what we need already. --- background_scripts/completion.coffee | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 5ceb515f..7cd47a00 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -146,8 +146,6 @@ class Suggestion # Simplify a suggestion's URL (by removing those parts which aren't useful for display or comparison). shortenUrl: () -> - # If we already have display URL, then use it. - @shortUrl ?= @displayUrl return @shortUrl if @shortUrl? # We get easier-to-read shortened URLs if we URI-decode them. url = (Utils.decodeURIByParts(@url) || @url).toLowerCase() @@ -207,8 +205,8 @@ class BookmarkCompleter @bookmarks.filter (bookmark) => suggestionTitle = if usePathAndTitle then bookmark.pathAndTitle else bookmark.title bookmark.hasJavascriptPrefix ?= Utils.hasJavascriptPrefix bookmark.url - bookmark.displayUrl ?= "javascript:..." if bookmark.hasJavascriptPrefix - suggestionUrl = bookmark.displayUrl ? bookmark.url + bookmark.shortUrl ?= "javascript:..." if bookmark.hasJavascriptPrefix + suggestionUrl = bookmark.shortUrl ? bookmark.url RankingUtils.matches(@currentSearch.queryTerms, suggestionUrl, suggestionTitle) else [] @@ -219,8 +217,8 @@ class BookmarkCompleter url: bookmark.url title: if usePathAndTitle then bookmark.pathAndTitle else bookmark.title relevancyFunction: @computeRelevancy - displayUrl: bookmark.displayUrl - deDuplicate: not bookmark.displayUrl? + shortUrl: bookmark.shortUrl + deDuplicate: not bookmark.shortUrl? onComplete = @currentSearch.onComplete @currentSearch = null onComplete suggestions @@ -255,7 +253,7 @@ class BookmarkCompleter bookmark.children.forEach((child) => @traverseBookmarksRecursive child, results, bookmark) if bookmark.children computeRelevancy: (suggestion) -> - RankingUtils.wordRelevancy(suggestion.queryTerms, suggestion.displayUrl ? suggestion.url, suggestion.title) + RankingUtils.wordRelevancy(suggestion.queryTerms, suggestion.shortUrl ? suggestion.url, suggestion.title) class HistoryCompleter filter: ({ queryTerms, seenTabToOpenCompletionList }, onComplete) -> -- cgit v1.2.3