From d37ef3e6cbba87d14505d8d12d3402d6e96bbb8d Mon Sep 17 00:00:00 2001 From: elzup Date: Fri, 27 Jun 2014 21:02:18 +0900 Subject: create pushfind.js --- pushfind.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 pushfind.js (limited to 'pushfind.js') diff --git a/pushfind.js b/pushfind.js new file mode 100755 index 0000000..04e0c8f --- /dev/null +++ b/pushfind.js @@ -0,0 +1,53 @@ + +// PLUGIN_INFO {{{ +let PLUGIN_INFO = xml` + + PushFind + プッシュファインド + push FIndHistory word searched on google + Google検索したワードをfindの履歴に放り込みます + 1.0 + elzup + 2.0pre + 2.0pre + +`; +// }}} + +(function () { + + autocommands.add( + 'PageLoad', + 'https:\/\/www.google.co.jp\/search.*', + function (args) { + var get_regex,delimiter,res,words; + var hs = storage['history-search']; + get_regex = /google.co.jp\/search.*[&?]q=(.*?)&/; + delimiter = "+"; + res = args.url.match(get_regex); + if (res[1]) { + words = res[1].split(delimiter); + } + for (var i = 0; i < words.length; i++) { + /* + * 最近のfindワードと被っていたらそれをpopする + var l = hs.length; + for (var j = l - 1; j >= l - recent_pop; j--) { + if (hs.get(j) == words[i]) { + } + var w = hs.get(j); + } + */ + hs.push(decodeURI(words[i])); + } + + // autocommandsの出力をクリア + // 抑制方法がわからない + liberator.echomsg(""); + } + ); +})(); + +// vim:sw=2 ts=2 et si fdm=marker: + -- cgit v1.2.3