Skip to content

Instantly share code, notes, and snippets.

@nthitz
Last active July 20, 2022 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nthitz/6505092 to your computer and use it in GitHub Desktop.
Save nthitz/6505092 to your computer and use it in GitHub Desktop.
plug dj woot!
javascript:var voteTimeout=null;var djCheckTimeout=null;var user=null;once();function once(){if(typeof ran!=="undefined"){return;}ran=true;API.on(API.DJ_ADVANCE,advance);$('#audience').remove();$('#playback').css('opacity',0);$('#room-wheel').css('background','black');voteTimeout=setTimeout(vote,2000);djCheckTimeout=setTimeout(checkIfDJing,1000);user=API.getUser();}function advance(obj){clearTimeout(voteTimeout);clearTimeout(djCheckTimeout);if(obj==null)return;var timer=30000+30000*Math.random();voteTimeout=setTimeout(vote,timer);djCheckTimeout=setTimeout(checkIfDJing,5000);}function vote(){$('#room #woot').click();}function checkIfDJing(){return;var curDJs=API.getDJs();var djing=false;for(var i=0;i<curDJs.length;i++){var dj=curDJs[i];if(dj.id===user.id){djing=true;break;}}if(djing){return;}var inWaitList=API.getWaitListPosition();if(inWaitList!=-1){return;}$('.button-dj:visible').click();}
var voteTimeout = null;
var djCheckTimeout = null;
var user = null;
once();
function once() {
if(typeof ran !== "undefined") {
return;
}
ran = true;
API.on(API.DJ_ADVANCE,advance);
$('#audience').remove();
$('#playback').css('opacity',0);
$('#room-wheel').css('background','black');
voteTimeout = setTimeout(vote,2000);
djCheckTimeout = setTimeout(checkIfDJing,1000);
user = API.getUser();
}
function advance(obj)
{
clearTimeout(voteTimeout);
clearTimeout(djCheckTimeout);
if (obj == null) return; // no dj
var timer = 30000 + 30000 * Math.random();
voteTimeout = setTimeout(vote,timer);
djCheckTimeout = setTimeout(checkIfDJing, 5000);
}
function vote() {
$('#room #woot').click();
}
function checkIfDJing() {
return;
var curDJs = API.getDJs();
var djing = false;
for(var i = 0; i < curDJs.length; i++) {
var dj = curDJs[i];
if(dj.id === user.id) {
djing = true;
break;
}
}
if(djing) {
return;
}
var inWaitList = API.getWaitListPosition();
if(inWaitList != -1) {
return;
}
$('.button-dj:visible').click();
}
//http://subsimple.com/bookmarklets/jsbuilder.htm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment