From 858ea0a11ba106f289f1c081560cda07eb02fd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Fri, 21 May 2021 23:54:41 +0200 Subject: [PATCH] Fix: Case where active element would stay visible on season view --- dist/plex-meets-homeassistant.js | 15 ++++++++++++++- src/plex-meets-homeassistant.ts | 17 ++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 65ec53c..c8f6326 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19887,6 +19887,9 @@ class PlexMeetsHomeAssistant extends HTMLElement { } }; this.minimizeAll = () => { + if (this.activeMovieElem) { + this.activeMovieElem.style.display = `block`; + } this.activeMovieElem = undefined; for (let i = 0; i < this.movieElems.length; i += 1) { if (parseInt(this.movieElems[i].style.width, 10) > CSS_STYLE.width) { @@ -20073,6 +20076,11 @@ class PlexMeetsHomeAssistant extends HTMLElement { } seasonElem.dataset.clicked = 'true'; this.activeMovieElem.style.top = `${top - 1000}px`; + setTimeout(() => { + if (this.activeMovieElem) { + this.activeMovieElem.style.display = 'none'; + } + }, 500); this.scrollDownInactiveSeasons(); seasonContainer.style.top = `${-CSS_STYLE.expandedHeight}px`; seasonElem.style.width = `${CSS_STYLE.expandedWidth}px`; @@ -20161,7 +20169,12 @@ class PlexMeetsHomeAssistant extends HTMLElement { seasonContainer.style.top = `${seasonContainer.dataset.top}px`; this.minimizeSeasons(); this.hideEpisodes(); - this.activeMovieElem.style.top = `${top + 16}px`; + this.activeMovieElem.style.display = `block`; + setTimeout(() => { + if (this.activeMovieElem) { + this.activeMovieElem.style.top = `${top + 16}px`; + } + }, 10); if (this.detailElem && this.detailElem.children[1]) { const { year } = this.detailElem.children[1].dataset; if (year) { diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index 23b2c80..7069bfd 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -396,6 +396,10 @@ class PlexMeetsHomeAssistant extends HTMLElement { }; minimizeAll = (): void => { + if (this.activeMovieElem) { + this.activeMovieElem.style.display = `block`; + } + this.activeMovieElem = undefined; for (let i = 0; i < this.movieElems.length; i += 1) { if (parseInt(this.movieElems[i].style.width, 10) > CSS_STYLE.width) { @@ -603,6 +607,11 @@ class PlexMeetsHomeAssistant extends HTMLElement { seasonElem.dataset.clicked = 'true'; this.activeMovieElem.style.top = `${top - 1000}px`; + setTimeout(() => { + if (this.activeMovieElem) { + this.activeMovieElem.style.display = 'none'; + } + }, 500); this.scrollDownInactiveSeasons(); @@ -705,7 +714,13 @@ class PlexMeetsHomeAssistant extends HTMLElement { seasonContainer.style.top = `${seasonContainer.dataset.top}px`; this.minimizeSeasons(); this.hideEpisodes(); - this.activeMovieElem.style.top = `${top + 16}px`; + this.activeMovieElem.style.display = `block`; + setTimeout(() => { + if (this.activeMovieElem) { + this.activeMovieElem.style.top = `${top + 16}px`; + } + }, 10); + if (this.detailElem && (this.detailElem.children[1] as HTMLElement)) { const { year } = (this.detailElem.children[1] as HTMLElement).dataset; if (year) {