aboutsummaryrefslogtreecommitdiffstats
path: root/googlesugest.js
diff options
context:
space:
mode:
authorshunirr2008-03-20 16:32:41 +0000
committershunirr2008-03-20 16:32:41 +0000
commitaad373b519fdaf2b04004db3e95c1571c5d9ddf8 (patch)
tree53b2ecdfea348e76a1b7180b76ead6252e02f228 /googlesugest.js
downloadvimperator-plugins-aad373b519fdaf2b04004db3e95c1571c5d9ddf8.tar.bz2
lang/javascript/vimperator-plugins/trunk
lang/javascript/vimperator-plugins/tags/0.5.3 - mkdir trunk, tags - mv some files git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@8221 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'googlesugest.js')
-rw-r--r--googlesugest.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/googlesugest.js b/googlesugest.js
new file mode 100644
index 0000000..f7e2643
--- /dev/null
+++ b/googlesugest.js
@@ -0,0 +1,29 @@
+// Vimperator plugin: 'Completion by Google Suggest'
+// Last Change: 02-Mar-2008. Jan 2008
+// 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.*
+
+vimperator.commands.addUserCommand(['google'],"Search web sites with google suggest",
+ function(arg){
+ const endpoint = "http://www.google.co.jp/search?q=";
+ //vimperator.open(endpoint + encodeURIComponent(arg));
+ vimperator.open(endpoint + encodeURIComponent(arg),vimperator.NEW_TAB);
+ },
+ {
+ completer: function (filter) {
+ const endPoint = "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl=ja&qu="
+ var xhr = new XMLHttpRequest();
+ var completionList = [];
+
+ xhr.open("GET",endPoint + encodeURIComponent(filter),false);
+ xhr.send(null);
+ var response = window.eval(xhr.responseText)[1];
+
+ for each (var r in response)
+ completionList.push([r,"Suggests"]);
+ return [0,completionList];
+ }
+ }
+);