This commit is contained in:
vapormusic 2021-12-09 14:54:43 +07:00
commit e9b9b5087c
3 changed files with 58 additions and 2 deletions

View file

@ -61,6 +61,8 @@ const app = new Vue({
quickPlayQuery: "",
search: {
term: "",
hints: [],
showHints: false,
results: {},
limit: 10
},
@ -310,6 +312,13 @@ const app = new Vue({
'background': ('linear-gradient(to right, var(--keyColor) 0%, var(--keyColor) ' + value + '%, #333 ' + value + '%, #333 100%)')
}
},
async getSearchHints() {
if(this.search.term == "") {
this.search.hints = ""
}
let hints = await app.mkapi("searchHints", false, this.search.term)
this.search.hints = hints.terms
},
getSongProgress() {
if(this.playerLCD.userInteraction) {
return this.playerLCD.desiredDuration
@ -1257,8 +1266,11 @@ const app = new Vue({
break;
}
},
async searchQuery() {
async searchQuery(term = this.search.term) {
let self = this
if(term == "") {
return
}
this.mk.api.search(this.search.term,
{
types: "activities,albums,apple-curators,artists,curators,editorial-items,music-movies,music-videos,playlists,songs,stations,tv-episodes,uploaded-videos,record-labels",