chore: Prettified Code
[ci skip]
This commit is contained in:
parent
167893e890
commit
db0316963c
2 changed files with 24 additions and 21 deletions
|
@ -1903,17 +1903,20 @@ const app = new Vue({
|
||||||
this.search.hints = [];
|
this.search.hints = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let hints = await (await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/search/suggestions?term=${this.search.term}`,
|
let hints = await (
|
||||||
{"fields[albums]": "artwork,name,playParams,url,artistName,id",
|
await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/search/suggestions?term=${this.search.term}`, {
|
||||||
|
"fields[albums]": "artwork,name,playParams,url,artistName,id",
|
||||||
"fields[artists]": "url,name,artwork,id",
|
"fields[artists]": "url,name,artwork,id",
|
||||||
"fields[songs]": "artwork,name,playParams,url,artistName,id",
|
"fields[songs]": "artwork,name,playParams,url,artistName,id",
|
||||||
"kinds": "terms,topResults",
|
kinds: "terms,topResults",
|
||||||
"l": this.mklang,
|
l: this.mklang,
|
||||||
"limit[results:terms]": 5,
|
"limit[results:terms]": 5,
|
||||||
"limit[results:topResults]": 5,
|
"limit[results:topResults]": 5,
|
||||||
"omit[resource]": "autos",
|
"omit[resource]": "autos",
|
||||||
"platform": "web",
|
platform: "web",
|
||||||
"types": "activities,albums,artists,editorial-items,music-movies,playlists,record-labels,songs,stations"})).data.results;
|
types: "activities,albums,artists,editorial-items,music-movies,playlists,record-labels,songs,stations",
|
||||||
|
})
|
||||||
|
).data.results;
|
||||||
this.search.hints = hints ? hints.suggestions : [];
|
this.search.hints = hints ? hints.suggestions : [];
|
||||||
},
|
},
|
||||||
getSongProgress() {
|
getSongProgress() {
|
||||||
|
@ -3900,20 +3903,20 @@ const app = new Vue({
|
||||||
if (e.keyCode == "40") {
|
if (e.keyCode == "40") {
|
||||||
if (this.search.hints.length - 1 < this.search.cursor + 1) return;
|
if (this.search.hints.length - 1 < this.search.cursor + 1) return;
|
||||||
this.search.cursor++;
|
this.search.cursor++;
|
||||||
let item = this.search.hints[this.search.cursor]
|
let item = this.search.hints[this.search.cursor];
|
||||||
this.search.term = item.content ? (item.content?.attributes?.name ?? "") :item.displayTerm;
|
this.search.term = item.content ? item.content?.attributes?.name ?? "" : item.displayTerm;
|
||||||
} else if (e.keyCode == "38") {
|
} else if (e.keyCode == "38") {
|
||||||
if (this.search.cursor == 0) return;
|
if (this.search.cursor == 0) return;
|
||||||
this.search.cursor--;
|
this.search.cursor--;
|
||||||
let item = this.search.hints[this.search.cursor]
|
let item = this.search.hints[this.search.cursor];
|
||||||
this.search.term = item.content ? (item.content?.attributes?.name ?? "") :item.displayTerm;
|
this.search.term = item.content ? item.content?.attributes?.name ?? "" : item.displayTerm;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async searchQuery(term = this.search.term) {
|
async searchQuery(term = this.search.term) {
|
||||||
let self = this;
|
let self = this;
|
||||||
if (typeof term === "object") {
|
if (typeof term === "object") {
|
||||||
this.routeView(term)
|
this.routeView(term);
|
||||||
this.search.term = ""
|
this.search.term = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (term == "") {
|
if (term == "") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue