-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
63 lines (44 loc) · 1.36 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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Elm + Bech32Convert</title>
<link rel="stylesheet" href="minimal.css">
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<div id="myapp"></div>
</body>
<script type="text/javascript">
// Start the Elm application.
var app = Elm.Main.init({
node: document.getElementById('myapp')
});
</script>
<script type="text/javascript" src="src/buffer.js"></script>
<script type="text/javascript" src="src/bech32.js"></script>
<script type="text/javascript" src="src/address.js"></script>
<script type="text/javascript">
var terra;
app.ports.sendAddress.subscribe(function(newMapped) {
console.log("DataFromElm: ", newMapped)
terra = String(newMapped);
var address = terra;
var prefix = "kujira";
var output = String(lookup(address, prefix));
console.log ("Output from conversion: ", output);
app.ports.receiveAddress.send(output);
});
// index.js (or similar)
app.ports.copyToClipboard.subscribe(function(text) {
console.log("Clipboard: ", text)
navigator.clipboard.writeText(text)
.then(() => {
app.ports.copyResult.send("Copied to clipboard!");
})
.catch(err => {
app.ports.copyResult.send("Error: " + err.message);
});
});
</script>
</html>