-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugAPI-dubtrack.js
52 lines (40 loc) · 1 KB
/
PlugAPI-dubtrack.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* Mady by 3ijtKwijt */
var API = {
main : {
init : function(){
if ( window.APIisRunning ){
console.log("[PlugAPI-Dubtrack] already running...")
return;
}
window.APIisRunning = true;
//OnSongUpdate Events
$('.currentSong').bind("DOMSubtreeModified", API.on.ADVANCE);
// [...]
},
},
chatLog : function(txt){
var b = new Dubtrack.View.chatLoadingItem;
b.$el.text(txt).appendTo(Dubtrack.room.chat._messagesEl);
},
sendChat : function(txt){
Dubtrack.room.chat._messageInputEl.val(txt);
Dubtrack.room.chat.sendMessage();
},
showPopup : function(title, message){
Dubtrack.helpers.displayError(title, message);
},
on : {
ADVANCE : function(){
// UPDATE ON SONG UPDATE
//Get Current song name
var songName = $(".currentSong").text();
//If "loading..." do nothing
if (songName == "loading...") return;
}
}
};
if(!window.APIisRunning){
API.main.init();
}else{
setTimeout(API.main.init, 1000);
}