Created
December 23, 2010 18:06
-
-
Save kurumigi/753318 to your computer and use it in GitHub Desktop.
[GM script]AutoPagerize Filter for Yahoo! Auction Japan / Yahoo!オークションに、AutoPagerizeが適用されるようにします。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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