improve title display for english titles

This commit is contained in:
Bui 2018-08-27 17:58:55 +01:00
parent 4537386305
commit ad79a77c51
2 changed files with 27 additions and 1 deletions

View File

@ -107,3 +107,13 @@ html, body{
position: absolute;
top: 0px;
}
.alpha-title .song-title-char {
transform: scale(1.3, 1);
font-size: 80%;
line-height: 22px;
}
.song-title-apos {
padding-left: 4px;
}

View File

@ -147,11 +147,27 @@ function SongSelect(){
var songTitle = song.title;
var songTitleSpace = songTitle.replace(/ /g, ' ');
var songPreview = song.preview;
var skipChars = [];
_code += "<div id='song-"+songID+"' class='song' data-title='"+songTitle+"' data-song-id='"+songID+"' data-preview='"+songPreview+"'><div class='song-title'>";
var cl = /^[\x00-\xFF]*$/.test(songTitle) ? 'song-title alpha-title' : 'song-title';
_code += "<div id='song-"+songID+"' class='song' data-title='"+songTitle+"' data-song-id='"+songID+"' data-preview='"+songPreview+"'><div class='"+cl+"'>";
for (var c=0; c<songTitle.length; c++) {
if (skipChars.indexOf(c) > -1) {
continue;
};
var ch = songTitle.charAt(c) == ' ' ? '&nbsp;' : songTitle.charAt(c);
var isApos = false;
if (songTitle.charAt(c+1) == '\'') {
ch = ch + '\'';
skipChars.push(c+1);
isApos = true;
};
var cl = ch == '&nbsp;' ? 'song-title-char song-title-space' : 'song-title-char';
cl = isApos ? cl + ' song-title-apos' : cl;
_code += '<span class="' + cl + '" alt="' + ch + '">' + ch + '</span>';
};
_code += "</div><ul class='difficulties'>";