mirror of
https://github.com/yuukiwww/taiko-web.git
synced 2024-10-22 17:05:49 +02:00
fix for search.js split
This commit is contained in:
parent
7d3cff5cbe
commit
f4f0081e3d
@ -33,6 +33,18 @@ class Search{
|
|||||||
loader.screen.appendChild(this.style)
|
loader.screen.appendChild(this.style)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
normalizeString(string){
|
||||||
|
string = string
|
||||||
|
.replace('’', '\'').replace('“', '"').replace('”', '"')
|
||||||
|
.replace('。', '.').replace(',', ',').replace('、', ',')
|
||||||
|
|
||||||
|
kanaPairs.forEach(pair => {
|
||||||
|
string = string.replace(pair[1], pair[0])
|
||||||
|
})
|
||||||
|
|
||||||
|
return string.normalize("NFKD").replace(/[\u0300-\u036f]/g, "")
|
||||||
|
}
|
||||||
|
|
||||||
perform(query){
|
perform(query){
|
||||||
var results = []
|
var results = []
|
||||||
var filters = {}
|
var filters = {}
|
||||||
@ -79,7 +91,7 @@ class Search{
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
query = editedSplit.join(" ").trim().normalize("NFD").replace(/[\u0300-\u036f]/g, "")
|
query = this.normalizeString(editedSplit.join(" ").trim())
|
||||||
|
|
||||||
var totalFilters = Object.keys(filters).length
|
var totalFilters = Object.keys(filters).length
|
||||||
var random = false
|
var random = false
|
||||||
|
@ -94,12 +94,14 @@ class SongSelect{
|
|||||||
|
|
||||||
this.font = strings.font
|
this.font = strings.font
|
||||||
|
|
||||||
|
this.search = new Search(this)
|
||||||
|
|
||||||
this.songs = []
|
this.songs = []
|
||||||
for(let song of assets.songs){
|
for(let song of assets.songs){
|
||||||
var title = this.getLocalTitle(song.title, song.title_lang)
|
var title = this.getLocalTitle(song.title, song.title_lang)
|
||||||
song.titlePrepared = title ? fuzzysort.prepare(this.normalizeSearch(title)) : null
|
song.titlePrepared = title ? fuzzysort.prepare(this.search.normalizeString(title)) : null
|
||||||
var subtitle = this.getLocalTitle(title === song.title ? song.subtitle : "", song.subtitle_lang)
|
var subtitle = this.getLocalTitle(title === song.title ? song.subtitle : "", song.subtitle_lang)
|
||||||
song.subtitlePrepared = subtitle ? fuzzysort.prepare(this.normalizeSearch(subtitle)) : null
|
song.subtitlePrepared = subtitle ? fuzzysort.prepare(this.search.normalizeString(subtitle)) : null
|
||||||
this.songs.push(this.addSong(song))
|
this.songs.push(this.addSong(song))
|
||||||
}
|
}
|
||||||
this.songs.sort((a, b) => {
|
this.songs.sort((a, b) => {
|
||||||
@ -228,7 +230,6 @@ class SongSelect{
|
|||||||
this.currentSongCache = new CanvasCache(noSmoothing)
|
this.currentSongCache = new CanvasCache(noSmoothing)
|
||||||
this.nameplateCache = new CanvasCache(noSmoothing)
|
this.nameplateCache = new CanvasCache(noSmoothing)
|
||||||
|
|
||||||
this.search = new Search(this)
|
|
||||||
|
|
||||||
this.difficulty = [strings.easy, strings.normal, strings.hard, strings.oni]
|
this.difficulty = [strings.easy, strings.normal, strings.hard, strings.oni]
|
||||||
this.difficultyId = ["easy", "normal", "hard", "oni", "ura"]
|
this.difficultyId = ["easy", "normal", "hard", "oni", "ura"]
|
||||||
|
Loading…
Reference in New Issue
Block a user