-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelativeJPath.html
55 lines (55 loc) · 1.2 KB
/
relativeJPath.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
<html>
<head>
<script src="jsont.js">
</script>
<script src="http://code.jquery.com/jquery-2.0.2.min.js">
</script>
<script>
function runJsonT() {
var jsonText = (document.getElementById('json'));
var json = JSON.parse(jsonText.value);
var rules = JSON.parse(document.getElementById('rules').value);
var result = jsonT(json, rules);
var div = $("div");
result = div.html(result);
alert(result.html());
document.getElementById("result").innerHTML = result.html();
};
</script>
</head>
<body>
<table width="100%">
<colgroup>
<col span="1" style="width: 50%;">
<col span="1" style="width: 50%;">
</colgroup>
<thead>
<tr>
<th>
JSON:
</th>
<th>
Transfo:
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<textarea rows="20" style="width: 100%" id="json">
{ "link": {"uri":{"value": "http://company.com", "display": "none"}, "title":"company homepage" }}
</textarea>
</td>
<td>
<textarea rows="20" style="width: 100%" id="rules">
{ "link": "<a href=\"{$.uri}\">{$.title}</a>" ,
"uri": "{$.value}"}
</textarea>
</td>
</tr>
</tbody>
</table>
<input type="button" value="--- Run ---" onclick="runJsonT();" style="width: 100%"></input>
<div id="result"/>
</body>
</html>