From aad373b519fdaf2b04004db3e95c1571c5d9ddf8 Mon Sep 17 00:00:00 2001 From: shunirr Date: Thu, 20 Mar 2008 16:32:41 +0000 Subject: 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 --- googlesugest.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 googlesugest.js (limited to 'googlesugest.js') 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 - 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]; + } + } +); -- cgit v1.2.3