Return to correct artist tab category when going back

This commit is contained in:
RemixDev 2020-06-13 11:14:11 +02:00
parent b0d233da28
commit b5021e12e3
3 changed files with 9 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -50,6 +50,9 @@ const ArtistTab = new Vue({
changeTab(tab) {
this.currentTab = tab
},
getCurrentTab() {
return this.currentTab
},
checkNewRelease(date) {
let g1 = new Date()
let g2 = new Date(date)
@ -65,7 +68,7 @@ const ArtistTab = new Vue({
this.image = picture_xl
this.type = 'Artist'
this.link = `https://www.deezer.com/artist/${id}`
this.currentTab = Object.keys(releases)[0]
if (this.currentTab === '') this.currentTab = Object.keys(releases)[0]
this.sortKey = 'release_date'
this.sortOrder = 'desc'
this.head = [

View File

@ -238,6 +238,7 @@ function showTab(type, id, back = false) {
if (windows_stack.length == 0) {
windows_stack.push({ tab: main_selected })
} else if (!back) {
if (currentStack.type === 'artist') currentStack.selected = ArtistTab.getCurrentTab()
windows_stack.push(currentStack)
}
@ -258,10 +259,12 @@ function backTab() {
document.getElementById(`main_${main_selected}link`).click()
} else {
// Retrieving tab type and tab id
let { type, id } = windows_stack.pop()
let data = windows_stack.pop()
let { type, id } = data
if (type === 'artist') {
ArtistTab.reset()
if (data.selected) ArtistTab.changeTab(data.selected)
} else {
TracklistTab.reset()
}