Remix this dance track by clicking samples

[Read the post]

That bookmarklet lost some html along the way. This works better:

!function(){var n=$("<a class='btn' id='randomButton'><span id='randomText'>random</span></a>");$(".info").append(n);var a=$(".button"),t=function(){for(var n=0;2>n;n++)a[Math.floor(Math.random()*a.length)].click()},o=0;n[0].onclick=function(){o?(o=0,clearInterval(t),$("#randomText").html("random")):(o=1,t(),setInterval(t,1e4),$("#randomText").html("stop random"))}}();

Neat, though the randomizer seems to allow for some terrible combinations that the UI doesn’t.

I’m thinkyfish from reddit and I just wanted to say all credit goes to udkgamer2 who wrote the original script. He also posted a more human readable version:

(function () {
var randomButton = $("<a class='btn' id='randomButton'><span id='randomText'>random</span></a>");
$(".info").append(randomButton);
var buttonList = $(".button");
var randomMusic = function() {
    for (var i = 0; i < 2; i++) {
        buttonList[Math.floor(Math.random()*buttonList.length)].click();
}}
var randomLoopActive= 0;
randomButton[0].onclick = function () 
{
    if (randomLoopActive) {
        randomLoopActive = 0;
        clearInterval(randomMusic);
        $("#randomText").html("random")
    }
    else {
        randomLoopActive = 1;
        randomMusic();
        setInterval(randomMusic, 10000);
        $("#randomText").html("stop random")
    }
}
} )()
1 Like

This topic was automatically closed after 5 days. New replies are no longer allowed.