-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplayQueueButton.js
More file actions
29 lines (27 loc) · 905 Bytes
/
playQueueButton.js
File metadata and controls
29 lines (27 loc) · 905 Bytes
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
onPage("Play", function () {
let queues, disable = true;
let restarting = false;
eventManager.on("jQuery", function onPlay() {
debug('jquery');
restarting = $('p.infoMessage:contains("The server will restart in")').length !== 0;
if (disable || restarting) {
queues = $("button.btn.btn-primary");
queues.prop("disabled", true);
if (restarting) {
queues.parent().hover(hover.show('Joining is disabled due to server restart.'));
} else {
queues.parent().on('mouseenter.script', hover.show('Waiting for connection to be established'))
.on('mouseleave.script', hover.hide());
}
}
});
eventManager.on('socketOpen', function checkButton() {
debug('socket');
disable = false;
if (queues && !restarting) {
queues.parent().off('.script');
queues.prop("disabled", false);
hover.hide();
}
});
});