Prevent creating multiple chapter vote containers

This commit is contained in:
Ajay 2022-09-04 21:52:14 -04:00
parent 00d625013b
commit 00f134029a

View file

@ -669,6 +669,11 @@ class PreviewBar {
const chapterVoteContainer = this.chapterVote.getContainer();
if (chosenSegment.source === SponsorSourceType.Server) {
if (!chapterButton.contains(chapterVoteContainer)) {
const oldVoteContainers = document.querySelectorAll("#chapterVote");
if (oldVoteContainers.length > 0) {
oldVoteContainers.forEach((oldVoteContainer) => oldVoteContainer.remove());
}
chapterButton.insertBefore(chapterVoteContainer, this.getChapterChevron());
}