diff options
| author | Stephen Blott | 2012-10-23 10:27:57 +0100 |
|---|---|---|
| committer | Stephen Blott | 2012-10-23 10:27:57 +0100 |
| commit | c380cb5c9c8dd786b8203d2ed10d451da2ece2b7 (patch) | |
| tree | fa449dbe4a1e98ddd68d91990ba84ab6d6638415 /lib/utils.coffee | |
| parent | 5327ac1c0dedfd9f4d30e9a0bf626f9ffb962e2d (diff) | |
| download | vimium-c380cb5c9c8dd786b8203d2ed10d451da2ece2b7.tar.bz2 | |
Code cleanup, as requested by in3/Jez Ng here:
- https://github.com/philc/vimium/pull/682.
Diffstat (limited to 'lib/utils.coffee')
| -rw-r--r-- | lib/utils.coffee | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee index e4debe71..778d338f 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -91,19 +91,15 @@ Utils = # Creates a search URL from the given :query. createSearchUrl: (query) -> - # Escape explicitly to encode characters like "+" correctly - # "http://www.google.com/search?q=" + encodeURIComponent(query) - # - # 1. pull default search engine from settungs - # 2. don't URLencode the "+", Google (and other search engines) doesn't - # require it, so it's probably ok - # - # note: query is already trimmed in convertToUrl + # 1. pull default search engine from settings + # 2. don't URLencode the "+", + # - chrome does not URLencode the "+" sign when sending requests to its + # default search engine, so we should do the same here # # note: it would be better to pull the default search engine from chrome # itself, but I'm not sure if/how that's possible # - Settings.get("defaultSearchUrl") + query.split(/\s+/).map(encodeURIComponent).join("+") + Settings.get("searchUrl") + query.split(/\s+/).map(encodeURIComponent).join("+") # Converts :string into a Google search if it's not already a URL. We don't bother with escaping characters # as Chrome will do that for us. @@ -137,5 +133,3 @@ globalRoot.extend = (hash1, hash2) -> root = exports ? window root.Utils = Utils - -# vim: softtabstop=2 |
