This repository was archived by the owner on Jul 31, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.html
More file actions
301 lines (270 loc) · 12.5 KB
/
main.html
File metadata and controls
301 lines (270 loc) · 12.5 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>#SaveCW Costume Server</title>
<link rel="icon" href="https://avatars.githubusercontent.com/u/172896885">
<meta name="title" content="#SaveCW Costume Server" />
<meta name="description" content="#SaveCW Костюмы - это проект от #SaveCW, позволяющий игрокам создавать и использовать пользовательские костюмы в игре CatWar." />
<meta content="#ffc223" data-react-helmet="true" name="theme-color">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:url" content="https://cat.arisamiga.rocks/" />
<meta property="og:title" content="#SaveCW Costume Server" />
<meta property="og:description" content="#SaveCW Костюмы - это проект от #SaveCW, позволяющий игрокам создавать и использовать пользовательские костюмы в игре CatWar." />
<meta property="og:image" content="https://avatars.githubusercontent.com/u/172896885" />
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="https://cat.arisamiga.rocks/" />
<meta property="twitter:title" content="#SaveCW Costume Server" />
<meta property="twitter:description" content="#SaveCW Костюмы - это проект от #SaveCW, позволяющий игрокам создавать и использовать пользовательские костюмы в игре CatWar." />
<meta property="twitter:image" content="https://avatars.githubusercontent.com/u/172896885" />
<script>
document.addEventListener('DOMContentLoaded', function() {
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
document.getElementsByClassName('dropbtn')[0].classList.toggle("dropdown-open")
}
document.getElementsByClassName("dropbtn")[0].addEventListener("click", myFunction);
// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
const dropBtn = document.getElementsByClassName('dropbtn')[0];
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
dropBtn.classList.remove("dropdown-open")
}
}
}
}
document.getElementById("russian").addEventListener("click", function() {
localStorage.setItem("language", "ru");
location.reload();
});
document.getElementById("english").addEventListener("click", function() {
localStorage.setItem("language", "en");
location.reload();
});
function changeText(data){
if (document.getElementById("welcome") != null)
document.getElementById("welcome").innerText = data["welcome"];
if (document.getElementById("title") != null)
document.getElementById("title").innerText = data["title"];
if (document.getElementById("paragraph") != null)
document.getElementById("paragraph").innerHTML = data["paragraph"];
if (document.getElementById("info") != null)
document.getElementById("info").innerHTML = data["info"];
if (document.getElementById("current") != null)
document.getElementById("current").innerText = data["current"];
if (document.getElementById("terms") != null)
document.getElementById("terms").innerText = data["terms"];
if (document.getElementById("privacy") != null)
document.getElementById("privacy").innerText = data["privacy"];
}
function translateText(lang) {
fetch("./locale/" + lang + ".json")
.then(response => response.json())
.then(data => {
changeText(data);
// Save on localstorage
localStorage.setItem("langdata", JSON.stringify(data));
});
}
// Get current language picked
var language = localStorage.getItem("language");
switch (language) {
case "ru":
document.getElementsByClassName("dropbtn")[0].querySelector("img").src = "./locale/ru.png";
translateText("ru");
break;
case "en":
document.getElementsByClassName("dropbtn")[0].querySelector("img").src = "./locale/en.png";
translateText("en");
break;
default:
// Check default language
const defaultLanguage = navigator.language;
if (defaultLanguage.includes("ru")) {
document.getElementsByClassName("dropbtn")[0].querySelector("img").src = "./locale/ru.png";
translateText("ru");
localStorage.setItem("language", "ru");
} else {
document.getElementsByClassName("dropbtn")[0].querySelector("img").src = "./locale/en.png";
translateText("en");
localStorage.setItem("language", "en");
}
break;
}
// Listening for the custom event
window.addEventListener('languageChange', function(e) {
switch (JSON.parse(e.detail).language) {
case "ru":
document.getElementsByClassName("dropbtn")[0].querySelector("img").src = "./locale/ru.png";
translateText("ru");
break;
case "en":
document.getElementsByClassName("dropbtn")[0].querySelector("img").src = "./locale/en.png";
translateText("en");
break;
}
});
});
</script>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
margin: 0;
padding: 0;
overflow-x: hidden;
}
header {
align-items: center;
display: flex;
justify-content: space-between;
margin: 0 auto;
width: 100%;
}
header img {
margin-right: auto; /* Pushes the image to the left and everything else to the right */
}
header h1 {
margin-left: auto; /* Pushes the heading to the right and everything else to the left */
margin-right: auto;
}
.left {
border-radius: 0.5rem;
margin: 0.5rem;
}
.left:hover {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.right {
opacity: 0;
margin: 0.5rem;
}
h1 {
margin: 0;
font-size: 32px;
}
.container {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #ffffff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 1rem;
}
p {
line-height: 1.5;
}
hr {
margin: 20px 0;
border: 0;
border-top: 1px solid #ddd;
}
/* Dropdown Languages */
/* Dropdown Button */
.dropbtn {
color: white;
background-color: transparent;
font-size: 16px;
margin: 1rem;
margin-right: -4rem;
border: none;
cursor: pointer;
transition: all 1s;
}
.dropbtn:hover {
margin-right: unset;
}
.dropbtn img {
height: 55px;
width: 90px;
border-radius: 2rem;
pointer-events: none;
border: 1px solid black;
}
/* The container <div> - needed to position the dropdown content */
.dropdown {
display: inline-block;
font-family: "Segoe UI", Arial, Helvetica, sans-serif;
font-size: 16px;
position: absolute;
top: 0;
right: 0;
}
.dropbtn.dropdown-open {
margin-right: unset;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
top: 100%; /* Position the dropdown content right below the dropdown button */
right: 0; /* Align the dropdown content to the right */
}
/* Links inside the dropdown */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: flex;
align-items: center;
gap: 1rem;
}
.dropdown-content a img {
height: 50px;
width: 50px;
border-radius: 1rem;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #ddd;}
/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */
.show {display:block;}
.legal {
text-align: center;
margin-top: 20px;
font-size: 14px;
}
</style>
</head>
<body>
<header>
<a href="https://github.com/SaveCW"><img class="left" src="https://avatars.githubusercontent.com/u/172896885" alt="Centered Image" height="100"></a>
<h1 class="center" id="welcome">Welcome to the #SaveCW Costumes!</h1>
<img class="right" src="https://avatars.githubusercontent.com/u/172896885" alt="Centered Image" height="100">
</header>
<div class="container">
<div class="dropdown">
<button class="dropbtn"><img src="./locale/en.png"></button>
<div id="myDropdown" class="dropdown-content">
<a href="#" id="russian"><img src="./locale/ru.png"> Русский</a>
<a href="#" id="english"><img src="./locale/en.png"> English</a>
</div>
</div>
<p>
<h2 id="title">What are #SaveCW Costumes?</h2>
<p id="paragraph">
#SaveCW Costumes is a project by #SaveCW, allowing players to create and use custom costumes in the CatWar game. <br> Recent updates to the game have introduced restrictions against "unrealistic" costumes, limiting players' creative expression. Our community-developed mod allows for the use of personalized costumes. <br><b>Please note</b>, to see each other's custom costumes, both players must have the mod installed. This mod is purely cosmetic and does not impact gameplay.
</p>
<hr>
<p id="info">
More Info on various projects by #SaveCW can be found on our <a href="https://github.com/SaveCW">GitHub</a> page.
</p>
</p>
<p><span id="current">Current Players Registered: </span> <b>%{PlayerNum}%</b></p>
</div>
<div class="legal"><a href="/guidelines" id="terms">Terms and Conditions</a> / <a href="/privacy" id="privacy">Privacy Policy</a></div>
</body>
</html>