add table of contents button

This commit is contained in:
Ruben 2024-10-01 00:52:27 -05:00
commit dd8c404cae
No known key found for this signature in database
4 changed files with 145 additions and 3 deletions

View file

@ -19,6 +19,26 @@ window.onclick = function(event) {
}
}
// Same snippet as above, but for the Table of Contents of button.
function tocDropdown() {
document.getElementById("toc-dropdown").classList.toggle("show-dropdown");
}
// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.toc-button')) {
var dropdowns = document.getElementsByClassName("toc-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show-dropdown')) {
openDropdown.classList.remove('show-dropdown');
}
}
}
}
// TODO: Replace the above(s) with CSS?
// snippet that copies the html for my button(s)
function copyButtonRegular() {
navigator.clipboard.writeText ('<a href="https://sneexy.pages.gay"><img src="https://sneexy.pages.gay/assets/buttons/sneexy.png" alt="Sneexy" title="Sneexy"></a>');