diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index ed97fc6..ed9323f 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19477,8 +19477,20 @@ class PlexMeetsHomeAssistant extends HTMLElement { const seasonElem = document.createElement('div'); seasonElem.className = 'seasonElem'; seasonElem.style.width = `${CSS_STYLE.width}px`; - seasonElem.style.height = `${CSS_STYLE.height}px`; + seasonElem.style.height = `${CSS_STYLE.height - 3}px`; seasonElem.style.backgroundImage = `url('${thumbURL}')`; + const interactiveArea = document.createElement('div'); + interactiveArea.className = 'interactiveArea'; + const playButton = document.createElement('button'); + playButton.name = 'playButton'; + playButton.addEventListener('click', event => { + event.stopPropagation(); + if (this.plex && this.playController) { + this.playController.play(seasonData.key.split('/')[3]); + } + }); + interactiveArea.append(playButton); + seasonElem.append(interactiveArea); seasonContainer.append(seasonElem); const seasonTitleElem = document.createElement('div'); seasonTitleElem.className = 'seasonTitleElem'; @@ -19491,8 +19503,9 @@ class PlexMeetsHomeAssistant extends HTMLElement { seasonContainer.addEventListener('click', event => { event.stopPropagation(); (async () => { - if (this.plex) { + if (this.plex && this.playController) { console.log(seasonData); + // this.playController.play(seasonData.key.split('/')[3]); console.log(await this.plex.getLibraryData(seasonData.key.split('/')[3])); } })(); diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index af682d9..318ee06 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -320,9 +320,23 @@ class PlexMeetsHomeAssistant extends HTMLElement { const seasonElem = document.createElement('div'); seasonElem.className = 'seasonElem'; seasonElem.style.width = `${CSS_STYLE.width}px`; - seasonElem.style.height = `${CSS_STYLE.height}px`; + seasonElem.style.height = `${CSS_STYLE.height - 3}px`; seasonElem.style.backgroundImage = `url('${thumbURL}')`; + const interactiveArea = document.createElement('div'); + interactiveArea.className = 'interactiveArea'; + + const playButton = document.createElement('button'); + playButton.name = 'playButton'; + playButton.addEventListener('click', event => { + event.stopPropagation(); + if (this.plex && this.playController) { + this.playController.play(seasonData.key.split('/')[3]); + } + }); + + interactiveArea.append(playButton); + seasonElem.append(interactiveArea); seasonContainer.append(seasonElem); const seasonTitleElem = document.createElement('div'); @@ -338,8 +352,9 @@ class PlexMeetsHomeAssistant extends HTMLElement { seasonContainer.addEventListener('click', event => { event.stopPropagation(); (async (): Promise => { - if (this.plex) { + if (this.plex && this.playController) { console.log(seasonData); + // this.playController.play(seasonData.key.split('/')[3]); console.log(await this.plex.getLibraryData(seasonData.key.split('/')[3])); } })();