diff options
| -rw-r--r-- | lib/utils.coffee | 15 | ||||
| -rw-r--r-- | options/options.coffee | 5 | ||||
| -rw-r--r-- | options/options.html | 14 |
3 files changed, 31 insertions, 3 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 diff --git a/options/options.coffee b/options/options.coffee index 27b08e38..078a931d 100644 --- a/options/options.coffee +++ b/options/options.coffee @@ -2,8 +2,9 @@ $ = (id) -> document.getElementById id bgSettings = chrome.extension.getBackgroundPage().Settings -editableFields = ["scrollStepSize", "excludedUrls", "linkHintCharacters", "userDefinedLinkHintCss", - "keyMappings", "filterLinkHints", "previousPatterns", "nextPatterns", "hideHud", "regexFindMode"] +editableFields = [ "scrollStepSize", "excludedUrls", "linkHintCharacters", + "userDefinedLinkHintCss", "keyMappings", "filterLinkHints", "previousPatterns", + "nextPatterns", "hideHud", "regexFindMode", "defaultSearchUrl"] canBeEmptyFields = ["excludedUrls", "keyMappings", "userDefinedLinkHintCss"] diff --git a/options/options.html b/options/options.html index d7851c75..ef1267cc 100644 --- a/options/options.html +++ b/options/options.html @@ -123,6 +123,9 @@ input#previousPatterns, input#nextPatterns { width: 100%; } + input#defaultSearchUrl { + width: 100%; + } #status { margin-left: 10px; font-size: 80%; @@ -308,6 +311,17 @@ unmapAll <input id="nextPatterns" type="text" /> </td> </tr> + <tr class="advancedOption"> + <td class="caption">Default Search</td> + <td verticalAlign="top"> + <div class="help"> + <div class="example"> + 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" /> + </td> + </tr> </table> <div id="buttonsPanel"> |
