Bugfix for tag traversal in anime ID retrieval
This commit is contained in:
@ -289,8 +289,13 @@ export default class AudioPlayer {
|
|||||||
this.trackLink.href = "/soundtrack/" + track.id
|
this.trackLink.href = "/soundtrack/" + track.id
|
||||||
this.trackLink.textContent = track.title.canonical || track.title.native
|
this.trackLink.textContent = track.title.canonical || track.title.native
|
||||||
|
|
||||||
|
// Find anime ID by looking at the tags
|
||||||
let animeId = ""
|
let animeId = ""
|
||||||
|
|
||||||
|
if(!track.tags) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for(let tag of (track.tags as string[])) {
|
for(let tag of (track.tags as string[])) {
|
||||||
if(tag.startsWith("anime:")) {
|
if(tag.startsWith("anime:")) {
|
||||||
animeId = tag.split(":")[1]
|
animeId = tag.split(":")[1]
|
||||||
@ -298,16 +303,18 @@ export default class AudioPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set anime info
|
if(animeId === "") {
|
||||||
if(animeId !== "") {
|
return
|
||||||
this.animeInfo.classList.remove("hidden")
|
|
||||||
let animeResponse = await fetch("/api/anime/" + animeId)
|
|
||||||
let anime = await animeResponse.json() as Anime
|
|
||||||
this.animeLink.title = anime.title.canonical
|
|
||||||
this.animeLink.href = "/anime/" + anime.id
|
|
||||||
this.animeImage.dataset.src = "//media.notify.moe/images/anime/medium/" + anime.id + ".jpg?" + anime.image.lastModified.toString()
|
|
||||||
this.animeImage.classList.remove("hidden")
|
|
||||||
this.animeImage["became visible"]()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set anime info
|
||||||
|
this.animeInfo.classList.remove("hidden")
|
||||||
|
let animeResponse = await fetch("/api/anime/" + animeId)
|
||||||
|
let anime = await animeResponse.json() as Anime
|
||||||
|
this.animeLink.title = anime.title.canonical
|
||||||
|
this.animeLink.href = "/anime/" + anime.id
|
||||||
|
this.animeImage.dataset.src = "//media.notify.moe/images/anime/medium/" + anime.id + ".jpg?" + anime.image.lastModified.toString()
|
||||||
|
this.animeImage.classList.remove("hidden")
|
||||||
|
this.animeImage["became visible"]()
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user