aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorJez Ng2012-11-09 14:14:42 -0800
committerJez Ng2012-11-09 14:14:42 -0800
commit8b09b8524ff7dedf4cd2e8448522920beb9c68f5 (patch)
tree7729332f27213e536d73813f24e9dc8b7da0602e /background_scripts
parent06863a5fba5ed3c1456ce393753513b642bc1f74 (diff)
parent8b02be8162033c77a68e75f4d9cff612f30d4edd (diff)
downloadvimium-8b09b8524ff7dedf4cd2e8448522920beb9c68f5.tar.bz2
Merge pull request #707 from smblott-github/small-bugs
Minor fixes.
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/completion.coffee2
-rw-r--r--background_scripts/main.coffee3
2 files changed, 3 insertions, 2 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index 9e12d497..e959d358 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -171,7 +171,7 @@ class DomainCompleter
for domain in domainCandidates
recencyScore = RankingUtils.recencyScore(@domains[domain].lastVisitTime || 0)
wordRelevancy = RankingUtils.wordRelevancy(queryTerms, domain, null)
- score = wordRelevancy + Math.max(recencyScore, wordRelevancy) / 2
+ score = (wordRelevancy + Math.max(recencyScore, wordRelevancy)) / 2
results.push([domain, score])
results.sort (a, b) -> b[1] - a[1]
results
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index e2bfeb6d..3d3a59a6 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -192,8 +192,9 @@ handleSettings = (args, port) ->
refreshCompleter = (request) -> completers[request.name].refresh()
+whitespaceRegexp = /\s+/
filterCompleter = (args, port) ->
- queryTerms = if (args.query == "") then [] else args.query.split(" ")
+ queryTerms = if (args.query == "") then [] else args.query.split(whitespaceRegexp)
completers[args.name].filter(queryTerms, (results) -> port.postMessage({ id: args.id, results: results }))
getCurrentTimeInSeconds = -> Math.floor((new Date()).getTime() / 1000)