-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathscript.js
More file actions
66 lines (63 loc) · 2.28 KB
/
script.js
File metadata and controls
66 lines (63 loc) · 2.28 KB
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
function showToast(message) {
const toast = document.getElementById("toast");
toast.innerText = message;
toast.classList.remove("hidden");
toast.classList.add("opacity-100");
setTimeout(() => {
toast.classList.add("hidden");
}, 3000);
}
function handleCopy() {
const upi = document.getElementById("upiID").innerText;
navigator.clipboard.writeText(upi);
showToast("UPI ID copied!");
}
function handleDownload() {
showToast("Wait");
setTimeout(() => {
const link = document.createElement("a");
link.href = "assets/downloadQR.png";
link.download = "qr";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
showToast("Downloaing.....");
}, 3000);
}
function handlePay() {
showToast("Opening UPI app(s)");
setTimeout(() => {
window.location.href = "upi://pay?pa=RahulDhankhar@UPI&pn=Rahul%20Dhankhar&mc=0000&mode=02&purpose=00"; // Replace upi id and name keep the format same
}, 3000);
}
const paymentAddresses = {
paypal: 'https://www.paypal.me/ImRahulDhankhar', // Update Paypal value
binance: '486968757', // Update Binance Pay value
coffee: 'https://buymeacoffee.com/RahulDhankhar' // Update Buy me coffe value
};
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('paypal-address').textContent = paymentAddresses.paypal;
document.getElementById('binance-address').textContent = paymentAddresses.binance;
document.getElementById('coffee-address').textContent = paymentAddresses.coffee;
});
function showToast(message) {
const toast = document.getElementById("toast");
toast.innerText = message;
toast.classList.remove("hidden");
toast.classList.add("opacity-100");
setTimeout(() => {
toast.classList.add("hidden");
}, 3000);
}
function copyPaymentAddress(method) {
const address = paymentAddresses[method];
if (!address) return;
if (method === 'paypal' || method === 'coffee') {
window.location.href = address;
return;
}
if (method === 'binance') {
navigator.clipboard.writeText(address);
showToast(`${method.charAt(0).toUpperCase() + method.slice(1)} copied!`);
}
}