Update: On season open, year changes to season name

pull/16/head
Juraj Nyíri 4 years ago
parent a98897256f
commit 1e21d74e35

@ -19411,13 +19411,14 @@ class PlexMeetsHomeAssistant extends HTMLElement {
const seasonTitleElem = child.children[1]; const seasonTitleElem = child.children[1];
const seasonEpisodesCount = child.children[2]; const seasonEpisodesCount = child.children[2];
seasonElem.style.display = 'block'; seasonElem.style.display = 'block';
const moveElem = (seasonElem) => { const moveElem = (elem) => {
seasonElem.style.marginTop = '0'; const seasonElemLocal = elem;
seasonElem.style.width = `${CSS_STYLE.width}px`; seasonElemLocal.style.marginTop = '0';
seasonElem.style.height = `${CSS_STYLE.height - 3}px`; seasonElemLocal.style.width = `${CSS_STYLE.width}px`;
seasonElem.style.zIndex = '3'; seasonElemLocal.style.height = `${CSS_STYLE.height - 3}px`;
seasonElem.style.marginLeft = `0px`; seasonElemLocal.style.zIndex = '3';
seasonElem.dataset.clicked = 'false'; seasonElemLocal.style.marginLeft = `0px`;
seasonElemLocal.dataset.clicked = 'false';
seasonTitleElem.style.display = 'block'; seasonTitleElem.style.display = 'block';
seasonEpisodesCount.style.display = 'block'; seasonEpisodesCount.style.display = 'block';
setTimeout(() => { setTimeout(() => {
@ -19471,11 +19472,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
}; };
this.scrollDownInactiveSeasons = () => { this.scrollDownInactiveSeasons = () => {
console.log('scrollDownInactiveSeasons');
if (this.seasonsElem) { if (this.seasonsElem) {
lodash.forEach(this.seasonsElem.childNodes, child => { lodash.forEach(this.seasonsElem.childNodes, child => {
const seasonElem = child.children[0]; const seasonElem = child.children[0];
console.log(seasonElem);
const seasonTitleElem = child.children[1]; const seasonTitleElem = child.children[1];
const seasonEpisodesCount = child.children[2]; const seasonEpisodesCount = child.children[2];
if (seasonElem.dataset.clicked === 'false') { if (seasonElem.dataset.clicked === 'false') {
@ -19513,6 +19512,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.detailElem.style.top = `${top}px`; this.detailElem.style.top = `${top}px`;
this.detailElem.children[0].innerHTML = escapeHtml(data.title); this.detailElem.children[0].innerHTML = escapeHtml(data.title);
this.detailElem.children[1].innerHTML = escapeHtml(data.year); this.detailElem.children[1].innerHTML = escapeHtml(data.year);
this.detailElem.children[1].dataset.year = escapeHtml(data.year);
this.detailElem.children[2].innerHTML = `${(data.duration !== undefined this.detailElem.children[2].innerHTML = `${(data.duration !== undefined
? `<span class='minutesDetail'>${Math.round(parseInt(escapeHtml(data.duration), 10) / 60 / 1000)} min</span>` ? `<span class='minutesDetail'>${Math.round(parseInt(escapeHtml(data.duration), 10) / 60 / 1000)} min</span>`
: '') + : '') +
@ -19592,10 +19592,19 @@ class PlexMeetsHomeAssistant extends HTMLElement {
seasonElem.style.marginLeft = `-${getOffset(seasonElem).left - getOffset(this.activeMovieElem).left}px`; seasonElem.style.marginLeft = `-${getOffset(seasonElem).left - getOffset(this.activeMovieElem).left}px`;
seasonTitleElem.style.color = 'rgba(255,255,255,0)'; seasonTitleElem.style.color = 'rgba(255,255,255,0)';
seasonEpisodesCount.style.color = 'rgba(255,255,255,0)'; seasonEpisodesCount.style.color = 'rgba(255,255,255,0)';
if (this.detailElem) {
this.detailElem.children[1].innerHTML = seasonData.title;
}
} }
else { else {
this.minimizeSeasons(); this.minimizeSeasons();
this.activeMovieElem.style.top = `16px`; this.activeMovieElem.style.top = `16px`;
if (this.detailElem && this.detailElem.children[1]) {
const { year } = this.detailElem.children[1].dataset;
if (year) {
this.detailElem.children[1].innerHTML = year;
}
}
} }
} }
}); });
@ -19616,7 +19625,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
} }
}, 200); }, 200);
console.log(seasonsData);
} }
}; };
this.showBackground = () => { this.showBackground = () => {

@ -226,13 +226,14 @@ class PlexMeetsHomeAssistant extends HTMLElement {
const seasonEpisodesCount = (child as HTMLElement).children[2] as HTMLElement; const seasonEpisodesCount = (child as HTMLElement).children[2] as HTMLElement;
seasonElem.style.display = 'block'; seasonElem.style.display = 'block';
const moveElem = (seasonElem: HTMLElement) => { const moveElem = (elem: HTMLElement): void => {
seasonElem.style.marginTop = '0'; const seasonElemLocal = elem;
seasonElem.style.width = `${CSS_STYLE.width}px`; seasonElemLocal.style.marginTop = '0';
seasonElem.style.height = `${CSS_STYLE.height - 3}px`; seasonElemLocal.style.width = `${CSS_STYLE.width}px`;
seasonElem.style.zIndex = '3'; seasonElemLocal.style.height = `${CSS_STYLE.height - 3}px`;
seasonElem.style.marginLeft = `0px`; seasonElemLocal.style.zIndex = '3';
seasonElem.dataset.clicked = 'false'; seasonElemLocal.style.marginLeft = `0px`;
seasonElemLocal.dataset.clicked = 'false';
seasonTitleElem.style.display = 'block'; seasonTitleElem.style.display = 'block';
seasonEpisodesCount.style.display = 'block'; seasonEpisodesCount.style.display = 'block';
setTimeout(() => { setTimeout(() => {
@ -289,11 +290,9 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}; };
scrollDownInactiveSeasons = (): void => { scrollDownInactiveSeasons = (): void => {
console.log('scrollDownInactiveSeasons');
if (this.seasonsElem) { if (this.seasonsElem) {
_.forEach(this.seasonsElem.childNodes, child => { _.forEach(this.seasonsElem.childNodes, child => {
const seasonElem = (child as HTMLElement).children[0] as HTMLElement; const seasonElem = (child as HTMLElement).children[0] as HTMLElement;
console.log(seasonElem);
const seasonTitleElem = (child as HTMLElement).children[1] as HTMLElement; const seasonTitleElem = (child as HTMLElement).children[1] as HTMLElement;
const seasonEpisodesCount = (child as HTMLElement).children[2] as HTMLElement; const seasonEpisodesCount = (child as HTMLElement).children[2] as HTMLElement;
if (seasonElem.dataset.clicked === 'false') { if (seasonElem.dataset.clicked === 'false') {
@ -335,6 +334,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.detailElem.children[0].innerHTML = escapeHtml(data.title); this.detailElem.children[0].innerHTML = escapeHtml(data.title);
this.detailElem.children[1].innerHTML = escapeHtml(data.year); this.detailElem.children[1].innerHTML = escapeHtml(data.year);
(this.detailElem.children[1] as HTMLElement).dataset.year = escapeHtml(data.year);
this.detailElem.children[2].innerHTML = `${(data.duration !== undefined this.detailElem.children[2].innerHTML = `${(data.duration !== undefined
? `<span class='minutesDetail'>${Math.round( ? `<span class='minutesDetail'>${Math.round(
parseInt(escapeHtml(data.duration), 10) / 60 / 1000 parseInt(escapeHtml(data.duration), 10) / 60 / 1000
@ -432,9 +432,18 @@ class PlexMeetsHomeAssistant extends HTMLElement {
seasonTitleElem.style.color = 'rgba(255,255,255,0)'; seasonTitleElem.style.color = 'rgba(255,255,255,0)';
seasonEpisodesCount.style.color = 'rgba(255,255,255,0)'; seasonEpisodesCount.style.color = 'rgba(255,255,255,0)';
if (this.detailElem) {
(this.detailElem.children[1] as HTMLElement).innerHTML = seasonData.title;
}
} else { } else {
this.minimizeSeasons(); this.minimizeSeasons();
this.activeMovieElem.style.top = `16px`; this.activeMovieElem.style.top = `16px`;
if (this.detailElem && (this.detailElem.children[1] as HTMLElement)) {
const { year } = (this.detailElem.children[1] as HTMLElement).dataset;
if (year) {
(this.detailElem.children[1] as HTMLElement).innerHTML = year;
}
}
} }
} }
}); });
@ -460,8 +469,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
} }
}, 200); }, 200);
console.log(seasonsData);
} }
}; };

Loading…
Cancel
Save