-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSSEStatus.js
More file actions
48 lines (36 loc) · 1.41 KB
/
SSEStatus.js
File metadata and controls
48 lines (36 loc) · 1.41 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class SSEStatus {
/*
The status display is used to report problems with the search.
*/
static loadStatus() {
fetch('https://fof1092.de/Plugins/SSE/status.php')
.then(
function(response) {
if (response.status !== 200) {
console.log('[SpigotMCSearchEngine] loadStatus - Error, Status Code: ' + response.status);
SSEStatus.displayStatus('Something unexpected has happened, please send me a message! @F_o_F_1092 (' + err + ')', '#ef1c1c');
return;
}
response.json().then(function(data) {
if (data['text'] != "null") {
SSEStatus.displayStatus(data['text'], data['color']);
}
});
}
)
.catch(function(err) {
console.log('[SpigotMCSearchEngine] loadStatus - Fetching Error: ', err);
SSEStatus.displayStatus('Something unexpected has happened, please send me a message! @F_o_F_1092 (' + err + ')', '#ef1c1c');
});
}
/* displayStatus */
static displayStatus(text, color) {
let divActionFilterRow = document.getElementsByClassName("actionFilterRow")[0];
let divInfoBox = document.createElement("div");
divInfoBox.classList.add('infoBox')
divInfoBox.style.background = color;
let infoBoxText = document.createTextNode(text);
divInfoBox.appendChild(infoBoxText);
divActionFilterRow.insertBefore(divInfoBox, divActionFilterRow.firstChild);
}
}