bee_api 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
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,151 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6
+ xmlns:cc="http://creativecommons.org/ns#"
7
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ xmlns:svg="http://www.w3.org/2000/svg"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ xmlns:xlink="http://www.w3.org/1999/xlink"
11
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
+ width="128"
14
+ height="128"
15
+ id="svg2"
16
+ version="1.1"
17
+ inkscape:version="0.48.3.1 r9886"
18
+ sodipodi:docname="icon_orange.svg"
19
+ inkscape:export-filename="/home/jos/jsoneditoronline/interface/img/jsoneditor_gray_128.png"
20
+ inkscape:export-xdpi="90"
21
+ inkscape:export-ydpi="90">
22
+ <defs
23
+ id="defs4">
24
+ <linearGradient
25
+ inkscape:collect="always"
26
+ id="linearGradient3873">
27
+ <stop
28
+ style="stop-color:#ffffff;stop-opacity:1;"
29
+ offset="0"
30
+ id="stop3875" />
31
+ <stop
32
+ style="stop-color:#ffffff;stop-opacity:0;"
33
+ offset="1"
34
+ id="stop3877" />
35
+ </linearGradient>
36
+ <linearGradient
37
+ id="linearGradient3831">
38
+ <stop
39
+ style="stop-color:#88a4f7;stop-opacity:1;"
40
+ offset="0"
41
+ id="stop3833" />
42
+ <stop
43
+ style="stop-color:#88a4f7;stop-opacity:0;"
44
+ offset="1"
45
+ id="stop3835" />
46
+ </linearGradient>
47
+ <linearGradient
48
+ id="linearGradient3782">
49
+ <stop
50
+ style="stop-color:#88a4f7;stop-opacity:1;"
51
+ offset="0"
52
+ id="stop3784" />
53
+ <stop
54
+ style="stop-color:#88a4f7;stop-opacity:0;"
55
+ offset="1"
56
+ id="stop3786" />
57
+ </linearGradient>
58
+ <linearGradient
59
+ inkscape:collect="always"
60
+ xlink:href="#linearGradient3873"
61
+ id="linearGradient3879"
62
+ x1="-52.789062"
63
+ y1="95.528737"
64
+ x2="46.478516"
65
+ y2="95.528737"
66
+ gradientUnits="userSpaceOnUse" />
67
+ <linearGradient
68
+ inkscape:collect="always"
69
+ xlink:href="#linearGradient3873"
70
+ id="linearGradient3885"
71
+ gradientUnits="userSpaceOnUse"
72
+ x1="-52.789062"
73
+ y1="95.528737"
74
+ x2="46.478516"
75
+ y2="95.528737"
76
+ gradientTransform="matrix(1.2781663,0,0,1.2781663,-0.56683723,-27.178371)" />
77
+ </defs>
78
+ <sodipodi:namedview
79
+ id="base"
80
+ pagecolor="#ffffff"
81
+ bordercolor="#666666"
82
+ borderopacity="1.0"
83
+ inkscape:pageopacity="0.0"
84
+ inkscape:pageshadow="2"
85
+ inkscape:zoom="4"
86
+ inkscape:cx="26.373"
87
+ inkscape:cy="63.939559"
88
+ inkscape:document-units="px"
89
+ inkscape:current-layer="layer1"
90
+ showgrid="false"
91
+ inkscape:window-width="1600"
92
+ inkscape:window-height="849"
93
+ inkscape:window-x="0"
94
+ inkscape:window-y="0"
95
+ inkscape:window-maximized="1"
96
+ showguides="true"
97
+ inkscape:guide-bbox="true">
98
+ <sodipodi:guide
99
+ orientation="0,1"
100
+ position="62.57895,132.22897"
101
+ id="guide3871" />
102
+ </sodipodi:namedview>
103
+ <metadata
104
+ id="metadata7">
105
+ <rdf:RDF>
106
+ <cc:Work
107
+ rdf:about="">
108
+ <dc:format>image/svg+xml</dc:format>
109
+ <dc:type
110
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
111
+ <dc:title></dc:title>
112
+ </cc:Work>
113
+ </rdf:RDF>
114
+ </metadata>
115
+ <g
116
+ inkscape:label="Layer 1"
117
+ inkscape:groupmode="layer"
118
+ id="layer1"
119
+ transform="translate(0,-924.36218)">
120
+ <rect
121
+ style="fill:#ffcb00;fill-opacity:1;stroke:none"
122
+ id="rect3004"
123
+ width="100"
124
+ height="100"
125
+ x="14"
126
+ y="938.36218"
127
+ ry="10"
128
+ rx="10" />
129
+ <path
130
+ style="opacity:0.2;fill:#ffffff;fill-opacity:1;stroke:none"
131
+ d="M 14,50.875 14.03125,23 c 0.0926,-4.543321 4.895309,-8.941992 9.125,-9 l 81.96875,0 c 4.49471,0.0913 8.85437,5.039189 8.875,9.125 L 114,51 C 80.492943,56.594067 47.17385,55.936454 14,50.875 z"
132
+ id="path3768"
133
+ inkscape:connector-curvature="0"
134
+ transform="translate(0,924.36218)"
135
+ sodipodi:nodetypes="ccccccc" />
136
+ <flowRoot
137
+ xml:space="preserve"
138
+ id="flowRoot3815"
139
+ style="font-size:100px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Arial Bold"
140
+ transform="matrix(0.78237078,0,0,0.78237078,65.80062,914.91146)"><flowRegion
141
+ id="flowRegion3817"
142
+ style="fill:url(#linearGradient3885);fill-opacity:1"><rect
143
+ id="rect3819"
144
+ width="208.57143"
145
+ height="192.14285"
146
+ x="-55.714287"
147
+ y="23"
148
+ style="font-size:100px;font-style:normal;fill:#ffffff;fill-opacity:1;-inkscape-font-specification:Arial Bold" /></flowRegion><flowPara
149
+ id="flowPara3821"
150
+ style="font-size:100px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#ffffff;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Bold">{ }</flowPara></flowRoot> </g>
151
+ </svg>
@@ -0,0 +1,191 @@
1
+ <!DOCTYPE HTML>
2
+
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
6
+
7
+ <title>JSON Editor Online - view, edit and format JSON online</title>
8
+
9
+ <!--
10
+
11
+ @file index.html
12
+
13
+ @brief
14
+ JSON Editor Online is a web-based tool to view, edit, and format JSON.
15
+ It shows your data side by side in a clear, editable treeview and in
16
+ a code editor.
17
+
18
+ Supported browsers: Chrome, Firefox, Safari, Opera, Internet Explorer 8+
19
+
20
+ @license
21
+ This json editor is open sourced with the intention to use the editor as
22
+ a component in your own application. Not to just copy and monetize the editor
23
+ as it is.
24
+
25
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
26
+ use this file except in compliance with the License. You may obtain a copy
27
+ of the License at
28
+
29
+ http://www.apache.org/licenses/LICENSE-2.0
30
+
31
+ Unless required by applicable law or agreed to in writing, software
32
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
33
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
34
+ License for the specific language governing permissions and limitations under
35
+ the License.
36
+
37
+ Copyright (C) 2011-2013 Jos de Jong, http://jsoneditoronline.org
38
+
39
+ @author Jos de Jong, <wjosdejong@gmail.com>
40
+ @version @@version
41
+ @date @@date
42
+ -->
43
+
44
+ <meta name="description" content="JSON Editor Online is a web-based tool to view, edit, and format JSON. It shows your data side by side in a clear, editable treeview and in a code editor.">
45
+ <meta name="keywords" content="json, editor, formatter, online, format, parser, json editor, json editor online, online json editor, javascript, javascript object notation, tools, tool, json tools, treeview, open source, free, json parser, json parser online, json formatter, json formatter online, online json formatter, online json parser, format json online">
46
+ <meta name="author" content="Jos de Jong">
47
+
48
+ <link rel="shortcut icon" href="favicon.ico">
49
+
50
+ <link rel="stylesheet" type="text/css" href="app-min.css">
51
+ <link rel="stylesheet" type="text/css" href="lib/jsoneditor/jsoneditor-min.css">
52
+ <!-- TODO: droid font
53
+ <link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
54
+ -->
55
+
56
+ <script type="text/javascript" src="lib/jsoneditor/jsoneditor-min.js"></script>
57
+ <script type="text/javascript" src="lib/ace/ace-min.js"></script>
58
+ <script type="text/javascript" src="app-min.js"></script>
59
+ </head>
60
+
61
+ <body>
62
+
63
+ <div id="header">
64
+ <a href="http://jsoneditoronline.org" class="header">
65
+ <img alt="JSON Editor Online" title="JSON Editor Online" src="img/logo.png" id="logo">
66
+ </a>
67
+
68
+ <div id="menu">
69
+ <ul>
70
+ <li>
71
+ <a id="clear" title="Clear contents">Clear</a>
72
+ </li>
73
+ <li>
74
+ <a id="open" title="Open file from disk">
75
+ Open
76
+ <span id="openMenuButton" title="Open file from disk or url">
77
+ &#x25BC;
78
+ </span>
79
+ </a>
80
+ <ul id="openMenu">
81
+ <li>
82
+ <a id="menuOpenFile" title="Open file from disk">Open&nbsp;file</a>
83
+ </li>
84
+ <li>
85
+ <a id="menuOpenUrl" title="Open file from url">Open&nbsp;url</a>
86
+ </li>
87
+ </ul>
88
+ </li>
89
+ <li>
90
+ <a id="save" title="Save file to disk">Save</a>
91
+ </li>
92
+ <li>
93
+ <a id="help" title="Open documentation (opens in a new window)" href="doc/index.html" target="_blank">Help</a>
94
+ </li>
95
+ </ul>
96
+ </div>
97
+
98
+ <!-- TODO: info, links, faq -->
99
+ <!--
100
+ <div class="info" style="display:none;">
101
+ JSON, or JavaScript Object Notation, is a lightweight text-based open standard
102
+ designed for human-readable data interchange. It is derived from the JavaScript
103
+ scripting language for representing simple data structures and associative arrays,
104
+ called objects. Despite its relationship to JavaScript, it is language-independent,
105
+ with parsers available for most languages.
106
+ The JSON format was originally specified by Douglas Crockford, and is described
107
+ in RFC 4627. The official Internet media type for JSON is application/json.
108
+ The JSON filename extension is .json.
109
+ The JSON format is often used for serializing and transmitting structured data
110
+ over a network connection. It is used primarily to transmit data between a server
111
+ and web application, serving as an alternative to XML.
112
+ <br><br>
113
+ From <a target="_blank" href="http://en.wikipedia.org/wiki/Json">Wikipedia</a>
114
+ </div>
115
+
116
+ <div class="links" style="display:none;">
117
+ <a target="_blank" href="http://json.org/">http://json.org/</a><br>
118
+ <a target="_blank" href="http://en.wikipedia.org/wiki/Json">http://en.wikipedia.org/wiki/Json</a><br>
119
+ </div>
120
+
121
+ <div class="faq" style="display:none;"></div>
122
+ -->
123
+ </div>
124
+
125
+ <div id="auto">
126
+ <div id="contents">
127
+ <div id="codeEditor"></div>
128
+
129
+ <div id="splitter">
130
+ <div id="buttons">
131
+ <div>
132
+ <button id="toTree" class="convert" title="Copy code to tree editor">
133
+ <div class="convert-right"></div>
134
+ </button>
135
+ </div>
136
+ <div>
137
+ <button id="toCode" class="convert" title="Copy tree to code editor">
138
+ <div class="convert-left"></div>
139
+ </button>
140
+ </div>
141
+ </div>
142
+ <div id="drag">
143
+ </div>
144
+ </div>
145
+
146
+ <div id="treeEditor"></div>
147
+
148
+ <script type="text/javascript">
149
+ app.load();
150
+ app.resize();
151
+ </script>
152
+
153
+ <div id="ad">
154
+ <script type="text/javascript"><!--
155
+ google_ad_client = "ca-pub-7938810169574141";
156
+ /* jsoneditoronline_160x600 */
157
+ google_ad_slot = "4671869937";
158
+ google_ad_width = 160;
159
+ google_ad_height = 600;
160
+ //-->
161
+ </script>
162
+
163
+ <script type="text/javascript"
164
+ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
165
+ </script>
166
+ </div>
167
+ </div>
168
+ </div>
169
+
170
+ <div id="footer">
171
+ <div id="footer-inner">
172
+ <a href="http://jsoneditoronline.org" class="footer">JSON Editor Online @@version</a>
173
+ &bull;
174
+ <a href="HISTORY.md" target="_blank" class="footer">History</a>
175
+ &bull;
176
+ <a href="https://github.com/josdejong/jsoneditor/" target="_blank" class="footer">Sourcecode</a>
177
+ &bull;
178
+ <a href="datapolicy.txt" target="_blank" class="footer">Data policy</a>
179
+ &bull;
180
+ <a href="NOTICE" target="_blank" class="footer">Copyright 2011-2013 Jos de Jong</a>
181
+ </div>
182
+ </div>
183
+
184
+ <script type="text/javascript">
185
+ app.resize();
186
+ </script>
187
+
188
+ <script type="text/javascript" src="lib/jsonlint/jsonlint.js"></script>
189
+
190
+ </body>
191
+ </html>
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Utility to display notifications and error messages.
3
+ * The messages are displayed on the top center of the web page
4
+ * @constructor Notify
5
+ */
6
+ function Notify () {
7
+ this.dom = {};
8
+
9
+ // TODO: attach the event as soon as there are one or multiple messages displayed,
10
+ // remove it as soon as they are all gone
11
+ var me = this;
12
+ jsoneditor.util.addEventListener(document, 'keydown', function (event) {
13
+ me.onKeyDown(event);
14
+ });
15
+ }
16
+
17
+ /**
18
+ * Show a notification
19
+ * @param {String} message
20
+ * @return {Element} messageObject
21
+ */
22
+ Notify.prototype.showNotification = function (message) {
23
+ return this.showMessage({
24
+ type: 'notification',
25
+ message: message,
26
+ closeButton: false
27
+ });
28
+ };
29
+
30
+ /**
31
+ * Show an error message
32
+ * @param {Error} error
33
+ * @return {Element} messageObject
34
+ */
35
+ Notify.prototype.showError = function (error) {
36
+ return this.showMessage({
37
+ type: 'error',
38
+ message: (error.message || error.toString()),
39
+ closeButton: true
40
+ });
41
+ };
42
+
43
+ /**
44
+ * Show a message
45
+ * @param {Object} params Available parameters:
46
+ * {String} message
47
+ * {String} type 'error', 'notification'
48
+ * {Boolean} closeButton
49
+ * @return {Element} messageObject
50
+ */
51
+ Notify.prototype.showMessage = function (params) {
52
+ var frame = this.dom.frame;
53
+ if (!frame) {
54
+ var width = 500;
55
+ var top = 5;
56
+ var windowWidth = document.body.offsetWidth || window.innerWidth;
57
+ frame = document.createElement('div');
58
+ frame.style.position = 'absolute';
59
+ frame.style.left = (windowWidth - width) / 2 + 'px';
60
+ frame.style.width = width + 'px';
61
+ frame.style.top = top + 'px';
62
+ frame.style.zIndex = '999';
63
+ document.body.appendChild(frame);
64
+ this.dom.frame = frame;
65
+ }
66
+
67
+ var type = params.type || 'notification';
68
+ var closeable = (params.closeButton !== false);
69
+ var divMessage = document.createElement('div');
70
+ divMessage.className = type;
71
+ divMessage.type = type;
72
+ divMessage.closeable = closeable;
73
+ divMessage.style.position = 'relative';
74
+ frame.appendChild(divMessage);
75
+
76
+ var table = document.createElement('table');
77
+ table.style.width = '100%';
78
+ divMessage.appendChild(table);
79
+ var tbody = document.createElement('tbody');
80
+ table.appendChild(tbody);
81
+ var tr = document.createElement('tr');
82
+ tbody.appendChild(tr);
83
+
84
+ var tdMessage = document.createElement('td');
85
+ tdMessage.innerHTML = params.message || '';
86
+ tr.appendChild(tdMessage);
87
+
88
+ if (closeable) {
89
+ var tdClose = document.createElement('td');
90
+ tdClose.style.textAlign = 'right';
91
+ tdClose.style.verticalAlign = 'top';
92
+ tr.appendChild(tdClose);
93
+
94
+ var closeDiv = document.createElement('button');
95
+ closeDiv.innerHTML = '&times;';
96
+ closeDiv.title = 'Close message (ESC)';
97
+ tdClose.appendChild(closeDiv);
98
+ var me = this;
99
+ closeDiv.onclick = function () {
100
+ me.removeMessage(divMessage);
101
+ }
102
+ }
103
+
104
+ return divMessage;
105
+ };
106
+
107
+ /**
108
+ * Remove a message from the list with messages
109
+ * @param {Element} [message] The HTML DOM of a message
110
+ * If undefined, the first closeable message will
111
+ * closed.
112
+ */
113
+ Notify.prototype.removeMessage = function (message) {
114
+ var frame = this.dom.frame;
115
+ if (!message && frame) {
116
+ // find the first closable message in the list with displayed messages
117
+ var child = frame.firstChild;
118
+ while (child && !child.closeable) {
119
+ child = child.nextSibling;
120
+ }
121
+ if (child && child.closeable) {
122
+ message = child;
123
+ }
124
+ }
125
+
126
+ if (message && message.parentNode == frame) {
127
+ message.parentNode.removeChild(message);
128
+ }
129
+
130
+ if (frame && frame.childNodes.length == 0) {
131
+ frame.parentNode.removeChild(frame);
132
+ delete this.dom.frame;
133
+ }
134
+ };
135
+
136
+ /**
137
+ * Handle key down event.
138
+ * @param {Event} event
139
+ * @private
140
+ */
141
+ Notify.prototype.onKeyDown = function (event) {
142
+ event = event || window.event;
143
+ var keynum = event.which || event.keyCode;
144
+ if (keynum == 27) { // ESC
145
+ // remove the oldest open and closeable message
146
+ this.removeMessage();
147
+ jsoneditor.util.preventDefault(event);
148
+ jsoneditor.util.stopPropagation(event);
149
+ }
150
+ };