2025-07-25 09:22:58 -04:00
|
|
|
//
|
|
|
|
// Smooth scrolling when opening and closing the details element for value block
|
|
|
|
//
|
2025-07-24 11:33:38 -04:00
|
|
|
// Set expanded value block to a variable
|
2025-07-24 11:31:27 -04:00
|
|
|
const valueBlock = document.getElementById("value-expanded");
|
2025-07-24 12:25:15 -04:00
|
|
|
const bodyTop = document.getElementById("top");
|
2025-07-24 11:31:27 -04:00
|
|
|
|
2025-07-24 11:33:38 -04:00
|
|
|
// Watch for the details element to be toggled
|
2025-07-24 11:31:27 -04:00
|
|
|
document.querySelector('.value-block').addEventListener('toggle', function() {
|
|
|
|
if (this.open) {
|
2025-07-24 11:33:38 -04:00
|
|
|
// Scroll to contents of value block when it is opened
|
2025-07-24 11:31:27 -04:00
|
|
|
valueBlock.scrollIntoView({ behavior: "smooth" });
|
2025-07-24 12:25:15 -04:00
|
|
|
} else {
|
|
|
|
// Scroll to top of button list when value block is closed
|
|
|
|
}
|
2025-07-24 11:31:27 -04:00
|
|
|
});
|
2025-07-25 09:22:58 -04:00
|
|
|
|
|
|
|
//
|
|
|
|
// Copy crypto wallet addresses to clipboard when clicked
|
|
|
|
//
|
2025-07-25 09:26:17 -04:00
|
|
|
// Set wallet addresses to variables
|
2025-07-25 09:50:30 -04:00
|
|
|
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);
|
2025-07-25 09:54:03 -04:00
|
|
|
// Display alert to confirm the address was added to clipboard
|
|
|
|
alert("BTC address copied to clipboard");
|
2025-07-25 09:50:30 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// Watch for click on ETH wallet address
|
|
|
|
document.getElementById("ethwall").addEventListener("click", function(){
|
|
|
|
// Copy ETH address to clipboard
|
|
|
|
navigator.clipboard.writeText(ethadd);
|
2025-07-25 09:54:03 -04:00
|
|
|
// Display alert to confirm the address was added to clipboard
|
|
|
|
alert("ETH address copied to clipboard");
|
2025-07-25 09:50:30 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// Watch for click on DOGE wallet address
|
|
|
|
document.getElementById("dogewall").addEventListener("click", function(){
|
|
|
|
// Copy DOGE address to clipboard
|
|
|
|
navigator.clipboard.writeText(dogeadd);
|
2025-07-25 09:54:03 -04:00
|
|
|
// Display alert to confirm the address was added to clipboard
|
|
|
|
alert("DOGE address copied to clipboard");
|
2025-07-25 09:50:30 -04:00
|
|
|
});
|
2025-07-26 15:58:33 -04:00
|
|
|
|
|
|
|
//
|
|
|
|
// Display crypto QR code when link is clicked
|
|
|
|
//
|
|
|
|
// Prevent clicks on QR codes from functioning
|
|
|
|
document.querySelector("#btc-qr-link a").addEventListener("click", function(event){
|
|
|
|
event.preventDefault()
|
|
|
|
});
|
|
|
|
document.querySelector("#eth-qr-link a").addEventListener("click", function(event){
|
|
|
|
event.preventDefault()
|
|
|
|
});
|
|
|
|
document.querySelector("#doge-qr-link a").addEventListener("click", function(event){
|
|
|
|
event.preventDefault()
|
|
|
|
});
|
|
|
|
|
|
|
|
// Watch for click on BTC QR code link
|
|
|
|
document.querySelector("#btc-qr-link a").addEventListener("click", function(){
|
|
|
|
// Hide all other QR codes
|
2025-07-26 16:34:56 -04:00
|
|
|
if (document.contains(document.querySelector("#eth-js-qr"))) {
|
|
|
|
document.querySelector("#eth-js-qr").remove();
|
|
|
|
}
|
|
|
|
if (document.contains(document.querySelector("#doge-js-qr"))) {
|
|
|
|
document.querySelector("#doge-js-qr").remove();
|
|
|
|
}
|
2025-07-26 15:58:33 -04:00
|
|
|
// Display BTC QR code
|
2025-07-26 16:44:09 -04:00
|
|
|
if (document.contains(document.querySelector("#btc-js-qr"))) {
|
|
|
|
document.querySelector("#btc-js-qr").remove();
|
|
|
|
} else {
|
2025-07-26 16:34:56 -04:00
|
|
|
document.querySelector("#btcwall").insertAdjacentHTML("afterend", "<span class=\"crypto-js-qr\" id=\"btc-js-qr\"><img src=\"images/crypto/btc-qr.png\"></span>");
|
2025-07-26 16:48:57 -04:00
|
|
|
document.querySelector("#btc-qr-link").scrollIntoView({ behavior: "smooth" });
|
2025-07-26 16:44:09 -04:00
|
|
|
}
|
2025-07-26 15:58:33 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// Watch for click on ETH QR code link
|
|
|
|
document.querySelector("#eth-qr-link a").addEventListener("click", function(){
|
|
|
|
// Hide all other QR codes
|
2025-07-26 16:34:56 -04:00
|
|
|
if (document.contains(document.querySelector("#btc-js-qr"))) {
|
|
|
|
document.querySelector("#btc-js-qr").remove();
|
|
|
|
}
|
|
|
|
if (document.contains(document.querySelector("#doge-js-qr"))) {
|
|
|
|
document.querySelector("#doge-js-qr").remove();
|
|
|
|
}
|
2025-07-26 15:58:33 -04:00
|
|
|
// Display ETH QR code
|
2025-07-26 16:44:09 -04:00
|
|
|
if (document.contains(document.querySelector("#eth-js-qr"))) {
|
|
|
|
document.querySelector("#eth-js-qr").remove();
|
|
|
|
} else {
|
2025-07-26 16:34:56 -04:00
|
|
|
document.querySelector("#ethwall").insertAdjacentHTML("afterend", "<span class=\"crypto-js-qr\" id=\"eth-js-qr\"><img src=\"images/crypto/eth-qr.png\"></span>");
|
2025-07-26 16:48:57 -04:00
|
|
|
document.querySelector("#eth-qr-link").scrollIntoView({ behavior: "smooth" });
|
2025-07-26 16:44:09 -04:00
|
|
|
}
|
2025-07-26 15:58:33 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// Watch for click on DOGE QR code link
|
|
|
|
document.querySelector("#doge-qr-link a").addEventListener("click", function(){
|
|
|
|
// Hide all other QR codes
|
2025-07-26 16:34:56 -04:00
|
|
|
if (document.contains(document.querySelector("#btc-js-qr"))) {
|
|
|
|
document.querySelector("#btc-js-qr").remove();
|
|
|
|
}
|
|
|
|
if (document.contains(document.querySelector("#eth-js-qr"))) {
|
|
|
|
document.querySelector("#eth-js-qr").remove();
|
|
|
|
}
|
2025-07-26 15:58:33 -04:00
|
|
|
// Display DOGE QR code
|
2025-07-26 16:44:09 -04:00
|
|
|
if (document.contains(document.querySelector("#doge-js-qr"))) {
|
|
|
|
document.querySelector("#doge-js-qr").remove();
|
|
|
|
} else {
|
2025-07-26 16:34:56 -04:00
|
|
|
document.querySelector("#dogewall").insertAdjacentHTML("afterend", "<span class=\"crypto-js-qr\" id=\"doge-js-qr\"><img src=\"images/crypto/doge-qr.png\"></span>");
|
2025-07-26 16:48:57 -04:00
|
|
|
document.querySelector("#doge-qr-link").scrollIntoView({ behavior: "smooth" });
|
2025-07-26 16:44:09 -04:00
|
|
|
}
|
2025-07-26 15:58:33 -04:00
|
|
|
});
|