-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathindex.html
418 lines (417 loc) · 28.1 KB
/
index.html
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FPS - 1v1 Multiplayer Shooter</title>
<style>
html {
cursor: url(./cursors/cursor1.png), auto !important;
min-height: 100%;
width: 100vw !important;
height: 100vh !important;
}
html, body {
font-family: Arial, Helvetica, sans-serif;
cursor: url(./cursors/cursor1.png), auto !important;
background-image: url(https://www.onlygfx.com/wp-content/uploads/2017/02/green-splatter-5.png), url(images/gun.png);
background-size: 50vw, 40vw;
background-repeat: no-repeat;
background-position: 0, 55vw;
background-color: #444;
user-select: none !important;
margin: 0 !important;
margin: 0 !important;
overflow: hidden !important;
}
body {
width: 100% !important;
height: 100% !important;
}
* {
cursor: url(./cursors/cursor1.png), auto !important;
}
.page-title {
position: relative;
text-align: center;
color: #333;
font-size: 60px;
font-weight: bold;
text-shadow: 2px 2px #25750a;
}
.page-text {
position: relative;
text-align: center;
color: #333;
font-size: 25px;
font-weight: 100;
}
button.button {
position: relative;
width: 150px;
text-align: center;
color: #333;
text-shadow: 0px 2px #25750a;
border: 2px solid #25750a;
background: #444;
padding: 10px;
font-weight: 600;
margin-bottom: 25px;
left: 50%;
margin-left: -75px;
cursor: default;
}
button.button:hover {
transform: scale(1.1);
}
.dialog-box .dialog-action,.dialog-box .dialog-content{right:0;border-top:1px solid #333;position:absolute;left:0}.dialog-box{background-color:#444;border:1px solid #333;-webkit-box-shadow:0 1px 5px rgba(0,0,0,.2);-mz-box-shadow:0 1px 5px rgba(0,0,0,.2);box-shadow:0 1px 5px rgba(0,0,0,.2);position:absolute;width:200px;height:100px;margin-top:-51px;margin-left:-101px;z-index:9999;color:#666;visibility:hidden;opacity:0}.dialog-box .dialog-title{margin:0;padding:0 .8em;font:inherit;color:inherit;font-weight:700;height:2em;line-height:2em;overflow:hidden;background-color:#333;cursor:move}.dialog-box .dialog-content{padding:1em;top:2em;bottom:3em;overflow:auto}.dialog-box .dialog-content iframe{display:block;border:none;background:0 0;margin:0;padding:0;overflow:auto;width:100%;height:100%}.dialog-box .dialog-content::-webkit-scrollbar{width:8px;height:8px;background-color:#444;border-left:1px solid #333}.dialog-box .dialog-content::-webkit-scrollbar-thumb{background-color:#666;border:none}.dialog-box .dialog-content::-webkit-scrollbar-thumb:hover{background-color:#555}.dialog-box .dialog-content::-webkit-scrollbar-thumb:active{background-color:#444}.dialog-box .dialog-action{bottom:0;height:2em;padding:.5em;background-color:#333;text-align:right}.dialog-box .dialog-action .btn{text-decoration:none;border:1px solid #444;outline:0;color:inherit;font-weight:700;background-color:#444;-webkit-border-radius:.2em;-moz-border-radius:.2em;border-radius:.2em;padding:.4em 1em;margin-left:.2em;line-height:2em;cursor:pointer}.dialog-box .dialog-close,.dialog-box .dialog-minmax{border:none;outline:0;background:0 0;font:inherit;font-family:Arial,Sans-Serif;font-style:normal;font-weight:700;font-size:150%;line-height:1.4em;color:#aaa;text-decoration:none;position:absolute;top:0;right:.3em;text-align:center;cursor:pointer}.dialog-box .dialog-minmax{right:1.5em}.dialog-box .dialog-action .btn:focus,.dialog-box .dialog-close:focus,.dialog-box .dialog-minmax:focus{border-width:0;outline:0}.dialog-box .dialog-close:hover,.dialog-box .dialog-minmax:hover{color:#444}.dialog-box .dialog-close:focus,.dialog-box .dialog-minmax:focus{color:#25750a}.dialog-box .dialog-close:active,.dialog-box .dialog-minmax:active{color:#444}.dialog-box .dialog-action .btn:hover{border-color:#333}.dialog-box .dialog-action .btn:focus{border-color:#333;border-width:1px}.dialog-box .dialog-action .btn:active{border-color:#333;background-color:#555}.dialog-box+.dialog-box-overlay{background-color:#000;opacity:.2;position:fixed!important;top:0;right:0;bottom:0;left:0;z-index:9997;display:none}.dialog-box.fixed-dialog-box{position:fixed!important}.dialog-box.minimize{width:2em!important;height:2em!important;overflow:hidden!important;margin-top:0!important;margin-left:0!important;top:-1px!important;left:1em!important}.dialog-box.minimize .dialog-title{color:transparent;text-shadow:none;text-indent:-9999px}.dialog-box.minimize .dialog-minmax{right:0;left:0}.dialog-box.minimize .dialog-action,.dialog-box.minimize .dialog-close,.dialog-box.minimize .dialog-content{display:none;visibility:hidden}
a {
color: #25750a !important;
text-decoration: underline;
}
.custom-anchor-tt {
display: none !important;
}
button[data-disabled] {
opacity: .5;
cursor: not-allowed !important;
transform: scale(1) !important;
pointer-events: none !important;
}
.tippy-box[data-theme~="default"] {
background: #444;
box-shadow: 0 0 5px 2px #25750a;
color: #25750a;
display: block !important;
}
.tippy-box[data-theme~="default"]:not([data-tippy-content]) {
display: none;
}
.tippy-box[data-theme~="default"][data-placement^="top"] > .tippy-arrow::before {
border-top-color: #444;
}
input {
background: #333 !important;
border: none;
color: #fff;
}
.swal-modal {
background: #444;
box-shadow: 0px 0px 10px 5px #ff4444;
}
.swal-modal * {
color: #ff4444;
}
.swal-button {
background: #ff4444 !important;
color: #333 !important;
box-shadow: none !important;
outline: none !important;
}
.loader {
position: absolute;
width: 100vw;
height: 100vh;
margin: 0;
background-color: #444;
display: flex;
justify-content: center;
align-items: center;
align-content: center;
margin: 0 !important;
left: 0 !important;
top: 0 !important;
right: 0 !important;
bottom: 0 !important;
z-index: 999999;
/* background-image: url(./images/spartan.png); */
background-repeat: no-repeat;
background-position: 50px 45%;
background-size: 25vw;
}
.loader-1 {
width: 8vmax;
height: 8vmax;
border-right: 4px solid #25750a;
border-radius: 100%;
animation: spinRight 800ms linear infinite;
margin: 0;
margin-top: -100px;
}
.loader-1:before, .loader-1:after {
content: "";
width: 6vmax;
height: 6vmax;
display: block;
position: absolute;
left: calc(50% - 3vmax);
border-left: 3px solid #25750a;
border-radius: 100%;
animation: spinLeft 800ms linear infinite;
}
.loader-1:after {
width: 4vmax;
height: 4vmax;
top: calc(50% - 2vmax);
left: calc(50% - 2vmax);
border: 0;
border-right: 2px solid #25750a;
animation: none;
}
@keyframes spinLeft {
from {
transform: rotate(0deg);
}
to {
transform: rotate(720deg);
}
}
@keyframes spinRight {
from {
transform: rotate(360deg);
}
to {
transform: rotate(0deg);
}
}
#login, #signup {
width: 75px;
height: 75px;
border-radius: 100%;
background: #333;
border: 3px solid #25750a;
color: #444;
text-shadow: 0 2px #25750a;
transition: border-color 1s, text-shadow 1s;
}
#login {
position: absolute;
left: 20px;
bottom: 20px;
}
#signup {
position: absolute;
right: 20px;
bottom: 20px;
}
#login:hover, #signup:hover {
border-color: #ff4444;
text-shadow: 0 2px #ff4444;
}
.status div, .status p {
display: inline-block;
margin-top: 0px;
}
.status {
position: absolute;
top: 50px;
right: 0;
width: 200px;
background: #333;
box-shadow: 0 0 0 3px #25750a;
text-align: center;
padding: 5px;
}
.status * {
color: #444 !important;
text-shadow: 2px 2px #25750a !important;
}
[data-inactive="true"] a {
color: #ff4444 !important;
}
</style>
<script type="text/javascript" src="https://npmcdn.com/parse/dist/parse.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/notiflix/Notiflix@latest/dist/notiflix-aio-3.2.7.min.js"></script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
</head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2ZQ6TMGVXJ"></script>
<script>
window.dataLayer=window.dataLayer||[];
function gtag(){dataLayer.push(arguments);}
gtag("js", new Date());
gtag("config", "G-2ZQ6TMGVXJ");
</script>
<body>
<div class="loader">
<div class="loader-1"></div>
<br>
<h2 style="font-size:20px;text-align:center;position:absolute;margin-top:100px;color:#25750a">LOADING<br></h2>
</div>
<div class="wrapper">
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/tippy.js@6"></script>
<script src="https://cdn.jsdelivr.net/gh/alvaromontoro/gamecontroller.js@latest/dist/gamecontroller.min.js"></script>
<h1 class="page-title">F-P-S</h1>
<h2 class="page-text">Multiplayer shooter</h2>
<br>
<button class="button" onclick="chooseMap()">CHOOSE MAP</button>
<br>
<button class="button" onclick="findLobby()">FIND LOBBY</button>
<br>
<button class="button" onclick='setDialog(`open`, { title: `Enter lobby name`, content: `Enter a name (2-10 characters):<input onkeyup="window.createlobbytext=this.value" /><br><a href="help.html#create-a-lobby">Need help?</a>` }, () => createLobby(createlobbytext))'>CREATE LOBBY</button>
<br>
<!-- <button class="button" onclick="chooseMap(startLocalGame)">SPLITSCREEN</button>
<br> -->
<button class="button" onclick="location.assign('chat.html')">CHAT</button>
<br>
<button class="button" onclick="help()">HELP</button>
<br>
<!-- <button class="button" onclick="chooseRandom()" data-disabled disabled>RANDOM MATCH</button> -->
<!-- <br> -->
<button class="button" onclick="desktopOptions()">OPTIONS</button>
<br>
<button class="button" onclick="location.assign('forge.html')//location.assign('https://github.com/Parking-Master/FPS')">FORGE</button>
</div>
<button onclick="location.assign('login.html')" id="login">LOG IN</button>
<button onclick="location.assign('signup.html')" id="signup">SIGN UP</button>
<div class="status">
<p>Current Points: <div class="currentPoints">0</div></p>
<p>Current Tier: <div class="currentTier">1</div></p>
<a href="users/" style="color:#25750a!important;text-shadow:none!important">See what you look like</a>
</div>
<script>
if (!localStorage["lobbies"]) localStorage.setItem("lobbies", 0);
currentFocus = null;
currentScroll = 0;
focusMax = null;
setInterval(() => {
for (let i = 0; i < document.querySelectorAll("a").length; i++) {
Object.values(document.querySelectorAll("a")[i].classList).indexOf("focus")>-1||document.querySelectorAll("a")[i].classList.add("focus");
}
for (let i = 0; i < document.querySelectorAll("button").length; i++) {
Object.values(document.querySelectorAll("button")[i].classList).indexOf("focus")>-1||document.querySelectorAll("button")[i].classList.add("focus");
}
for (let i = 0; i < document.querySelectorAll(".focus").length; i++) {
Object.values(document.querySelectorAll(".focus")[0].classList).indexOf("tabfocus"+i)>-1||document.querySelectorAll(".focus")[i].classList.add("tabfocus"+i);
focusMax = document.querySelectorAll(".focus").length - 1;
}
});
setInterval(() => {
if (!currentFocus && currentFocus != 0) { return }
document.querySelector(".tabfocus"+currentFocus).style.outline = "4px solid #eee";
for (let i = 0; i < Object.values(document.querySelectorAll(".focus")).filter(e => e !== document.querySelector(".tabfocus"+currentFocus)).length; i++) {
Object.values(document.querySelectorAll(".focus")).filter(e => e !== document.querySelector(".tabfocus"+currentFocus))[i].style.outline = "none";
}
});
Parse.initialize("qEK42aDtmQiBXmIoRdojDAYrKXGj5w4h2QnNRpYz","J4IK0gqf8rQS8G8Hg5LDbz0oEASJtRlUS2LPiRVg"),Parse.serverURL="https://parseapi.back4app.com/";
window.addEventListener("load", (e) => {
if (document.readyState == "complete" || document.readyState == "interactive") {
setTimeout(() => document.querySelector(".loader").remove(), 400);
}
if (new URLSearchParams(location.search).get("e")&&typeof (new URLSearchParams(location.search).get("e")-0)=="number"&&localStorage["username"]&&localStorage["password"]) {
pointsToAdd = new URLSearchParams(location.search).get("e")-0;
let user = Parse.User.logIn(localStorage["username"], localStorage["password"]).then(function(user) {
let currentPoints = user.get("currentPoints")-0;
user.set("currentPoints", currentPoints + pointsToAdd);
user.save().then((e) => { history.replaceState({},document.title,location.href.split("//").splice(1).join("//").includes("/")?"/":"?"), console.log(user.get("currentPoints")+" Points added to user "+user.get("username")) })
});
}
if (localStorage["username"]&&localStorage["password"]) {
pointsToAdd = new URLSearchParams(location.search).get("e")-0;
let user = Parse.User.logIn(localStorage["username"], localStorage["password"]).then(function(user) {
let currentPoints = user.get("currentPoints")-0;
let currentTier = currentPoints < 20 ? 1 : currentPoints < 50 ? 2 : currentPoints < 100 ? 3 : currentPoints < 200 ? 4 : currentPoints < 500 ? 5 : currentPoints > 500 && 6;
document.querySelector(".currentPoints").textContent = user.get("currentPoints").toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
document.querySelector(".currentTier").textContent = currentTier == 1 ? "1 (Rookie)" : currentTier == 2 ? "2 (Gunsmith)" : currentTier == 3 ? "3 (Expert)" : currentTier == 4 ? "4 (Intermediate)" : currentTier == 5 ? "5 (FPS Master)" : currentTier == 6 && "6 (Final Tier)";
});
document.querySelector("#login").textContent = "LOG OUT";
document.querySelector("#login").onclick = function() {
Parse.User.logOut();
localStorage.removeItem("username");
localStorage.removeItem("password");
location.reload(true);
}
} else {
document.querySelector(".status").remove();
}
});
Notiflix.Notify.init({clickToClose:true,showOnlyTheLastOne:true,timeout:100000000,info:{shadow:true,background:"#333",textColor:"#25750a",notiflixIconColor:"#25750a"}});
tippy("[data-tippy-content]");
// tippy("button")[0].show();
let Lobby = Parse.Object.extend("Lobby");
!function(e,i){var t,n,l=(new Date).getTime();t=i.createElement("div"),n=i.createElement("div"),t.className="dialog-box",t.id="dialog-box-"+l,t.innerHTML='<h3 class="dialog-title"> </h3><a class="dialog-minmax" title="Minimize" onclick="event.preventDefault()" href="javascript:void(0)">–</a><a class="dialog-close" title="Close" onclick="event.preventDefault()" href="javascript:void(0)">×</a><div class="dialog-content"> </div><div class="dialog-action"></div>',n.className="dialog-box-overlay",i.body.appendChild(t),i.body.appendChild(n);var o=!1,a=i.getElementById("dialog-box-"+l),s=a.children[0],c=a.children[1],d=a.children[2],p=a.children[3],r=a.children[4],f=a.nextSibling;function h(){o?(a.className+=" minimize",c.innerHTML="+",c.title=s.innerHTML.replace(/<.*?>/g,""),o=!1):(a.className=a.className.replace(/(^| )minimize($| )/g,""),c.innerHTML="–",c.title="Minimize",o=!0)}e.setDialog=function(t,n,z){var l=null,m=0,g=0,v=0,x=0,u={title:s.innerHTML,content:p.innerHTML,width:300,height:150,top:!1,left:!1,buttons:{Next:function(){setDialog("close"),z()}},specialClass:"",fixed:!0,overlay:!1};for(var b in n)u[b]=(n[b],n[b]);if(a.className="dialog-box "+(u.fixed?"fixed-dialog-box ":"")+u.specialClass,a.style.visibility="open"==t?"visible":"hidden",a.style.opacity="open"==t?1:0,a.style.width=u.width+"px",a.style.height=u.height+"px",a.style.top=u.top?"0px":"50%",a.style.left=u.left?"0px":"50%",a.style.marginTop=u.top?u.top+"px":"-"+u.height/2+"px",a.style.marginLeft=u.left?u.left+"px":"-"+u.width/2+"px",s.innerHTML=u.title,p.innerHTML=u.content,r.innerHTML="",f.style.display="open"==t&&u.overlay?"block":"none",u.buttons)for(var y in u.buttons){var M=i.createElement("a");M.className="btn",M.innerHTML=y,M.onclick=u.buttons[y],r.appendChild(M)}else r.innerHTML=" ";s.onmousedown=function(){var e;return e=this.parentNode,v=m-(l=e).offsetLeft,x=g-l.offsetTop,!1},c.innerHTML="–",c.title="Minimize",c.onclick=h,d.onclick=function(){setDialog("close",{content:""})},i.onmousemove=function(t){m=i.all?e.event.clientX:t.pageX,g=i.all?e.event.clientY:t.pageY,null!==l&&(l.style.left=u.left?m-v-u.left+"px":m-v+l.offsetWidth/2+"px",l.style.top=u.top?g-x-u.top+"px":g-x+l.offsetHeight/2+"px")},i.onmouseup=function(){l=null},o="open"==t}}(window,document);
function chooseMap(csf = null) {
setDialog('open', { title: 'Choose a map', content: '<button class="button" onclick="selectMap(\'Cargo\', this)">Cargo Port</button><br><!--<button class="button" onclick="selectMap(this)">Vertex</button><br><button class="button" onclick="selectMap(this)">Apex</button><br><button class="button" onclick="selectMap(this)">Everest</button><br>--><button class="button" onclick="selectMap(\'Ghost\', this)">Ghost City</button><!--<br><button class="button" onclick="selectMap(this)">Harvest</button><br>-->' }, csf ? csf : chooseMode);
}
function chooseMode(csf = null) {
setDialog('open', { title: 'Choose a game mode', content: '<button class="button" onclick="selectMode(\'Slayer\', this)">Slayer</button><br><button class="button" onclick="selectMode(\'Fiesta\', this)">Fiesta</button><br><button class="button" onclick="selectMode(\'Snipers\', this)">Snipers</button><br><button class="button" onclick="selectMode(\'RockNRail\', this)">Rock N\' Rail</button><br><button class="button" onclick="location.assign(\'practice.html\')">Practice</button>' }, csf ? csf : findLobby);
}
// function startLocalGame() {
// location.assign("./play.html?splitscreen=true&map="+selectedMap);
// }
selectedMap = "Cargo";
selectedMode = "Slayer";
function selectMap(map, el) {
selectedMap = map;
el.style.outline = "2px solid #999";
for(let i=0;i<(()=>{let g=Object.values(el.parentNode.children);g.splice(Object.values(el.parentNode.children).indexOf(el),1);return(g)})().length;i++){(()=>{let g=Object.values(el.parentNode.children);g.splice(Object.values(el.parentNode.children).indexOf(el),1);return(g)})()[i].style.outline="none"}
}
function parseDate(str) {
var mdy = str.split('/');
return new Date(mdy[2], mdy[0]-1, mdy[1]);
}
function datediff(first, second) {
return Math.round((second-first)/(1000*60*60*24));
}
function selectMode(mode, el) {
selectedMode = mode;
el.style.outline = "2px solid #999";
for(let i=0;i<(()=>{let g=Object.values(el.parentNode.children);g.splice(Object.values(el.parentNode.children).indexOf(el),1);return(g)})().length;i++){(()=>{let g=Object.values(el.parentNode.children);g.splice(Object.values(el.parentNode.children).indexOf(el),1);return(g)})()[i].style.outline="none"}
}
createlobbytext = "";
allowCustomArmor = true;
allowMultiMaps = false;
function createLobby(name) {
if (localStorage["limitDay"]) {
let dayfrom = localStorage["limitDay"];
let dayto = (new Date()).toLocaleDateString("en-US");
if (datediff(parseDate(dayfrom), parseDate(dayto)) >= 7) {
localStorage.setItem("lobbies", 0);
localStorage.removeItem("limitDay");
}
}
if ((localStorage["lobbies"] - 0) >= 3) return swal({
title: "Error",
text: "Your weekly lobby limit has exceeded. You have created 3 or more lobbies this week. Please wait until next week to create more lobbies."
}), !localStorage["limitDay"] && (localStorage["limitDay"] = (new Date()).toLocaleDateString("en-US"));
localStorage.setItem("lobbies", (localStorage["lobbies"] - 0) + 1);
if (name == "" || !name) { return; }
let lobby = new Lobby();
lobby.set("name", name);
setDialog(`open`, { title: `Specific options`, content: `All players options<br> - <input name="allowCustomArmor" type="checkbox" onclick="allowCustomArmor=this.checked" checked><label for="allowCustomArmor">Allow custom armor</label><br> - <input name="allowMultiMaps" type="checkbox" onclick="allowMultiMaps=this.checked"><label for="allowMultiMaps">Allow <a href="help.html#multimaps">multi-maps</a></label><br><br>In-Game options<br> - <label for="customTimeLimit">Time limit:</label><input name="customTimeLimit" type="number" style="width:15px;-moz-appearance:textfield!important" value="10" onkeyup="timeLimit=this.value.toString()"> minutes<br> - <label for="customScoreLimit">Score limit:</label><input name="customScoreLimit" type="number" style="width:15px;-moz-appearance:textfield!important" value="10" onkeyup="scoreLimit=this.value.toString()"> kills` }, () => {
lobby.set("active", false);
lobby.save().then(() => console.log("Lobby \"" + name.toString() + "\" saved with options:",{"allowCustomArmor":document.getElementsByName("allowCustomArmor")[0].checked,"allowMultiMaps":document.getElementsByName("allowMultiMaps")[document.getElementsByName.length-1].checked}), findLobby(name.toString(), () => { document.querySelector(".dialog-content").innerHTML += '<div class="lobby" id="'+btoa(encodeURIComponent(name.toString())).replace(/\=/gi,"")+'">"<a onclick="location.assign(\'./play.html?lobby='+encodeURIComponent(name.toString())+("&map="+(selectedMap||"Cargo"))+("&mode="+(selectedMode||"Slayer"))+'\')" style="border:2px solid #25750a">'+(name.toString().trim()==""?("(blank space)"):name.toString().trim())+'</a>" : '+(new Date).toString().split(" ").splice(1).reverse().splice(4).reverse().join(" ").split(":").reverse().splice(1).reverse().join(":")+"</div>", location.hash = btoa(encodeURIComponent(name.toString())).replace(/\=/gi,"") }));
});
}
function findLobby(l, addlobby = null) {
Notiflix.Notify.info("Loading lobbies...");
let islobbyadded=false;
(async()=>{let e=!1;const t=Parse.Object.extend("Lobby"),n=new Parse.Query(t),s=await n.find();for(let t=0;t<s.length;t++){const n=Parse.Object.extend("Lobby");new Parse.Query(n).get(s[t].id).then((t=>{const n={name:t.get("name"),time:t.get("createdAt"),active:t.get("active")};e?((!!addlobby&&!islobbyadded&&(islobbyadded=true,addlobby())),document.querySelector(".dialog-content").innerHTML+='<div class="lobby" id="'+btoa(encodeURIComponent(n.name)).replace(/\=/gi,"")+'">"<a '+(!n.active?'style="color:#ff4444!important"':'')+' onclick="location.assign(\'./play.html?lobby='+encodeURIComponent(n.name)+("&map="+(selectedMap||"Cargo"))+("&mode="+(selectedMode||"Slayer"))+'\')">'+(n.name.trim()==""?("(blank space)"):n.name.trim())+'</a>" : '+n.time.toString().split(" ").reverse().splice(4).reverse().splice(1).join(" ").split(":").reverse().splice(1).reverse().join(":")+"</div>"):(document.querySelector("#NotiflixNotifyWrap").children[0].click(),setDialog("open",{title:"Choose a map",content:'<i style="color:#333">Lobbies marked <span style="text-decoration:underline">red</span> are inactive.</i><br><div class="lobby" data-inactive="'+(n.inactive)+'" id="'+btoa(encodeURIComponent(n.name)).replace(/\=/gi,"")+'">"<a '+(!n.active?'style="color:#ff4444!important"':'')+' onclick="location.assign(\'./play.html?lobby='+encodeURIComponent(n.name)+("&map="+(selectedMap||"Cargo"))+("&mode="+(selectedMode||"Slayer"))+'\')">'+n.name+'</a>" : '+n.time.toString().split(" ").reverse().splice(4).reverse().splice(1).join(" ").split(":").reverse().splice(1).reverse().join(":")+"</div>"}, () => {})),e=!0}),(e=>{}))}})();
}
function chooseRandom() {
location.assign('./play.html?lobby='+["RandomLobby", "MyLobby", "Randomness"][Math.floor(Math.random()*3)]+'&map='+(chooseMap(()=>{}),document.querySelector(".dialog-box.fixed-dialog-box").style.display="none",(()=>{g=[];for(let i=0;i<document.querySelector(".dialog-content").innerHTML.split("<br>").length;i++){i>=5||g.push(document.querySelector(".dialog-content").innerHTML.split("<br>")[i].split("\">")[1].split("<")[0])}document.querySelector(".dialog-box.fixed-dialog-box").style.display="block";document.querySelector(".dialog-action").querySelector("a.btn").children[0].click();return g})()[Math.floor(Math.random()*document.querySelector(".dialog-content").innerHTML.split("<br>").length)]));
}
function desktopOptions() {
return location.assign("preferences.html");
console.log("#Electron:custom_options []");
}
function help() {
swal({
title: "Need help getting started?",
text: "FPS has a nice Documentation ready to go. You can look at it at bit.ly/FPSHelp, or www.fps5.uk.to/help.html",
buttons: ["Close", "Go"]
}).then(e => e && location.assign("help.html"));
}
window.addEventListener("load", () => { document.querySelector("head").innerHTML+="<style>.custom-anchor-tt{position:fixed;z-index:9999;display:none;background:#efefef;left:0;bottom:0;overflow:visible;padding:5px;font-size:18px;border-top-right-radius:5px;border-top:1px solid #999;border-right:1px solid #999;color:#999}a:hover+.custom-anchor-tt{display:block}</style>";for(let e=0;e<document.querySelectorAll("a").length;e++){let o=document.createElement("div");o.className="custom-anchor-tt",o.textContent=(document.querySelectorAll("a")[e].href.split("://")[0]=="http"?document.querySelectorAll("a")[e].href.substr(document.querySelectorAll("a")[e].href.indexOf("://")+3).replace(/(\/)$/g, ""):document.querySelectorAll("a")[e].href.replace(/(\/)$/g, ""));let r=document.querySelectorAll("a")[e].href;document.querySelectorAll("a")[e].addEventListener("click",(()=>location.href=r)),document.querySelectorAll("a")[e].removeAttribute("href"),function(){const e=arguments[0],o=arguments[1];e.parentNode.insertBefore(o,e.nextSibling)}(document.querySelectorAll("a")[e],o)} });
gameControl.on("connect", (controller) => {
window.controller = controller;
controller.on("button6", () => {}).before("button6", () => (currentFocus==null?currentFocus=0:(currentFocus<0?currentFocus=focusMax:currentFocus--)));
controller.on("button7", () => {}).before("button7", () => (currentFocus==null?currentFocus=0:(currentFocus+1>focusMax?currentFocus=0:currentFocus++)));
controller.on("button0", () => {}).before("button0", () => (currentFocus==null||document.querySelector(".tabfocus"+currentFocus).click()));
controller.on("right1", () => {typeof document.querySelector(".dialog-content")!="undefined"&&(document.querySelector(".dialog-content").scroll(0,currentScroll),currentScroll++)});
controller.on("left1", () => {typeof document.querySelector(".dialog-content")!="undefined"&&(document.querySelector(".dialog-content").scroll(0,currentScroll),currentScroll--)});
});
</script>
</body>
</html>