-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
162 lines (141 loc) · 5.96 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
<!DOCTYPE HTML>
<html>
<head>
<meta name="description" content="Use this link to transfer me some coins">
<meta name="keywords" content="Bitcoin,Ethereum,Blockchain,Cryptocurrency, Cold wallet, Mobile wallet">
<meta name="author" content="Flightwallet.org">
<title>Send me crypto</title>
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content="Send me crypto">
<meta itemprop="description" content="Use this link to transfer me some coins">
<meta itemprop="image" content="https://raw.githubusercontent.com/flightwallet/flightwallet.github.io/master/images/wallet-2%20copy.png">
<!-- Twitter Card data -->
<meta name="twitter:card" content="product">
<meta name="twitter:site" content="@caffeinum">
<meta name="twitter:title" content="Send me crypto">
<meta name="twitter:description" content="Use this link to transfer me some coins">
<meta name="twitter:creator" content="@caffeinum">
<meta name="twitter:image" content="https://raw.githubusercontent.com/flightwallet/flightwallet.github.io/master/images/wallet-2%20copy.png">
<!-- Open Graph data -->
<meta property="og:title" content="Send me crypto" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https:/flightwallet.org" />
<meta property="og:image" content="https://raw.githubusercontent.com/flightwallet/flightwallet.github.io/master/images/wallet-2%20copy.png" />
<meta property="og:description" content="Send me crypto" />
<meta property="og:site_name" content="Flight wallet" />
<!-- Yandex.Metrika counter -->
<script type="text/javascript" >
(function (d, w, c) {
(w[c] = w[c] || []).push(function() {
try {
w.yaCounter50897126 = new Ya.Metrika2({
id:50897126,
clickmap:true,
trackLinks:true,
accurateTrackBounce:true,
webvisor:true
});
} catch(e) { }
});
var n = d.getElementsByTagName("script")[0],
s = d.createElement("script"),
f = function () { n.parentNode.insertBefore(s, n); };
s.type = "text/javascript";
s.async = true;
s.src = "https://mc.yandex.ru/metrika/tag.js";
if (w.opera == "[object Opera]") {
d.addEventListener("DOMContentLoaded", f, false);
} else { f(); }
})(document, window, "yandex_metrika_callbacks2");
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/50897126" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
<script src="https://davidshimjs.github.io/qrcodejs/qrcode.min.js"></script>
</head>
<style>
</style>
<body>
<div id="container" style="justify-content: center; align-items: center; text-align: center;">
<div id="title" style="font-size: 30px;">
<h1 id="title-value">Send me crypto to <div id="chain-value"></div></h1>
</div>
<br>
<div id="instructions"></div>
<div id="address">
Address: <div id="address-value"></div>
</div>
<br>
<div id="amount">
Amount: <div id="amount-value"></div>
</div>
<br>
<div style="display: flex; justify-content: center;" id="qrcode"></div>
<div id="qrcode-description"></div>
<br>
</div>
<footer style="display: flex; justify-content: center; position: fixed; left: 0; width: 100%;">
<a href="https://flightwallet.org/pay?chain=bitcoin&address=mvF1LyVR6yxFpEwmkeMVq3SBx2pX6mcFYV&amount=0.01"><i>example</i></a>
<span> · </span>
<a href="https://flightwallet.org"><i>flightwallet</i></a>
<span> · </span>
<a href="https://github.com/flightwallet/pay/"><i>github</i></a>
<span> · </span>
<a href="https://t.me/flightwallet"><i>contact</i></a>
</footer>
<script>
var query = window.location.search || "?"
var params = query.slice(1).split("&").map((str) => str.split("=")).reduce((obj, [key, value]) => ({ [key]: value, ...obj }), {})
console.log('params', params)
params.chain = params.chain ? params.chain : "bitcoin"
var bitcoinURI = params.chain + ":" + params.address
if (params.amount) {
bitcoinURI += "?amount=" + parseFloat(params.amount)
}
try {
if (params.address) {
document.location = bitcoinURI
console.log('redirect to', bitcoinURI)
}
}
catch(err) {
console.log("redirect failed - device does not support URI '" + params.chain + "'")
window.location.reload(true);
window.open("https://flightwallet.org", '_blank');
}
function fillCredentials() {
document.getElementById("chain-value").innerHTML = params.chain
document.getElementById("address-value").innerHTML = params.address
document.getElementById("amount-value").innerHTML = params.amount
if (params.address) {
var qrcode = new QRCode(document.getElementById("qrcode"), {
text: bitcoinURI,
width: 512,
height: 512,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
document.getElementById("qrcode-description").innerHTML = bitcoinURI
}
}
function fillFallback() {
document.getElementById("title-value").innerHTML = "Generate crypto invoice request"
document.getElementById("instructions").innerHTML = "<h2>Example</h2>\
https://flightwallet.org/pay?<b>chain</b>=bitcoin&<b>address</b>=mvF1LyVR6yxFpEwmkeMVq3SBx2pX6mcFYV&<b>amount</b>=0.01\
<br>\
<h2>Result</h2>\
bitcoin:mvF1LyVR6yxFpEwmkeMVq3SBx2pX6mcFYV?amount=0.01\
<br><br><br>\
<h2>Params that you have already passed</h2>\
"
}
if (params.address) {
document.addEventListener("DOMContentLoaded", fillCredentials);
} else {
console.log('no values', params)
document.addEventListener("DOMContentLoaded", fillCredentials);
document.addEventListener("DOMContentLoaded", fillFallback);
}
</script>
</body>
</html>