diff --git a/public/src/js/loader.js b/public/src/js/loader.js index 08d767d..6889a00 100644 --- a/public/src/js/loader.js +++ b/public/src/js/loader.js @@ -107,6 +107,14 @@ class Loader{ this.addPromise(this.ajax("/api/categories").then(categories => { assets.categories = JSON.parse(categories) + assets.categories.forEach(cat => { + let title = cat.title + // if(cat.title_lang){ + translations.categories[title] = cat.title_lang + // } + + }); + separateStrings() assets.categories.push({ title: "default", songSkin: { diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 504ead6..31f57c4 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -256,8 +256,7 @@ class SongSelect{ this.songSelect = document.getElementById("song-select") var cat = this.songs[this.selectedSong].category - var sort = cat in this.songSkin ? this.songSkin[cat].sort : 7 - this.drawBackground(cat, sort) + this.drawBackground(cat) this.previewId = 0 this.previewList = Array(5) @@ -1165,9 +1164,7 @@ class SongSelect{ if(this.songs[this.selectedSong].action !== "back"){ var cat = this.songs[this.selectedSong].category - var sort = cat in this.songSkin ? this.songSkin[cat].sort : 7 - - this.drawBackground(cat, sort) + this.drawBackground(cat) } } if(this.state.moveMS && ms < this.state.moveMS + changeSpeed){ @@ -2273,18 +2270,14 @@ class SongSelect{ } } - drawBackground(cat, sort){ + drawBackground(cat){ if(this.songSkin[cat] && this.songSkin[cat].bg_img){ let filename = this.songSkin[cat].bg_img.slice(0, this.songSkin[cat].bg_img.lastIndexOf(".")) this.songSelect.style.backgroundImage = "url('" + assets.image[filename].src + "')" }else{ - if(assets.image["bg_genre_" + sort]){ - this.songSelect.style.backgroundImage = "url('" + assets.image["bg_genre_" + sort].src + "')" - }else{ - this.songSelect.style.backgroundImage = "url('" + assets.image["bg_genre_def"].src + "')" + this.songSelect.style.backgroundImage = "url('" + assets.image["bg_genre_def"].src + "')" } } - } drawClosedSong(config){ var ctx = config.ctx diff --git a/public/src/js/strings.js b/public/src/js/strings.js index 9d99ff2..975ad44 100644 --- a/public/src/js/strings.js +++ b/public/src/js/strings.js @@ -47,52 +47,7 @@ var translations = { en: "Taiko no Tatsujin ©&™ 2011 BANDAI NAMCO Entertainment Inc." }, categories: { - "J-POP": { - ja: "J-POP", - en: "Pop", - cn: "流行音乐", - tw: "流行音樂", - ko: "POP" - }, - "アニメ": { - ja: "アニメ", - en: "Anime", - cn: "卡通动画音乐", - tw: "卡通動畫音樂", - ko: "애니메이션" - }, - "ボーカロイド™曲": { - ja: "ボーカロイド™曲", - en: "VOCALOID™ Music" - }, - "バラエティ": { - ja: "バラエティ", - en: "Variety", - cn: "综合音乐", - tw: "綜合音樂", - ko: "버라이어티" - }, - "クラシック": { - ja: "クラシック", - en: "Classical", - cn: "古典音乐", - tw: "古典音樂", - ko: "클래식" - }, - "ゲームミュージック": { - ja: "ゲームミュージック", - en: "Game Music", - cn: "游戏音乐", - tw: "遊戲音樂", - ko: "게임" - }, - "ナムコオリジナル": { - ja: "ナムコオリジナル", - en: "NAMCO Original", - cn: "NAMCO原创音乐", - tw: "NAMCO原創音樂", - ko: "남코 오리지널" - } + }, selectSong: { ja: "曲をえらぶ", @@ -1130,7 +1085,7 @@ function separateStrings(){ } var str = allStrings[lang] var translateObj = function(obj, name, str){ - if("en" in obj){ + if(obj != null && "en" in obj && obj["en"] != null){ for(var i in obj){ str[name] = obj[lang] || obj.en }