first commit
27
data.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"monero": {
|
||||
"address": "85z2KvhGAsqP3CqB4PngKZCPYRrSX6pMBEcfzhZpVb8n1bzo8NvwhxbaagjPJpnDfJPXL5WQQ8aMBTDwWTH2hfqbCvMcnxS",
|
||||
"qr": "qr/xmr-1.png",
|
||||
"icon": "icons/xmr.png"
|
||||
},
|
||||
"bitcoin": {
|
||||
"address": "bc1pfx4a7n6fuyum4dv6rjmg9nsuj7t9wdepjjgsp67d6n8hsdp8w47qw228fy",
|
||||
"qr": "qr/btc-taproot.png",
|
||||
"icon": "icons/btc.png"
|
||||
},
|
||||
"eth": {
|
||||
"address": "0x75aa91c8a00966bAc3a1a4371C8588D018Dbd7c4",
|
||||
"qr": "qr/eth.png",
|
||||
"icon": "icons/eth.png"
|
||||
},
|
||||
"tron": {
|
||||
"address": "TEMzQqABo7ttKioED8CVtTFkLz57cBSYc7",
|
||||
"qr": "qr/trx.png",
|
||||
"icon": "icons/trx.png"
|
||||
},
|
||||
"solana": {
|
||||
"address": "BDL89QkYohoU1zdx2wZtw2zDkcx6xth1ecrV6bhPja2a",
|
||||
"qr": "qr/sol.png",
|
||||
"icon": "icons/sol.png"
|
||||
}
|
||||
}
|
BIN
favicon.ico
Normal file
After Width: | Height: | Size: 32 KiB |
12
i18n/en.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"title": "Donate Cryptocurrency",
|
||||
"copyAddress": "Copy Address",
|
||||
"copyAddressSuccess": "Address Copied!",
|
||||
"english": "English",
|
||||
"chinese": "中文",
|
||||
"tron": "Tron",
|
||||
"eth": "EVM Capable",
|
||||
"bitcoin": "Bitcoin",
|
||||
"solana": "Solana",
|
||||
"monero": "Monero"
|
||||
}
|
12
i18n/zh.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"title": "捐赠加密货币",
|
||||
"copyAddress": "复制地址",
|
||||
"copyAddressSuccess": "复制成功",
|
||||
"english": "English",
|
||||
"chinese": "中文",
|
||||
"tron": "波场",
|
||||
"eth": "以太坊(EVM兼容网络)",
|
||||
"bitcoin": "比特币",
|
||||
"solana": "Solana",
|
||||
"monero": "门罗币"
|
||||
}
|
BIN
icons/btc.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
icons/eth.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
icons/sol.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
icons/trx.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
icons/xmr.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
43
index.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>加密货币捐赠</title>
|
||||
<link rel="icon" href="favicon.ico">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<h1 id="title"><img src="logo.png" alt="asadasd" width="24px"> 捐赠加密货币</h1>
|
||||
<div class="donation-card">
|
||||
<div class="select-wrapper">
|
||||
<select id="blockchain" onchange="updateDonationInfo()"></select>
|
||||
<div id="icon-wrapper">
|
||||
<img id="blockchain-icon" src="icons/btc.png" alt="Blockchain Icon">
|
||||
</div>
|
||||
</div>
|
||||
<div id="donation-info">
|
||||
<img id="qr-code" src="qr/btc-taproot.png" alt="QR Code">
|
||||
<p id="address">bc1pfx4a7n6fuyum4dv6rjmg9nsuj7t9wdepjjgsp67d6n8hsdp8w47qw228fy</p>
|
||||
<button onclick="copyAddress()" id="copyAddress">复制地址</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="language-list">
|
||||
<li onclick="changeLanguage('en')">English</li>
|
||||
<li onclick="changeLanguage('zh')">中文</li>
|
||||
</ul>
|
||||
<div class="social-media">
|
||||
<a href="https://github.com/earthjasonlin" target="_blank"><img class="social-icon" src="https://www.svgrepo.com/download/521688/github.svg" alt="GitHub"></a>
|
||||
<a href="https://t.me/zcl1103" target="_blank"><img class="social-icon" src="https://www.svgrepo.com/download/521874/telegram.svg" alt="Telegram"></a>
|
||||
<a href="mailto:earthjasonlin@126.com" target="_blank"><img class="social-icon" src="https://www.svgrepo.com/download/479773/email-8.svg" alt="e-Mail"></a>
|
||||
</div>
|
||||
<footer>
|
||||
<p>© 2024-now earthjasonlin. All rights reserved.</p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
BIN
qr/btc-taproot.png
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
qr/eth.png
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
qr/sol.png
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
qr/trx.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
qr/xmr-1.png
Normal file
After Width: | Height: | Size: 58 KiB |
74
script.js
Normal file
@ -0,0 +1,74 @@
|
||||
let currentLang = 'zh';
|
||||
let data, i18n;
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
loadData('data.json', loadBlockchainOptions);
|
||||
changeLanguage(currentLang);
|
||||
updateCopyrightYear()
|
||||
});
|
||||
|
||||
function updateCopyrightYear() {
|
||||
const currentYear = new Date().getFullYear();
|
||||
let copyrightText
|
||||
if(currentYear > 2024) {
|
||||
copyrightText = `© 2024-${currentYear} earthjasonlin. All rights reserved.`;
|
||||
} else {
|
||||
copyrightText = `© 2024 earthjasonlin. All rights reserved.`;
|
||||
}
|
||||
document.querySelector("footer p").innerHTML = copyrightText;
|
||||
}
|
||||
|
||||
function loadData(url, callback) {
|
||||
fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
data = json;
|
||||
callback();
|
||||
})
|
||||
.catch(error => console.error('Error loading JSON:', error));
|
||||
}
|
||||
|
||||
function loadI18n(url, callback) {
|
||||
fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
i18n = json;
|
||||
callback();
|
||||
})
|
||||
.catch(error => console.error('Error loading i18n JSON:', error));
|
||||
}
|
||||
|
||||
function loadBlockchainOptions() {
|
||||
const blockchainSelect = document.getElementById("blockchain");
|
||||
blockchainSelect.innerHTML = '';
|
||||
|
||||
for (const key in data) {
|
||||
const option = document.createElement("option");
|
||||
option.value = key;
|
||||
option.textContent = i18n[key];
|
||||
blockchainSelect.appendChild(option);
|
||||
}
|
||||
updateDonationInfo();
|
||||
}
|
||||
|
||||
function changeLanguage(lang) {
|
||||
loadI18n(`i18n/${lang}.json`, () => {
|
||||
document.getElementById("title").textContent = i18n.title;
|
||||
document.getElementById("copyAddress").textContent = i18n.copyAddress;
|
||||
loadBlockchainOptions();
|
||||
});
|
||||
}
|
||||
|
||||
function updateDonationInfo() {
|
||||
const blockchain = document.getElementById("blockchain").value;
|
||||
document.getElementById("qr-code").src = data[blockchain].qr;
|
||||
document.getElementById("address").textContent = data[blockchain].address;
|
||||
document.getElementById("blockchain-icon").src = data[blockchain].icon;
|
||||
}
|
||||
|
||||
function copyAddress() {
|
||||
const address = document.getElementById("address").textContent;
|
||||
navigator.clipboard.writeText(address).then(() => {
|
||||
alert(i18n.copyAddressSuccess);
|
||||
});
|
||||
}
|
131
styles.css
Normal file
@ -0,0 +1,131 @@
|
||||
body {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
background-color: #f2f2f2;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 300px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 15px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
|
||||
margin-bottom: 20px;
|
||||
transition: transform 0.3s ease-in-out;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.donation-card {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.select-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
select {
|
||||
padding: 8px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #ddd;
|
||||
font-size: 16px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
#icon-wrapper {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#blockchain-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
#donation-info img {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
#address {
|
||||
font-size: 14px;
|
||||
background-color: #f0f0f0;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
|
||||
.language-list {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 20px 0;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.language-list li {
|
||||
margin: 0 10px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.language-list li:hover {
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
.social-media {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.social-media a {
|
||||
margin: 0 10px;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.social-media a:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.social-icon {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
footer {
|
||||
font-size: 14px;
|
||||
color: #777;
|
||||
}
|