-
Notifications
You must be signed in to change notification settings - Fork 2
/
multiplayer.html
executable file
·278 lines (272 loc) · 10.6 KB
/
multiplayer.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Parking Master 3.0</title>
<style>
@font-face {
font-family: "GlacialIndifference";
src: url(fonts/GlacialIndifference.ttf);
}
body {
font-family: "Open Sans Light", Arial, Helvetica, sans-serif;
overflow: hidden !important;
background-image: url(./images/skid.png);
background-size: cover;
background-repeat: no-repeat;
background-color: #fff;
background-position-x: 15vw;
}
h1 {
font-family: "GlacialIndifference";
font-style: normal;
font-size: 7.638888888888889vw;
white-space: nowrap;
letter-spacing: 15px;
text-align: center;
color: #000;
}
h2 {
font-family: "GlacialIndifference";
font-style: normal;
font-size: 50px;
letter-spacing: 15px;
text-align: center;
margin: 0;
margin-bottom: -100px;
}
hr {
position: relative;
border: none !important;
outline: none !important;
height: 1px;
width: 27.77777777777778vw;
background: #000;
left: 50% !important;
margin-left: -475px;
margin-bottom: 100px;
}
button {
position: relative;
background: #fff;
border: 2px solid #000;
padding: 10px;
width: 200px;
height: 50px;
font-family: "Open Sans Light", Arial;
font-weight: 100;
font-size: 18px;
margin-left: 13.5%;
margin-bottom: 50px;
transition: transform .1s;
white-space: nowrap;
color: #333 !important;
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.24);
}
button:hover {
transform: scale(1.1);
cursor: pointer;
}
#link-container {
position: absolute;
display: block;
margin-top: 150px;
text-align: center;
width: 200px;
left: 50%;
margin-left: -100px;
}
#link-container br {
margin-bottom: 25px;
}
a {
color: #000;
text-decoration: none;
border-bottom: 1px solid currentColor;
filter: invert(1);
mix-blend-mode: difference;
}
.transition {
position: absolute;
left: -100%;
top: -50%;
width: 100%;
background: #fff;
border-radius: 100%;
z-index: 9999;
object-fit: contain;
}
#multiplayer-frame {
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
border: none;
background: #fff;
display: none;
}
#play-frame {
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
border: none;
background: #fff;
display: none;
}
#vrs {
position: absolute;
width: 72%;
left: 50%;
margin-left: -36%;
}
* {
user-select: none !important;
}
iframe {
z-index: 9999;
}
.swal-button {
color: #fff !important;
background: #333 !important;
width: unset !important;
box-shadow: none !important;
}
.swal-content__input {
border: 1px solid #333 !important;
}
.swal-modal {
border-radius: 1px;
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.24);
}
.lobby {
border-bottom: none !important;
text-decoration: none !important;
color: #000 !important;
}
</style>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script src="scripts/user/user.js"></script>
</head>
<body>
<style>body,html,*{cursor:none!important}#follower #circle1,#follower #circle2{cursor:none!important;position:absolute;border-radius:50%;height:0;width:0;margin-top:0;margin-left:0}*,body,html{cursor:none!important}#follower{position:absolute;top:50%;left:50%}#follower #circle1{-webkit-animation:2s infinite pulse;animation:2s infinite pulse;background:#fff}#follower #circle2{-webkit-animation:4s infinite pulse;animation:4s infinite pulse;background:rgba(0,0,0,.8)}@-moz-keyframes pulse{0%,100%{opacity:.2;height:1em;width:1em;margin-top:-.5em;margin-left:-.5em}50%{opacity:.9;height:3em;width:3em;margin-top:-1.5em;margin-left:-1.5em}}@-webkit-keyframes pulse{0%,100%{opacity:.2;height:1em;width:1em;margin-top:-.5em;margin-left:-.5em}50%{opacity:.9;height:3em;width:3em;margin-top:-1.5em;margin-left:-1.5em}}@-o-keyframes pulse{0%,100%{opacity:.2;height:1em;width:1em;margin-top:-.5em;margin-left:-.5em}50%{opacity:.9;height:3em;width:3em;margin-top:-1.5em;margin-left:-1.5em}}@keyframes pulse{0%,100%{opacity:.2;height:1em;width:1em;margin-top:-.5em;margin-left:-.5em}50%{opacity:.9;height:3em;width:3em;margin-top:-1.5em;margin-left:-1.5em}}</style>
<div id="follower" style="pointer-events:none;z-index:9997" class="cursor">
<div id="circle1"></div>
<div id="circle2"></div>
</div>
<script>(function(){var t,n,e,o;t=document.getElementById("follower"),document.getElementById("printout"),n=function(t){return t.clientX},e=function(t){return t.clientY},o=function(o){var u;return u={x:n(o),y:e(o)},t.style.top=u.y+"px",t.style.left=u.x+"px"},window.onmousemove=function(t){var n;return n=t,setTimeout((function(){return o(n)}),1)}}).call(this);</script>
<h1>MULTIPLAYER</h1>
<h2>3.0</h2>
<div id="link-container">
<a href="downloads">DOWNLOAD</a>
<br>
<a href="support.html">SUPPORT</a>
<br>
<a href="contact.html">CONTACT</a>
</div>
<img src="images/vrs.png" id="vrs">
<div style="margin-top:200px">
<button onclick="viewLobbies()">VIEW LOBBIES</button>
<button style="margin-left:0;position:absolute;margin-right:13.5%!important;right:0!important" onclick="index()">BACK</button>
<br>
<button onclick="createLobby()">CREATE LOBBY</button>
<button style="margin-left:0;position:absolute;margin-right:13.5%!important;right:0!important" onclick="location.reload()">REFRESH</button>
</div>
<img class="transition" src="images/wheel.png" />
<script>
function index() {
top.postMessage("rmframe", "*");
}
function createLobby() {
swal({
text: "Enter lobby name (2-16 characters):",
content: "input"
}).then((name) => {
if (name.length < 2 || name.length > 16) return swal("Lobby name is too short or too long").then(() => createLobby());
if (!/^[a-zA-Z]+$/.test(name)) return swal("Lobby name includes invalid characters").then(() => createLobby());
const Lobbies = Parse.Object.extend("Lobby");
const lobby = new Lobbies();
lobby.set("name", name);
lobby.set("createdAt", ((new Date).toString().split(" ").reverse().splice(4).reverse().join(" ").split(" ")[0] + ", ") + (new Date).toString().split(" ").reverse().splice(4).reverse().splice(1).join(" "));
lobby.save().then((result) => {
swal({
icon: "success",
text: "Your lobby has been created. To view your lobby, go to \"VIEW LOBBIES\" and join it. Please note that lobbies will only stay up for no longer than 1 week."
});
});
});
}
function timeConvert(e) {
const [hours, minutes, seconds] = e.split(":");
return `${(hours > 12) ? hours - 12 : hours}:${minutes}${seconds ? `:${seconds}` : ""} ${(hours >= 12) ? "PM" : "AM"}`;
}
function daysBetween(date1, date2) {
const ONE_DAY = 1000 * 60 * 60 * 24;
const differenceMs = Math.abs(date1 - date2);
return Math.round(differenceMs / ONE_DAY);
}
// Delete lobbies that are up for longer than a week
function viewLobbies() {
let content = document.createElement("div");
swal({
text: "Current lobbies:",
content: content
});
(async () => {
const AllLobbies = Parse.Object.extend("Lobby");
const activeLobbies = new Parse.Query(AllLobbies);
const lobbyResults = await activeLobbies.find();
for (let i = 0; i < lobbyResults.length; i++) {
const ActiveLobbies = Parse.Object.extend("Lobby");
const lobbies = new Parse.Query(ActiveLobbies);
lobbies.get(lobbyResults[i].id).then((lobbyName) => {
const lobby = { name: lobbyName.get("name"), time: lobbyName.get("createdAt") };
let date = ((lobby.time.toString().split(" ").splice(2)[0]));
let currentDate = (new Date()).getDate();
let compareDate = currentDate - date;
let time = parseFloat((lobby.time.toString().split(" ").splice(4)[0]).split(":")[0]);
let currentTime = (new Date()).getHours();
let dateList = {};
dateList.days = compareDate;
if ((dateList.days >= 7 || (dateList.days == 7 && currentTime > time))) {
lobbies.get(lobbyResults[i].id).then((data) => {
data.destroy().then((data) => {
}, (error) => {
// The delete failed.
// error is a Parse.Error with an error code and message.
})
}, (error) => {
// The object was not retrieved successfully.
});
}
content.innerHTML += `
<a class="lobby" href="lobby.html?channel=${lobby.name}">> ${lobby.name} <small>Created ${daysBetween(lobby.time, new Date()) <= 0 ? "today" : daysBetween(lobby.time, new Date()) <= 1 ? "yesterday" : daysBetween(lobby.time, new Date()) + " days ago"} at ${timeConvert(lobby.time.toLocaleString().split(" ")[1].split(":").reverse().splice(1).reverse().join(":"))}</small></a>
<br>
`;
if (i + 1 >= lobbyResults.length) {
content.innerHTML += `
<br>
<br>
<small><i><a href="/support.html#lobbies">What are these for?</a></i></small>
`;
}
}, (error) => {
// The object was not retrieved successfully.
});
}
})();
}
</script>
</body>
</html>