From bd4b89dc263d53a730fc3c4eccc8ddea8b301510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Wed, 5 May 2021 19:14:24 +0200 Subject: [PATCH] Fix: Clicking on opened entry does not close seasons and is not clickable --- dist/plex-meets-homeassistant.js | 14 ++++++-------- src/plex-meets-homeassistant.ts | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index dc6fb02..1e59203 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19595,9 +19595,10 @@ class PlexMeetsHomeAssistant extends HTMLElement { contentbg[0].style.zIndex = '1'; contentbg[0].style.backgroundColor = 'rgba(0,0,0,0)'; }; - this.activateMovieElem = (movieElem, minimize = true) => { + this.activateMovieElem = (movieElem) => { const movieElemLocal = movieElem; if (movieElem.dataset.clicked === 'true') { + this.minimizeAll(); this.activeMovieElem = undefined; this.hideDetails(); movieElemLocal.style.width = `${CSS_STYLE.width}px`; @@ -19606,19 +19607,16 @@ class PlexMeetsHomeAssistant extends HTMLElement { movieElemLocal.style.top = `${movieElem.dataset.top}px`; movieElemLocal.style.left = `${movieElem.dataset.left}px`; setTimeout(() => { - this.dataset.clicked = 'false'; + movieElemLocal.dataset.clicked = 'false'; }, 500); this.hideBackground(); } else { - console.log('TEST'); const doc = document.documentElement; const top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - if (minimize) { - this.minimizeAll(); - this.showDetails(this.activeMovieElemData); - this.showBackground(); - } + this.minimizeAll(); + this.showDetails(this.activeMovieElemData); + this.showBackground(); movieElemLocal.style.width = `${CSS_STYLE.expandedWidth}px`; movieElemLocal.style.height = `${CSS_STYLE.expandedHeight}px`; movieElemLocal.style.zIndex = '3'; diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index 431605d..264ef1e 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -441,9 +441,10 @@ class PlexMeetsHomeAssistant extends HTMLElement { (contentbg[0] as HTMLElement).style.backgroundColor = 'rgba(0,0,0,0)'; }; - activateMovieElem = (movieElem: HTMLElement, minimize = true): void => { + activateMovieElem = (movieElem: HTMLElement): void => { const movieElemLocal = movieElem; if (movieElem.dataset.clicked === 'true') { + this.minimizeAll(); this.activeMovieElem = undefined; this.hideDetails(); movieElemLocal.style.width = `${CSS_STYLE.width}px`; @@ -453,19 +454,16 @@ class PlexMeetsHomeAssistant extends HTMLElement { movieElemLocal.style.left = `${movieElem.dataset.left}px`; setTimeout(() => { - this.dataset.clicked = 'false'; + movieElemLocal.dataset.clicked = 'false'; }, 500); this.hideBackground(); } else { - console.log('TEST'); const doc = document.documentElement; const top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - if (minimize) { - this.minimizeAll(); - this.showDetails(this.activeMovieElemData); - this.showBackground(); - } + this.minimizeAll(); + this.showDetails(this.activeMovieElemData); + this.showBackground(); movieElemLocal.style.width = `${CSS_STYLE.expandedWidth}px`; movieElemLocal.style.height = `${CSS_STYLE.expandedHeight}px`; movieElemLocal.style.zIndex = '3';