// ==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 }