2.0
Juraj Nyíri 3 years ago
parent 46221d02a7
commit ab60645c52

@ -20448,6 +20448,7 @@ style.textContent = css `
class PlexMeetsHomeAssistant extends HTMLElement { class PlexMeetsHomeAssistant extends HTMLElement {
constructor() { constructor() {
super(...arguments); super(...arguments);
this.searchInputElem = document.createElement('input');
this.plexProtocol = 'http'; this.plexProtocol = 'http';
this.plexPort = false; this.plexPort = false;
this.detailsShown = false; this.detailsShown = false;
@ -20699,17 +20700,17 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.searchInput = () => { this.searchInput = () => {
const searchContainer = document.createElement('div'); const searchContainer = document.createElement('div');
searchContainer.className = 'searchContainer'; searchContainer.className = 'searchContainer';
const searchInput = document.createElement('input'); this.searchInputElem = document.createElement('input');
searchInput.type = 'text'; this.searchInputElem.type = 'text';
searchInput.value = this.searchValue; this.searchInputElem.value = this.searchValue;
searchInput.placeholder = `Search ${this.config.libraryName}...`; this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`;
searchInput.addEventListener('keyup', () => { this.searchInputElem.addEventListener('keyup', () => {
this.searchValue = searchInput.value; this.searchValue = this.searchInputElem.value;
this.renderPage(); this.renderPage();
this.focus(); this.focus();
this.renderNewElementsIfNeeded(); this.renderNewElementsIfNeeded();
}); });
searchContainer.appendChild(searchInput); searchContainer.appendChild(this.searchInputElem);
return searchContainer; return searchContainer;
}; };
this.renderMovieElems = () => { this.renderMovieElems = () => {
@ -20773,6 +20774,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.contentBGHeight = getHeight(contentbg); this.contentBGHeight = getHeight(contentbg);
}; };
this.renderPage = () => { this.renderPage = () => {
this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`;
if (this.card) { if (this.card) {
const marginRight = 10; // needs to be equal to .container margin right const marginRight = 10; // needs to be equal to .container margin right
const areaSize = this.card.offsetWidth - parseInt(this.card.style.paddingRight, 10) - parseInt(this.card.style.paddingLeft, 10); const areaSize = this.card.offsetWidth - parseInt(this.card.style.paddingRight, 10) - parseInt(this.card.style.paddingLeft, 10);

@ -29,6 +29,8 @@ declare global {
} }
class PlexMeetsHomeAssistant extends HTMLElement { class PlexMeetsHomeAssistant extends HTMLElement {
searchInputElem = document.createElement('input');
plexProtocol: 'http' | 'https' = 'http'; plexProtocol: 'http' | 'https' = 'http';
plexPort: number | false = false; plexPort: number | false = false;
@ -372,19 +374,19 @@ class PlexMeetsHomeAssistant extends HTMLElement {
const searchContainer = document.createElement('div'); const searchContainer = document.createElement('div');
searchContainer.className = 'searchContainer'; searchContainer.className = 'searchContainer';
const searchInput = document.createElement('input'); this.searchInputElem = document.createElement('input');
searchInput.type = 'text'; this.searchInputElem.type = 'text';
searchInput.value = this.searchValue; this.searchInputElem.value = this.searchValue;
searchInput.placeholder = `Search ${this.config.libraryName}...`; this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`;
searchInput.addEventListener('keyup', () => { this.searchInputElem.addEventListener('keyup', () => {
this.searchValue = searchInput.value; this.searchValue = this.searchInputElem.value;
this.renderPage(); this.renderPage();
this.focus(); this.focus();
this.renderNewElementsIfNeeded(); this.renderNewElementsIfNeeded();
}); });
searchContainer.appendChild(searchInput); searchContainer.appendChild(this.searchInputElem);
return searchContainer; return searchContainer;
}; };
@ -456,6 +458,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}; };
renderPage = (): void => { renderPage = (): void => {
this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`;
if (this.card) { if (this.card) {
const marginRight = 10; // needs to be equal to .container margin right const marginRight = 10; // needs to be equal to .container margin right
const areaSize = const areaSize =

Loading…
Cancel
Save