From cf4dddbb22ad6e47aaac424db4e4dc8c346dbc63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Sat, 2 Oct 2021 15:25:06 +0200 Subject: [PATCH] Add #43: Load songs in album --- dist/plex-meets-homeassistant.js | 10 ++++++++-- src/plex-meets-homeassistant.ts | 9 +++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 919bab2..fb56f77 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -22877,9 +22877,10 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.detailElem.children[1].innerHTML = childData.title; } (async () => { - if (childData.leafCount > 0 && this.plex) { + if (this.plex && (childData.leafCount > 0 || lodash.isEqual(childData.type, 'album'))) { this.episodesElemFreshlyLoaded = true; const episodesData = await this.plex.getLibraryData(childData.key.split('/')[3]); + console.log(episodesData); if (this.episodesElem) { this.episodesElemHidden = false; this.episodesElem.style.display = 'block'; @@ -22895,7 +22896,12 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.episodesLoadTimeout = setTimeout(() => { if (this.episodesElem) { this.episodesElem.style.transition = `0.7s`; - this.episodesElem.style.top = `${top + this.minExpandedHeight + 16}px`; + if (this.activeMovieElem) { + this.episodesElem.style.top = `${top + getHeight(this.activeMovieElem) + 16 * 2}px`; + } + else { + this.episodesElem.style.top = `${top + this.minExpandedHeight + 16}px`; + } this.resizeBackground(); } }, 200); diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index 37f57d5..875f917 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -1579,9 +1579,10 @@ class PlexMeetsHomeAssistant extends HTMLElement { (this.detailElem.children[1] as HTMLElement).innerHTML = childData.title; } (async (): Promise => { - if (childData.leafCount > 0 && this.plex) { + if (this.plex && (childData.leafCount > 0 || _.isEqual(childData.type, 'album'))) { this.episodesElemFreshlyLoaded = true; const episodesData = await this.plex.getLibraryData(childData.key.split('/')[3]); + console.log(episodesData); if (this.episodesElem) { this.episodesElemHidden = false; this.episodesElem.style.display = 'block'; @@ -1605,7 +1606,11 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.episodesLoadTimeout = setTimeout(() => { if (this.episodesElem) { this.episodesElem.style.transition = `0.7s`; - this.episodesElem.style.top = `${top + this.minExpandedHeight + 16}px`; + if (this.activeMovieElem) { + this.episodesElem.style.top = `${top + getHeight(this.activeMovieElem) + 16 * 2}px`; + } else { + this.episodesElem.style.top = `${top + this.minExpandedHeight + 16}px`; + } this.resizeBackground(); }