Skip to content

Instantly share code, notes, and snippets.

@kurumigi
Created December 23, 2010 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kurumigi/753318 to your computer and use it in GitHub Desktop.
Save kurumigi/753318 to your computer and use it in GitHub Desktop.
[GM script]AutoPagerize Filter for Yahoo! Auction Japan / Yahoo!オークションに、AutoPagerizeが適用されるようにします。
// ==UserScript==
// @name AutoPagerize Filter for Yahoo! Auction Japan
// @namespace http://d.hatena.ne.jp/kurumigi/
// @description Yahoo!オークションに、AutoPagerizeが適用されるようにします。(AutoPagerize Filter for Yahoo! Auction Japan.)
// @include http://auctions.search.yahoo.co.jp/search?*
// @version 0.2
// ==/UserScript==
// このスクリプトはAutoPagerizeより先に実行される必要があります。
// インストール後、Greasemonkeyの「ユーザースクリプトの管理」メニューで
// このスクリプトがAutoPagerizeより上になるように 必 ず 並べ替えてください。
(function() {
// rewrite link to next page.
function rewriteNextLink(doc) {
var a = doc.evaluate('id("Sp1")/p/strong/following-sibling::a[1]', doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
if (a.singleNodeValue) {
a.singleNodeValue.href = decodeURIComponent(a.singleNodeValue.href.replace(/^http:\/\/.*\/\*-/,''));
}
}
// push filters.
function addFilterHandler() {
if (window.AutoPagerize.addDocumentFilter) {
window.AutoPagerize.addDocumentFilter(rewriteNextLink)
}
}
// execute rewriting.
rewriteNextLink(document);
// for AutoPagerize.
if (window.AutoPagerize) {
addFilterHandler();
} else {
window.addEventListener('GM_AutoPagerizeLoaded', addFilterHandler, false);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment