From 403c07ae0bd434edb2a24e4041638a9f6472321c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Mon, 12 Jul 2021 14:28:40 +0200 Subject: [PATCH] no message --- dist/plex-meets-homeassistant.js | 35 ++++++++++++++++++++++++++++++++ src/editor.ts | 34 +++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 70affd5..245e13f 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19456,6 +19456,7 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.tabs = document.createElement('paper-tabs'); this.sort = document.createElement('paper-dropdown-menu'); this.sortOrder = document.createElement('paper-dropdown-menu'); + this.playTrailer = document.createElement('paper-dropdown-menu'); this.devicesTabs = 0; this.entities = []; this.sections = []; @@ -19500,6 +19501,15 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { } }); } + if (lodash.isEqual(this.playTrailer.value, 'Yes')) { + this.config.playTrailer = true; + } + else if (lodash.isEqual(this.playTrailer.value, 'No')) { + this.config.playTrailer = false; + } + else if (lodash.isEqual(this.playTrailer.value, 'Muted')) { + this.config.playTrailer = 'muted'; + } } if (!lodash.isEqual(this.config, originalConfig)) { console.log(this.config); @@ -19659,6 +19669,25 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { } } this.plexValidSection.appendChild(this.sortOrder); + this.playTrailer.innerHTML = ''; + const playTrailerItems = document.createElement('paper-listbox'); + playTrailerItems.appendChild(addDropdownItem('Yes')); + playTrailerItems.appendChild(addDropdownItem('Muted')); + playTrailerItems.appendChild(addDropdownItem('No')); + playTrailerItems.slot = 'dropdown-content'; + this.playTrailer.label = 'Play Trailer'; + this.playTrailer.appendChild(playTrailerItems); + this.playTrailer.style.width = '100%'; + this.playTrailer.addEventListener('value-changed', this.valueUpdated); + let playTrailerValue = 'Yes'; + if (lodash.isEqual(this.config.playTrailer, 'muted')) { + playTrailerValue = 'Muted'; + } + else if (!this.config.playTrailer) { + playTrailerValue = 'No'; + } + this.playTrailer.value = playTrailerValue; + this.plexValidSection.appendChild(this.playTrailer); let hasUIConfig = true; if (lodash.isArray(this.config.entity)) { // eslint-disable-next-line consistent-return @@ -19732,6 +19761,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { if (!config.sort) { this.config.sort = 'titleSort:asc'; } + if (!lodash.isNil(config.playTrailer)) { + this.config.playTrailer = config.playTrailer; + } + else { + this.config.playTrailer = true; + } this.render(); }; this.configChanged = (newConfig) => { diff --git a/src/editor.ts b/src/editor.ts index fe214ee..f39d83a 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -34,6 +34,8 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { sortOrder: any = document.createElement('paper-dropdown-menu'); + playTrailer: any = document.createElement('paper-dropdown-menu'); + devicesTabs = 0; hassObj: HomeAssistant | undefined; @@ -92,6 +94,13 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { } }); } + if (_.isEqual(this.playTrailer.value, 'Yes')) { + this.config.playTrailer = true; + } else if (_.isEqual(this.playTrailer.value, 'No')) { + this.config.playTrailer = false; + } else if (_.isEqual(this.playTrailer.value, 'Muted')) { + this.config.playTrailer = 'muted'; + } } if (!_.isEqual(this.config, originalConfig)) { console.log(this.config); @@ -266,6 +275,25 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { } this.plexValidSection.appendChild(this.sortOrder); + this.playTrailer.innerHTML = ''; + const playTrailerItems: any = document.createElement('paper-listbox'); + playTrailerItems.appendChild(addDropdownItem('Yes')); + playTrailerItems.appendChild(addDropdownItem('Muted')); + playTrailerItems.appendChild(addDropdownItem('No')); + playTrailerItems.slot = 'dropdown-content'; + this.playTrailer.label = 'Play Trailer'; + this.playTrailer.appendChild(playTrailerItems); + this.playTrailer.style.width = '100%'; + this.playTrailer.addEventListener('value-changed', this.valueUpdated); + let playTrailerValue = 'Yes'; + if (_.isEqual(this.config.playTrailer, 'muted')) { + playTrailerValue = 'Muted'; + } else if (!this.config.playTrailer) { + playTrailerValue = 'No'; + } + this.playTrailer.value = playTrailerValue; + this.plexValidSection.appendChild(this.playTrailer); + let hasUIConfig = true; if (_.isArray(this.config.entity)) { // eslint-disable-next-line consistent-return @@ -345,6 +373,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.config.sort = 'titleSort:asc'; } + if (!_.isNil(config.playTrailer)) { + this.config.playTrailer = config.playTrailer; + } else { + this.config.playTrailer = true; + } + this.render(); };