forked from Inve1951/BetterDiscordStuff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
statusCss.plugin.js
64 lines (50 loc) · 1.27 KB
/
statusCss.plugin.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
53
54
55
56
57
58
59
60
61
62
63
64
//META{"name":"statusCss"}*//;
var statusCss;
statusCss = (function() {
var observer, status, statusElem;
class statusCss {
getName() {
return "Status Css";
}
getDescription() {
return "Adds your status to <body> class list so you can style with it. `.own-status-online`, `.own-status-dnd`, etc.";
}
getAuthor() {
return "square";
}
getVersion() {
return "1.0.0";
}
load() {}
start() {
var o;
observer = new MutationObserver(o = function() {
var i, k, len, ref, v, x;
ref = ["online", "idle", "dnd", "invisible", "streaming"];
for (i = 0, len = ref.length; i < len; i++) {
x = ref[i];
status[x] = statusElem.classList.contains(`status-${x}`);
}
for (k in status) {
v = status[k];
document.body.classList.toggle(`own-status-${k}`, v);
}
});
o();
observer.observe(statusElem, {
attributes: true
});
}
stop() {
var k;
observer.disconnect();
for (k in status) {
document.body.classList.remove(`own-status-${k}`);
}
}
};
status = {};
observer = null;
statusElem = document.querySelector(".container-iksrDt .status");
return statusCss;
})();