-
+
{{ $strings.LabelSeason }} {{ group.season }}
{{ group.episodes.length }}
+
+ expand_more
+
-
-
-
-
-
+
+
+
@@ -104,7 +111,8 @@ export default {
episodeComponentRefs: {},
windowHeight: 0,
episodesTableOffsetTop: 0,
- episodeRowHeight: 176
+ episodeRowHeight: 176,
+ seasonGroups: {}
}
},
watch: {
@@ -112,6 +120,9 @@ export default {
handler() {
this.refresh()
}
+ },
+ episodesList() {
+ this.updateSeasonGroups();
}
},
computed: {
@@ -259,29 +270,41 @@ export default {
timeFormat() {
return this.$store.state.serverSettings.timeFormat
},
- groupedEpisodesBySeason() {
- if (this.podcastType !== 'serial') {
- return [];
+ },
+ methods: {
+ updateSeasonGroups() {
+ if (!this.episodesSorted.length) {
+ this.seasonGroups = {};
+ return;
}
- return this.episodesList.reduce((grouped, episode, index) => {
- let season = episode.season || 'unknown';
- const seasonGroup = grouped.find(group => group.season === season);
+ const grouped = this.episodesSorted.reduce((grouped, episode, index) => {
+ let season = Number(episode.season);
+ season = Number.isInteger(season) ? season : 'unknown';
+ const seasonGroup = grouped[season];
if (!seasonGroup) {
- grouped.push({
+ const newGroup = {
season,
- episodes: [index]
- });
+ episodes: [index],
+ showSeason: false
+ };
+ grouped[season] = newGroup;
} else {
seasonGroup.episodes.push(index);
}
return grouped;
- }, []).sort((a, b) => b.season - a.season);
- }
- },
- methods: {
+ }, {});
+
+ const sortedGrouped = Object.values(grouped).sort((a, b) => b.season - a.season);
+
+ if (sortedGrouped.length > 0) {
+ sortedGrouped[0].showSeason = true;
+ }
+
+ this.seasonGroups = sortedGrouped;
+ },
submit() {},
inputUpdate() {
clearTimeout(this.searchTimeout)
@@ -479,6 +502,9 @@ export default {
this.episodeComponentRefs = {}
this.episodeIndexesMounted = []
},
+ clickBar(group) {
+ group.showSeason = !group.showSeason
+ },
mountEpisode(index) {
const episodeEl = document.getElementById(`episode-${index}`)
if (!episodeEl) {