-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
316 lines (315 loc) · 13.8 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
<!doctype html>
<html lang="en">
<head>
<title>Home</title>
<meta charset="UTF-8">
<link rel=”canonical” href=”https://webosu.online/”/>
<meta name="description" content="The unofficial web port of the rhythm game osu!">
<meta name="google-site-verification" content="lLznJ7kC5ONeKPxymEt_ecjm1iz-tDisk8TQcs-60vc">
<link rel="icon" href="assets/img/favicon.png">
<link rel="stylesheet" href="assets/css/picnic.min.css">
<link rel="stylesheet" href="assets/css/main.css">
<link rel="stylesheet" href="assets/css/font.css">
<script src="assets/js/launchgame.js"></script>
<script src="assets/js/downloader.js"></script>
<script src="assets/js/addbeatmaplist.js"></script>
<script src="assets/js/settings.js"></script>
<script src="assets/js/jsloader.js"></script>
<link rel="manifest" href="/manifest.json">
<script src="assets/js/lib/localforage.min.js"></script>
<script defer data-domain="webosu.online" src="https://plausible.io/js/plausible.js"></script>
<script src="assets/js/lib/fpsDebug.js"></script>
</head>
<body style="overflow-x: hidden;">
<video id="bgVideo" style="position: absolute; left: 50%; top:50%; min-width: 100%; min-height: 100%; width: auto; height: auto; transform: translate(-50%,-50%);"></video>
<div id="bgDimVideo" style="position: absolute; left: 0px; top:0px; background-color: rgba(0,0,0,1); width: 100vw; height: 100vh; display: none; opacity: 0;"></div>
<!--Game Area-->
<div class="game-area" id="game-area" hidden style="position: absolute;">
</div>
<div class="pause-menu" id="pause-menu" hidden>
<div class="paused-title">Paused</div>
<div class="button-list">
<div class="pausebutton continue" id="pausebtn-continue">
<div class="inner">Continue</div>
</div>
<div class="pausebutton retry" id="pausebtn-retry">
<div class="inner">Retry</div>
</div>
<div class="pausebutton quit" id="pausebtn-quit">
<div class="inner">Quit</div>
</div>
</div>
</div>
<div class="pause-menu" id="fail-menu" hidden>
<div class="paused-title">You Died!</div>
<div class="button-list">
<div class="pausebutton retry" id="failbtn-retry">
<div class="inner">Retry</div>
</div>
<div class="pausebutton quit" id="failbtn-quit">
<div class="inner">Quit</div>
</div>
</div>
</div>
<!--Nav Bar-->
<nav id="main-nav">
<div class="nav-link">
<a href="index.html" class="brand">webosu!</a>
<a href="new.html" class="pseudo button">New</a>
<a href="hot.html" class="pseudo button">Popular</a>
</div>
<div class="nav-search">
<form action="search.html">
<container id="searchbar" class="searchbar">
<input type="text" name="q" placeholder="Beatmap name or Set ID" />
</container>
</form>
</div>
<div class="nav-tool">
<a href="faq.html" class="pseudo button">FAQ</a>
<a href="local.html" class="pseudo button">Favorites</a>
<a href="settings.html" class="pseudo button">Settings</a>
<a onclick="document.documentElement.requestFullscreen();" class="pseudo button">F11</a>
</div>
</nav>
<div class="main-page" id="main-page">
<div class="main-content">
<div class="announcement">
Notice: API is now switched to <a href="https://catboy.best">Mino</a>!! For any issues join the <a href="https://discord.gg/v7wBtSdYzx">Discord</a>
</div>
<br>
<div class="index-area">
<h2>Live plays</h2>
<hr/>
<table>
<thead>
<tr>
<td>Player</td>
<td>Song</td>
<td>Combo</td>
<td>Score</td>
<td>Acc</td>
<td>Mods</td>
<td>Time</td>
</tr>
</thead>
<tbody id="activity-list">
<!--will be filled in by script-->
</tbody>
</table>
</div>
<div class="index-area">
<h2>Popular beatmaps</h2>
<a href="hot.html" class="more">See more Popular Beatmaps</a>
<hr/>
<div class="beatmap-list" id="beatmap-list-hot">
<!-- Beatmaps will be here -->
</div>
</div>
<div class="index-area">
<h2>Recently Played</h2>
<a href="history.html" class="more">See your play history</a>
<hr/>
<div class="beatmap-list" id="beatmap-list-history">
<!-- Beatmaps will be here -->
</div>
</div>
<div class="index-area">
<h2>kone's osu! client (some may not work/load)</h2>
<hr/>
<div class="beatmap-list" id="client-list">
<!-- Beatmaps will be here -->
</div>
</div>
<div class="index-area">
<h2>Favorited Beatmaps</h2>
<a href="local.html" class="more">See all favorited Beatmaps</a>
<hr/>
<div class="beatmap-list" id="beatmap-list-liked">
<!-- Beatmaps will be here -->
</div>
</div>
<div class="index-area">
<h2>Latest Beatmaps</h2>
<a href="new.html" class="more">See all latest Beatmaps</a>
<hr/>
<div class="beatmap-list" id="beatmap-list-new">
<!-- Beatmaps will be here -->
</div>
</div>
<div class="index-area">
<a onclick="genRandomList()" class="more" style="cursor:pointer;">Get new random Beatmaps</a>
<h2>Random Beatmaps<h2>
<hr/>
<div class="beatmap-list" id="beatmap-list-random">
<!-- to be filled in script -->
</div>
</div>
<!--Loader progress-->
<div class="statuslines" id="statuslines">
<div class="progress" id="script-progress">
Scripts
<div class="lds-dual-ring"></div>
</div>
<div class="progress" id="skin-progress">
Skin
<div class="lds-dual-ring"></div>
</div>
<div class="progress" id="sound-progress">
Hitsounds
<div class="lds-dual-ring"></div>
</div>
</div>
</div>
<!--Footer-->
<div class="footer">
<div class="footer-infos">
<span class="footer-info">Join the <a href="https://discord.gg/v7wBtSdYzx">Discord server</a>!</span>
<span class="footer-info">Beatmap API: <a href="https://catboy.best/">Mino</a></span>
<span class="footer-info">Stable Release: <a href="https://github.com/konekowo/webosu">3.0</a></span>
<span class="footer-info">Would not be possible without <a href="https://github.com/BlaNKtext/webosu">original webosu</a></span>
</div>
</div>
<script src="./import.js"></script>
<script>
// Live scores
let tbody = document.getElementById("activity-list");
function formattime(date) {
let m;
return date.getHours() + ":" + ((m = date.getMinutes()) < 10 ? ('0' + m) : m);
}
function showActivity(records) {
records = records.reverse();
while (tbody.firstChild)
tbody.removeChild(tbody.firstChild);
for (let i = 0; i < records.length && i < 10; ++i) {
let tr = document.createElement("tr");
tbody.appendChild(tr);
function nexttd(content) {
let td = document.createElement("td");
tr.appendChild(td);
if (!content) return;
if (content.tagName)
td.appendChild(content);
else
td.innerText = content;
}
let b = records[i].ip.split(".");
b[0] = "Player";
if (b.length > 3) b[3] = "Player";
nexttd(b.join("."));
let title = document.createElement("a");
title.innerText = records[i].title + " [" + records[i].version + "]";
title.title = records[i].title + " [" + records[i].version + "]";
if (records[i].sid == "undefined")
records[i].sid = undefined;
title.href = "search.html?q=" + (records[i].sid || records[i].title);
nexttd(title);
nexttd(records[i].combo + "x");
nexttd(parseInt(records[i].score).toLocaleString());
let acc = document.createElement("span");
acc.innerText = records[i].acc;
acc.className = records[i].grade;
nexttd(acc);
nexttd(records[i].mods);
nexttd(formattime(new Date(parseInt(records[i].time))));
}
}
let b = {
ip: "",
title: "",
version: "loading",
score: 0,
combo: 0,
acc: 0
};
showActivity([b, b, b, b, b, b, b, b, b, b])
async function refreshLivescore() {
const request = await fetch(`https://us-central1-webosu.cloudfunctions.net/app/get`)
const data = await request.json()
if(request.error) return console.log(request.error)
showActivity(data);
}
//refreshLivescore();
//window.setInterval(refreshLivescore, 5000);
// Recent
if (window.localforage) {
let listhistory = document.getElementById("beatmap-list-history");
localforage.getItem("playhistory1000", function (err, item) {
if (err) {
listhistory.innerText = "Failed to load your recently played";
return;
}
if (item && item.length) {
item = item.reverse();
sid = [];
for (let i = 0; i < item.length; ++i) {
if (item[i].sid)
sid.push(item[i].sid);
}
sid = [...new Set(sid)]; // uniq
for (let i = 0; i < 6 && i < sid.length; ++i){
addBeatmapSid(sid[i], listhistory)
}
} else {
listhistory.innerText =
"You haven't played any Beatmaps yet! Click on a Beatmap and select the difficulty to start playing!";
}
})
}
// Get new beatmaps
addBeatmapList("https://catboy.best/api/v2/search?amount=6&mode=0",
document.getElementById("beatmap-list-new"), true);
// Get random beatmaps
function genRandomList() {
// Wipe Random List
let list = document.getElementById("beatmap-list-random");
list.innerHTML = ''
// Re-fill Random List
let randquery = Math.random().toString(36).replace(/[^a-p]+/g, '').substr(1, 5);
addBeatmapList("https://catboy.best/api/v2/search?q=" + randquery + "&amount=6&mode=0", list, true)
}
genRandomList();
// Get hot beatmaps
addBeatmapList("https://catboy.best/api/v2/search?amount=6&mode=0&query=Top Rated", document.getElementById(
"beatmap-list-hot"), true);
// Favorite beatmaps
if (window.localforage) {
window.localforage.getItem("likedsidset", function (err, val) {
if (err) {
document.getElementById("beatmap-list-liked").innerText =
"Failed to load favorites list.";
return;
}
if (val && val.size) {
let listlike = document.getElementById("beatmap-list-liked");
list = Array.from(val);
for (let i = 0; i < list.length && i < 6; ++i){
addBeatmapSid(list[i], listlike);
}
} else {
document.getElementById("beatmap-list-liked").innerText =
"You haven't favorited any Beatmaps yet! Click on the heart in the lower right corner of the Beatmap to save it.";
}
});
} else {
alert("Oh no, localforage isn't supported on this browser")
}
</script>
</body>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.0.2/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.0.2/firebase-analytics.js";
const firebaseConfig = {
apiKey: "AIzaSyBJyrBf03GhNZbupO6uU-wtDTfAC_zY8_0",
authDomain: "webosu.firebaseapp.com",
projectId: "webosu",
storageBucket: "webosu.appspot.com",
messagingSenderId: "138250997417",
appId: "1:138250997417:web:be7407c18de702880763b8",
measurementId: "G-55J58MR5ZW"
};
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
</script>
</html>