diff options
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 |
