-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtry.html
242 lines (205 loc) · 7.12 KB
/
try.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hjson, a user interface for JSON</title>
<meta name="description" content="Hjson, a user interface for JSON. Adds comments, makes it nicer to read and avoids comma mistakes.">
<meta name="viewport" content="width=device-width">
<link rel="canonical" href="https://hjson.github.io"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/md.css" />
<link rel="stylesheet" type="text/css" href="css/pg5.css" />
<script type="text/javascript">if (window.location.href.indexOf("hjson.org")>0) window.location.href="https://hjson.github.io";</script>
<meta name="twitter:card" content="summary"f>
<meta name="twitter:site" content="@laktakk">
<meta name="twitter:creator" content="@laktakk">
<meta name="twitter:title" content="Hjson, a user interface for JSON">
<meta name="twitter:description" content="Hjson, a user interface for JSON. Adds comments, makes it nicer to read and avoids comma mistakes.">
<meta name="twitter:image" content="https://hjson.github.io/icon/hjson-s.png">
<link rel="icon" type="image/png" sizes="192x192" href="fav/icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="fav/icon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="fav/icon-96x96.png">
<link rel="apple-touch-icon" href="fav/icon-192x192.png">
<meta name="msapplication-TileImage" content="fav/icon-192x192.png">
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js" crossorigin="anonymous"></script>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="."><img src="icon/hjson-st.png">Hjson</a>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a class="btn navbar-btn btn-success" href="users.html">Users</a>
</li>
<li>
<a class="btn navbar-btn btn-success" href="download.html">Developers</a>
</li>
<li>
<a href="syntax.html">Syntax</a>
</li>
<li>
<a class="btn navbar-btn btn-danger" href="try.html">Try</a>
</li>
<li>
<a href="faq.html">FAQ</a>
</li>
<li>
<a aria-label="Star hjson on GitHub" data-count-aria-label="# stargazers on GitHub" data-count-api="/repos/hjson/hjson#stargazers_count" data-count-href="/hjson/hjson/stargazers" data-style="mega" data-icon="octicon-star" href="https://github.com/hjson/hjson" class="github-button">Star</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<div id="main">
<style type="text/css" media="screen">
#main {
position: absolute;
top: 50px;
left: 0;
right: 0;
bottom: 0;
}
.all {
height: 100%;
}
.edcon {
float: left;
width: 50%;
height: 100%;
}
.footer {
display: none;
}
</style>
<div id="loading">Loading...</div>
<div class="all" style="display: none">
<div class="edcon" id="hjson">{
// Live demo.
// Type either into the Hjson or JSON input
// to convert to the other format.
// Reload to reset.
# comments are useful
# specify rate in requests/second
"rate": 1000
// maybe you prefer js style comments
/* or if you feel old fashioned */
# key names do not need to be placed in quotes
key: "value"
# you don't need quotes for strings
text: look ma, no quotes!
# note that for quoteless strings everything up
# to the next line is part of the string!
# commas are optional
commas:
{
one: 1
two: 2
}
# trailing commas are allowed
trailing:
{
one: 1,
two: 2,
}
# multiline string
haiku:
'''
JSON I love you.
But you strangle my expression.
This is so much better.
'''
# Obviously you can always use standard JSON syntax as well:
favNumbers: [ 1, 2, 3, 6, 42 ]
}
</div>
<div class="edcon" id="json"></div>
</div>
<script src="js/hjson.js" type="text/javascript" charset="utf-8"></script>
<script src="js/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="js/mode-hjson.js" type="text/javascript" charset="utf-8"></script>
<script src="js/mode-json.js" type="text/javascript" charset="utf-8"></script>
<script src="js/theme-ambiance.js" type="text/javascript" charset="utf-8"></script>
<script>
var locked, orgText;
var hjson=ace.edit("hjson");
hjson.setTheme("ace/theme/ambiance");
hjson.on("change", changeHjson);
hjson.on("paste", changeHjson);
var hjsonMode=ace.require("ace/mode/hjson").Mode;
hjson.session.setMode(new hjsonMode());
var json=ace.edit("json");
json.setTheme("ace/theme/ambiance");
json.on("change", changeJson);
json.on("paste", changeJson);
var jsonMode=ace.require("ace/mode/json").Mode;
json.session.setMode(new jsonMode());
function changeHjson()
{
if (locked) return;
var text=hjson.getSession().getValue();
try { text=JSON.stringify(Hjson.parse(text), null, " "); }
catch (e) {
text=e.toString();
if (e.hint) text+="\n\nhint: "+e.hint;
}
locked=true;
json.getSession().setValue(text);
locked=false;
}
function changeJson()
{
if (locked) return;
var text=json.getSession().getValue();
try { text=Hjson.stringify(JSON.parse(text)); }
catch (e) { text=e.toString(); }
locked=true;
hjson.getSession().setValue(text);
locked=false;
}
function reset()
{
locked=false;
hjson.getSession().setValue(orgText);
}
orgText=hjson.getSession().getValue();
changeHjson();
$("#loading").hide();
$(".all").show();
</script>
<div class="ynav">
<a href="users.html">Users</a>
<a href="download.html">Developers</a>
<a href="syntax.html">Syntax</a>
<a href="try.html">Try</a>
<a href="faq.html">FAQ</a>
<a href="https://github.com/hjson/hjson/issues">Feedback</a>
<a href="history.html">History</a>
</div>
</div>
</body>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-49208230-1', 'auto');
ga('send', 'pageview');
$(document).on("click", ".navbar-collapse.in", function(e) {
if ($(e.target).is("a") && $(e.target).attr("class")!="dropdown-toggle")
$(this).collapse("hide");
});
</script>
<script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script>
</html>