forked from andrefigueira/json-formatter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.html
197 lines (170 loc) · 5.72 KB
/
demo.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
<!DOCTYPE html>
<html>
<head>
<title>JAYSUN, Play nice with JSON, jQuery Plugin</title>
<link rel="stylesheet" href="css/main.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,400italic,700italic,900italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<!-- Include the plugin files -->
<link rel="stylesheet" href="src/jaysun.css" />
<script src="src/jaysun.1.0.js"></script>
<script>
$(document).ready(function(){
$('.json').Jaysun({
collapse: true, // Setting to 'true' this will format the JSON into a collapsable/expandable tree
closed:false //This only is valid if collapse is true, sets if the objects are visible or not
});
$('.json2').Jaysun({
collapse: false // Setting to 'true' this will format the JSON into a collapsable/expandable tree
});
});
</script>
</head>
<body>
<h1>JAYSUN</h1>
<div class="container">
<p class="intro">A lightweight plugin that allows you to view JSON nicely.</p>
<div class="subContainer">
<h2>Usage</h2>
<p>Using JAYSUN is as simple as 1, 2, 3... Initiate the jQuery function poiting the function to the element containing the unformatted JSON string.</p>
<h2>JavaScript</h2>
<pre>
$(document).ready(function(){
$('.json').Jaysun({
collapse: true, // Setting to 'true' this will format the JSON into a collapsable/expandable tree
closed:false //This only is valid if collapse is true, sets if the objects are visible or not
});
});
</pre>
<h2>Unformatted</h2>
<div class="jsonExample">
{
"page": 1,
"pages": 1,
"per_page": 15,
"total": 2,
"shots": [
{
"id": 48351,
"title": "Slow and steady wins the race.",
"url": "http://dribbble.com/shots/48351-Slow-and-steady-wins-the-race",
"short_url": "http://drbl.in/48351",
"image_url": "http://dribbble.com/system/users/1/screenshots/48351/shot_1282591933.png",
"image_teaser_url": "http://dribbble.com/system/users/1/screenshots/48351/shot_1282591933_teaser.png",
"width": 400,
"height": 300,
"views_count": 864,
"likes_count": 24,
"comments_count": 13,
"rebounds_count": 0,
"rebound_source_id": 43424,
"created_at": "2010/08/23 15:32:13 -0400",
"player": {
"id": 1,
"name": "Dan Cederholm",
"username": "simplebits",
"url": "http://dribbble.com/simplebits",
"avatar_url": "http://dribbble.com/system/users/1/avatars/original/dancederholm-peek.jpg",
"location": "Salem, MA",
"twitter_screen_name": "simplebits",
"drafted_by_player_id": null,
"shots_count": 147,
"draftees_count": 103,
"followers_count": 2027,
"following_count": 354,
"created_at": "2009/07/07 21:51:22 -0400"
}
},
...
]
}
</div>
<h2>With JAYSUN (Collapsable)</h2>
<div class="json" id="json">
{
"page": 1,
"pages": 1,
"per_page": 15,
"total": 2,
"shots": [
{
"id": 48351,
"title": "Slow and steady wins the race.",
"url": "http://dribbble.com/shots/48351-Slow-and-steady-wins-the-race",
"short_url": "http://drbl.in/48351",
"image_url": "http://dribbble.com/system/users/1/screenshots/48351/shot_1282591933.png",
"image_teaser_url": "http://dribbble.com/system/users/1/screenshots/48351/shot_1282591933_teaser.png",
"width": 400,
"height": 300,
"views_count": 864,
"likes_count": 24,
"comments_count": 13,
"rebounds_count": 0,
"rebound_source_id": 43424,
"created_at": "2010/08/23 15:32:13 -0400",
"player": {
"id": 1,
"name": "Dan Cederholm",
"username": "simplebits",
"url": "http://dribbble.com/simplebits",
"avatar_url": "http://dribbble.com/system/users/1/avatars/original/dancederholm-peek.jpg",
"location": "Salem, MA",
"twitter_screen_name": "simplebits",
"drafted_by_player_id": null,
"shots_count": 147,
"draftees_count": 103,
"followers_count": 2027,
"following_count": 354,
"created_at": "2009/07/07 21:51:22 -0400"
}
}
]
}
</div>
<h2>With JAYSUN (Not Collapsable)</h2>
<div class="json2" id="json2">
{
"page": 1,
"pages": 1,
"per_page": 15,
"total": 2,
"shots": [
{
"id": 48351,
"title": "Slow and steady wins the race.",
"url": "http://dribbble.com/shots/48351-Slow-and-steady-wins-the-race",
"short_url": "http://drbl.in/48351",
"image_url": "http://dribbble.com/system/users/1/screenshots/48351/shot_1282591933.png",
"image_teaser_url": "http://dribbble.com/system/users/1/screenshots/48351/shot_1282591933_teaser.png",
"width": 400,
"height": 300,
"views_count": 864,
"likes_count": 24,
"comments_count": 13,
"rebounds_count": 0,
"rebound_source_id": 43424,
"created_at": "2010/08/23 15:32:13 -0400",
"player": {
"id": 1,
"name": "Dan Cederholm",
"username": "simplebits",
"url": "http://dribbble.com/simplebits",
"avatar_url": "http://dribbble.com/system/users/1/avatars/original/dancederholm-peek.jpg",
"location": "Salem, MA",
"twitter_screen_name": "simplebits",
"drafted_by_player_id": null,
"shots_count": 147,
"draftees_count": 103,
"followers_count": 2027,
"following_count": 354,
"created_at": "2009/07/07 21:51:22 -0400"
}
}
]
}
</div>
</div><!-- End sub container -->
</div><!-- End container -->
</body>
</html>