diff options
| -rw-r--r-- | background_scripts/settings.coffee | 2 | ||||
| -rw-r--r-- | lib/utils.coffee | 16 | ||||
| -rw-r--r-- | options/options.coffee | 2 | ||||
| -rw-r--r-- | options/options.html | 4 |
4 files changed, 9 insertions, 15 deletions
diff --git a/background_scripts/settings.coffee b/background_scripts/settings.coffee index ce8b8e16..812fc775 100644 --- a/background_scripts/settings.coffee +++ b/background_scripts/settings.coffee @@ -57,7 +57,7 @@ root.Settings = Settings = # "\bnext\b,\bmore\b,>,→,»,≫,>>" nextPatterns: "next,more,>,\u2192,\xbb,\u226b,>>" # default/fall back search engine - defaultSearchUrl: "http://www.google.com/search?q=" + searchUrl: "http://www.google.com/search?q=" # Initialization code. # We use this parameter to coordinate any necessary schema changes. 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 diff --git a/options/options.coffee b/options/options.coffee index 078a931d..640b6632 100644 --- a/options/options.coffee +++ b/options/options.coffee @@ -4,7 +4,7 @@ bgSettings = chrome.extension.getBackgroundPage().Settings editableFields = [ "scrollStepSize", "excludedUrls", "linkHintCharacters", "userDefinedLinkHintCss", "keyMappings", "filterLinkHints", "previousPatterns", - "nextPatterns", "hideHud", "regexFindMode", "defaultSearchUrl"] + "nextPatterns", "hideHud", "regexFindMode", "searchUrl"] canBeEmptyFields = ["excludedUrls", "keyMappings", "userDefinedLinkHintCss"] diff --git a/options/options.html b/options/options.html index ef1267cc..3bce82ce 100644 --- a/options/options.html +++ b/options/options.html @@ -123,7 +123,7 @@ input#previousPatterns, input#nextPatterns { width: 100%; } - input#defaultSearchUrl { + input#searchUrl { width: 100%; } #status { @@ -319,7 +319,7 @@ unmapAll Vomnibar fall back URL/search engine if nothing else matches (examples: "http://duckduckgo.com/?q=", "http://www.google.com/search?q="). </div> </div> - <input id="defaultSearchUrl" type="text" /> + <input id="searchUrl" type="text" /> </td> </tr> </table> |
