-
Notifications
You must be signed in to change notification settings - Fork 16
/
customcsschanger.js
58 lines (52 loc) · 1.23 KB
/
customcsschanger.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
// ==UserScript==
// @name Example Custom CSS Changer
// @author AspectQuote
// @version 1
// @desc Uses custom settings to change custom CSS.
// ==/UserScript==
let currentCSS = -1;
const customCSSes = [
{
name: "No CSS",
css: ``
},
{
name: "Hide Bottom Right Info Bar",
css: `#mapInfoHolder {
display: none !important;
}`
},
{
name: "Hide Krunker Logo",
css: `#gameNameHolder, #seasonLabel {
display: none !important;
}`
}
]
removeCSS = () => {
this._css('', 'customcssindex' + currentCSS, false);
}
swapCSS = (cssIndex) => {
removeCSS();
if (cssIndex !== currentCSS) {
this._css(customCSSes[cssIndex].css, 'customcssindex'+cssIndex, true);
}
currentCSS = cssIndex;
}
// remove the css when userscript is unloaded
this.unload = () => {
removeCSS();
}
this.settings = {
'usingcss': {
title: "CSS to inject",
type: 'sel',
desc: "The custom CSS you want to use.",
value: customCSSes[0].name,
opts: customCSSes.map(item => item.name),
changed: (newName) => {
swapCSS(customCSSes.findIndex(item => item.name === newName));
}
}
}
return this;