Lyrics, search, and other fixes
- #LYRIC - Parse #LYRIC commands and apply them to all difficulties that do not have them - #LYRIC command now supports branches - Fix last #LYRIC at the end of the chart getting ignored - Fix the glitchy dragging and dropping of files on the custom song importing page - Fix Ctrl and Shift keys getting stuck on song select when switching tabs with Ctrl(+Shift)+Tab - Search - Fix the search box "random:yes" query to randomize the entire results and not just the first 50 - Add "all:yes" query to the search box to remove the result limit and display all of the results - Fix searching for an invalid query (like "cleared:yes" or ":") unexpectedly returning all the songs - Fix pressing Q then jumping to a song through search not unmuting the sound - Pressing the search key on mobile will hide the keyboard - Fix search tips changing rapidly when the window is resized - Use comments instead of `######` in the issue template so that the warning does not appear in the issue - Fix TJA MAKER: url between angle brackets not working - Add a check for Class field declarations in the browser support warning - Fix gpicker getting stuck if a network error occurs - Fix not being able to replace some assets using a "taiko-web assets" folder - Fix selectable song title not being aligned with the game if the game window is too wide - Allow plugin developers to use the "select" type for the settings options - It uses "options" array and "options_lang" object - Fix plugins not getting removed from the plugin list on syntax error - Fix error messages not working if a default plugin is broken - Fix the start of default plugins not stopping the page from loading on error - Fix not being able to scroll the plugins screen on mobile
This commit is contained in:
@@ -49,9 +49,7 @@ class Search{
|
||||
var results = []
|
||||
var filters = {}
|
||||
|
||||
var querySplit = query.split(" ")
|
||||
var editedSplit = query.split(" ")
|
||||
querySplit.forEach(word => {
|
||||
var querySplit = query.split(" ").filter(word => {
|
||||
if(word.length > 0){
|
||||
var parts = word.toLowerCase().split(":")
|
||||
if(parts.length > 1){
|
||||
@@ -82,19 +80,23 @@ class Search{
|
||||
case "maker":
|
||||
case "diverge":
|
||||
case "random":
|
||||
case "all":
|
||||
filters[parts[0]] = parts[1]
|
||||
break
|
||||
default:
|
||||
return true
|
||||
}
|
||||
|
||||
editedSplit.splice(editedSplit.indexOf(word), 1)
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
query = this.normalizeString(editedSplit.join(" ").trim())
|
||||
query = this.normalizeString(querySplit.join(" ").trim())
|
||||
|
||||
var totalFilters = Object.keys(filters).length
|
||||
var random = false
|
||||
var allResults = false
|
||||
for(var i = 0; i < assets.songs.length; i++){
|
||||
var song = assets.songs[i]
|
||||
var passedFilters = 0
|
||||
@@ -169,6 +171,12 @@ class Search{
|
||||
passedFilters++
|
||||
}
|
||||
break
|
||||
case "all":
|
||||
if(value === "yes" || value === "no"){
|
||||
allResults = value === "yes"
|
||||
passedFilters++
|
||||
}
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
@@ -177,7 +185,7 @@ class Search{
|
||||
}
|
||||
}
|
||||
|
||||
var maxResults = totalFilters > 0 && !query ? 100 : 50
|
||||
var maxResults = allResults ? Infinity : (totalFilters > 0 && !query ? 100 : 50)
|
||||
|
||||
if(query){
|
||||
results = fuzzysort.go(query, results, {
|
||||
@@ -233,6 +241,15 @@ class Search{
|
||||
}
|
||||
}
|
||||
}
|
||||
if(random){
|
||||
var rand = Math.random() * -9000
|
||||
if(score0 !== -Infinity){
|
||||
score0 = rand
|
||||
}
|
||||
if(score1 !== -Infinity){
|
||||
score1 = rand
|
||||
}
|
||||
}
|
||||
if(a[0]){
|
||||
return a[1] ? Math.max(score0, score1) : score0
|
||||
}else{
|
||||
@@ -241,18 +258,18 @@ class Search{
|
||||
}
|
||||
})
|
||||
}else{
|
||||
if(random){
|
||||
for(var i = results.length - 1; i > 0; i--){
|
||||
var j = Math.floor(Math.random() * (i + 1))
|
||||
var temp = results[i]
|
||||
results[i] = results[j]
|
||||
results[j] = temp
|
||||
}
|
||||
}
|
||||
results = results.slice(0, maxResults).map(result => {
|
||||
return {obj: result}
|
||||
})
|
||||
}
|
||||
if(random){
|
||||
for(var i = results.length - 1; i > 0; i--){
|
||||
var j = Math.floor(Math.random() * (i + 1))
|
||||
var temp = results[i]
|
||||
results[i] = results[j]
|
||||
results[j] = temp
|
||||
}
|
||||
}
|
||||
|
||||
return results
|
||||
}
|
||||
@@ -402,7 +419,7 @@ class Search{
|
||||
|
||||
this.input = this.div.querySelector(":scope #song-search-input")
|
||||
this.input.setAttribute("placeholder", strings.search.searchInput)
|
||||
pageEvents.add(this.input, ["input"], this.onInput.bind(this))
|
||||
pageEvents.add(this.input, ["input"], () => this.onInput())
|
||||
|
||||
this.songSelect.playSound("se_pause")
|
||||
loader.screen.appendChild(this.div)
|
||||
@@ -484,6 +501,9 @@ class Search{
|
||||
var song = this.songSelect.songs.find(song => song.id === songId)
|
||||
this.remove()
|
||||
this.songSelect.playBgm(false)
|
||||
if(this.songSelect.previewing === "muted"){
|
||||
this.songSelect.previewing = null
|
||||
}
|
||||
|
||||
var songIndex = this.songSelect.songs.findIndex(song => song.id === songId)
|
||||
this.songSelect.setSelectedSong(songIndex)
|
||||
@@ -532,13 +552,15 @@ class Search{
|
||||
return ranges
|
||||
}
|
||||
|
||||
onInput(){
|
||||
onInput(resize){
|
||||
var text = this.input.value
|
||||
localStorage.setItem("lastSearchQuery", text)
|
||||
text = text.toLowerCase()
|
||||
|
||||
if(text.length === 0){
|
||||
this.setTip()
|
||||
if(!resize){
|
||||
this.setTip()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -623,6 +645,9 @@ class Search{
|
||||
this.proceed(parseInt(this.results[this.active].dataset.songId))
|
||||
}else{
|
||||
this.onInput()
|
||||
if(event.keyCode === 13 && this.songSelect.touchEnabled){
|
||||
this.input.blur()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user