Add: Play button for seasons

pull/16/head
Juraj Nyíri 4 years ago
parent 42e7782ca0
commit c6288deb93

@ -19477,8 +19477,20 @@ class PlexMeetsHomeAssistant extends HTMLElement {
const seasonElem = document.createElement('div'); const seasonElem = document.createElement('div');
seasonElem.className = 'seasonElem'; seasonElem.className = 'seasonElem';
seasonElem.style.width = `${CSS_STYLE.width}px`; 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}')`; 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); seasonContainer.append(seasonElem);
const seasonTitleElem = document.createElement('div'); const seasonTitleElem = document.createElement('div');
seasonTitleElem.className = 'seasonTitleElem'; seasonTitleElem.className = 'seasonTitleElem';
@ -19491,8 +19503,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
seasonContainer.addEventListener('click', event => { seasonContainer.addEventListener('click', event => {
event.stopPropagation(); event.stopPropagation();
(async () => { (async () => {
if (this.plex) { if (this.plex && this.playController) {
console.log(seasonData); console.log(seasonData);
// this.playController.play(seasonData.key.split('/')[3]);
console.log(await this.plex.getLibraryData(seasonData.key.split('/')[3])); console.log(await this.plex.getLibraryData(seasonData.key.split('/')[3]));
} }
})(); })();

@ -320,9 +320,23 @@ class PlexMeetsHomeAssistant extends HTMLElement {
const seasonElem = document.createElement('div'); const seasonElem = document.createElement('div');
seasonElem.className = 'seasonElem'; seasonElem.className = 'seasonElem';
seasonElem.style.width = `${CSS_STYLE.width}px`; 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}')`; 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); seasonContainer.append(seasonElem);
const seasonTitleElem = document.createElement('div'); const seasonTitleElem = document.createElement('div');
@ -338,8 +352,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
seasonContainer.addEventListener('click', event => { seasonContainer.addEventListener('click', event => {
event.stopPropagation(); event.stopPropagation();
(async (): Promise<void> => { (async (): Promise<void> => {
if (this.plex) { if (this.plex && this.playController) {
console.log(seasonData); console.log(seasonData);
// this.playController.play(seasonData.key.split('/')[3]);
console.log(await this.plex.getLibraryData(seasonData.key.split('/')[3])); console.log(await this.plex.getLibraryData(seasonData.key.split('/')[3]));
} }
})(); })();

Loading…
Cancel
Save