@@ -6,36 +6,38 @@ function closeNav() {
6
6
}
7
7
function selecttype ( ) {
8
8
let type = document . getElementById ( "type" ) . value ;
9
- if ( type == "arkse" ) {
9
+ if ( type === "arkse" ) {
10
10
text = "If you don't want to use rcon, use 0 as rcon port." ;
11
11
document . getElementById ( "input-qport" ) . required = true ;
12
- } else if ( type == "csgo" ) {
12
+ } else if ( type === "csgo" ) {
13
13
text = "If you don't want to use rcon, use 0 as rcon port." ;
14
14
document . getElementById ( "input-qport" ) . required = true ;
15
- } else if ( type == "minecraft" ) {
15
+ } else if ( type === "minecraft" ) {
16
16
text = "If your server doesn't support the query protocol, use 0 as query port. If you don't want to use rcon, use 0 as rcon port." ;
17
- } else if ( type == "valheim" ) {
17
+ } else if ( type === "valheim" ) {
18
18
text = "If you don't want to use rcon, use 0 as rcon port." ;
19
19
document . getElementById ( "input-qport" ) . required = true ;
20
- } else if ( type == "vrising" ) {
20
+ } else if ( type === "vrising" ) {
21
21
text = "If you don't want to use rcon, use 0 as rcon port." ;
22
22
document . getElementById ( "input-qport" ) . required = true ;
23
- } else if ( type == "rust" ) {
23
+ } else if ( type === "rust" ) {
24
24
text = "If you don't want to use rcon, use 0 as rcon port." ;
25
25
document . getElementById ( "input-qport" ) . required = true ;
26
26
}
27
27
document . getElementById ( "notes" ) . innerHTML = text ;
28
28
}
29
- if ( window . location . search . indexOf ( 'page=settings' ) > - 1 ) {
30
- document . getElementById ( "tab1" ) . style . textDecoration = "none" ;
31
- document . getElementById ( "tab2" ) . style . textDecoration = "underline" ;
32
- document . getElementById ( "control" ) . style . display = "none" ;
33
- document . getElementById ( "settings" ) . style . display = "block" ;
34
- } else {
35
- document . getElementById ( "tab2" ) . style . textDecoration = "none" ;
36
- document . getElementById ( "tab1" ) . style . textDecoration = "underline" ;
37
- document . getElementById ( "control" ) . style . display = "flex" ;
38
- document . getElementById ( "settings" ) . style . display = "none" ;
29
+ if ( document . getElementById ( 'tab1' ) != null ) {
30
+ if ( window . location . search . indexOf ( 'page=settings' ) > - 1 ) {
31
+ document . getElementById ( "tab1" ) . style . textDecoration = "none" ;
32
+ document . getElementById ( "tab2" ) . style . textDecoration = "underline" ;
33
+ document . getElementById ( "control" ) . style . display = "none" ;
34
+ document . getElementById ( "settings" ) . style . display = "block" ;
35
+ } else {
36
+ document . getElementById ( "tab2" ) . style . textDecoration = "none" ;
37
+ document . getElementById ( "tab1" ) . style . textDecoration = "underline" ;
38
+ document . getElementById ( "control" ) . style . display = "flex" ;
39
+ document . getElementById ( "settings" ) . style . display = "none" ;
40
+ }
39
41
}
40
42
function tab ( clicked_id ) {
41
43
let x = document . getElementById ( "control" ) ;
@@ -66,4 +68,48 @@ function startTime() {
66
68
function checkTime ( i ) {
67
69
if ( i < 10 ) { i = "0" + i } ; // add zero in front of numbers < 10
68
70
return i ;
71
+ }
72
+ function changetheme ( theme ) {
73
+ tablinks = document . getElementsByClassName ( "tablinks" ) ;
74
+ for ( i = 0 ; i < tablinks . length ; i ++ ) {
75
+ tablinks [ i ] . className = tablinks [ i ] . className . replace ( " active" , "" ) ;
76
+ }
77
+ document . getElementById ( theme ) . classList . add ( "active" ) ;
78
+ if ( theme === "btndark" ) {
79
+ backgroundcolor = "#1D1D1F" ;
80
+ servercolor = "#3b3b3b" ;
81
+ fontcolor = "#ebebeb" ;
82
+ border = "1px solid transparent" ;
83
+ themename = "dark" ;
84
+ } else if ( theme === "btnlight" ) {
85
+ backgroundcolor = "white" ;
86
+ servercolor = "#e6e6e6" ;
87
+ fontcolor = "black" ;
88
+ border = "1px solid transparent" ;
89
+ themename = "light" ;
90
+ } else if ( theme === "btnsnight" ) {
91
+ backgroundcolor = "#1D1D1F" ;
92
+ servercolor = "#F5F5F5" ;
93
+ fontcolor = "black" ;
94
+ border = "1px solid transparent" ;
95
+ themename = "summer-night" ;
96
+ } else if ( theme === "btnsnightinv" ) {
97
+ backgroundcolor = "#e6e6e6" ;
98
+ servercolor = "#1D1D1F" ;
99
+ fontcolor = "#ebebeb" ;
100
+ border = "1px solid transparent" ;
101
+ themename = "summer-night-inverted" ;
102
+ } else if ( theme === "btnmidnight" ) {
103
+ backgroundcolor = "#0F0F0FFF" ;
104
+ servercolor = "rgb(0, 0, 0)" ;
105
+ fontcolor = "#ebebeb" ;
106
+ border = "1px solid white" ;
107
+ themename = "midnight" ;
108
+ }
109
+ document . getElementById ( 'server_list_table' ) . style . color = fontcolor ;
110
+ document . getElementById ( 'themevl' ) . style . backgroundColor = backgroundcolor ;
111
+ document . getElementById ( 'vorschauparent' ) . style . backgroundColor = servercolor ;
112
+ document . getElementById ( 'vorschauparent' ) . style . border = border ;
113
+ document . getElementById ( 'themeinput' ) . value = themename ;
114
+
69
115
}
0 commit comments