From f5f3ed2f33afe1e88e5ae47d49a303c452b48c0e Mon Sep 17 00:00:00 2001 From: suVene Date: Tue, 9 Dec 2008 12:50:34 +0000 Subject: * _libly.js ver.0.1.4にあわせた修正 [26222] git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/branches/1.2@26225 d0d07461-0603-4401-acd4-de1884942a52 --- multi_requester.js | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'multi_requester.js') diff --git a/multi_requester.js b/multi_requester.js index 2dd7e8e..afb0e97 100644 --- a/multi_requester.js +++ b/multi_requester.js @@ -5,19 +5,20 @@ var PLUGIN_INFO = request, and the result is displayed to the buffer. リクエストの結果をバッファに出力する。 suVene - 0.4.3 + 0.4.4 1.2 1.2 request by the input text, and display to the buffer. :mr! goo[,any1,any2,…] {window.selection} -> request by the selected text, and display to the new tab. @@ -28,7 +29,7 @@ or liberator.globalVariables.multi_requester_command = [ANY1, ANY2, ……]; == SITEINFO == -ex.) +e.g.) javascript <<EOM liberator.globalVariables.multi_requester_siteinfo = [ { @@ -51,7 +52,7 @@ EOM @see http://wedata.net/databases/Multi%20Requester/items == MAPPINGS == -ex.) +e.g.) javascript < ' + extractLink; - var a = el.firstChild; - var url = $U.pathToURL((a.href || a.action || a.value)); - var req = new Request(url, null, $U.extend(res.req.options, {extractLink: true})); + var url = $U.pathToURL(el[0]); + var req = new libly.Request(url, null, $U.extend(res.req.options, {extractLink: true})); req.addEventListener('onException', $U.bind(this, this.onException)); req.addEventListener('onSuccess', $U.bind(this, this.onSuccess)); req.addEventListener('onFailure', $U.bind(this, this.onFailure)); @@ -342,7 +342,7 @@ var MultiRequester = { MultiRequester.requestCount++; MultiRequester.doProcess = true; - }, //}}} + },//}}} onSuccess: function(res) { //{{{ if (!MultiRequester.doProcess) { @@ -372,14 +372,13 @@ var MultiRequester = { return; } - doc = res.getHTMLDocument(xpath, null, res.req.options.siteinfo.ignoreTags); + var ignoreTags = ['script'].concat(libly.$U.A(res.req.options.siteinfo.ignoreTags)); + doc = document.createElementNS(null, 'div'); + res.getHTMLDocument(xpath, null, ignoreTags, function(node, i) { doc.appendChild(node) } ); if (!doc) throw 'XPath result is undefined or null.: XPath -> ' + xpath; html = '' + escapedUrl + '' + - (new XMLSerializer()).serializeToString(doc) - .replace(/<[^>]+>/g, function(all) all.toLowerCase()) - .replace(//g, ''); // actually - //.replace(//g, ''); // strictly + $U.xmlSerialize(doc); MultiRequester.echoHash[res.req.options.siteinfo.name] = html; @@ -392,7 +391,7 @@ var MultiRequester = { if (MultiRequester.requestCount == 0) { let echoList = []; MultiRequester.requestNames.split(',').forEach(function(name) { - echoList.push(MultiRequester.echoHash[name]) + echoList.push(MultiRequester.echoHash[name]); }); html = '
' + echoList.join('') + -- cgit v1.2.3