|
|
@ -19588,6 +19588,7 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
this.token = document.createElement('paper-input');
|
|
|
|
this.token = document.createElement('paper-input');
|
|
|
|
this.port = document.createElement('paper-input');
|
|
|
|
this.port = document.createElement('paper-input');
|
|
|
|
this.maxCount = document.createElement('paper-input');
|
|
|
|
this.maxCount = document.createElement('paper-input');
|
|
|
|
|
|
|
|
this.maxRows = document.createElement('paper-input');
|
|
|
|
this.cardTitle = document.createElement('paper-input');
|
|
|
|
this.cardTitle = document.createElement('paper-input');
|
|
|
|
this.libraryName = document.createElement('paper-dropdown-menu');
|
|
|
|
this.libraryName = document.createElement('paper-dropdown-menu');
|
|
|
|
this.protocol = document.createElement('paper-dropdown-menu');
|
|
|
|
this.protocol = document.createElement('paper-dropdown-menu');
|
|
|
@ -19653,6 +19654,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
this.config.maxCount = this.maxCount.value;
|
|
|
|
this.config.maxCount = this.maxCount.value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lodash.isEmpty(this.maxRows.value)) {
|
|
|
|
|
|
|
|
this.config.maxRows = '';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
this.config.maxRows = this.maxRows.value;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (lodash.isEmpty(this.cardTitle.value)) {
|
|
|
|
if (lodash.isEmpty(this.cardTitle.value)) {
|
|
|
|
this.config.title = '';
|
|
|
|
this.config.title = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -19913,6 +19920,11 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
this.maxCount.type = 'number';
|
|
|
|
this.maxCount.type = 'number';
|
|
|
|
this.maxCount.addEventListener('change', this.valueUpdated);
|
|
|
|
this.maxCount.addEventListener('change', this.valueUpdated);
|
|
|
|
this.plexValidSection.appendChild(this.maxCount);
|
|
|
|
this.plexValidSection.appendChild(this.maxCount);
|
|
|
|
|
|
|
|
this.maxRows.label = 'Maximum number of rows to display (Optional)';
|
|
|
|
|
|
|
|
this.maxRows.value = this.config.maxRows;
|
|
|
|
|
|
|
|
this.maxRows.type = 'number';
|
|
|
|
|
|
|
|
this.maxRows.addEventListener('change', this.valueUpdated);
|
|
|
|
|
|
|
|
this.plexValidSection.appendChild(this.maxRows);
|
|
|
|
this.sort.innerHTML = '';
|
|
|
|
this.sort.innerHTML = '';
|
|
|
|
const sortItems = document.createElement('paper-listbox');
|
|
|
|
const sortItems = document.createElement('paper-listbox');
|
|
|
|
sortItems.slot = 'dropdown-content';
|
|
|
|
sortItems.slot = 'dropdown-content';
|
|
|
@ -20161,6 +20173,9 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
|
|
|
|
if (lodash.isNumber(this.config.maxCount)) {
|
|
|
|
if (lodash.isNumber(this.config.maxCount)) {
|
|
|
|
this.config.maxCount = `${this.config.maxCount}`;
|
|
|
|
this.config.maxCount = `${this.config.maxCount}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lodash.isNumber(this.config.maxRows)) {
|
|
|
|
|
|
|
|
this.config.maxRows = `${this.config.maxRows}`;
|
|
|
|
|
|
|
|
}
|
|
|
|
this.render();
|
|
|
|
this.render();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.configChanged = (newConfig) => {
|
|
|
|
this.configChanged = (newConfig) => {
|
|
|
@ -20906,6 +20921,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.previousPageWidth = 0;
|
|
|
|
this.previousPageWidth = 0;
|
|
|
|
this.runAfter = '';
|
|
|
|
this.runAfter = '';
|
|
|
|
this.columnsCount = 0;
|
|
|
|
this.columnsCount = 0;
|
|
|
|
|
|
|
|
this.renderedRows = 0;
|
|
|
|
this.renderedItems = 0;
|
|
|
|
this.renderedItems = 0;
|
|
|
|
this.maxRenderCount = false;
|
|
|
|
this.maxRenderCount = false;
|
|
|
|
this.seasonContainerClickEnabled = true;
|
|
|
|
this.seasonContainerClickEnabled = true;
|
|
|
@ -20921,6 +20937,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.config = {};
|
|
|
|
this.config = {};
|
|
|
|
this.loading = false;
|
|
|
|
this.loading = false;
|
|
|
|
this.maxCount = false;
|
|
|
|
this.maxCount = false;
|
|
|
|
|
|
|
|
this.maxRows = false;
|
|
|
|
this.error = '';
|
|
|
|
this.error = '';
|
|
|
|
this.contentBGHeight = 0;
|
|
|
|
this.contentBGHeight = 0;
|
|
|
|
this.initialDataLoaded = false;
|
|
|
|
this.initialDataLoaded = false;
|
|
|
@ -20929,9 +20946,11 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
const height = getHeight(this.content);
|
|
|
|
const height = getHeight(this.content);
|
|
|
|
if (!this.detailsShown &&
|
|
|
|
if (!this.detailsShown &&
|
|
|
|
window.innerHeight + window.scrollY > height + getOffset(this.content).top - 300 &&
|
|
|
|
window.innerHeight + window.scrollY > height + getOffset(this.content).top - 300 &&
|
|
|
|
this.renderedItems > 0) {
|
|
|
|
this.renderedItems > 0 &&
|
|
|
|
|
|
|
|
this.renderedItems < this.data[this.config.libraryName].length &&
|
|
|
|
|
|
|
|
(!this.maxRows || this.renderedRows < this.config.maxRows)) {
|
|
|
|
this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2);
|
|
|
|
this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2);
|
|
|
|
this.renderMovieElems();
|
|
|
|
this.renderPage();
|
|
|
|
this.calculatePositions();
|
|
|
|
this.calculatePositions();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -21248,7 +21267,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.searchValue = this.searchInputElem.value;
|
|
|
|
this.searchValue = this.searchInputElem.value;
|
|
|
|
this.renderPage();
|
|
|
|
this.renderPage();
|
|
|
|
this.focus();
|
|
|
|
this.focus();
|
|
|
|
this.renderNewElementsIfNeeded();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
searchContainer.appendChild(this.searchInputElem);
|
|
|
|
searchContainer.appendChild(this.searchInputElem);
|
|
|
@ -21262,11 +21280,13 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
// eslint-disable-next-line consistent-return
|
|
|
|
// eslint-disable-next-line consistent-return
|
|
|
|
let lastRowTop = 0;
|
|
|
|
let lastRowTop = 0;
|
|
|
|
const loadAdditionalRowsCount = 2; // todo: make this configurable
|
|
|
|
const loadAdditionalRowsCount = 2; // todo: make this configurable
|
|
|
|
|
|
|
|
this.renderedRows = 0;
|
|
|
|
|
|
|
|
this.columnsCount = 0;
|
|
|
|
const hasEpisodesResult = hasEpisodes(this.data[this.config.libraryName]);
|
|
|
|
const hasEpisodesResult = hasEpisodes(this.data[this.config.libraryName]);
|
|
|
|
// eslint-disable-next-line consistent-return
|
|
|
|
|
|
|
|
lodash.forEach(this.data[this.config.libraryName], (movieData) => {
|
|
|
|
lodash.forEach(this.data[this.config.libraryName], (movieData) => {
|
|
|
|
if ((!this.maxCount || this.renderedItems < this.maxCount) &&
|
|
|
|
if ((!this.maxCount || this.renderedItems < this.maxCount) &&
|
|
|
|
(!this.maxRenderCount || this.renderedItems < this.maxRenderCount)) {
|
|
|
|
(!this.maxRenderCount || this.renderedItems < this.maxRenderCount) &&
|
|
|
|
|
|
|
|
(!this.maxRows || this.renderedRows <= this.maxRows)) {
|
|
|
|
const movieElem = this.getMovieElement(movieData, hasEpisodesResult);
|
|
|
|
const movieElem = this.getMovieElement(movieData, hasEpisodesResult);
|
|
|
|
let shouldRender = false;
|
|
|
|
let shouldRender = false;
|
|
|
|
if (this.looseSearch) {
|
|
|
|
if (this.looseSearch) {
|
|
|
@ -21296,7 +21316,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.renderedItems += 1;
|
|
|
|
this.renderedItems += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (lastRowTop !== movieElem.getBoundingClientRect().top) {
|
|
|
|
if (shouldRender && lastRowTop !== movieElem.getBoundingClientRect().top) {
|
|
|
|
|
|
|
|
this.renderedRows += 1;
|
|
|
|
if (lastRowTop !== 0 && this.columnsCount === 0) {
|
|
|
|
if (lastRowTop !== 0 && this.columnsCount === 0) {
|
|
|
|
this.columnsCount = this.renderedItems - 1;
|
|
|
|
this.columnsCount = this.renderedItems - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -21305,10 +21326,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
this.maxRenderCount = this.renderedItems - 1 + this.columnsCount * loadAdditionalRowsCount;
|
|
|
|
this.maxRenderCount = this.renderedItems - 1 + this.columnsCount * loadAdditionalRowsCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.maxRows && this.renderedRows > this.maxRows) {
|
|
|
|
|
|
|
|
movieElem.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const contentbg = this.getElementsByClassName('contentbg')[0];
|
|
|
|
const contentbg = this.getElementsByClassName('contentbg')[0];
|
|
|
@ -22331,6 +22354,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
if (config.maxCount && config.maxCount !== '') {
|
|
|
|
if (config.maxCount && config.maxCount !== '') {
|
|
|
|
this.maxCount = config.maxCount;
|
|
|
|
this.maxCount = config.maxCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config.maxRows && config.maxRows !== '' && config.maxRows !== '0' && config.maxRows !== 0) {
|
|
|
|
|
|
|
|
this.maxRows = config.maxRows;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
this.maxRows = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (config.runBefore && !lodash.isEqual(config.runBefore, '')) {
|
|
|
|
if (config.runBefore && !lodash.isEqual(config.runBefore, '')) {
|
|
|
|
this.runBefore = config.runBefore;
|
|
|
|
this.runBefore = config.runBefore;
|
|
|
|
}
|
|
|
|
}
|
|
|
|