mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 21:17:20 +03:00
Moved notice closing to renderer (no leftover nodes)
This commit is contained in:
@@ -9,6 +9,8 @@ class SkipNotice {
|
||||
// Contains functions and variables from the content script needed by the skip notice
|
||||
contentContainer: () => any;
|
||||
|
||||
noticeElement: HTMLDivElement;
|
||||
|
||||
constructor(UUID: string, autoSkip: boolean = false, contentContainer) {
|
||||
this.UUID = UUID;
|
||||
this.autoSkip = autoSkip;
|
||||
@@ -35,16 +37,23 @@ class SkipNotice {
|
||||
//this is the suffix added at the end of every id
|
||||
let idSuffix = this.UUID + amountOfPreviousNotices;
|
||||
|
||||
let noticeElement = document.createElement("div");
|
||||
noticeElement.id = "sponsorSkipNoticeContainer" + idSuffix;
|
||||
this.noticeElement = document.createElement("div");
|
||||
this.noticeElement.id = "sponsorSkipNoticeContainer" + idSuffix;
|
||||
|
||||
referenceNode.prepend(noticeElement);
|
||||
referenceNode.prepend(this.noticeElement);
|
||||
|
||||
ReactDOM.render(
|
||||
<SkipNoticeComponent UUID={UUID} autoSkip={autoSkip} contentContainer={contentContainer} />,
|
||||
noticeElement
|
||||
<SkipNoticeComponent UUID={UUID}
|
||||
autoSkip={autoSkip}
|
||||
contentContainer={contentContainer}
|
||||
closeListener={() => this.close()} />,
|
||||
this.noticeElement
|
||||
);
|
||||
}
|
||||
|
||||
close() {
|
||||
this.noticeElement.remove();
|
||||
}
|
||||
}
|
||||
|
||||
export default SkipNotice;
|
||||
Reference in New Issue
Block a user