-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
48 lines (48 loc) · 2.44 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.10/css/dataTables.bootstrap.min.css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<style media="screen">
td, th { border: 1px solid #ccc; padding: 3px }
td > td { border: 0px }
table > td { border: 0px }
.none {display: none !important}
</style>
</head>
<body>
<div class="container-fluid">
<div class="col-sx-12 col-md-12">
<textarea id="src" style="width:100%" rows="3" onkeyup="render()" onmouseup="render()" placeholder="Paste your JSON here"></textarea>
<span><input id="datatable_enabled" type="checkbox" onchange="render()">DataTables</span>
<span><input id="bootstrap_enabled" type="checkbox" onchange="render()">Bootstrap</span>
</div>
<div id="result" class="col-sx-12 col-md-12 table-responsive well">
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js"></script>
<script src="cito.js"></script>
<script src="jsonastable.js"></script>
<script src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.js"></script>
<script src="https://cdn.datatables.net/1.10.10/js/dataTables.bootstrap.min.js"></script>
<script>
function render(){
var container = $("#result").empty()[0];
var json = JSON.parse($("#src").val());
var table = cito.vdom.append(container, jsonastable(json, {bootstrap:$("#bootstrap_enabled").is(":checked"), datatable:$("#datatable_enabled").is(":checked")}));
$("caption").click(function(){$(this.nextSibling).toggleClass("none")});
if ($("#datatable_enabled").is(":checked")) $("td>table.datatable").DataTable({"lengthMenu": [[-1, 1, 5, 10, 50], ["All", 1, 5, 10, 50]]});
}
</script>
</body>
</html>