Fix: Progressive loading in cards

pull/16/head
Juraj Nyíri 4 years ago
parent b15c226e22
commit 364aede3e9

@ -19628,8 +19628,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.loadInitialData = async () => {
window.addEventListener('scroll', () => {
const loadAdditionalRowsCount = 2; // todo: make this configurable
const height = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
if (window.innerHeight + window.scrollY > height - 300 && this.renderedItems > 0) {
const height = Math.max(this.content.scrollHeight, this.content.offsetHeight, this.content.clientHeight, this.content.scrollHeight, this.content.offsetHeight);
if (window.innerHeight + window.scrollY > height + getOffset(this.content).top - 300 && this.renderedItems > 0) {
this.maxRenderCount = this.renderedItems - 1 + this.columnsCount * (loadAdditionalRowsCount * 2);
this.renderMovieElems();
this.calculatePositions();

@ -105,13 +105,13 @@ class PlexMeetsHomeAssistant extends HTMLElement {
window.addEventListener('scroll', () => {
const loadAdditionalRowsCount = 2; // todo: make this configurable
const height = Math.max(
document.body.scrollHeight,
document.body.offsetHeight,
document.documentElement.clientHeight,
document.documentElement.scrollHeight,
document.documentElement.offsetHeight
this.content.scrollHeight,
this.content.offsetHeight,
this.content.clientHeight,
this.content.scrollHeight,
this.content.offsetHeight
);
if (window.innerHeight + window.scrollY > height - 300 && this.renderedItems > 0) {
if (window.innerHeight + window.scrollY > height + getOffset(this.content).top - 300 && this.renderedItems > 0) {
this.maxRenderCount = this.renderedItems - 1 + this.columnsCount * (loadAdditionalRowsCount * 2);
this.renderMovieElems();

Loading…
Cancel
Save