Fix: Edge case scenario where episodes would not dissappear after navigating back to seasons

pull/16/head
Juraj Nyíri 4 years ago
parent 02fc49eea4
commit 8f732cc60c

@ -19453,7 +19453,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}, 100);
};
this.minimizeSeasons = () => {
return new Promise((resolve, reject) => {
this.seasonsElemHidden = false;
if (this.seasonsElem) {
lodash.forEach(this.seasonsElem.childNodes, child => {
@ -19482,12 +19481,10 @@ class PlexMeetsHomeAssistant extends HTMLElement {
else {
setTimeout(() => {
moveElem(seasonElem);
resolve();
}, 100);
}
});
}
});
};
this.minimizeAll = () => {
this.activeMovieElem = undefined;
@ -19648,7 +19645,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
seasonEpisodesCount.innerHTML = `${escapeHtml(seasonData.leafCount)} episodes`;
seasonContainer.append(seasonEpisodesCount);
seasonContainer.addEventListener('click', event => {
(async () => {
event.stopPropagation();
if (this.activeMovieElem) {
if (seasonElem.dataset.clicked === 'false') {
@ -19659,8 +19655,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
seasonElem.style.width = `${CSS_STYLE.expandedWidth}px`;
seasonElem.style.height = `${CSS_STYLE.expandedHeight - 6}px`;
seasonElem.style.zIndex = '3';
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)';
seasonEpisodesCount.style.color = 'rgba(255,255,255,0)';
if (this.detailElem) {
@ -19730,7 +19725,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
})();
}
else {
await this.minimizeSeasons();
this.minimizeSeasons();
this.hideEpisodes();
this.activeMovieElem.style.top = `${top + 16}px`;
if (this.detailElem && this.detailElem.children[1]) {
@ -19741,7 +19736,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}
}
}
})();
});
this.seasonsElem.append(seasonContainer);
}

@ -238,8 +238,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}, 100);
};
minimizeSeasons = (): Promise<void> => {
return new Promise((resolve, reject) => {
minimizeSeasons = (): void => {
this.seasonsElemHidden = false;
if (this.seasonsElem) {
_.forEach(this.seasonsElem.childNodes, child => {
@ -269,12 +268,10 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} else {
setTimeout(() => {
moveElem(seasonElem);
resolve();
}, 100);
}
});
}
});
};
minimizeAll = (): void => {
@ -456,7 +453,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
seasonContainer.append(seasonEpisodesCount);
seasonContainer.addEventListener('click', event => {
(async (): Promise<void> => {
event.stopPropagation();
if (this.activeMovieElem) {
if (seasonElem.dataset.clicked === 'false') {
@ -471,8 +467,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
seasonElem.style.height = `${CSS_STYLE.expandedHeight - 6}px`;
seasonElem.style.zIndex = '3';
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)';
seasonEpisodesCount.style.color = 'rgba(255,255,255,0)';
@ -552,7 +547,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}
})();
} else {
await this.minimizeSeasons();
this.minimizeSeasons();
this.hideEpisodes();
this.activeMovieElem.style.top = `${top + 16}px`;
if (this.detailElem && (this.detailElem.children[1] as HTMLElement)) {
@ -563,7 +558,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}
}
}
})();
});
this.seasonsElem.append(seasonContainer);

Loading…
Cancel
Save