-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
200 lines (189 loc) · 5.49 KB
/
Copy pathindex.html
File metadata and controls
200 lines (189 loc) · 5.49 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>BNTPAY</title>
<meta property="og:title" content="BNTPAY">
<meta property="og:description" content="Payment links for Blocknet">
<meta property="og:site_name" content="BNTPAY">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="BNTPAY">
<meta name="twitter:description" content="Payment links for Blocknet">
<meta name="theme-color" content="#000000">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: #000;
color: #b0b0b0;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
padding: 32px;
}
#app {
flex: 1;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.brand {
font-size: clamp(48px, 10vw, 96px);
font-weight: 900;
font-style: italic;
letter-spacing: -2px;
color: #af0;
user-select: none;
}
.sub {
font-size: 15px;
margin-top: 12px;
color: #fff;
opacity: 0.8;
}
.payment { text-align: center; max-width: 600px; width: 100%; }
.payment .brand { margin-bottom: 48px; }
.pay-detail {
font-size: 15px;
line-height: 2;
text-align: left;
display: inline-block;
}
.pay-detail .label { color: #fff; opacity: 0.8; }
.pay-detail .value { color: #af0; }
.pay-detail .memo-value { color: #fff; font-style: italic; }
.pay-actions {
margin-top: 48px;
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
}
.open-btn {
background: #af0;
color: #000;
border: none;
padding: 16px 32px;
font: bold 16px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
cursor: pointer;
transition: background 0.2s;
width: 100%;
max-width: 320px;
}
.open-btn:hover { background: #cf3; }
.fallback {
margin-top: 40px;
font-size: 14px;
color: #fff;
opacity: 0.8;
}
.fallback a { color: #af0; }
.landing { text-align: center; }
.landing .brand { margin-bottom: 16px; }
.example {
margin-top: 40px;
text-align: left;
display: inline-block;
font-size: 13px;
color: #fff;
opacity: 0.8;
line-height: 2;
}
.footer {
width: 100%;
text-align: center;
font-size: 13px;
color: #fff;
opacity: 0.85;
padding-top: 16px;
}
.footer a {
color: #af0;
text-decoration: none;
}
.footer a:hover { text-decoration: underline; }
</style>
</head>
<body>
<div id="app"></div>
<div class="footer">
made by <a href="https://bntpay.com/$bntpay?amount=100&memo=thanks%20%3A%29">$bntpay</a>
</div>
<script>
(function () {
var path = window.location.pathname.replace(/^\/+/, '').replace(/\/+$/, '');
var params = new URLSearchParams(window.location.search);
var app = document.getElementById('app');
function escapeHtml(s) {
var d = document.createElement('div');
d.appendChild(document.createTextNode(s));
return d.innerHTML;
}
if (!path) {
app.innerHTML =
'<div class="landing">' +
'<div class="brand">BNTPAY</div>' +
'<div class="sub">Payment links for Blocknet</div>' +
'<div class="example">' +
'bntpay.com/<b>ADDRESS</b>?amount=<b>100</b>&memo=<b>invoice-42</b>' +
'</div>' +
'</div>';
return;
}
var address = decodeURIComponent(path);
var amount = params.get('amount') || '';
var memo = params.get('memo') || '';
var uri = 'blocknet://' + address;
var uriParams = [];
if (amount) uriParams.push('amount=' + encodeURIComponent(amount));
if (memo) uriParams.push('memo=' + encodeURIComponent(memo));
if (uriParams.length) uri += '?' + uriParams.join('&');
var displayAddress = address;
if (address.charAt(0) !== '$' && address.charAt(0) !== '@' && address.length > 20) {
displayAddress = address.substring(0, 12) + '...' + address.substring(address.length - 8);
}
var amountDisplay = '';
if (amount) {
var parts = parseFloat(amount).toFixed(8).split('.');
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
amountDisplay = parts.join('.');
}
var shortAddr = address;
if (address.charAt(0) !== '$' && address.charAt(0) !== '@' && address.length > 20)
shortAddr = address.substring(0, 4) + '...' + address.substring(address.length - 4);
var desc = 'Pay ' + shortAddr + (amount ? ' ~' + amount + ' BNT' : '') + ' on Blocknet';
document.title = 'BNTPAY \u2014 ' + desc;
var html =
'<div class="payment">' +
'<div class="brand">BNTPAY</div>' +
'<div class="pay-detail">' +
'<div><span class="label">Pay </span><span class="value">' + escapeHtml(displayAddress) + '</span></div>';
if (amount) {
html += '<div><span class="label">Amount </span><span class="value">' + amountDisplay + ' BNT</span></div>';
}
if (memo) {
html += '<div><span class="label">Memo </span><span class="memo-value">“' + escapeHtml(memo) + '”</span></div>';
}
html +=
'</div>' +
'<div class="pay-actions">' +
'<button class="open-btn" id="open-btn">Open in Wallet</button>' +
'</div>' +
'<div class="fallback">' +
'Don\'t have Blocknet Wallet yet?<br>' +
'<a href="https://github.com/blocknetprivacy/blocknet-tauri/releases">Download here</a>' +
'</div>' +
'</div>';
app.innerHTML = html;
document.getElementById('open-btn').addEventListener('click', function () {
window.location.href = uri;
});
setTimeout(function () { window.location.href = uri; }, 600);
})();
</script>
</body>
</html>