-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhistory.html
143 lines (141 loc) · 6.32 KB
/
history.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
<!doctype html>
<html lang="en">
<head>
<title>Play History</title>
<link rel=”canonical” href=”https://webosu.online/”/>
<meta name="description" content="The unofficial web port of the rhythm game osu!">
<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/lib/localforage.min.js"></script>
<script defer data-domain="webosu.online" src="https://plausible.io/js/plausible.js"></script>
</head>
<!--Main Nav Bar-->
<body>
<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>
<!--Main Page-->
<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>
<table style="white-space: nowrap;">
<thead>
<tr>
<td>Song</td>
<td>Combo</td>
<td>Score</td>
<td>Accuracy</td>
<td>Mods Used</td>
<td>Time</td>
</tr>
</thead>
<tbody id="history-list">
<!-- will be filled in script -->
</tbody>
</table>
</div>
</div>
<script>
Date.prototype.customFormat = function (formatString) {
var YYYY, YY, MMMM, MMM, MM, M, DDDD, DDD, DD, D, hhhh, hhh, hh, h, mm, m, ss, s, ampm, AMPM, dMod, th;
var dateObject = this;
YY = ((YYYY = dateObject.getFullYear()) + "").slice(-2);
MM = (M = dateObject.getMonth() + 1) < 10 ? ('0' + M) : M;
MMM = (MMMM = ["January", "February", "March", "April", "May", "June", "July", "August", "September",
"October", "November", "December"
][M - 1]).substring(0, 3);
DD = (D = dateObject.getDate()) < 10 ? ('0' + D) : D;
DDD = (DDDD = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][dateObject
.getDay()
]).substring(0, 3);
th = (D >= 10 && D <= 20) ? 'th' : ((dMod = D % 10) == 1) ? 'st' : (dMod == 2) ? 'nd' : (dMod == 3) ?
'rd' : 'th';
formatString = formatString.replace("#YYYY#", YYYY).replace("#YY#", YY).replace("#MMMM#", MMMM).replace(
"#MMM#", MMM).replace("#MM#", MM).replace("#M#", M).replace("#DDDD#", DDDD).replace("#DDD#",
DDD).replace("#DD#", DD).replace("#D#", D).replace("#th#", th);
h = (hhh = dateObject.getHours());
if (h == 0) h = 24;
if (h > 12) h -= 12;
hh = h < 10 ? ('0' + h) : h;
hhhh = hhh < 10 ? ('0' + hhh) : hhh;
AMPM = (ampm = hhh < 12 ? 'am' : 'pm').toUpperCase();
mm = (m = dateObject.getMinutes()) < 10 ? ('0' + m) : m;
ss = (s = dateObject.getSeconds()) < 10 ? ('0' + s) : s;
return formatString.replace("#hhhh#", hhhh).replace("#hhh#", hhh).replace("#hh#", hh).replace("#h#", h)
.replace("#mm#", mm).replace("#m#", m).replace("#ss#", ss).replace("#s#", s).replace("#ampm#", ampm)
.replace("#AMPM#", AMPM);
}
//*** customFormat ends
var list = document.getElementById("history-list");
function addEntry(summary) {
let tr = document.createElement("tr");
list.appendChild(tr);
function nexttd(content) {
let td = document.createElement("td");
tr.appendChild(td);
if (content.tagName)
td.appendChild(content);
else
td.innerText = content;
}
let title = document.createElement("a");
title.innerText = summary.title + " [" + summary.version + "]";
title.href = "search.html?q=" + (summary.sid || summary.title);
nexttd(title);
nexttd(summary.combo);
nexttd(summary.score);
nexttd(summary.grade);
nexttd(summary.mods);
nexttd(new Date(summary.time).customFormat("#D# #MMM# #hhhh#:#mm#"));
}
if (window.localforage) {
localforage.getItem("playhistory1000", function (err, item) {
if (!err && item && item.length) {
item = item.reverse();
for (let i = 0; i < item.length; ++i) {
addEntry(item[i]);
}
}
})
} 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>