-
Notifications
You must be signed in to change notification settings - Fork 0
/
json-editor.html
207 lines (188 loc) · 5.82 KB
/
json-editor.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- Use the .htaccess and remove these lines to avoid edge case issues.
More info: h5bp.com/i/378 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<!-- Our site title and description -->
<title>JSON Editor | Stanford Graphics Lab Website</title>
<meta name="generator" content="DocPad v6.78.4" />
<!-- Mobile viewport optimized: h5bp.com/viewport -->
<meta name="viewport" content="width=device-width" />
<!-- Icons -->
<link rel="shortcut icon" href="images/icons/favicon.ico">
<!-- Shims: IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script async src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="/styles/twitter-bootstrap.css" /><link rel="stylesheet" href="/styles/style.css" />
</head>
<body>
<!-- Navbar Menu -->
<div class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Stanford Graphics Lab</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li
typeof="sioc:Page"
about="/pages/people.html"
class=""
>
<a href="/pages/people.html" property="dc:title">
People
</a>
</li>
<li
typeof="sioc:Page"
about="/pages/projects.html"
class=""
>
<a href="/pages/projects.html" property="dc:title">
Projects
</a>
</li>
<li
typeof="sioc:Page"
about="/pages/courses.html"
class=""
>
<a href="/pages/courses.html" property="dc:title">
Courses
</a>
</li>
<li
typeof="sioc:Page"
about="/pages/publications.html"
class=""
>
<a href="/pages/publications.html" property="dc:title">
Publications
</a>
</li>
<li
typeof="sioc:Page"
about="/pages/data.html"
class=""
>
<a href="/pages/data.html" property="dc:title">
Data
</a>
</li>
</ul>
</div>
</div>
</div><!-- navbar -->
<!-- Content -->
<div class="container">
<section id="content" class="content">
<h1>Basic JSON Editor Example</h1>
<div id='editor_holder'></div>
<button id='submit' class='btn btn-success btn-lg'>Submit (console.log)</button>
<script>
$(document).ready(function() {
JSONEditor.defaults.options.theme = 'bootstrap3';
JSONEditor.defaults.options.ajax = true;
JSONEditor.defaults.options.iconlib = 'bootstrap3';
//JSONEditor.defaults.options.object_layout = 'grid';
var editor = new JSONEditor(document.getElementById('editor_holder'),{
schema: {
"$schema": "http://json-schema.org/draft-04/schema",
"@context": "http://schema.org",
title: "Publication",
properties: {
title: {
type: "string",
title: "Title"
},
thumbnail: {
"@type": "URL",
type: "string",
title: "Thumbnail URL"
},
author: {
type: "array",
format: "table",
title: "Authors",
uniqueItems: true,
items: {
"@type": "Author",
type: "string",
title: "Author"
}
},
keywords: {
type: "array",
format: "table",
title: "Keywords",
items: {
"@type": "keywords",
type: "string",
title: "Keyword"
}
},
award: {
type: "array",
format: "table",
title: "Awards",
items: {
"@type": "awards",
type: "string",
title: "Award"
}
},
quicklinks: {
type: "array",
format: "table",
title: "Quicklinks",
items: {
"@type": "URL",
type: "string",
title: "Quicklink",
enum: ["PDF","BIB","Website","Video","Youtube","Supplemental"]
}
},
venue: {
type: "string",
title: "Venue"
},
date: {
"@type": "Date",
type: "string",
title: "Date"
}
},
required: [
"title",
"author",
"date"
]
}
});
// Hook up the submit button to log to the console
document.getElementById('submit').addEventListener('click',function() {
// Get the value from the editor
console.log(editor.getValue());
});
})
</script>
</section>
<!-- Footer -->
<footer>
<p class="pull-left">© Stanford Computer Graphics Lab 2016</p>
<p class="pull-right">
This website was last updated at 2016-01-21T18:16:27.989Z
</p>
</footer>
</div><!-- Content -->
<!-- Scripts -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script><script src="/scripts/bootstrap.min.js"></script><script src="/vendor/scripts/jsoneditor.min.js"></script><script src="/scripts/script.js"></script>
</body>
</html>