-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
index.html
208 lines (193 loc) · 6.72 KB
/
index.html
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
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta property="og:site_name" content="">
<meta property="og:description" content="">
<meta property="og:image" content="/lnme/icon.svg">
<title>Send me some sats</title>
<style>
html {
width: 100%;
height: 100%;
font-size: 1vw;
}
body {
background-image: linear-gradient(60deg, #3d3393 0%, #2b76b9 37%, #2cacd1 65%, #35eb93 100%);
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
.wrapper {
font-weight: 400;
line-height: 1.25;
margin-bottom: 1rem;
font-size: 4em;
color: #fff;
width: 640px;
margin: 1em auto;
text-align: center;
}
.note {
font-size: 0.2em;
}
.wrapper h1 {
font-weight: 700;
}
.wrapper h2 {
font-weight: 400;
}
.wrapper a, .wrapper a:visited, .wrapper a:active {
color: #fff;
text-decoration:none;
}
.wrapper p {
margin: 0.5em 0;
}
input, input:focus {
outline: none;
background-color: transparent;
font-size: 1em;
font-weight: 700;
border: none;
border-bottom: 1px solid #fff;
text-align: center;
color: #fff;
}
::placeholder {
color: #fff;
opacity: 0.2;
}
input[type=number] {
-moz-appearance: textfield;
}
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input.amount {
width: 300px;
}
input.memo {
width: 100%;
}
button {
color: #fff;
font-weight: 400;
font-size: 0.5em;
line-height: 1.5;
font-weight: 400;
width: 100%;
cursor: pointer;
border: none;
border-radius: 30px;
background-color: #2b76b9;
}
h2.lnme-value, h1.lnme-memo {
font-size: 2em;
font-weight: 400;
}
.lnme-wrapper {
margin-top: 1em;
font-size: 0.5em;
width: 100%;
white-space: nowrap;
}
.lnme-qrcode > canvas {
border: 5px solid #fff;
background: #fff;
}
.lnme-details {
text-overflow: ellipsis;
overflow: hidden;
}
.lnme-link {
text-overflow: ellipsis;
overflow: hidden;
}
.lnme-copy {
cursor: pointer;
}
</style>
<link rel="icon" type="image/svg+xml" href="/lnme/favicon.svg" />
</head>
<body>
<div class="wrapper">
<div class="form" id="form">
<p>
Send me<br>
<input type="number" placeholder="10000" class="amount" id="amount" autofocus="true" autocomplete="off" min="100"> sats
<br>
for
<br>
<input type="text" class="memo" id="memo" placeholder="message" autocomplete="off">
</p>
<button id="send-button">⚡ Send ⚡</button>
<p id="onchain" class="note">
<a href="#" id="get-new-address" class="onchain">Prefer onchain Bitcoin? Click here!</a>
</p>
<div id="lnme-wrapper" class="lnme-wrapper" style="display:none">
<div class="lnme-qrcode"></div>
<div class="lnme-details">
<a href="#" class="lnme-link"><span class="lnme-payment-request"></span></a>
<div class="lnme-copy">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-copy"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
</div>
</div>
</div>
<div id="loader" style="display:none">
<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
<animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/>
</path>
</svg>
</div>
</div>
</div>
<script src="/lnme/lnme.js" id="lnme-script"></script>
<script>
var siteName = document.querySelector('head > meta[property="og:site_name"]');
if (siteName && !siteName.content) {
siteName.content = window.location.host;
}
var siteDescription = document.querySelector('head > meta[property="og:description"]');
if (siteDescription && !siteDescription.content) {
siteDescription.content = "sats for " + window.location.host;
}
document.getElementById("get-new-address").addEventListener('click', function(e) {
e.preventDefault();
var lnme = new LnMe({});
lnme.newAddress().then(address => {
document.getElementById("onchain").innerHTML = address;
});
});
var urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('amount')) {
document.getElementById('amount').value = urlParams.get('amount');
}
if (urlParams.get('memo')) {
document.getElementById('memo').value = urlParams.get('memo');
}
document.getElementById('send-button').addEventListener('click', function(e) {
e.preventDefault();
var amountElement = document.getElementById('amount');
var memoElement = document.getElementById('memo');
if (amountElement.value == "") {
return;
}
document.getElementById('loader').style.display = 'block';
e.target.setAttribute('disabled', true);
amountElement.setAttribute('disabled', true);
memoElement.setAttribute('disabled', true);
var lnme = new LnMe({ value: amountElement.value, memo: memoElement.value, target: document.getElementById('lnme-wrapper') });
lnme.showPaymentRequest = function() {
document.getElementById('send-button').style.display = 'none';
document.getElementById('lnme-wrapper').style.display = 'block';
this.populatePaymentRequest();
}
lnme.thanks = function() {
document.getElementById('form').innerHTML = '<h1 class="lnme-headline">Thanks!</h1>';
}
lnme.request();
});
</script>
</body>
</html>