Last active
January 6, 2016 05:17
-
-
Save edcottrell/7f54f8070be1a972ecb9 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 Load random Stack Exchange network hot question | |
// @namespace http://edcottrell.com/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Ed Cottrell | |
// @include *://stackexchange.com* | |
// @grant none | |
// ==/UserScript== | |
var hotLinkCount, | |
randomHotLink, | |
randomHotLinkNumber; | |
if (location.search.match(/[?&]\brandom\b/)) { | |
hotLinkCount = $('a.question-link').length; | |
randomHotLinkNumber = Math.floor(Math.random() * hotLinkCount); | |
randomHotLink = $('a.question-link:eq(' + randomHotLinkNumber + ')'); | |
document.location = randomHotLink.prop('href'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment