diff options
| author | Phil Crosby | 2012-06-10 01:37:03 -0700 |
|---|---|---|
| committer | Phil Crosby | 2012-06-10 01:41:45 -0700 |
| commit | 3bbca08833efc80d248fce1127044fa7135d293a (patch) | |
| tree | b9f84714d0b3f25cf38365a46e17474c2bc3f150 /lib | |
| parent | 17441ec22e3ee1a607674b4b6b57b0bca433a841 (diff) | |
| download | vimium-3bbca08833efc80d248fce1127044fa7135d293a.tar.bz2 | |
Perform a google search if they hit enter with no selection.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/utils.js b/lib/utils.js index 1babb2ec..5bb3a6cc 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -143,16 +143,15 @@ root.utils = { }, /** - * Tries to convert :str into a valid URL. - * We don't bother with escaping characters, however, as Chrome will do that for us. + * 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. */ - ensureUrl: function(str) { - // trim str - str = str.replace(/^\s+|\s+$/g, ''); - if (utils.isUrl(str)) - return utils.createFullUrl(str); + convertToUrl: function(string) { + string = string.trim(); + if (utils.isUrl(string)) + return utils.createFullUrl(string); else - return utils.createSearchUrl(str); + return utils.createSearchUrl(string); } }; |
