-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
114 lines (114 loc) · 3.79 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Boltz Embed Example</title>
<style>
html {
background-color: darkkhaki;
color: maroon;
text-align: center;
}
</style>
</head>
<body>
<h1>Boltz Embed Example</h1>
<iframe id="boltz" width="400" src="" scrolling="no" frameborder="0"></iframe>
<h2 id="url"></h2>
<label>Set Invoice: <input type="checkbox" id="invoice" /></label>
<br />
<label>Set Address: <input type="checkbox" id="address" /></label>
<br />
<label>
<label for="sendAmount">
<input type="radio" id="sendAmount" name="amount[]" value="sendAmount" checked/>
Send Amount
</label>
<br />
<label for="receiveAmount">
<input type="radio" id="receiveAmount" name="amount[]" value="receiveAmount"/>
Receive Amount
</label>
<br />
<input type="number" id="amount" value="100000"/></label>
<br />
<label>Set Asset Send:
<label>
<input type="radio" name="assetSend[]" value="BTC"/>
BTC
</label>
<label>
<input type="radio" name="assetSend[]" value="LN"/>
LN
</label>
<label>
<input type="radio" name="assetSend[]" value="L-BTC"/>
L-BTC
</label>
<label>
<input type="radio" name="assetSend[]" value="RBTC"/>
RBTC
</label>
</label>
<br />
<label> Set Asset Receive:
<label>
<input type="radio" name="assetReceive[]" value="BTC"/>
BTC
</label>
<label>
<input type="radio" name="assetReceive[]" value="LN"/>
LN
</label>
<label>
<input type="radio" name="assetReceive[]" value="L-BTC"/>
L-BTC
</label>
<label>
<input type="radio" name="assetReceive[]" value="RBTC"/>
RBTC
</label>
</label>
<br />
<br />
<button id="update">Update</button>
<script type="module">
import { iframeResize } from 'iframe-resizer';
const baseUrl = "https://webapp-git-feat-url-params-3-boltz.vercel.app?embed=1&ref=embed";
//const baseUrl = "https://localhost:5173?embed=1&ref=embed";
let url = baseUrl;
const urlElement = document.getElementById('url');
const iframe = document.getElementById('boltz');
const updateElement = document.getElementById('update');
urlElement.innerText = url;
iframe.src = url;
iframeResize({ log: false }, '#boltz');
updateElement.addEventListener('click', () => {
url = baseUrl;
const invoice = document.getElementById('invoice').checked;
if (invoice) {
url += "&invoice=lnbc10n1p0v";
}
const address = document.getElementById('address').checked;
if (address) {
url += "&address=bc1qar0srrr";
}
const amount = document.getElementById('amount').value;
const amountDirection = document.querySelector('input[name="amount[]"]:checked').value;
if (amount && amountDirection) {
url += `&${amountDirection}=${amount}`;
}
const assetSend = document.querySelector('input[name="assetSend[]"]:checked');
if (assetSend) {
url += `&assetSend=${assetSend.value}`;
}
const assetReceive = document.querySelector('input[name="assetReceive[]"]:checked');
if (assetReceive) {
url += `&assetReceive=${assetReceive.value}`;
}
iframe.src = url;
urlElement.innerText = url;
});
</script>
</body>
</html>