diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 2612796..0ac1d19 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19411,13 +19411,14 @@ class PlexMeetsHomeAssistant extends HTMLElement { const seasonTitleElem = child.children[1]; const seasonEpisodesCount = child.children[2]; seasonElem.style.display = 'block'; - const moveElem = (seasonElem) => { - seasonElem.style.marginTop = '0'; - seasonElem.style.width = `${CSS_STYLE.width}px`; - seasonElem.style.height = `${CSS_STYLE.height - 3}px`; - seasonElem.style.zIndex = '3'; - seasonElem.style.marginLeft = `0px`; - seasonElem.dataset.clicked = 'false'; + const moveElem = (elem) => { + const seasonElemLocal = elem; + seasonElemLocal.style.marginTop = '0'; + seasonElemLocal.style.width = `${CSS_STYLE.width}px`; + seasonElemLocal.style.height = `${CSS_STYLE.height - 3}px`; + seasonElemLocal.style.zIndex = '3'; + seasonElemLocal.style.marginLeft = `0px`; + seasonElemLocal.dataset.clicked = 'false'; seasonTitleElem.style.display = 'block'; seasonEpisodesCount.style.display = 'block'; setTimeout(() => { @@ -19471,11 +19472,9 @@ class PlexMeetsHomeAssistant extends HTMLElement { } }; this.scrollDownInactiveSeasons = () => { - console.log('scrollDownInactiveSeasons'); if (this.seasonsElem) { lodash.forEach(this.seasonsElem.childNodes, child => { const seasonElem = child.children[0]; - console.log(seasonElem); const seasonTitleElem = child.children[1]; const seasonEpisodesCount = child.children[2]; if (seasonElem.dataset.clicked === 'false') { @@ -19513,6 +19512,7 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.detailElem.style.top = `${top}px`; this.detailElem.children[0].innerHTML = escapeHtml(data.title); this.detailElem.children[1].innerHTML = escapeHtml(data.year); + this.detailElem.children[1].dataset.year = escapeHtml(data.year); this.detailElem.children[2].innerHTML = `${(data.duration !== undefined ? `${Math.round(parseInt(escapeHtml(data.duration), 10) / 60 / 1000)} min` : '') + @@ -19592,10 +19592,19 @@ class PlexMeetsHomeAssistant extends HTMLElement { seasonElem.style.marginLeft = `-${getOffset(seasonElem).left - getOffset(this.activeMovieElem).left}px`; seasonTitleElem.style.color = 'rgba(255,255,255,0)'; seasonEpisodesCount.style.color = 'rgba(255,255,255,0)'; + if (this.detailElem) { + this.detailElem.children[1].innerHTML = seasonData.title; + } } else { this.minimizeSeasons(); this.activeMovieElem.style.top = `16px`; + if (this.detailElem && this.detailElem.children[1]) { + const { year } = this.detailElem.children[1].dataset; + if (year) { + this.detailElem.children[1].innerHTML = year; + } + } } } }); @@ -19616,7 +19625,6 @@ class PlexMeetsHomeAssistant extends HTMLElement { } } }, 200); - console.log(seasonsData); } }; this.showBackground = () => { diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index a5c9522..a2bcc6c 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -226,13 +226,14 @@ class PlexMeetsHomeAssistant extends HTMLElement { const seasonEpisodesCount = (child as HTMLElement).children[2] as HTMLElement; seasonElem.style.display = 'block'; - const moveElem = (seasonElem: HTMLElement) => { - seasonElem.style.marginTop = '0'; - seasonElem.style.width = `${CSS_STYLE.width}px`; - seasonElem.style.height = `${CSS_STYLE.height - 3}px`; - seasonElem.style.zIndex = '3'; - seasonElem.style.marginLeft = `0px`; - seasonElem.dataset.clicked = 'false'; + const moveElem = (elem: HTMLElement): void => { + const seasonElemLocal = elem; + seasonElemLocal.style.marginTop = '0'; + seasonElemLocal.style.width = `${CSS_STYLE.width}px`; + seasonElemLocal.style.height = `${CSS_STYLE.height - 3}px`; + seasonElemLocal.style.zIndex = '3'; + seasonElemLocal.style.marginLeft = `0px`; + seasonElemLocal.dataset.clicked = 'false'; seasonTitleElem.style.display = 'block'; seasonEpisodesCount.style.display = 'block'; setTimeout(() => { @@ -289,11 +290,9 @@ class PlexMeetsHomeAssistant extends HTMLElement { }; scrollDownInactiveSeasons = (): void => { - console.log('scrollDownInactiveSeasons'); if (this.seasonsElem) { _.forEach(this.seasonsElem.childNodes, child => { const seasonElem = (child as HTMLElement).children[0] as HTMLElement; - console.log(seasonElem); const seasonTitleElem = (child as HTMLElement).children[1] as HTMLElement; const seasonEpisodesCount = (child as HTMLElement).children[2] as HTMLElement; if (seasonElem.dataset.clicked === 'false') { @@ -335,6 +334,7 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.detailElem.children[0].innerHTML = escapeHtml(data.title); this.detailElem.children[1].innerHTML = escapeHtml(data.year); + (this.detailElem.children[1] as HTMLElement).dataset.year = escapeHtml(data.year); this.detailElem.children[2].innerHTML = `${(data.duration !== undefined ? `${Math.round( parseInt(escapeHtml(data.duration), 10) / 60 / 1000 @@ -432,9 +432,18 @@ class PlexMeetsHomeAssistant extends HTMLElement { seasonTitleElem.style.color = 'rgba(255,255,255,0)'; seasonEpisodesCount.style.color = 'rgba(255,255,255,0)'; + if (this.detailElem) { + (this.detailElem.children[1] as HTMLElement).innerHTML = seasonData.title; + } } else { this.minimizeSeasons(); this.activeMovieElem.style.top = `16px`; + if (this.detailElem && (this.detailElem.children[1] as HTMLElement)) { + const { year } = (this.detailElem.children[1] as HTMLElement).dataset; + if (year) { + (this.detailElem.children[1] as HTMLElement).innerHTML = year; + } + } } } }); @@ -460,8 +469,6 @@ class PlexMeetsHomeAssistant extends HTMLElement { } } }, 200); - - console.log(seasonsData); } };