oAutoPagerize ver 0.3.1

本家 AutoPagerize0.0.22 - SWDYHにあわせてこちらもアップデート。

2008/02/13 00:27
Safariなどで動作しないバグがあったので修正しました。Operaの方には影響ありません。

更新はoAutoPagerize - 0xFFからどうぞ。


documentFiltersというnextLinkなどの取得前にかけられるフィルタが追加されています。
具体的には、stock.xchngのSITEINFO - 0xFFのようなケースに使えます。

// ==UserScript==
// @name           stock.xchng basefix
// @namespace      http://ss-o.net/
// @include        http://www.sxc.hu/category/*
// ==/UserScript==
setTimeout(function(){
	if (!window.AutoPagerize) return;
	window.AutoPagerize.addDocumentFilter(function(htmlDoc, requestURL, info){
		var next = getFirstElementByXPath(info.nextLink,htmlDoc);
		next.setAttribute('href',document.baseURI + next.getAttribute('href') );
	});
	function getFirstElementByXPath(xpath, node) {
		var node = node || document;
		var doc = node.ownerDocument ? node.ownerDocument : node;
		var result = doc.evaluate(xpath, node, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
		return result.singleNodeValue ? result.singleNodeValue : null;
	}
},0);

こんな感じ(上記はFirefox用)でnextLinkを書き換えてしまえば、割と自由に次のページを指定できます。(初回は成功していないと駄目ですが。)

後、ちょこちょこと高速化のための修正などをしてたりします。

更新したらSafariで動かなくなったという報告をみつけました。同様の方がいたら報告いただけると助かります。あ、Twitter / iyoda: http://d.hatena.ne.jp/os0x ...も見つけた。。
修正できた。と思います。すみませんでした。。