-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
171 lines (161 loc) · 5.17 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
<!DOCTYPE html>
<html>
<head>
<title>osu! Collection Exporter</title>
<script src="src/index.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=UA-155121908-1"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "UA-155121908-1");
</script>
<script>
window.addEventListener("load", function () {
var mapData;
var collectionData;
document.querySelector("#osudb").addEventListener("change", (input) => {
console.log(input);
let file = document.querySelector("#osudb").files[0];
let reader = new FileReader();
reader.readAsArrayBuffer(file);
reader.onload = function () {
buffer = reader.result;
mapData = new OsuDB(buffer);
if (collectionData && mapData) {
parseCollections();
}
};
reader.onerror = function () {
console.log(reader.error);
};
});
document
.querySelector("#collectiondb")
.addEventListener("change", (input) => {
let file = document.querySelector("#collectiondb").files[0];
let reader = new FileReader();
reader.readAsArrayBuffer(file);
reader.onload = function () {
buffer = reader.result;
collectionData = new CollectionDB(buffer);
if (collectionData && mapData) {
parseCollections();
}
};
reader.onerror = function () {
console.log(reader.error);
};
});
function parseCollections() {
maps = mapData.readBeatmaps();
collections = collectionData.readCollections();
collectionString = "";
for (var i = 0; i < collections.collections.length; i++) {
collectionString += collections.collections[i].name + "\n";
for (var j = 0; j < collections.collections[i].hashes.length; j++) {
if (collections.collections[i].hashes[j] in maps) {
var map = maps[collections.collections[i].hashes[j]];
var url = "Beatmap Url Unavailable";
if (map.beatmap_id != 0)
url = `https://osu.ppy.sh/beatmaps/${map.beatmap_id}`;
collectionString += `${map.song_title}: ${map.difficulty}: ${url}\n`;
}
}
collectionString += "\n";
}
document.querySelector("#paragraph").value = collectionString;
}
});
</script>
<style>
@import url("https://fonts.googleapis.com/css2?family=Lato&display=swap");
body {
margin: 0;
font-family: Lato;
background-color: #decfe0;
}
#heading {
background-color: #e660ab;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
color: white;
line-height: 13px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2),
0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
#container {
display: flex;
justify-content: center;
}
#content {
background-color: white;
padding: 20px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2),
0 6px 20px 0 rgba(0, 0, 0, 0.19);
width: 750px;
height: 100%;
}
.upload {
border: gray;
}
#fork {
position: absolute;
}
#paragraph {
width: 100%;
height: 500px;
}
</style>
</head>
<body>
<a href="https://github.com/jaasonw/osu-collection-exporter" id="fork"
><img
loading="lazy"
width="149"
height="149"
src="https://github.blog/wp-content/uploads/2008/12/forkme_left_darkblue_121621.png?resize=149%2C149"
class="attachment-full size-full"
alt="Fork me on GitHub"
data-recalc-dims="1"
/></a>
<div id="heading">
<h1>osu! Collection Exporter</h1>
<h3>Created by jasonw</h3>
</div>
<div id="container">
<div id="content">
<h2>Step 1: Upload your osu!.db file</h2>
<div class="upload">
<input id="osudb" type="file" />
</div>
<div class="upload">
<h2>Step 2: Upload your collection.db file</h2>
</div>
<input id="collectiondb" type="file" />
<br />
<br />
NOTE: This entire process is performed locally on your browser and
nothing is ever uploaded to our servers
<br />
<textarea id="paragraph"></textarea>
<br />
<br />
If you enjoy this project and would like to support me, you can do so
<a href="https://ko-fi.com/wayson">here</a>
<br />
If did not enjoy this project and/or would like to help make it better
then shoot me a bug report or a pull request
<a href="https://github.com/jaasonw/osu-collection-exporter">here</a>
</div>
</div>
</body>
</html>