Show checkmark after copying/selecting heading

This commit is contained in:
2024-12-30 18:46:33 +01:00
parent af883f2f6e
commit cf537b1488
2 changed files with 21 additions and 4 deletions
+11
View File
@@ -35,7 +35,18 @@ window.addEventListener("load", () => {
heading.classList.add("article-heading");
anchor.addEventListener("click", (e) => {
e.preventDefault();
window.history.replaceState({}, "", anchor.href);
navigator.clipboard.writeText(anchor.href);
document
.querySelectorAll(".current-heading")
.forEach((elem) =>
elem.classList.remove("current-heading")
);
anchor.classList.add("current-heading");
});
}
}