44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
//
|
|
// Smooth scrolling when opening and closing the details element for value block
|
|
//
|
|
// Set expanded value block to a variable
|
|
const valueBlock = document.getElementById("value-expanded");
|
|
const bodyTop = document.getElementById("top");
|
|
|
|
// Watch for the details element to be toggled
|
|
document.querySelector('.value-block').addEventListener('toggle', function() {
|
|
if (this.open) {
|
|
// Scroll to contents of value block when it is opened
|
|
valueBlock.scrollIntoView({ behavior: "smooth" });
|
|
} else {
|
|
// Scroll to top of button list when value block is closed
|
|
bodyTop.scrollIntoView({ behavior: "smooth" });
|
|
}
|
|
});
|
|
|
|
//
|
|
// Copy crypto wallet addresses to clipboard when clicked
|
|
//
|
|
// Set wallet addresses to variables
|
|
const btcadd = document.getElementById("btcwall").textContent;
|
|
const ethadd = document.getElementById("ethwall").textContent;
|
|
const dogeadd = document.getElementById("dogewall").textContent;
|
|
|
|
// Watch for click on BTC wallet address
|
|
document.getElementById("btcwall").addEventListener("click", function(){
|
|
// Copy BTC address to clipboard
|
|
navigator.clipboard.writeText(btcadd);
|
|
});
|
|
|
|
// Watch for click on ETH wallet address
|
|
document.getElementById("ethwall").addEventListener("click", function(){
|
|
// Copy ETH address to clipboard
|
|
navigator.clipboard.writeText(ethadd);
|
|
});
|
|
|
|
// Watch for click on DOGE wallet address
|
|
document.getElementById("dogewall").addEventListener("click", function(){
|
|
// Copy DOGE address to clipboard
|
|
navigator.clipboard.writeText(dogeadd);
|
|
});
|