Fix: Live TV channels open&close properly and have correct margins and heights on different styles

music
Juraj Nyíri 3 years ago
parent 3b9dae5c14
commit 83acbc374a

@ -22042,16 +22042,13 @@ class PlexMeetsHomeAssistant extends HTMLElement {
CSS_STYLE.episodeHeight = Math.round(CSS_STYLE.episodeWidth * CSS_STYLE.episodeRatio); CSS_STYLE.episodeHeight = Math.round(CSS_STYLE.episodeWidth * CSS_STYLE.episodeRatio);
} }
else if (this.renderPageRetries < 10) { else if (this.renderPageRetries < 10) {
{
// sometimes it loop forever, todo: properly fix! // sometimes it loop forever, todo: properly fix!
setTimeout(() => { setTimeout(() => {
this.renderPageRetries += 1; this.renderPageRetries += 1;
console.log('retry');
this.renderPage(); this.renderPage();
}, 250); }, 250);
} }
} }
}
this.renderedItems = 0; this.renderedItems = 0;
// this.columnsCount = 0; // this.columnsCount = 0;
const spinner = document.createElement('div'); const spinner = document.createElement('div');
@ -22372,15 +22369,16 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
}; };
this.minimizeAll = () => { this.minimizeAll = () => {
// this.content.style.position = 'relative';
this.detailsShown = false; this.detailsShown = false;
if (this.activeMovieElem) { if (this.activeMovieElem) {
this.activeMovieElem.style.display = `block`; this.activeMovieElem.style.display = `block`;
} }
this.activeMovieElem = undefined; this.activeMovieElem = undefined;
for (let i = 0; i < this.movieElems.length; i += 1) { for (let i = 0; i < this.movieElems.length; i += 1) {
if (lodash.isEqual(parseInt(this.movieElems[i].style.width, 10), this.minExpandedWidth) && if ((lodash.isEqual(parseInt(this.movieElems[i].style.width, 10), this.minExpandedWidth) &&
lodash.isEqual(parseInt(this.movieElems[i].style.height, 10), this.minExpandedHeight)) { lodash.isEqual(parseInt(this.movieElems[i].style.height, 10), this.minExpandedHeight)) ||
(lodash.isEqual(parseInt(this.movieElems[i].style.width, 10), this.minExpandedWidth) &&
lodash.isEqual(parseInt(this.movieElems[i].style.height, 10), this.minExpandedWidth))) {
if (lodash.isEqual(this.movieElems[i].style.width, this.movieElems[i].style.height)) { if (lodash.isEqual(this.movieElems[i].style.width, this.movieElems[i].style.height)) {
this.movieElems[i].style.width = `${CSS_STYLE.width}px`; this.movieElems[i].style.width = `${CSS_STYLE.width}px`;
this.movieElems[i].style.height = `${CSS_STYLE.width}px`; this.movieElems[i].style.height = `${CSS_STYLE.width}px`;
@ -23075,7 +23073,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
container.style.marginBottom = '5px'; container.style.marginBottom = '5px';
} }
if (!lodash.isNil(data.channelCallSign)) { if (!lodash.isNil(data.channelCallSign)) {
container.style.marginBottom = '50px'; container.style.marginBottom = '10px';
} }
const movieElem = document.createElement('div'); const movieElem = document.createElement('div');
movieElem.className = 'movieElem'; movieElem.className = 'movieElem';
@ -23085,7 +23083,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
movieElem.style.backgroundSize = '80%'; movieElem.style.backgroundSize = '80%';
movieElem.style.backgroundColor = 'rgba(0,0,0,0.2)'; movieElem.style.backgroundColor = 'rgba(0,0,0,0.2)';
movieElem.style.backgroundPosition = 'center'; movieElem.style.backgroundPosition = 'center';
container.style.height = container.style.width;
movieElem.style.height = `${CSS_STYLE.width}px`; movieElem.style.height = `${CSS_STYLE.width}px`;
} }
movieElem.style.backgroundImage = `url('${thumbURL}')`; movieElem.style.backgroundImage = `url('${thumbURL}')`;
@ -23167,6 +23164,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
else if (!lodash.isNil(data.epg)) { else if (!lodash.isNil(data.epg)) {
yearElem.innerHTML = escapeHtml(data.epg.title); yearElem.innerHTML = escapeHtml(data.epg.title);
} }
else {
yearElem.innerHTML = '&nbsp;';
}
yearElem.className = 'yearElem'; yearElem.className = 'yearElem';
yearElem.style.fontSize = `${this.fontSize2}px`; yearElem.style.fontSize = `${this.fontSize2}px`;
yearElem.style.lineHeight = `${this.fontSize2}px`; yearElem.style.lineHeight = `${this.fontSize2}px`;

@ -1023,7 +1023,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}; };
minimizeAll = (): void => { minimizeAll = (): void => {
// this.content.style.position = 'relative';
this.detailsShown = false; this.detailsShown = false;
if (this.activeMovieElem) { if (this.activeMovieElem) {
this.activeMovieElem.style.display = `block`; this.activeMovieElem.style.display = `block`;
@ -1032,8 +1031,10 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.activeMovieElem = undefined; this.activeMovieElem = undefined;
for (let i = 0; i < this.movieElems.length; i += 1) { for (let i = 0; i < this.movieElems.length; i += 1) {
if ( if (
_.isEqual(parseInt(this.movieElems[i].style.width, 10), this.minExpandedWidth) && (_.isEqual(parseInt(this.movieElems[i].style.width, 10), this.minExpandedWidth) &&
_.isEqual(parseInt(this.movieElems[i].style.height, 10), this.minExpandedHeight) _.isEqual(parseInt(this.movieElems[i].style.height, 10), this.minExpandedHeight)) ||
(_.isEqual(parseInt(this.movieElems[i].style.width, 10), this.minExpandedWidth) &&
_.isEqual(parseInt(this.movieElems[i].style.height, 10), this.minExpandedWidth))
) { ) {
if (_.isEqual(this.movieElems[i].style.width, this.movieElems[i].style.height)) { if (_.isEqual(this.movieElems[i].style.width, this.movieElems[i].style.height)) {
this.movieElems[i].style.width = `${CSS_STYLE.width}px`; this.movieElems[i].style.width = `${CSS_STYLE.width}px`;
@ -1804,7 +1805,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
container.style.marginBottom = '5px'; container.style.marginBottom = '5px';
} }
if (!_.isNil(data.channelCallSign)) { if (!_.isNil(data.channelCallSign)) {
container.style.marginBottom = '50px'; container.style.marginBottom = '10px';
} }
const movieElem = document.createElement('div'); const movieElem = document.createElement('div');
@ -1817,7 +1818,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
movieElem.style.backgroundSize = '80%'; movieElem.style.backgroundSize = '80%';
movieElem.style.backgroundColor = 'rgba(0,0,0,0.2)'; movieElem.style.backgroundColor = 'rgba(0,0,0,0.2)';
movieElem.style.backgroundPosition = 'center'; movieElem.style.backgroundPosition = 'center';
container.style.height = container.style.width;
movieElem.style.height = `${CSS_STYLE.width}px`; movieElem.style.height = `${CSS_STYLE.width}px`;
} }
@ -1910,6 +1910,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
yearElem.innerHTML = escapeHtml(data.year); yearElem.innerHTML = escapeHtml(data.year);
} else if (!_.isNil(data.epg)) { } else if (!_.isNil(data.epg)) {
yearElem.innerHTML = escapeHtml(data.epg.title); yearElem.innerHTML = escapeHtml(data.epg.title);
} else {
yearElem.innerHTML = '&nbsp;';
} }
yearElem.className = 'yearElem'; yearElem.className = 'yearElem';
yearElem.style.fontSize = `${this.fontSize2}px`; yearElem.style.fontSize = `${this.fontSize2}px`;

Loading…
Cancel
Save