mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 20:17:05 +03:00
Prevent creating multiple chapter vote containers
This commit is contained in:
@@ -669,6 +669,11 @@ class PreviewBar {
|
|||||||
const chapterVoteContainer = this.chapterVote.getContainer();
|
const chapterVoteContainer = this.chapterVote.getContainer();
|
||||||
if (chosenSegment.source === SponsorSourceType.Server) {
|
if (chosenSegment.source === SponsorSourceType.Server) {
|
||||||
if (!chapterButton.contains(chapterVoteContainer)) {
|
if (!chapterButton.contains(chapterVoteContainer)) {
|
||||||
|
const oldVoteContainers = document.querySelectorAll("#chapterVote");
|
||||||
|
if (oldVoteContainers.length > 0) {
|
||||||
|
oldVoteContainers.forEach((oldVoteContainer) => oldVoteContainer.remove());
|
||||||
|
}
|
||||||
|
|
||||||
chapterButton.insertBefore(chapterVoteContainer, this.getChapterChevron());
|
chapterButton.insertBefore(chapterVoteContainer, this.getChapterChevron());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user