-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
42 lines (40 loc) · 1.77 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
<html>
<head>
<title>Flyt - Transalate arrays</title>
<style>
html, body{ width:100%; min-height: 100%;}
#root{ margin: 200 auto; width: 400px; height: 300px; text-align:center;}
form{ width: 100%; height: 100%;}
input{ display: block; margin-bottom: 10px; margin-left: 5%; width: 90%; height: 30px; padding: 5px; font-size: 22px; margin-top: 15px; }
button{ width:90%; border: 0; height: 30px; }
</style>
</head>
<body>
<div id="root">
<form name="flyt-check">
<heading>
<h1>flyt.<em>flatten(...)</em></h1>
</heading>
<input id="source" name="source" value=""></input>
<input id="result" name="result" value=""></input>
<button id="flytize">Flyt It!</button>
</form>
</div>
<script type='text/javascript' src='./flyt.js'></script>
<script type='text/javascript'>
window.addEventListener('DOMContentLoaded', function(){
document.getElementById('flytize').addEventListener('click', function(e){
e.preventDefault();
var source = document.getElementById('source') ? document.getElementById('source').value : false;
var result = document.getElementById('result') ? document.getElementById('result') : false;
if(source && source.length){
result.value = '[' + flyt.flatten(eval(source)) + ']';
}else{
alert('Please put source array e.g. [[1, 2, [3]], 4]');
}
return false;
});
});
</script>
</body>
</html>