Skip to content

Commit

Permalink
Merge pull request #53 from sgvictorino/prevent-duplicate-annotation-…
Browse files Browse the repository at this point in the history
…cards

fix: don't create duplicate annotation elements
  • Loading branch information
rramiachraf authored Apr 6, 2024
2 parents f4f5bab + d3b4059 commit aac426d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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)
}
}
}
}
Expand Down

0 comments on commit aac426d

Please sign in to comment.