-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdonate.js
100 lines (87 loc) · 2.83 KB
/
donate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
Author: Leakfa Team
Author URI: https://leakfa.com
Version: 1.1.0
*/
const coins = [
{
name: "Bitcoin",
address: "bc1qcggr0e9yse2pmsvkpdxaaf3eg06klu5h7pzdj3",
qr: "images/donate/btcQR.jpg",
logo: "images/donate/btcButtonLogo.png"
},
{
name: "Ethereum",
address: "0xb85298B60AA6A40d4eC462E0Eb8A958d7c735df3",
qr: "images/donate/ethQR.jpg",
logo: "images/donate/ethButtonLogo.png"
},
{
name: "BNB",
address: "0xb85298B60AA6A40d4eC462E0Eb8A958d7c735df3",
qr: "images/donate/bnbQR.jpg",
logo: "images/donate/bnbButtonLogo.png"
},
{
name: "TON",
address: "EQBjfUvqsVTRidYUvA-lahY2NX8HEB2GQrGU7SYlISHA9cCw",
qr: "images/donate/tonQR.jpg",
logo: "images/donate/tonButtonLogo.png"
},
{
name: "Litecoin",
address: "ltc1q0zyrmlrxyjf266ha3kdnanzkaclvv357faq8e3",
qr: "images/donate/ltcQR.jpg",
logo: "images/donate/ltcButtonLogo.png"
},
{
name: "Tron",
address: "TTgkifzuHTeoV1wPvzvdnejUpEvmxkzgi2",
qr: "images/donate/trxQR.jpg",
logo: "images/donate/trxButtonLogo.png"
},
{
name: "USDT (TRC20)",
address: "TTgkifzuHTeoV1wPvzvdnejUpEvmxkzgi2",
qr: "images/donate/usdtQR.jpg",
logo: "images/donate/usdtButtonLogo.png"
},
];
let currentCoinIndex = 0;
function updateDisplay() {
const coinLogo = document.getElementById('coin-logo');
const addressText = document.getElementById('address-text');
const qr = document.getElementById('qr');
const copyMessage = document.getElementById('copy-message');
coinLogo.src = coins[currentCoinIndex].logo;
coinLogo.alt = coins[currentCoinIndex].name;
addressText.value = coins[currentCoinIndex].address;
qr.src = coins[currentCoinIndex].qr;
qr.alt = `${coins[currentCoinIndex].name} QR Code`;
// Hide the copied message when updating
copyMessage.style.opacity = 0;
}
function prevCoin() {
currentCoinIndex = (currentCoinIndex === 0) ? coins.length - 1 : currentCoinIndex - 1;
updateDisplay();
}
function nextCoin() {
currentCoinIndex = (currentCoinIndex === coins.length - 1) ? 0 : currentCoinIndex + 1;
updateDisplay();
}
function copyAddress() {
const addressText = document.getElementById('address-text');
const copyMessage = document.getElementById('copy-message');
addressText.select();
addressText.setSelectionRange(0, 99999); // For mobile devices
// Copy the text inside the text field
document.execCommand('copy');
// Show the "Copied!" message
copyMessage.style.opacity = 1;
// Hide the message after 2 seconds
setTimeout(() => {
copyMessage.style.opacity = 0;
}, 2000);
}
// Initialize the widget with the first coin
updateDisplay();