diff --git a/public/index.html b/public/index.html
index f6c9c49..44a11a4 100644
--- a/public/index.html
+++ b/public/index.html
@@ -49,6 +49,7 @@
+
diff --git a/public/src/js/element.js b/public/src/js/element.js
new file mode 100644
index 0000000..e38a7e6
--- /dev/null
+++ b/public/src/js/element.js
@@ -0,0 +1,49 @@
+function element(){
+ var parent
+ var lasttag
+ var createdtag
+ var toreturn={}
+ for(var i=0;i";
+ var song = assets.songs[i];
+ var songTitle = song.title;
+ var skipChars = [];
+ var charElements = [0]
+ var diffElements = [0]
+
for (var c=0; c -1) {
continue;
};
-
- var ch = songTitle.charAt(c) == ' ' ? ' ' : songTitle.charAt(c);
-
+
+ var ch = songTitle.charAt(c) == " " ? "\xa0" : songTitle.charAt(c);
+
var isApos = false;
- if (songTitle.charAt(c+1) == '\'') {
- ch = ch + '\'';
+ if (songTitle.charAt(c+1) == "'") {
+ ch = ch + "'";
skipChars.push(c+1);
isApos = true;
};
-
- var cl = ch == ' ' ? 'song-title-char song-title-space' : 'song-title-char';
- cl = isApos ? cl + ' song-title-apos' : cl;
-
- _code += '' + ch + '';
+
+ var cl = ch == "\xa0" ? "song-title-char song-title-space" : "song-title-char";
+ cl = isApos ? cl + " song-title-apos" : cl;
+
+ charElements.push(
+ ["span", {
+ class: cl,
+ alt: ch
+ }, ch]
+ )
};
- _code += "
";
for(var diff in _diffNames){
var diffName = diff;
- var diffLevel = songDifficulties[diff];
+ var diffLevel = song.stars[diff];
if (!diffLevel) {
continue;
}
- var starsDisplay="";
+ var starsDisplay = [0]
for(var x=1; x<=diffLevel; x++){
- starsDisplay+="★
";
+ starsDisplay.push("\u2605")
+ starsDisplay.push(["br"])
}
var diffTxt=_diffNames[diffName]
-
- _code += "- ";
- _code+= ""+diffTxt+"";
- _code+= ""+starsDisplay+"";
- _code += "
";
+
+ diffElements.push(
+ ["li", {
+ class: "difficulty " + diffName
+ },
+ ["span", {
+ class: "diffname"
+ }, diffTxt],
+ ["span", {
+ class: "stars"
+ }, starsDisplay]
+ ]
+ )
}
- _code += "
";
-
+ songElements.push(
+ ["div", {
+ id: "song-" + song.id,
+ class: "song",
+ "data-title": songTitle,
+ "data-song-id": song.id,
+ "data-preview": song.preview
+ },
+ ["div", {
+ class: /^[\x00-\xFF]*$/.test(songTitle) ? "song-title alpha-title" : "song-title"
+ }, charElements],
+ ["ul", {
+ class: "difficulties"
+ }, diffElements]
+ ]
+ )
}
- $("#song-container").html(_code);
+ element(
+ document.getElementById("song-container"),
+ songElements
+ )
$('.difficulty').hide();
}