Created
August 30, 2008 15:40
-
-
Save anonymous/8121 to your computer and use it in GitHub Desktop.
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 pixiv random pickup pagerize | |
// @namespace http://zuu9xi.sa.yona.la/ | |
// @description pagerize random pickup page of pixiv | |
// @include http://www.pixiv.net/random_pickup.php | |
// ==/UserScript== | |
window.addEventListener( "load", function () { | |
var page = 0 | |
if (typeof window.AutoPagerize != "undefined") { | |
window.AutoPagerize.addDocumentFilter( | |
function () { | |
var html = arguments[0] | |
var info = arguments[2] | |
var nextAnchor = getElementsByXPath(info.nextLink, html)[0] | |
// add dummy query to href | |
// to avoid autopagerize checking url | |
// not to loading same url twice. | |
// dummy query will be simply ignored. | |
nextAnchor.href.replace(/\?paged=\d+$/, '') | |
nextAnchor.href += "?paged=" + page++ | |
// alert(nextAnchor.href) | |
} | |
) | |
} | |
}, false) | |
// copied from autopagerize (http://userscripts.org/scripts/show/8551) | |
function getElementsByXPath(xpath, node) { | |
var node = node || document | |
var doc = node.ownerDocument ? node.ownerDocument : node | |
var nodesSnapshot = doc.evaluate(xpath, node, null, | |
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null) | |
var data = [] | |
for (var i = 0; i < nodesSnapshot.snapshotLength; i++) { | |
data.push(nodesSnapshot.snapshotItem(i)) | |
} | |
return data | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment