Created
May 7, 2010 05:44
-
-
Save negipo/393108 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 WikipediaRandomAutoPager | |
// @namespace http://polog.org/ | |
// @include http://*.wikipedia.org/wiki/* | |
// @require http://gist.github.com/3242.txt | |
// ==/UserScript== | |
// requires AutoPagerize http://userscripts.org/scripts/show/8551 by swdyh | |
// using utility $X() http://gist.github.com/3242 by os0x | |
// notice: put this script ABOVE AutoPagerize | |
function randomPagerFilter(doc, url, info){ | |
var content_element = $X('id("content")', doc)[0]; | |
var links = $X('descendant-or-self::a[contains(@href, "/wiki/")]', content_element); | |
if(links.length < 1) return; | |
content_element.className = 'autopagerize_page_element'; | |
links[Math.floor(Math.random() * links.length)].rel = "next"; | |
} | |
randomPagerFilter(document, '', ''); | |
setTimeout(function(){window.AutoPagerize.addDocumentFilter(randomPagerFilter)},10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment