Skip to content

Commit

Permalink
Fix: clipboard button not working
Browse files Browse the repository at this point in the history
Resolved issue with non-functional clipboard button on homepage.

Signed-off-by: Anoop Kumar <[email protected]>
  • Loading branch information
HelllGuest committed Dec 31, 2023
1 parent f2f936d commit e4579ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
13 changes: 0 additions & 13 deletions content/fedora.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,5 @@ document.addEventListener("DOMContentLoaded", function() {
e.preventDefault();
};
});
var btn = document.getElementById("copy-button");
btn.onmouseover = function(e) {
btn.firstChild.classList.remove("fa-check");
btn.firstChild.classList.add("fa-clipboard");
}
btn.onclick = function(e) {
var text = document.getElementById("curl");
window.getSelection().selectAllChildren(text);
navigator.clipboard.writeText(text.textContent);
btn.firstChild.classList.add("fa-check");
btn.firstChild.classList.remove("fa-clipboard");
e.preventDefault();
};
});
</script>
16 changes: 16 additions & 0 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,21 @@
</div>
</div>
</footer>
<!-- JavaScript code -->
<script>
var btn = document.getElementById("copy-button");
btn.onmouseover = function(e) {
btn.firstChild.classList.remove("fa-check");
btn.firstChild.classList.add("fa-clipboard");
}
btn.onclick = function(e) {
var text = document.getElementById("curl");
window.getSelection().selectAllChildren(text);
navigator.clipboard.writeText(text.textContent);
btn.firstChild.classList.add("fa-check");
btn.firstChild.classList.remove("fa-clipboard");
e.preventDefault();
};
</script>
</body>
</html>

0 comments on commit e4579ed

Please sign in to comment.