-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.html
70 lines (67 loc) · 2.23 KB
/
demo.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>xBase32 - DEMO - base32 encoding and decoding that optimizes byte size based on input characters and supports unicode.</title>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="dist/xbase32.min.js"></script>
</head>
<body>
<div class="container">
<h1>xBase32</h1>
<p>base32 encoding and decoding that optimizes byte size based on input characters and supports unicode.</p>
<hr>
<ul>
<li>
<a href="https://github.com/busterc/x-base-32">Github</a>
</li>
<li>
<a href="https://npmjs.com/package/x-base-32">NPM</a>
</li>
</ul>
<hr>
<p>
<b>Demo</b>
</p>
<div class="field">
<textarea id="input" class="form-control" placeholder="Content to be encoded">🦁🐯🐻 oh my!</textarea>
</div>
<button id="encode" class="btn btn-primary btn-default">↓ Encode ↓</button>
<hr>
<button id="decode" class="btn btn-primary btn-default">↑ Decode ↑</button>
<div class="field">
<textarea id="output" class="form-control" placeholder="Encoded content to be decoded"></textarea>
</div>
<hr>
<p>
powered by 🦁🐯🐻 oh my!
</p>
</div>
<script>
var btnEncode = document.getElementById("encode");
var btnDecode = document.getElementById("decode");
var input = document.getElementById("input");
var output = document.getElementById("output");
btnEncode.onclick = function () {
try {
output.value = xBase32.encode(input.value);
input.value = "";
} catch (error) {
alert(error);
}
}
btnDecode.onclick = function () {
try {
input.value = xBase32.decode(output.value);
output.value = "";
} catch (error) {
alert(error);
}
}
</script>
</body>
</html>