bee_api 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. data/bin/bee_api +84 -0
  2. data/lib/mdpreview.rb +80 -0
  3. data/lib/mdpreview/translator.rb +60 -0
  4. data/lib/mdpreview/version.rb +3 -0
  5. data/test/mdptest.rb +100 -0
  6. data/vendor/HISTORY.md +237 -0
  7. data/vendor/Jakefile.js +316 -0
  8. data/vendor/LICENSE +176 -0
  9. data/vendor/NOTICE +17 -0
  10. data/vendor/README.md +102 -0
  11. data/vendor/app/chrome/documentation.txt +12 -0
  12. data/vendor/app/chrome/manifest.json +24 -0
  13. data/vendor/app/web/ajax.js +43 -0
  14. data/vendor/app/web/app.css +292 -0
  15. data/vendor/app/web/app.js +377 -0
  16. data/vendor/app/web/beta/index.html +17 -0
  17. data/vendor/app/web/datapolicy.txt +48 -0
  18. data/vendor/app/web/doc/doc.css +60 -0
  19. data/vendor/app/web/doc/img/actions_menu.png +0 -0
  20. data/vendor/app/web/doc/img/button_actions_menu.png +0 -0
  21. data/vendor/app/web/doc/img/button_dragarea.png +0 -0
  22. data/vendor/app/web/doc/img/jsoneditor.png +0 -0
  23. data/vendor/app/web/doc/img/jsonformatter.png +0 -0
  24. data/vendor/app/web/doc/img/main_menu.png +0 -0
  25. data/vendor/app/web/doc/img/splitter.png +0 -0
  26. data/vendor/app/web/doc/index.html +201 -0
  27. data/vendor/app/web/favicon.ico +0 -0
  28. data/vendor/app/web/fileretriever.css +54 -0
  29. data/vendor/app/web/fileretriever.js +567 -0
  30. data/vendor/app/web/fileretriever.php +120 -0
  31. data/vendor/app/web/googlea47c4a0b36d11021.html +1 -0
  32. data/vendor/app/web/hash.js +133 -0
  33. data/vendor/app/web/img/description.txt +20 -0
  34. data/vendor/app/web/img/header_background.png +0 -0
  35. data/vendor/app/web/img/icon_128.png +0 -0
  36. data/vendor/app/web/img/icon_16.png +0 -0
  37. data/vendor/app/web/img/icon_gray.svg +151 -0
  38. data/vendor/app/web/img/icon_gray_16.svg +150 -0
  39. data/vendor/app/web/img/icon_orange.svg +151 -0
  40. data/vendor/app/web/img/logo.png +0 -0
  41. data/vendor/app/web/img/logo.xcf +0 -0
  42. data/vendor/app/web/img/logo_app.png +0 -0
  43. data/vendor/app/web/img/logo_app.xcf +0 -0
  44. data/vendor/app/web/index.html +191 -0
  45. data/vendor/app/web/notify.js +150 -0
  46. data/vendor/app/web/queryparams.js +71 -0
  47. data/vendor/app/web/robots.txt +0 -0
  48. data/vendor/app/web/splitter.js +179 -0
  49. data/vendor/app/web/test.html +224 -0
  50. data/vendor/component.json +33 -0
  51. data/vendor/docs/api.md +188 -0
  52. data/vendor/docs/usage.md +137 -0
  53. data/vendor/examples/01_basic_usage.html +45 -0
  54. data/vendor/examples/02_viewer.html +38 -0
  55. data/vendor/examples/03_switch_mode.html +98 -0
  56. data/vendor/examples/cur.file +1 -0
  57. data/vendor/examples/jquery.js +2 -0
  58. data/vendor/examples/meta.js +1 -0
  59. data/vendor/examples/requirejs_demo/requirejs_demo.html +19 -0
  60. data/vendor/examples/requirejs_demo/scripts/main.js +25 -0
  61. data/vendor/examples/requirejs_demo/scripts/require.js +35 -0
  62. data/vendor/img/jsoneditor-icons.png +0 -0
  63. data/vendor/jsoneditor-min.css +1 -0
  64. data/vendor/jsoneditor-min.js +34 -0
  65. data/vendor/jsoneditor.css +597 -0
  66. data/vendor/jsoneditor.js +6069 -0
  67. data/vendor/jsoneditor/css/contextmenu.css +219 -0
  68. data/vendor/jsoneditor/css/img/description.txt +13 -0
  69. data/vendor/jsoneditor/css/img/export.sh +16 -0
  70. data/vendor/jsoneditor/css/img/jsoneditor-icons.png +0 -0
  71. data/vendor/jsoneditor/css/img/jsoneditor-icons.svg +861 -0
  72. data/vendor/jsoneditor/css/jsoneditor.css +220 -0
  73. data/vendor/jsoneditor/css/menu.css +81 -0
  74. data/vendor/jsoneditor/css/searchbox.css +73 -0
  75. data/vendor/jsoneditor/js/appendnode.js +211 -0
  76. data/vendor/jsoneditor/js/contextmenu.js +440 -0
  77. data/vendor/jsoneditor/js/header.js +32 -0
  78. data/vendor/jsoneditor/js/highlighter.js +82 -0
  79. data/vendor/jsoneditor/js/history.js +218 -0
  80. data/vendor/jsoneditor/js/jsoneditor.js +206 -0
  81. data/vendor/jsoneditor/js/module.js +50 -0
  82. data/vendor/jsoneditor/js/node.js +2864 -0
  83. data/vendor/jsoneditor/js/searchbox.js +288 -0
  84. data/vendor/jsoneditor/js/texteditor.js +311 -0
  85. data/vendor/jsoneditor/js/treeeditor.js +770 -0
  86. data/vendor/jsoneditor/js/util.js +582 -0
  87. data/vendor/lib/ace/ace.js +11 -0
  88. data/vendor/lib/ace/mode-json.js +1 -0
  89. data/vendor/lib/ace/theme-jsoneditor.js +144 -0
  90. data/vendor/lib/ace/theme-textmate.js +163 -0
  91. data/vendor/lib/ace/worker-json.js +1 -0
  92. data/vendor/lib/jsonlint/README.md +62 -0
  93. data/vendor/lib/jsonlint/jsonlint.js +432 -0
  94. data/vendor/misc/screenshots/actionsmenu_640x400.png +0 -0
  95. data/vendor/misc/screenshots/codeeditor_640x400.png +0 -0
  96. data/vendor/misc/screenshots/description.json +17 -0
  97. data/vendor/misc/screenshots/jsoneditoronline.png +0 -0
  98. data/vendor/misc/screenshots/jsoneditoronline_640x400.png +0 -0
  99. data/vendor/misc/screenshots/search_640x400.png +0 -0
  100. data/vendor/misc/screenshots/small_tile.xcf +0 -0
  101. data/vendor/misc/screenshots/small_tile_440x280.png +0 -0
  102. data/vendor/misc/todo.txt +101 -0
  103. data/vendor/package.json +28 -0
  104. data/vendor/test/couchdbeditor.html +100 -0
  105. data/vendor/test/largefile.json +12605 -0
  106. data/vendor/test/test_ace.html +60 -0
  107. data/vendor/test/test_editable_div.html +449 -0
  108. metadata +154 -0
