Skip to content

Commit c89496a

Browse files
Fix bug where multiple duplicate buttons would be created when viewing multiple events
1 parent 2ea6dd9 commit c89496a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ function app() {
5656
const eventId = this.getAttribute('data-eventid');
5757
const dupBtn = `<div class="dup-btn" data-id="${eventId}">${dupIcon}</div>`;
5858
intervalAddIcon = setInterval(function () {
59-
if(document.querySelector('.pPTZAe') == null) return;
59+
const eventNode = document.querySelector('.pPTZAe');
60+
if(eventNode == null) return;
6061
clearInterval(intervalAddIcon);
61-
document.querySelector('.pPTZAe').prepend(htmlToElement(dupBtn));
62+
if(eventNode.querySelector('.dup-btn') != null) return;
63+
eventNode.prepend(htmlToElement(dupBtn));
6264
}, 50);
6365
});
6466

0 commit comments

Comments
 (0)