aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2012-10-23 10:27:57 +0100
committerStephen Blott2012-10-23 10:27:57 +0100
commitc380cb5c9c8dd786b8203d2ed10d451da2ece2b7 (patch)
treefa449dbe4a1e98ddd68d91990ba84ab6d6638415
parent5327ac1c0dedfd9f4d30e9a0bf626f9ffb962e2d (diff)
downloadvimium-c380cb5c9c8dd786b8203d2ed10d451da2ece2b7.tar.bz2
Code cleanup, as requested by in3/Jez Ng here:
- https://github.com/philc/vimium/pull/682.
-rw-r--r--background_scripts/settings.coffee2
-rw-r--r--lib/utils.coffee16
-rw-r--r--options/options.coffee2
-rw-r--r--options/options.html4
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>