@@ -0,0 +1,377 @@
1
+ /*!
2
+ * @file app.js
3
+ *
4
+ * @brief
5
+ * JSONEditor is an editor to display and edit JSON data in a treeview.
6
+ *
7
+ * Supported browsers: Chrome, Firefox, Safari, Opera, Internet Explorer 8+
8
+ *
9
+ * @license
10
+ * This json editor is open sourced with the intention to use the editor as
11
+ * a component in your own application. Not to just copy and monetize the editor
12
+ * as it is.
13
+ *
14
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
15
+ * use this file except in compliance with the License. You may obtain a copy
16
+ * of the License at
17
+ *
18
+ * http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software
21
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
23
+ * License for the specific language governing permissions and limitations under
24
+ * the License.
25
+ *
26
+ * Copyright (C) 2011-2013 Jos de Jong, http://jsoneditoronline.org
27
+ *
28
+ * @author Jos de Jong, <wjosdejong@gmail.com>
29
+ * @date 2013-04-30
30
+ */
31
+
32
+
33
+ var treeEditor = null;
34
+ var codeEditor = null;
35
+
36
+ var app = {};
37
+
38
+ /**
39
+ * Get the JSON from the code editor and load it in the tree editor
40
+ */
41
+ app.CodeToTree = function() {
42
+ try {
43
+ treeEditor.set(codeEditor.get());
44
+ }
45
+ catch (err) {
46
+ app.notify.showError(app.formatError(err));
47
+ }
48
+ };
49
+
50
+ /**
51
+ * Get the JSON from the tree editor and load it into the code editor
52
+ */
53
+ app.treeToCode = function () {
54
+ try {
55
+ codeEditor.set(treeEditor.get());
56
+ }
57
+ catch (err) {
58
+ app.notify.showError(app.formatError(err));
59
+ }
60
+ };
61
+
62
+ /**
63
+ * Load the interface (tree editor, code editor, splitter)
64
+ */
65
+ // TODO: split the method load in multiple methods, it is too large
66
+ app.load = function() {
67
+ try {
68
+ // notification handler
69
+ app.notify = new Notify();
70
+
71
+ // retriever for loading/saving files
72
+ app.retriever = new FileRetriever({
73
+ scriptUrl: 'fileretriever.php',
74
+ notify: app.notify
75
+ });
76
+
77
+ // default json document
78
+ var json = {
79
+ "array": [1, 2, 3],
80
+ "boolean": true,
81
+ "null": null,
82
+ "number": 123,
83
+ "object": {"a": "b", "c": "d", "e": "f"},
84
+ "string": "Hello World"
85
+ };
86
+
87
+ // load url if query parameters contains a url
88
+ if (window.QueryParams) {
89
+ var qp = new QueryParams();
90
+ var url = qp.getValue('url');
91
+ if (url) {
92
+ json = {};
93
+ app.openUrl(url);
94
+ }
95
+ }
96
+
97
+ // Store whether tree editor or code editor is last changed
98
+ app.lastChanged = undefined;
99
+
100
+ // code editor
101
+ var container = document.getElementById("codeEditor");
102
+ codeEditor = new jsoneditor.JSONEditor(container, {
103
+ mode: 'code',
104
+ change: function () {
105
+ app.lastChanged = codeEditor;
106
+ },
107
+ error: function (err) {
108
+ app.notify.showError(app.formatError(err));
109
+ }
110
+ });
111
+ codeEditor.set(json);
112
+
113
+ // tree editor
114
+ container = document.getElementById("treeEditor");
115
+ treeEditor = new jsoneditor.JSONEditor(container, {
116
+ mode: 'tree',
117
+ change: function () {
118
+ app.lastChanged = treeEditor;
119
+ },
120
+ error: function (err) {
121
+ app.notify.showError(app.formatError(err));
122
+ }
123
+ });
124
+ treeEditor.set(json);
125
+ // TODO: automatically synchronize data of code and tree editor? (tree editor should keep its state though)
126
+
127
+ // splitter
128
+ app.splitter = new Splitter({
129
+ container: document.getElementById('drag'),
130
+ change: function () {
131
+ app.resize();
132
+ }
133
+ });
134
+
135
+ // button Code-to-Tree
136
+ var toTree = document.getElementById('toTree');
137
+ toTree.onclick = function () {
138
+ this.focus();
139
+ app.CodeToTree();
140
+ };
141
+
142
+ // button Tree-to-Code
143
+ var toCode = document.getElementById('toCode');
144
+ toCode.onclick = function () {
145
+ this.focus();
146
+ app.treeToCode();
147
+ };
148
+
149
+ // web page resize handler
150
+ jsoneditor.util.addEventListener(window, 'resize', app.resize);
151
+
152
+ // clear button
153
+ var domClear = document.getElementById('clear');
154
+ domClear.onclick = app.clearFile;
155
+
156
+ /* TODO: enable clicking on open to execute the default, "open file"
157
+ // open button
158
+ var domOpen = document.getElementById('open');
159
+ var domOpenMenuButton = document.getElementById('openMenuButton');
160
+ domOpen.onclick = function (event) {
161
+ event = event || window.event; // for IE8
162
+ var target = event.target || event.srcElement;
163
+ if (target == domOpenMenuButton ||
164
+ (event.offsetX > domOpen.offsetWidth - domOpenMenuButton.offsetWidth)) {
165
+ // clicked on the menu button
166
+ }
167
+ else {
168
+ app.openFile();
169
+ }
170
+ };
171
+ */
172
+
173
+ // menu button open file
174
+ var domMenuOpenFile = document.getElementById('menuOpenFile');
175
+ domMenuOpenFile.onclick = function (event) {
176
+ app.openFile();
177
+ jsoneditor.util.stopPropagation(event);
178
+ jsoneditor.util.preventDefault(event);
179
+ };
180
+
181
+ // menu button open url
182
+ var domMenuOpenUrl = document.getElementById('menuOpenUrl');
183
+ domMenuOpenUrl.onclick = function (event) {
184
+ app.openUrl();
185
+ jsoneditor.util.stopPropagation(event);
186
+ jsoneditor.util.preventDefault(event);
187
+ };
188
+
189
+ // save button
190
+ var domSave = document.getElementById('save');
191
+ domSave.onclick = app.saveFile;
192
+
193
+ // set focus on the code editor
194
+ codeEditor.focus();
195
+
196
+ // enforce FireFox to not do spell checking on any input field
197
+ document.body.spellcheck = false;
198
+ } catch (err) {
199
+ app.notify.showError(err);
200
+ }
201
+ };
202
+
203
+ /**
204
+ * Callback method called when a file or url is opened.
205
+ * @param {Error} err
206
+ * @param {String} data
207
+ */
208
+ app.openCallback = function (err, data) {
209
+ if (!err) {
210
+ if (data != null) {
211
+ codeEditor.setText(data);
212
+ try {
213
+ var json = jsoneditor.util.parse(data);
214
+ treeEditor.set(json);
215
+ }
216
+ catch (err) {
217
+ treeEditor.set({});
218
+ app.notify.showError(app.formatError(err));
219
+ }
220
+ }
221
+ }
222
+ else {
223
+ app.notify.showError(err);
224
+ }
225
+ };
226
+
227
+ /**
228
+ * Open a file explorer to select a file and open the file
229
+ */
230
+ app.openFile = function() {
231
+ app.retriever.loadFile(app.openCallback);
232
+ };
233
+
234
+ /**
235
+ * Open a url. If no url is provided as parameter, a dialog will be opened
236
+ * to select a url.
237
+ * @param {String} [url]
238
+ */
239
+ app.openUrl = function (url) {
240
+ if (!url) {
241
+ app.retriever.loadUrlDialog(app.openCallback);
242
+ }
243
+ else {
244
+ app.retriever.loadUrl(url, app.openCallback);
245
+ }
246
+ };
247
+
248
+ /**
249
+ * Open a file explorer to save the file.
250
+ */
251
+ app.saveFile = function () {
252
+ // first synchronize both editors contents
253
+ if (app.lastChanged == treeEditor) {
254
+ app.treeToCode();
255
+ }
256
+ /* TODO: also sync from code to tree editor? will clear the history ...
257
+ if (app.lastChanged == codeEditor) {
258
+ app.CodeToEditor();
259
+ }
260
+ */
261
+ app.lastChanged = undefined;
262
+
263
+ // save the text from the code editor
264
+ // TODO: show a 'saving...' notification
265
+ var data = codeEditor.getText();
266
+ app.retriever.saveFile(data, function (err) {
267
+ if (err) {
268
+ app.notify.showError(err);
269
+ }
270
+ });
271
+ };
272
+
273
+ /**
274
+ * Format a JSON parse/stringify error as HTML
275
+ * @param {Error} err
276
+ * @returns {string}
277
+ */
278
+ app.formatError = function (err) {
279
+ var message = '<pre class="error">' + err.toString() + '</pre>';
280
+ if (typeof(jsonlint) != 'undefined') {
281
+ message +=
282
+ '<a class="error" href="http://zaach.github.com/jsonlint/" target="_blank">' +
283
+ 'validated by jsonlint' +
284
+ '</a>';
285
+ }
286
+ return message;
287
+ };
288
+
289
+ /**
290
+ * Clear the current file
291
+ */
292
+ app.clearFile = function () {
293
+ var json = {};
294
+ codeEditor.set(json);
295
+ treeEditor.set(json);
296
+ };
297
+
298
+ app.resize = function() {
299
+ var domMenu = document.getElementById('menu');
300
+ var domTreeEditor = document.getElementById('treeEditor');
301
+ var domCodeEditor = document.getElementById('codeEditor');
302
+ var domSplitter = document.getElementById('splitter');
303
+ var domSplitterButtons = document.getElementById('buttons');
304
+ var domSplitterDrag = document.getElementById('drag');
305
+ var domAd = document.getElementById('ad');
306
+
307
+ var margin = 15;
308
+ var width = (window.innerWidth || document.body.offsetWidth ||
309
+ document.documentElement.offsetWidth);
310
+ var adWidth = domAd ? domAd.clientWidth : 0;
311
+ if (adWidth) {
312
+ width -= (adWidth + margin);
313
+ }
314
+
315
+ if (app.splitter) {
316
+ app.splitter.setWidth(width);
317
+
318
+ // calculate horizontal splitter position
319
+ var value = app.splitter.getValue();
320
+ var showCodeEditor = (value > 0);
321
+ var showTreeEditor = (value < 1);
322
+ var showButtons = showCodeEditor && showTreeEditor;
323
+ domSplitterButtons.style.display = showButtons ? '' : 'none';
324
+
325
+ var splitterWidth = domSplitter.clientWidth;
326
+ var splitterLeft;
327
+ if (!showCodeEditor) {
328
+ // code editor not visible
329
+ splitterLeft = 0;
330
+ domSplitterDrag.innerHTML = '&rsaquo;';
331
+ domSplitterDrag.title = 'Drag right to show the code editor';
332
+ }
333
+ else if (!showTreeEditor) {
334
+ // tree editor not visible
335
+ splitterLeft = width * value - splitterWidth;
336
+ domSplitterDrag.innerHTML = '&lsaquo;';
337
+ domSplitterDrag.title = 'Drag left to show the tree editor';
338
+ }
339
+ else {
340
+ // both tree and code editor visible
341
+ splitterLeft = width * value - splitterWidth / 2;
342
+
343
+ // TODO: find a character with vertical dots that works on IE8 too, or use an image
344
+ var isIE8 = (jsoneditor.util.getInternetExplorerVersion() == 8);
345
+ domSplitterDrag.innerHTML = (!isIE8) ? '&#8942;' : '|';
346
+ domSplitterDrag.title = 'Drag left or right to change the width of the panels';
347
+ }
348
+
349
+ // resize code editor
350
+ domCodeEditor.style.display = (value == 0) ? 'none' : '';
351
+ domCodeEditor.style.width = Math.max(Math.round(splitterLeft), 0) + 'px';
352
+ codeEditor.resize();
353
+
354
+ // resize the splitter
355
+ domSplitterDrag.style.height = (domSplitter.clientHeight -
356
+ domSplitterButtons.clientHeight - 2 * margin -
357
+ (showButtons ? margin : 0)) + 'px';
358
+ domSplitterDrag.style.lineHeight = domSplitterDrag.style.height;
359
+
360
+ // resize tree editor
361
+ // the width has a -1 to prevent the width from being just half a pixel
362
+ // wider than the window, causing the content elements to wrap...
363
+ domTreeEditor.style.display = (value == 1) ? 'none' : '';
364
+ domTreeEditor.style.left = Math.round(splitterLeft + splitterWidth) + 'px';
365
+ domTreeEditor.style.width = Math.max(Math.round(width - splitterLeft - splitterWidth - 2), 0) + 'px';
366
+ }
367
+
368
+ // align main menu with ads
369
+ if (domMenu) {
370
+ if (adWidth) {
371
+ domMenu.style.right = (margin + (adWidth + margin)) + 'px';
372
+ }
373
+ else {
374
+ domMenu.style.right = margin + 'px';
375
+ }
376
+ }
377
+ };
@@ -0,0 +1,17 @@
1
+ <html>
2
+ <head>
3
+ <title>JSON Editor Online - Beta</title>
4
+ <link href="../doc/doc.css" type="text/css" rel="stylesheet">
5
+ </head>
6
+ <body>
7
+ <div id="container">
8
+ <h1>JSON Editor Online - Beta</h1>
9
+ <p>
10
+ There is currently no beta version available.
11
+ </p>
12
+ <p>
13
+ <a href="http://jsoneditoronline.org/">Go to the current version</a>
14
+ </p>
15
+ </div>
16
+ </body>
17
+ </html>
@@ -0,0 +1,48 @@
1
+ # JSON Editor online - Data policy
2
+
3
+ http://jsoneditoronline.org
4
+
5
+
6
+ This file describes the data policy of JSON Editor Online. When using the
7
+ open/save functionality of the editor, files may need to be downloaded via the
8
+ server, therefore:
9
+
10
+ **DO NOT LOAD OR SAVE SENSITIVE DATA VIA THE EDITORS OPEN/SAVE FUNCTIONALITY.**
11
+
12
+ Files which are downloaded via the server are sent unsecured and unencrypted.
13
+
14
+
15
+ ## 1. Opening files
16
+
17
+ If the browser in use supports HTML5 FileReader, files are directly loaded
18
+ from disk into the editor. The files are not send to the server.
19
+
20
+ If HTML5 is not supported, the files are first uploaded to the server and then
21
+ downloaded by the editor. The files are deleted from the server as soon as
22
+ they are downloaded once. If a file is not downloaded for some reason, it will
23
+ be deleted from the server after one hour.
24
+
25
+
26
+ ## 2. Saving files
27
+
28
+ If the browser in use supports HTML5 a.download, files are directly saved
29
+ from the browser to disk. The files are not send to the server.
30
+
31
+ If HTML5 is not supported, the files are first uploaded to the server and then
32
+ downloaded to disk. The files are deleted from the server as soon as they are
33
+ downloaded once. If a file is not downloaded for some reason, it will be
34
+ deleted from the server after one hour.
35
+
36
+
37
+ ## 3. Opening urls
38
+
39
+ When opening an url, the editor first opens the url directly. If this fails
40
+ due to cross-domain restrictions, the url will be retrieved via the server.
41
+ In that case, the retrieved data is sent directly to the browser and is not
42
+ stored on the server.
43
+
44
+
45
+ ## 4. Cutting/pasting clipboard data
46
+
47
+ When cutting and pasting text in the editor using the system clipboard, no
48
+ data is sent via the server.
@@ -0,0 +1,60 @@
1
+ body, td, th {
2
+ font-family: arial, sans-serif;
3
+ font-size: 11pt;
4
+ color: #4d4d4d;
5
+ }
6
+
7
+ body, html {
8
+ width: 100%;
9
+ height: 100%;
10
+ padding: 0;
11
+ margin: 0;
12
+ }
13
+
14
+ #container {
15
+ width: 600px;
16
+ margin: 0 auto;
17
+ padding: 20px 0 60px 0;
18
+ }
19
+
20
+ h1 {
21
+ font-size: 14pt;
22
+ color: #4d4d4d;
23
+ }
24
+
25
+ h2 {
26
+ font-size: 11pt;
27
+ color: #97B0F8;
28
+ padding-top: 20px;
29
+ }
30
+
31
+ table {
32
+ border-collapse: collapse;
33
+ }
34
+
35
+ th {
36
+ text-align: left;
37
+ background-color: #e5e5e5;;
38
+
39
+ }
40
+
41
+ td {
42
+ vertical-align: top;
43
+ }
44
+
45
+ th, td {
46
+ border: 1px solid #e5e5e5;
47
+ padding: 4px 4px;
48
+ }
49
+
50
+ a {
51
+ color: #4183C4;
52
+ }
53
+ a:hover {
54
+ color: red;
55
+ }
56
+
57
+ img.icon {
58
+ vertical-align: middle;
59
+ margin: 0 5px;
60
+ }