diff options
| author | Stephen Blott | 2012-10-21 13:13:07 +0100 |
|---|---|---|
| committer | Stephen Blott | 2012-10-21 13:13:07 +0100 |
| commit | 25ebcf13c2510c20caa52d230abbb29a3e91459b (patch) | |
| tree | 7eafd864a2208b7459537ce4e9a6334dccfaed11 /lib/utils.coffee | |
| parent | ac67f18dc08174b0460df94151e09ec21a6b56c9 (diff) | |
| download | vimium-25ebcf13c2510c20caa52d230abbb29a3e91459b.tar.bz2 | |
Configurable vomnibox default/fallback search engine.
Diffstat (limited to 'lib/utils.coffee')
| -rw-r--r-- | lib/utils.coffee | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee index a2221ba4..e4debe71 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -92,7 +92,18 @@ 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) + # "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 + # + # 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("+") # 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. @@ -126,3 +137,5 @@ globalRoot.extend = (hash1, hash2) -> root = exports ? window root.Utils = Utils + +# vim: softtabstop=2 |
