From 3bbca08833efc80d248fce1127044fa7135d293a Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Sun, 10 Jun 2012 01:37:03 -0700 Subject: Perform a google search if they hit enter with no selection. --- lib/utils.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lib/utils.js') 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); } }; -- cgit v1.2.3