Created
December 21, 2011 21:27
-
-
Save cballou/1507779 to your computer and use it in GitHub Desktop.
tt.fm core JS
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
// makes me cry | |
messageListener:function(d){ | |
if(d.hasOwnProperty("msgid")){return;} | |
if(d.command=="speak"){ | |
this.showChatMessage(d.userid,d.name,d.text); | |
}else{ | |
if(d.command=="newsong"){ | |
if(this.sjEUHqPqB.time_left>10){ | |
turntablePlayer.playEphemeral(UI_SOUND_ENDSONG,true); | |
} | |
this.setCurrentSong(d.room.metadata); | |
this.addToSongLog(d.room.metadata.current_song); | |
}else{ | |
if(d.command=="nosong"){ | |
this.setCurrentSong(null); | |
}else{ | |
if(d.command=="registered"){ | |
this.addUser(d.user[0]); | |
}else{ | |
if(d.command=="deregistered"){ | |
this.removeUser(d.user[0].userid); | |
}else{ | |
if(d.command=="update_user"){ | |
this.updateUser(d); | |
}else{ | |
if(d.command=="add_dj"){ | |
var a=d.user[0]; | |
a.fanof=($.inArray(a.userid,turntable.user.fanOf)!=-1); | |
this.users[a.userid]=a; | |
this.addDj(a.userid); | |
if(this.djIds.length>1&&turntablePlayer.bukDNkXLoCvTbad){ | |
turntablePlayer.ZJFFUSe(false); | |
} | |
}else{ | |
if(d.command=="rem_dj"){ | |
var c=d.user[0].userid; | |
this.removeDj(c); | |
if(d.modid){ | |
var f=(d.modid==1?" was booed off the stage.":" was kindly escorted off the stage by "+this.users[d.modid].name+"."); | |
this.appendChatMessage(c,this.users[c].name,f,"action"); | |
} | |
}else{ | |
if(d.command=="update_votes"){ | |
this.updateVotes(d.room.metadata,true); | |
}else{ | |
if(d.command=="new_moderator"){ | |
if($.inArray(d.userid,this.moderators)==-1){ | |
this.moderators.push(d.userid); | |
if(d.userid==this.selfId){ | |
// blah blah | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment