From 6c9743431ee74ae50296f596d38ec1980dc5e675 Mon Sep 17 00:00:00 2001
From: elzzup
Date: Fri, 4 Jul 2014 14:22:32 +0900
Subject: udpate pushfind delimiter fix
---
pushfind.js | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
(limited to 'pushfind.js')
diff --git a/pushfind.js b/pushfind.js
index ce6a145..733914d 100755
--- a/pushfind.js
+++ b/pushfind.js
@@ -6,7 +6,7 @@ let PLUGIN_INFO = xml`
プッシュファインド
push FIndHistory word searched on google
Google検索したワードをfindの履歴に放り込みます
-1.1
+1.2
elzup
2.0pre
2.0pre
@@ -28,19 +28,19 @@ let PLUGIN_INFO = xml`
name: "wikipedia",
url: 'http:\/\/ja.wikipedia.org\/wiki/*',
get_regex: /http:\/\/ja.wikipedia.org\/wiki\/([^#\/]*)/,
- delimiter: "+"
+ delimiter: " "
},
{
name: "nicovideo",
url: 'http:\/\/www.nicovideo.jp\/search\/*',
get_regex: /http:\/\/www.nicovideo.jp\/search\/(.*)/,
- delimiter: "%20"
+ delimiter: " "
},
{
name: "google",
url: 'https:\/\/www.google.co.jp\/search.*',
get_regex: /google.co.jp\/search.*[&?]q=(.*?)&/,
- delimiter: "+"
+ delimiter: " "
},
];
@@ -58,22 +58,18 @@ let PLUGIN_INFO = xml`
var words, res, hits, hs, pushwords;
hs = storage['history-search'];
for each (var cf in pushfind_configs) {
-// liberator.echomsg("pushfind: " + cf.name + "check start");
pushwords = [];
hits = (args.url.match(cf.get_regex));
if (!hits || !hits[1]) {
- // liberator.echomsg(is_echo_pushfind ? "pushfind: [no hits]" + pushwords : "");
continue;
- // return;
}
- res = hits[1];
+ res = decodeURI(hits[1]).replace(/[ +]/g, cf.delimiter);
if (!cf.delimiter) {
words.push(res);
} else {
words = res.split(cf.delimiter);
}
- for (var i = 0; i < words.length; i++) {
- var w = decodeURI(words[i]);
+ for each (var w in words) {
if (!w || pushwords.indexOf(w) != -1) {
continue;
}
--
cgit v1.2.3