-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplayQueueButton.js
More file actions
32 lines (28 loc) · 1.02 KB
/
playQueueButton.js
File metadata and controls
32 lines (28 loc) · 1.02 KB
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
onPage("Play", function () {
let queues, disable = true;
let restarting = false;
eventManager.on("jQuery", function onPlay() {
restarting = $('p.infoMessage[data-i18n-custom="header-info-restart"]').length !== 0;
if (disable || restarting) {
queues = $("#standard-mode, #ranked-mode, button.btn.btn-primary");
closeQueues(restarting ? 'Joining is disabled due to server restart.' : 'Waiting for connection to be established.');
}
});
eventManager.on('socketOpen', function checkButton() {
disable = false;
if (queues && !restarting) {
queues.parent().off('.script');
queues.prop("disabled", false); // TODO: Cleanup
queues.toggleClass('closed', false);
hover.hide();
}
});
eventManager.on('closeQueues', closeQueues);
function closeQueues(message) {
queues.prop("disabled", true); // TODO: Cleanup
queues.toggleClass('closed', true);
queues.parent()
.on('mouseenter.script', hover.show(message))
.on('mouseleave.script', hover.hide());
}
});