aboutsummaryrefslogtreecommitdiffstats
path: root/googlesuggest.js
diff options
context:
space:
mode:
authordrry2008-04-08 01:43:37 +0000
committerdrry2008-04-08 01:43:37 +0000
commitf9a1e4ca0db0894f84f65d833fc4c100db97ec51 (patch)
treed1ac825175db5704a813c127c5f40e8ebe7b057e /googlesuggest.js
parentefba180e6004413ae2724d298366da2a30dd82a8 (diff)
downloadvimperator-plugins-f9a1e4ca0db0894f84f65d833fc4c100db97ec51.tar.bz2
lang/javascript/vimperator-plugins/trunk/googlesuggest.js:
* 日本語版以外のサジェストに対応しました。 * ほか。 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@9111 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'googlesuggest.js')
-rw-r--r--googlesuggest.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/googlesuggest.js b/googlesuggest.js
index 582f23b..0036fcd 100644
--- a/googlesuggest.js
+++ b/googlesuggest.js
@@ -3,9 +3,9 @@
// License: Creative Commons
// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid
//
-// search word completion using google suggest script for vimperator0.6.*
+// search word completion using Google Suggest script for Vimperator 0.6.*
-liberator.commands.addUserCommand(['google'],"Search web sites with google suggest",
+liberator.commands.addUserCommand(['google'],"Search Web sites with Google Suggest",
function(arg){
const endpoint = "http://www.google.co.jp/search?q=";
//liberator.open(endpoint + encodeURIComponent(arg));
@@ -13,11 +13,14 @@ liberator.commands.addUserCommand(['google'],"Search web sites with google sugge
},
{
completer: function (filter) {
- const endPoint = "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl=ja&qu="
+ const endPoint = "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox"
+ var [lang] = Components.classes["@mozilla.org/network/protocol;1?name=http"]
+ .getService(Components.interfaces.nsIHttpProtocolHandler)
+ .language.split("-", 1);
var xhr = new XMLHttpRequest();
var completionList = [];
- xhr.open("GET",endPoint + encodeURIComponent(filter),false);
+ xhr.open("GET",endPoint + "&hl=" + lang + "&qu=" + encodeURIComponent(filter),false);
xhr.send(null);
var response = window.eval(xhr.responseText)[1];
@@ -27,3 +30,4 @@ liberator.commands.addUserCommand(['google'],"Search web sites with google sugge
}
}
);
+// vim:sw=4 ts=4 et: