-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
76 lines (53 loc) · 2.12 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
<!DOCTYPE html>
<html ng-app="MinefieldExperiment">
<head>
<meta charset="utf-8">
<title>Text to Image</title>
<link rel="stylesheet" href="css/styles.css">
<link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body ng-controller="IndexCtrl as ctrl">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label for="exampleInputEmail1">Input</label>
<textarea rows="5" class="form-control" id="input"></textarea>
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<label for="exampleInputEmail1">Output Image</label>
<div><img src="" id="image-output" /></div>
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<label for="exampleInputEmail1">Decoded</label>
<textarea rows="5" class="form-control" id="decoded"></textarea>
</div>
</div>
</div>
</div>
<script src="js/scripts.js"></script>
<script>
var c = new Compressor();
var input = document.getElementById('input');
var output = document.getElementById('image-output');
var decoded = document.getElementById('decoded');
input.addEventListener('keyup', function(e) {
var value = e.target.value;
var result = c.compress(value);
var r = result.toImage();
output.src = r;
});
output.addEventListener('load', function(e) {
var data = c.decompressImage(e.target, function(c) {
decoded.value = c;
});
});
</script>
</body>
</html>