-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
118 lines (101 loc) · 2.56 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html>
<head>
<style>
h1{
font-weight: 300;
font-family: sans-serif
}
.back{
font-weight: 600;
background: black;
color: white ;
}
a{
display: inline-block;
xmargin-bottom: 12px;
color: purple;
outline: 1px solid blue;
margin-bottom: 5px ;
border-radius: 60px;
padding: 6px;
}
</style>
<script src="../xjsx.js"></script>
<!-- Modules -->
<script src="fetch.js"></script>
<script src="include.js"></script>
<script src="print.js"></script>
<script src="print-html.js"></script>
<script src="if.js"></script>
<script src="data.js"></script>
<script src="on.js"></script>
<script src="eval.js"></script>
<script src="console-log.js"></script>
<script src="animate.js"></script>
<script src="for-each.js"></script>
<script src="parse-json.js"></script>
<script src="use-template.js"></script>
<script src=" html-element.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<?html-element: "h1"?>
List of all keys at window
<?end?>
<?on: "xload"; event?>
<?eval: var _dt=event.detail, _pt=_dt.path, _pk=_dt.parentKey, _pv=_dt.parentVal, _val=event.detail.val, _key=event.detail.key?>
<?if: _pk?>
<?html-element:"a", {onclick:back, class: "back"}; node?>
<?eval: node.key=_pk, node.val=_pv, node.path=_pt?>
<?print: _pk?> (go back)
<?end?>
<br>
<?end?>
<?if: "object"=== typeof _val && _val?>
<?for-each: _val, 10; val, key?>
<?html-element:"a", {onclick:foo}; node?>
<?eval: node.key=key, node.val=val,node.path=_pt, node.parentKey=_key, node.parentVal=_val?>
<?print: key?>
<?end?>
<br>
<?end?>
<?else?>
<mark><?print: _val?></mark>
<?end?>
<?end?>
<script>
function parse(e){
e=e
.trim()
. replace (/(\/)/g,".");
return e
}
function prt(e){
e=e.trim()
.split("/");
e.pop();
e=e.join("/")
return e
}
function back(){
var pt=this.path
pt=pt[pt.length-2]||[]
this.path.pop()
XJSX.event.emit("xload", {path:this.path, val: this.val, key: this.key, parentVal: pt[0], parentKey: pt[1]})
}
function foo(){
XJSX.event.emit("xload", {
val: this.val,
key:this.key,
path:this.path?this.path.push([this.parentVal,this.parentKey])&&this.path:[[this.parentVal,this.parentKey]],
parentKey: this.parentKey,
parentVal: this.parentVal
})
}
XJSX.event.emit("xload",{val: window, key:"window", path:[]})
</script>
</body>
</html>