bee_api 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/bee_api +84 -0
- data/lib/mdpreview.rb +80 -0
- data/lib/mdpreview/translator.rb +60 -0
- data/lib/mdpreview/version.rb +3 -0
- data/test/mdptest.rb +100 -0
- data/vendor/HISTORY.md +237 -0
- data/vendor/Jakefile.js +316 -0
- data/vendor/LICENSE +176 -0
- data/vendor/NOTICE +17 -0
- data/vendor/README.md +102 -0
- data/vendor/app/chrome/documentation.txt +12 -0
- data/vendor/app/chrome/manifest.json +24 -0
- data/vendor/app/web/ajax.js +43 -0
- data/vendor/app/web/app.css +292 -0
- data/vendor/app/web/app.js +377 -0
- data/vendor/app/web/beta/index.html +17 -0
- data/vendor/app/web/datapolicy.txt +48 -0
- data/vendor/app/web/doc/doc.css +60 -0
- data/vendor/app/web/doc/img/actions_menu.png +0 -0
- data/vendor/app/web/doc/img/button_actions_menu.png +0 -0
- data/vendor/app/web/doc/img/button_dragarea.png +0 -0
- data/vendor/app/web/doc/img/jsoneditor.png +0 -0
- data/vendor/app/web/doc/img/jsonformatter.png +0 -0
- data/vendor/app/web/doc/img/main_menu.png +0 -0
- data/vendor/app/web/doc/img/splitter.png +0 -0
- data/vendor/app/web/doc/index.html +201 -0
- data/vendor/app/web/favicon.ico +0 -0
- data/vendor/app/web/fileretriever.css +54 -0
- data/vendor/app/web/fileretriever.js +567 -0
- data/vendor/app/web/fileretriever.php +120 -0
- data/vendor/app/web/googlea47c4a0b36d11021.html +1 -0
- data/vendor/app/web/hash.js +133 -0
- data/vendor/app/web/img/description.txt +20 -0
- data/vendor/app/web/img/header_background.png +0 -0
- data/vendor/app/web/img/icon_128.png +0 -0
- data/vendor/app/web/img/icon_16.png +0 -0
- data/vendor/app/web/img/icon_gray.svg +151 -0
- data/vendor/app/web/img/icon_gray_16.svg +150 -0
- data/vendor/app/web/img/icon_orange.svg +151 -0
- data/vendor/app/web/img/logo.png +0 -0
- data/vendor/app/web/img/logo.xcf +0 -0
- data/vendor/app/web/img/logo_app.png +0 -0
- data/vendor/app/web/img/logo_app.xcf +0 -0
- data/vendor/app/web/index.html +191 -0
- data/vendor/app/web/notify.js +150 -0
- data/vendor/app/web/queryparams.js +71 -0
- data/vendor/app/web/robots.txt +0 -0
- data/vendor/app/web/splitter.js +179 -0
- data/vendor/app/web/test.html +224 -0
- data/vendor/component.json +33 -0
- data/vendor/docs/api.md +188 -0
- data/vendor/docs/usage.md +137 -0
- data/vendor/examples/01_basic_usage.html +45 -0
- data/vendor/examples/02_viewer.html +38 -0
- data/vendor/examples/03_switch_mode.html +98 -0
- data/vendor/examples/cur.file +1 -0
- data/vendor/examples/jquery.js +2 -0
- data/vendor/examples/meta.js +1 -0
- data/vendor/examples/requirejs_demo/requirejs_demo.html +19 -0
- data/vendor/examples/requirejs_demo/scripts/main.js +25 -0
- data/vendor/examples/requirejs_demo/scripts/require.js +35 -0
- data/vendor/img/jsoneditor-icons.png +0 -0
- data/vendor/jsoneditor-min.css +1 -0
- data/vendor/jsoneditor-min.js +34 -0
- data/vendor/jsoneditor.css +597 -0
- data/vendor/jsoneditor.js +6069 -0
- data/vendor/jsoneditor/css/contextmenu.css +219 -0
- data/vendor/jsoneditor/css/img/description.txt +13 -0
- data/vendor/jsoneditor/css/img/export.sh +16 -0
- data/vendor/jsoneditor/css/img/jsoneditor-icons.png +0 -0
- data/vendor/jsoneditor/css/img/jsoneditor-icons.svg +861 -0
- data/vendor/jsoneditor/css/jsoneditor.css +220 -0
- data/vendor/jsoneditor/css/menu.css +81 -0
- data/vendor/jsoneditor/css/searchbox.css +73 -0
- data/vendor/jsoneditor/js/appendnode.js +211 -0
- data/vendor/jsoneditor/js/contextmenu.js +440 -0
- data/vendor/jsoneditor/js/header.js +32 -0
- data/vendor/jsoneditor/js/highlighter.js +82 -0
- data/vendor/jsoneditor/js/history.js +218 -0
- data/vendor/jsoneditor/js/jsoneditor.js +206 -0
- data/vendor/jsoneditor/js/module.js +50 -0
- data/vendor/jsoneditor/js/node.js +2864 -0
- data/vendor/jsoneditor/js/searchbox.js +288 -0
- data/vendor/jsoneditor/js/texteditor.js +311 -0
- data/vendor/jsoneditor/js/treeeditor.js +770 -0
- data/vendor/jsoneditor/js/util.js +582 -0
- data/vendor/lib/ace/ace.js +11 -0
- data/vendor/lib/ace/mode-json.js +1 -0
- data/vendor/lib/ace/theme-jsoneditor.js +144 -0
- data/vendor/lib/ace/theme-textmate.js +163 -0
- data/vendor/lib/ace/worker-json.js +1 -0
- data/vendor/lib/jsonlint/README.md +62 -0
- data/vendor/lib/jsonlint/jsonlint.js +432 -0
- data/vendor/misc/screenshots/actionsmenu_640x400.png +0 -0
- data/vendor/misc/screenshots/codeeditor_640x400.png +0 -0
- data/vendor/misc/screenshots/description.json +17 -0
- data/vendor/misc/screenshots/jsoneditoronline.png +0 -0
- data/vendor/misc/screenshots/jsoneditoronline_640x400.png +0 -0
- data/vendor/misc/screenshots/search_640x400.png +0 -0
- data/vendor/misc/screenshots/small_tile.xcf +0 -0
- data/vendor/misc/screenshots/small_tile_440x280.png +0 -0
- data/vendor/misc/todo.txt +101 -0
- data/vendor/package.json +28 -0
- data/vendor/test/couchdbeditor.html +100 -0
- data/vendor/test/largefile.json +12605 -0
- data/vendor/test/test_ace.html +60 -0
- data/vendor/test/test_editable_div.html +449 -0
- metadata +154 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
{
|
2
|
+
"name": "jsoneditor",
|
3
|
+
"version": "2.2.0",
|
4
|
+
"description": "A web-based tool to view, edit and format JSON",
|
5
|
+
"tags": [
|
6
|
+
"json",
|
7
|
+
"editor",
|
8
|
+
"viewer",
|
9
|
+
"formatter"
|
10
|
+
],
|
11
|
+
"homepage": "http://jsoneditoronline.org/",
|
12
|
+
"repository": {
|
13
|
+
"type": "git",
|
14
|
+
"url": "https://github.com/josdejong/jsoneditor.git"
|
15
|
+
},
|
16
|
+
"bugs": "https://github.com/josdejong/jsoneditor/issues",
|
17
|
+
"ignore": [
|
18
|
+
"app",
|
19
|
+
"build",
|
20
|
+
"downloads",
|
21
|
+
"jsoneditor",
|
22
|
+
"misc",
|
23
|
+
"node_modules",
|
24
|
+
"test",
|
25
|
+
"tools",
|
26
|
+
".idea",
|
27
|
+
"Jakefile.js",
|
28
|
+
"package.json",
|
29
|
+
".npmignore",
|
30
|
+
".gitignore"
|
31
|
+
],
|
32
|
+
"dependencies": {}
|
33
|
+
}
|
data/vendor/docs/api.md
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
# API Reference
|
2
|
+
|
3
|
+
## JSONEditor
|
4
|
+
|
5
|
+
### Constructor
|
6
|
+
|
7
|
+
#### `JSONEditor(container [, options] [, json])`
|
8
|
+
|
9
|
+
Constructs a new JSONEditor.
|
10
|
+
|
11
|
+
*Parameters:*
|
12
|
+
|
13
|
+
- `{Element} container`
|
14
|
+
An HTML DIV element. The JSONEditor will be created inside this container
|
15
|
+
element.
|
16
|
+
- `{Object} options`
|
17
|
+
Optional object with options. Available options:
|
18
|
+
|
19
|
+
- `{function} change`.
|
20
|
+
Set a callback method triggered when the contents of the JSONEditor change.
|
21
|
+
Called without parameters.
|
22
|
+
- `{function} error`.
|
23
|
+
Set a callback method triggered when an error occurs.
|
24
|
+
Invoked with the error as first argument. The callback is only invoked
|
25
|
+
for errors triggered by a users action.
|
26
|
+
- `{boolean} history`.
|
27
|
+
Enables history, adds a button Undo and Redo to the menu of the JSONEditor.
|
28
|
+
True by default. Only applicable when `mode` is 'tree' or 'form'.
|
29
|
+
- `{String} mode`.
|
30
|
+
Set the editor mode. Available values: 'tree' (default), 'view', 'form',
|
31
|
+
'code', 'text'. In 'view' mode, the data and datastructure is read-only.
|
32
|
+
In 'form' mode, only the value can be changed, the datastructure is read-only.
|
33
|
+
Mode 'code' requires the Ace editor to be loaded on the page.
|
34
|
+
Mode 'text' shows the data as plain text.
|
35
|
+
- `{String} name`.
|
36
|
+
Initial field name for the root node, is undefined by default.
|
37
|
+
Can also be set using `JSONEditor.setName(name)`.
|
38
|
+
Only applicable when `mode` is 'tree', 'view', or 'form'.
|
39
|
+
- `{boolean} search`.
|
40
|
+
Enables a search box in the upper right corner of the JSONEditor.
|
41
|
+
True by default.
|
42
|
+
Only applicable when `mode` is 'tree', 'view', or 'form'.
|
43
|
+
- `{Number} indentation`.
|
44
|
+
Number of indentation spaces. 4 by default.
|
45
|
+
Only applicable when `mode` is 'code' or 'text'.
|
46
|
+
|
47
|
+
- `{JSON} json`
|
48
|
+
Initial JSON data to be loaded into the JSONEditor. Alternatively, the method `JSONEditor.set(json)` can be used to load JSON data into the editor.
|
49
|
+
|
50
|
+
*Returns:*
|
51
|
+
|
52
|
+
- `{jsoneditor.JSONEditor} editor`
|
53
|
+
New instance of a JSONEditor.
|
54
|
+
|
55
|
+
|
56
|
+
### Methods
|
57
|
+
|
58
|
+
#### `JSONEditor.collapseAll()`
|
59
|
+
|
60
|
+
Collapse all fields. Only applicable for mode 'tree', 'view', and 'form'.
|
61
|
+
|
62
|
+
#### `JSONEditor.expandAll()`
|
63
|
+
|
64
|
+
Expand all fields. Only applicable for mode 'tree', 'view', and 'form'.
|
65
|
+
|
66
|
+
#### `JSONEditor.set(json)`
|
67
|
+
|
68
|
+
Set JSON data.
|
69
|
+
|
70
|
+
*Parameters:*
|
71
|
+
|
72
|
+
- `{JSON} json`
|
73
|
+
JSON data to be displayed in the JSONEditor.
|
74
|
+
|
75
|
+
#### `JSONEditor.setMode(mode)`
|
76
|
+
|
77
|
+
Switch mode. Mode `code` requires the [Ace editor](http://ace.ajax.org/).
|
78
|
+
|
79
|
+
*Parameters:*
|
80
|
+
|
81
|
+
- `{String} mode`
|
82
|
+
Available values: `tree`, 'view', `form`, `code`, `text`.
|
83
|
+
|
84
|
+
#### `JSONEditor.setName(name)`
|
85
|
+
|
86
|
+
Set a field name for the root node.
|
87
|
+
|
88
|
+
*Parameters:*
|
89
|
+
|
90
|
+
- `{String | undefined} name`
|
91
|
+
Field name of the root node. If undefined, the current name will be removed.
|
92
|
+
|
93
|
+
#### `JSONEditor.setText(jsonString)`
|
94
|
+
|
95
|
+
Set text data in the formatter.
|
96
|
+
|
97
|
+
*Parameters:*
|
98
|
+
- `{String} jsonString` Contents of the JSONformatter as string.
|
99
|
+
|
100
|
+
#### `JSONEditor.get()`
|
101
|
+
|
102
|
+
Get JSON data.
|
103
|
+
|
104
|
+
*Returns:*
|
105
|
+
- `{JSON} json` JSON data from the JSONEditor.
|
106
|
+
|
107
|
+
#### `JSONEditor.getName()`
|
108
|
+
|
109
|
+
Retrieve the current field name of the root node.
|
110
|
+
|
111
|
+
*Returns:*
|
112
|
+
|
113
|
+
- `{String | undefined} name`
|
114
|
+
Current field name of the root node, or undefined if not set.
|
115
|
+
|
116
|
+
#### `JSONEditor.getText()`
|
117
|
+
|
118
|
+
Get JSON data as string.
|
119
|
+
|
120
|
+
*Returns:*
|
121
|
+
- `{String} jsonString` Contents of the JSONformatter as string.
|
122
|
+
|
123
|
+
|
124
|
+
### Examples
|
125
|
+
|
126
|
+
A tree editor:
|
127
|
+
|
128
|
+
```js
|
129
|
+
var options = {
|
130
|
+
"mode": "tree",
|
131
|
+
"search": true
|
132
|
+
};
|
133
|
+
var editor = new jsoneditor.JSONEditor (container, options);
|
134
|
+
var json = {
|
135
|
+
"Array": [1, 2, 3],
|
136
|
+
"Boolean": true,
|
137
|
+
"Null": null,
|
138
|
+
"Number": 123,
|
139
|
+
"Object": {"a": "b", "c": "d"},
|
140
|
+
"String": "Hello World"
|
141
|
+
};
|
142
|
+
editor.set(json);
|
143
|
+
editor.expandAll();
|
144
|
+
|
145
|
+
var json = editor.get(json);
|
146
|
+
```
|
147
|
+
|
148
|
+
A text editor:
|
149
|
+
|
150
|
+
```js
|
151
|
+
var options = {
|
152
|
+
"mode": "text",
|
153
|
+
"indentation": 2
|
154
|
+
};
|
155
|
+
var editor = new jsoneditor.JSONEditor (container, options);
|
156
|
+
var json = {
|
157
|
+
"Array": [1, 2, 3],
|
158
|
+
"Boolean": true,
|
159
|
+
"Null": null,
|
160
|
+
"Number": 123,
|
161
|
+
"Object": {"a": "b", "c": "d"},
|
162
|
+
"String": "Hello World"
|
163
|
+
};
|
164
|
+
editor.set(json);
|
165
|
+
|
166
|
+
var json = editor.get(json);
|
167
|
+
```
|
168
|
+
|
169
|
+
## JSON parsing and stringification
|
170
|
+
|
171
|
+
In general to parse or stringify JSON data, the browsers built in JSON parser can be used.
|
172
|
+
To create a formatted string from a JSON object, use:
|
173
|
+
|
174
|
+
```js
|
175
|
+
var formattedString = JSON.stingify(json, null, 2);
|
176
|
+
```
|
177
|
+
|
178
|
+
to create a compacted string from a JSON object, use:
|
179
|
+
|
180
|
+
```js
|
181
|
+
var compactString = JSON.stingify(json);
|
182
|
+
```
|
183
|
+
|
184
|
+
To parse a String to a JSON object, use:
|
185
|
+
|
186
|
+
```js
|
187
|
+
var json = JSON.parse(string);
|
188
|
+
```
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# Usage
|
2
|
+
|
3
|
+
### Install
|
4
|
+
|
5
|
+
with npm:
|
6
|
+
|
7
|
+
npm install jsoneditor
|
8
|
+
|
9
|
+
with bower:
|
10
|
+
|
11
|
+
bower install jsoneditor
|
12
|
+
|
13
|
+
download:
|
14
|
+
|
15
|
+
[http://jsoneditoronline.org/downloads/](http://jsoneditoronline.org/downloads/)
|
16
|
+
|
17
|
+
The library consists of three files: one javascript file, one css file and an
|
18
|
+
image. Both full and minified version are available.
|
19
|
+
|
20
|
+
## Load
|
21
|
+
|
22
|
+
To implement JSONEditor in a web application, load the javascript and css file
|
23
|
+
in the head of the HTML page:
|
24
|
+
|
25
|
+
```html
|
26
|
+
<link rel="stylesheet" type="text/css" href="jsoneditor/jsoneditor-min.css">
|
27
|
+
<script type="text/javascript" src="jsoneditor/jsoneditor-min.js"></script>
|
28
|
+
```
|
29
|
+
|
30
|
+
### Detailed error messages
|
31
|
+
|
32
|
+
Optionally, [jsonlint](https://github.com/zaach/jsonlint) can be loaded to get
|
33
|
+
more detailed error messages.
|
34
|
+
|
35
|
+
```html
|
36
|
+
<script type="text/javascript" src="lib/jsonlint/jsonlint.js"></script>
|
37
|
+
```
|
38
|
+
|
39
|
+
### Code editor
|
40
|
+
|
41
|
+
The mode 'code' requires the [Ace editor](http://ace.ajax.org/) to be loaded.
|
42
|
+
Also, the content type must be specified on the page.
|
43
|
+
|
44
|
+
```html
|
45
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
46
|
+
|
47
|
+
<script type="text/javascript" src="../lib/ace/ace.js"></script>
|
48
|
+
<script type="text/javascript" src="../lib/ace/mode-json.js"></script>
|
49
|
+
<script type="text/javascript" src="../lib/ace/theme-textmate.js"></script>
|
50
|
+
<script type="text/javascript" src="../lib/ace/theme-jsoneditor.js"></script>
|
51
|
+
```
|
52
|
+
|
53
|
+
## Use
|
54
|
+
|
55
|
+
In the body, create an div element with an id and a size:
|
56
|
+
|
57
|
+
```html
|
58
|
+
<div id="jsoneditor" style="width: 400px; height: 400px;"></div>
|
59
|
+
```
|
60
|
+
|
61
|
+
After the page is loaded, load the editor with javascript:
|
62
|
+
|
63
|
+
```js
|
64
|
+
var container = document.getElementById("jsoneditor");
|
65
|
+
var options = {
|
66
|
+
mode: 'tree'
|
67
|
+
};
|
68
|
+
var editor = new jsoneditor.JSONEditor(container, options);
|
69
|
+
```
|
70
|
+
|
71
|
+
To set JSON data in the editor:
|
72
|
+
|
73
|
+
```js
|
74
|
+
var json = {
|
75
|
+
"Array": [1, 2, 3],
|
76
|
+
"Boolean": true,
|
77
|
+
"Null": null,
|
78
|
+
"Number": 123,
|
79
|
+
"Object": {"a": "b", "c": "d"},
|
80
|
+
"String": "Hello World"
|
81
|
+
};
|
82
|
+
editor.set(json);
|
83
|
+
```
|
84
|
+
|
85
|
+
To get JSON data from the editor:
|
86
|
+
|
87
|
+
```js
|
88
|
+
var json = editor.get();
|
89
|
+
```
|
90
|
+
|
91
|
+
|
92
|
+
## Full Example
|
93
|
+
|
94
|
+
```html
|
95
|
+
<!DOCTYPE HTML>
|
96
|
+
<html>
|
97
|
+
<head>
|
98
|
+
<link rel="stylesheet" type="text/css" href="jsoneditor/jsoneditor-min.css">
|
99
|
+
<script type="text/javascript" src="jsoneditor/jsoneditor-min.js"></script>
|
100
|
+
</head>
|
101
|
+
<body>
|
102
|
+
<p>
|
103
|
+
<button onclick="setJSON();">Set JSON</button>
|
104
|
+
<button onclick="getJSON();">Get JSON</button>
|
105
|
+
</p>
|
106
|
+
<div id="jsoneditor" style="width: 400px; height: 400px;"></div>
|
107
|
+
|
108
|
+
<script type="text/javascript" >
|
109
|
+
// create the editor
|
110
|
+
var container = document.getElementById("jsoneditor");
|
111
|
+
var editor = new jsoneditor.JSONEditor(container);
|
112
|
+
|
113
|
+
// set json
|
114
|
+
function setJSON () {
|
115
|
+
var json = {
|
116
|
+
"Array": [1, 2, 3],
|
117
|
+
"Boolean": true,
|
118
|
+
"Null": null,
|
119
|
+
"Number": 123,
|
120
|
+
"Object": {"a": "b", "c": "d"},
|
121
|
+
"String": "Hello World"
|
122
|
+
};
|
123
|
+
editor.set(json);
|
124
|
+
}
|
125
|
+
|
126
|
+
// get json
|
127
|
+
function getJSON() {
|
128
|
+
var json = editor.get();
|
129
|
+
alert(JSON.stringify(json, null, 2));
|
130
|
+
}
|
131
|
+
</script>
|
132
|
+
</body>
|
133
|
+
</html>
|
134
|
+
```
|
135
|
+
|
136
|
+
For more examples, see the
|
137
|
+
[examples section](https://github.com/josdejong/jsoneditor/tree/master/examples).
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link rel="stylesheet" type="text/css" href="../jsoneditor.css">
|
5
|
+
<script type="text/javascript" src="../jsoneditor.js"></script>
|
6
|
+
<style type="text/css">
|
7
|
+
#jsoneditor {
|
8
|
+
width: 500px;
|
9
|
+
height: 500px;
|
10
|
+
}
|
11
|
+
</style>
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<p>
|
15
|
+
<button id="setJSON">Set JSON</button>
|
16
|
+
<button id="getJSON">Get JSON</button>
|
17
|
+
</p>
|
18
|
+
<div id="jsoneditor"></div>
|
19
|
+
|
20
|
+
<script type="text/javascript" >
|
21
|
+
// create the editor
|
22
|
+
var container = document.getElementById("jsoneditor");
|
23
|
+
var editor = new jsoneditor.JSONEditor(container);
|
24
|
+
|
25
|
+
// set json
|
26
|
+
document.getElementById("setJSON").onclick = function () {
|
27
|
+
var json = {
|
28
|
+
"array": [1, 2, 3],
|
29
|
+
"boolean": true,
|
30
|
+
"null": null,
|
31
|
+
"number": 123,
|
32
|
+
"object": {"a": "b", "c": "d"},
|
33
|
+
"string": "Hello World"
|
34
|
+
};
|
35
|
+
editor.set(json);
|
36
|
+
};
|
37
|
+
|
38
|
+
// get json
|
39
|
+
document.getElementById("getJSON").onclick = function () {
|
40
|
+
var json = editor.get();
|
41
|
+
alert(JSON.stringify(json, null, 2));
|
42
|
+
};
|
43
|
+
</script>
|
44
|
+
</body>
|
45
|
+
</html>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link rel="stylesheet" type="text/css" href="../jsoneditor.css">
|
5
|
+
<script type="text/javascript" src="../jsoneditor.js"></script>
|
6
|
+
<style type="text/css">
|
7
|
+
body {
|
8
|
+
font: 11pt arial;
|
9
|
+
}
|
10
|
+
#jsoneditor {
|
11
|
+
width: 500px;
|
12
|
+
}
|
13
|
+
</style>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<p>
|
17
|
+
This editor is read-only (mode='viewer').
|
18
|
+
</p>
|
19
|
+
<div id="jsoneditor"></div>
|
20
|
+
|
21
|
+
<script type="text/javascript" >
|
22
|
+
// create the editor
|
23
|
+
var container = document.getElementById("jsoneditor");
|
24
|
+
var options = {
|
25
|
+
mode: "view"
|
26
|
+
};
|
27
|
+
var json = {
|
28
|
+
"array": [1, 2, 3],
|
29
|
+
"boolean": true,
|
30
|
+
"null": null,
|
31
|
+
"number": 123,
|
32
|
+
"object": {"a": "b", "c": "d"},
|
33
|
+
"string": "Hello World"
|
34
|
+
};
|
35
|
+
var editor = new jsoneditor.JSONEditor(container, options, json);
|
36
|
+
</script>
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
5
|
+
|
6
|
+
<!-- jsoneditor -->
|
7
|
+
<link rel="stylesheet" type="text/css" href="../jsoneditor.css">
|
8
|
+
<script type="text/javascript" src="../jsoneditor.js"></script>
|
9
|
+
|
10
|
+
<!-- ace code editor -->
|
11
|
+
<script type="text/javascript" src="../lib/ace/ace.js"></script>
|
12
|
+
<script type="text/javascript" src="../lib/ace/mode-json.js"></script>
|
13
|
+
<script type="text/javascript" src="../lib/ace/theme-textmate.js"></script>
|
14
|
+
<script type="text/javascript" src="../lib/ace/theme-jsoneditor.js"></script>
|
15
|
+
<script type="text/javascript" src="jquery.js"></script>
|
16
|
+
<!-- json lint -->
|
17
|
+
<script type="text/javascript" src="../lib/jsonlint/jsonlint.js"></script>
|
18
|
+
|
19
|
+
<style type="text/css">
|
20
|
+
body, select {
|
21
|
+
font: 10pt arial;
|
22
|
+
font-family: arial, sans-serif;
|
23
|
+
font-size: 11pt;
|
24
|
+
|
25
|
+
}
|
26
|
+
#jsoneditor {
|
27
|
+
width: 100%;
|
28
|
+
height: 1000px;
|
29
|
+
}
|
30
|
+
</style>
|
31
|
+
<title>Beeframework API Viewer</title>
|
32
|
+
</head>
|
33
|
+
<body>
|
34
|
+
|
35
|
+
|
36
|
+
<div style='float:right'>
|
37
|
+
<p>
|
38
|
+
<label for="mode">切换模式:</label>
|
39
|
+
<select id="mode">
|
40
|
+
<option value="tree">tree</option>
|
41
|
+
<option value="view">view</option>
|
42
|
+
<option value="form">form</option>
|
43
|
+
<option value="code">code</option>
|
44
|
+
<option value="text">text</option>
|
45
|
+
</select>
|
46
|
+
</p>
|
47
|
+
</div>
|
48
|
+
<div id="jsoneditor">没有数据就是请求错误了,看看你的接口和配置文件吧</div>
|
49
|
+
|
50
|
+
<script type="text/javascript" >
|
51
|
+
$(function(){
|
52
|
+
var editor,json_dir;
|
53
|
+
|
54
|
+
$.get('./cur.file',function(cur_file_content){
|
55
|
+
var json = eval("(" + cur_file_content + ")");
|
56
|
+
var mode = document.getElementById('mode');
|
57
|
+
mode.onchange = function () {
|
58
|
+
editor.setMode(mode.value);
|
59
|
+
};
|
60
|
+
|
61
|
+
// create the editor
|
62
|
+
var container = document.getElementById("jsoneditor");
|
63
|
+
var options = {
|
64
|
+
mode: mode.value,
|
65
|
+
error: function (err) {
|
66
|
+
alert(err.toString());
|
67
|
+
}
|
68
|
+
};
|
69
|
+
|
70
|
+
editor = new jsoneditor.JSONEditor(container, options, json);
|
71
|
+
editor.expandAll();
|
72
|
+
});
|
73
|
+
|
74
|
+
$.get('./meta.js',function(cur_file_content){
|
75
|
+
json_dir = cur_file_content;
|
76
|
+
});
|
77
|
+
|
78
|
+
self.setInterval(function(){
|
79
|
+
console.log("current times is :"+i++);
|
80
|
+
|
81
|
+
$.get(json_dir,function(cur_file_content){
|
82
|
+
// alert(cur_file_content);
|
83
|
+
//editor.getSession().setValue(cur_file_content);
|
84
|
+
//alert(t.name);
|
85
|
+
// create switchable mode
|
86
|
+
var json = eval("(" + cur_file_content + ")");
|
87
|
+
|
88
|
+
console.log("json =:"+ cur_file_content);
|
89
|
+
editor.set(json);
|
90
|
+
editor.expandAll();
|
91
|
+
});
|
92
|
+
}, 500)
|
93
|
+
});
|
94
|
+
|
95
|
+
|
96
|
+
</script>
|
97
|
+
</body>
|
98
|
+
</html>
|