Skip to content

Commit 2acd8c7

Browse files
committed
Add theme selector
1 parent 36cb83e commit 2acd8c7

File tree

4 files changed

+493
-36
lines changed

4 files changed

+493
-36
lines changed

server.php

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,27 @@
2727
<summary>
2828
<table class="server_list_table">
2929
<tbody>
30-
<tr class="server_onl">
31-
<td class="status_cell">
32-
<span class="status_icon_onl" style="<?php echo $statusfarbe ?>"></span>
33-
<div class="status-letter-online"><?php
34-
if ($status == "1") {
35-
echo "ONLINE";
36-
}
37-
else {
38-
echo "OFFLINE";
39-
}?>
40-
</div>
41-
<div class="status-letter-offline">OFFLINE</div>
42-
</td>
43-
<td title="GAME LINK" class="connectlink_cell"><a href="<?php echo $connectlink ?>"><?php echo $ip . "<span>:" . $gport ."</span>"?></a></td>
44-
<td title="<?php if (isset($title)) {echo $title;} ?>" class="servername_cell">
45-
<div class="servername_nolink"><?php if (isset($title)) {echo $title;} ?></div></td>
46-
<td class="players_cell"><div class="outer_bar"><div class="inner_bar"><span class="players_numeric"><?php echo $countplayers . '/' . $maxplayers;?></span></div></div></td>
47-
<td class="img-cell"><img src="<?php echo $img ?>" width="80px" height="80px" style="float:right;margin-right: 8px;" alt="<?php echo $img ?>"></td>
48-
</tr>
49-
</tbody></table>
30+
<tr class="server_onl">
31+
<td class="status_cell">
32+
<span class="status_icon_onl" style="<?php echo $statusfarbe ?>"></span>
33+
<div class="status-letter-online"><?php
34+
if ($status == "1") {
35+
echo "ONLINE";
36+
}
37+
else {
38+
echo "OFFLINE";
39+
}?>
40+
</div>
41+
<div class="status-letter-offline">OFFLINE</div>
42+
</td>
43+
<td title="GAME LINK" class="connectlink_cell"><a href="<?php echo $connectlink ?>"><?php echo $ip . "<span>:" . $gport ."</span>"?></a></td>
44+
<td title="<?php if (isset($title)) {echo $title;} ?>" class="servername_cell">
45+
<div class="servername_nolink"><?php if (isset($title)) {echo $title;} ?></div></td>
46+
<td class="players_cell"><div class="outer_bar"><div class="inner_bar"><span class="players_numeric"><?php echo $countplayers . '/' . $maxplayers;?></span></div></div></td>
47+
<td class="img-cell"><img src="<?php echo $img ?>" width="80px" height="80px" style="float:right;margin-right: 8px;" alt="<?php echo $img ?>"></td>
48+
</tr>
49+
</tbody>
50+
</table>
5051
</summary>
5152
<?php
5253
include('html/tabs.php');

users/control/script.js

Lines changed: 62 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,38 @@ function closeNav() {
66
}
77
function selecttype() {
88
let type = document.getElementById("type").value;
9-
if (type == "arkse") {
9+
if (type === "arkse") {
1010
text = "If you don't want to use rcon, use 0 as rcon port.";
1111
document.getElementById("input-qport").required = true;
12-
} else if (type == "csgo") {
12+
} else if (type === "csgo") {
1313
text = "If you don't want to use rcon, use 0 as rcon port.";
1414
document.getElementById("input-qport").required = true;
15-
} else if (type == "minecraft") {
15+
} else if (type === "minecraft") {
1616
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") {
1818
text = "If you don't want to use rcon, use 0 as rcon port.";
1919
document.getElementById("input-qport").required = true;
20-
} else if (type == "vrising") {
20+
} else if (type === "vrising") {
2121
text = "If you don't want to use rcon, use 0 as rcon port.";
2222
document.getElementById("input-qport").required = true;
23-
} else if (type == "rust") {
23+
} else if (type === "rust") {
2424
text = "If you don't want to use rcon, use 0 as rcon port.";
2525
document.getElementById("input-qport").required = true;
2626
}
2727
document.getElementById("notes").innerHTML = text;
2828
}
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+
}
3941
}
4042
function tab(clicked_id) {
4143
let x = document.getElementById("control");
@@ -66,4 +68,48 @@ function startTime() {
6668
function checkTime(i) {
6769
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
6870
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+
69115
}

0 commit comments

Comments
 (0)