From d3b40590de126c4b330a3535ce24e92a1b9978ff Mon Sep 17 00:00:00 2001 From: Solomon Victorino Date: Sat, 6 Apr 2024 14:17:42 -0600 Subject: [PATCH] fix: don't create duplicate annotation elements --- static/script.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/script.js b/static/script.js index 65bffdd..d25e856 100644 --- a/static/script.js +++ b/static/script.js @@ -32,7 +32,9 @@ function getAnnotation(e) { annotationDiv.innerHTML = parsedReponse.html annotationDiv.id = uri annotationDiv.className = "annotation" - e.target.parentElement.insertAdjacentElement('afterend', annotationDiv) + if (!document.getElementById(uri)) { + e.target.parentElement.insertAdjacentElement('afterend', annotationDiv) + } } } }