/
index.html
339 lines (301 loc) · 18 KB
/
index.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<!-- HTML File Content WebApp - generated 2020/07/27 11:13:14 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="jsoneditor4menu" content="https://niehausbert.gitlab.io/jsoneditor4menu">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>WebApp - WebApp</title>
<link href="css/bootstrap-brown.css" rel="stylesheet">
<Xlink href="css/main.css" rel="stylesheet">
<!-- generated CSS files by jsoneditor4menu -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/jquery-ui.css">
<link rel="stylesheet" href="css/menu.css">
<link rel="stylesheet" href="css/pages.css">
<!-- Bootstrap Core CSS -->
<script src="ace/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="js/arrayhash.js"></script>
<!-- generated script tags for 'settings.jsfiles' -->
<!-- js/jquery-3.2.0.js is generated by JSONEditor4Menu -->
<script src="js/jquery-3.2.0.js"></script>
<!-- js/printcode.js is generated by JSONEditor4Menu -->
<script src="js/printcode.js"></script>
<!-- js/menu.js is generated by JSONEditor4Menu -->
<script src="js/menu.js"></script>
<!-- js/loadfile4dom.js is generated by JSONEditor4Menu -->
<script src="js/loadfile4dom.js"></script>
<!-- js/filesaver.js is generated by JSONEditor4Menu -->
<script src="js/filesaver.js"></script>
<script src="js/jquery.js"></script>
<script src="js/jsoneditor_x.js"></script>
<script src="js/handlebars4code.js"></script>
<script>
var vDataJSON = {
"tpl":{},
"out":{}
};
// Set the default CSS theme and icon library globally
JSONEditor.defaults.theme = 'bootstrap3';
JSONEditor.defaults.iconlib = 'fontawesome4';
//--- Handlebars4Code: see https://www.github.com/niebert/HandleBars4Code ---
function saveFile2HDD(pFilename,pContent) {
var file = new File([pContent], {type: "text/plain;charset=utf-8"});
saveAs(file,pFilename);
}
function saveTemplate2HDD(pContent) {
var vFilename = getBaseFileName()+".tpl";
saveFile2HDD(vFilename,pContent)
}
</script>
<script src="js/loadfile4dom_init.js"></script>
<script src="db/db_default.js"></script>
<script src="db/db_init.js"></script>
<!-- Load SCHEMAS: vSchemaID = "class_schema" -->
<script src="schema/schema4json.js"></script>
<!-- Load SCHEMAS: vSchemaID = "class_schema" -->
<script src="tpl/template4json_tpl.js"></script>
</head>
<body onload="lf4d.create()">
<div class="wrapper">
<nav class="site-nav">
<h1 class="menu-logo">JSON-Editor <span><div id4marker="version" style="display: inline-block">1.1.8</div></span></h1>
<div class="menu-toggle">
<div class="hamburger"></div>
</div>
<ul class="open desktop">
<!-- Menu Item 'Load' - type: page - visibility: visible -->
<li><a href="#!" onclick="app.nav.page('load')"><img width="100" class="menu-icon" src="img/icons-svg/fa-folder-open-white.svg"><div class="nav-text site-nav--icon">Load</div></a></li>
<!-- Menu Item 'Save' - type: page - visibility: visible -->
<li><a href="#!" onclick="app.nav.page('save')"><img class="menu-icon" src="img/icons-svg/fa-file-save-white.svg"><div class="nav-text site-nav--icon">Save</div></a></li>
<!-- Menu Item 'Edit' - type: page - visibility: visible -->
<li><a href="#!" onclick="app.nav.page('edit')"><img class="menu-icon" src="img/icons-svg/edit-white.svg"><div class="nav-text site-nav--icon">Edit</div></a></li>
<!-- Menu Item 'Delete' - type: page - visibility: visible -->
<li><a href="#!" onclick="app.nav.page('delete')"><img class="menu-icon" src="img/icons-svg/fa-trash-white.svg"><div class="nav-text site-nav--icon">Delete</div></a></li>
<!-- Menu Item 'Print' - type: page - visibility: visible -->
<li><a href="#!" onclick="el('app_editor').value=JSON.stringify(editor.getValue(),null,4);app.nav.page('print')"><img class="menu-icon" src="img/icons-svg/fa-print-white.svg"><div class="nav-text site-nav--icon">Print</div></a></li>
<!-- Menu Item 'Settings' - type: page - visibility: visible -->
<li><a href="#!" onclick="app.nav.page('settings')"><img class="menu-icon" src="img/icons-svg/gear-white.svg"><div class="nav-text site-nav--icon">Settings</div></a></li>
<!-- Menu Item 'About' - type: page - visibility: visible -->
<li><a href="#!" onclick="app.nav.page('about')"><img class="menu-icon" src="img/icons-svg/info-white.svg"><div class="nav-text site-nav--icon">About</div></a></li>
</ul>
</nav>
</div>
<div class="area" data-role="page-container" id="page-container" currentpage="home">
<div class="pages-app" data-role="page" id="load">
<h2>Load</h2>
<!-- place content of the page here CALL: lf4d.open_dialog('mytxtfile') -->
<button id="bJSONLoad" class="btn4menu" onclick="lf4d.open_dialog('myjsonfile');return false">
<img src="img/icons-svg/fa-folder-open-white.svg">
Load JSON
</button>
</div>
<div class="pages-app" data-role="page" id="save">
<h2>Save</h2>
<!-- place content of the page here
var vFilename = document.getElementById('tFilename').value;
var vContent = document.getElementById('app_editor').value;
saveFile2HDD(vFilename,vContent)
-->
<button id='bExportJSON' class="btn4menu">
<img src="img/icons-svg/fa-file-save-white.svg">
Save JSON
</button>
<input type="text" id="jsonfile" length="10" value="myjson.json">
<!-- Begin: Hidden Buttons -->
<button id='submit' style="display:none">Submit (console.log)</button>
<button id='enable_disable' style="display:none">Disable/Enable Form</button>
<!-- End: hidden Buttons --->
<br>
<button id='bExportOutput' class="btn4menu">
<img src="img/icons-svg/fa-file-save-white.svg">
Save Handlebars4Code Output
</button>
<button id='bShowTemplate' class="btn4menu" onclick="app.nav.page('settings');return false">
<img src="img/icons-svg/gear-white.svg">
Show Template
</button>
</div>
<div class="pages-app" data-role="page" id="edit">
<h2>Edit</h2>
<center>
<button id='restore' class="btn4menu">
<img src="img/icons-svg/recycle-white.svg">
Restore to Default
</button>
<b>JSON Validator:</b> <span id='valid_indicator'></span>
<div id='editor_holder' style="margin:20px;text-align:left"></div>
</center>
</div>
<div class="pages-app" data-role="page" id="delete">
<h2>Delete</h2>
<!-- This is the page content of the menu item 'Delete' of type 'page' -->
<!-- <input type='button' value='Clear Content' onclick="document.getElementById('app_editor').value='';app.nav.page('edit');"> -->
<button id="bButtonDelete" class="btn4menu" onclick="document.getElementById('app_editor').value='';editor.setValue(vDataJSON.db_default);app.nav.page('edit');"><img class="menu-icon" src="img/icons-svg/fa-trash-white.svg"> Clear Content</button>
<hr>
<center>
<font size="-1">
<b><a href="https://github.com/niebert/jsoneditor_app/archive/master.zip">jsoneditor_app</a></b> is an <a href="https://en.wikiversity.org/wiki/AppLSAC" target="_blank">AppLSAC</a><br>
<a href="https://github.com/niebert/jsoneditor_app" target="_blank">GitHub Repository with <kbd>jsoneditor_app</kbd></a>
<br> Repository uses <a href="https://www.github.com/json-editor/json-editor" target="_blank">JSON-Editor</a>, <a href="https://github.com/niebert/loadfile4dom" target="_blank">LoadFile4DOM</a>, <a href="https://github.com/eligrey/FileSaver.js/" target="_blank">FileSaver</a> and <a href="https://github.com/niebert/icons4menu/" target="_blank">Icons4Menu</a><br>
<a href="https://niehausbert.gitlab.com/JSON2Schema" target="_blank">Create your own jsoneditor_app with JSON2Schema</a>
</font>
</center>
</div>
<div class="pages-app" data-role="page" id="print">
<h2>Print</h2>
<h3>Display Options</h3>
<table border=0>
<tr>
<td>
<button class="btn4menu" onclick="app.evt.show_json();return false"><img src="img/icons-svg/fa-edit-white.svg" width="20"> JSON</button>
</td>
<td>
</td>
<td>
<button class="btn4menu" onclick="app.evt.show_output();return false"><img src="img/icons-svg/fa-line-chart-white.svg" width="20"> Handlebars4Code Output</button>
</td>
</tr>
<tr>
<td>
<button class="btn4menu" onclick="app.evt.show_schema();return false"><img src="img/icons-svg/fa-harddisk-white.svg" width="20"> JSON Schema</button>
</td>
<td>
</td>
<td>
<button class="btn4menu" onclick="app.evt.show_template();return false"><img src="img/icons-svg/fa-paste-white.svg" width="20"> Handlebars4Code Template</button>
</td>
</tr>
</table>
<hr>
<!-- This is the page content of the menu item 'Print' of type 'page' -->
<h3>Print File</h3>
<!-- <button class="btn4menu" onclick="previewTextArea('app_editor');return false">Print Preview</button> -->
<button class="btn4menu" onclick="printTextArea('app_editor');return false">Print</button>
<hr>
<div style="float:center;width:90%;">
<textarea id="app_editor" style="width:100%;height:100%" rows="20" ></textarea>
</div>
</div>
<div class="pages-app" data-role="page" id="settings">
<h2>Settings</h2>
<!-- This is the page content of the menu item 'Settings' of type 'page' -->
<b>Export Extension Handlebars4Code:</b>
<input type='text' id='tExtension' value='.md'>
<br>
<button id='bExportSchemaJSON' class="btn4menu">
<img src="img/icons-svg/fa-file-save-white.svg">
Save JSON Editor Schema
</button> - see <a href="https://niehausbert.gitlab.io/JSON2Schema">JSON2Schema on GitLab</a>
<hr>
<b>Template for Handlebars4Code:</b>
<div style="float:center;width:90%;">
<textarea id="tTemplate" style="width:100%;height:100%" rows="20" ></textarea>
</div>
<button id='bExportTemplate' class="btn4menu" onclick="saveFile2HDD('template4json'+el('tExtension').value+'.tpl',el('tTemplate').value)">
<img src="img/icons-svg/fa-file-save-white.svg">
Save Template
</button> - see <a href="https://www.gitlab.com/niehausbert/handlebars4code">Handlebars4Code on GitLab</a>
</div>
<div class="pages-app" data-role="page" id="about">
<h2>About</h2>
<h3>
WebApp - JSON-Editor <div id4marker="version" style="display: inline-block">1.1.8</div>
</h3>
<h4>
AppLSAC
</h4>
This is a JSON editor with Load, Save and Print features running completely in the browser without submission of loaded data to remote servers.
<ul>
<li>
<a href="https://www.github.com/niebert/jsoneditor_app" target="_blank"><b>JSON-Editor App</b> </a> The <a href="https://github.com/json-editor/json-editor" target="_blank">underlying JSON-Editor</a> was used for this repository <a href="https://www.github.com/niebert/jsoneditor_app" target="_blank">jsoneditor_app on GitHub</a>.
Editor layout for input is configured by a JSON Schema W to generate tailored JSON
</li>
<li>
<b><a href="https://en.wikipedia.org/wiki/Template:Graph:Chart" target="_blank">Template for Graphs:</a></b> The syntax for the output is defined by the <a href="https://en.wikipedia.org/wiki/Template:Graph:Chart" target="_blank">Wikipedia/Wikiversity Template - Graph:Chart</a>. The Handlebars4Code template generates the Wiki-Graph output with the library <a href="https://gitlab.com/niehausbert/handlebars4code#readme" target="_blank">Handlebars4Code</a>. The output of CSV2WikiChart WebApp uses the JSON in the JSON Editor to populate the <a href="tpl/template4json_tpl.js" target="_blank">Handlebars4Code-Template <tt>tpl/template4json_tpl.js</tt></a> (see also <a href="https://niehausbert.gitlab.io/handlebars4code" target="_blank">Handelbars4Code Demo</a>).
</li>
<li>
<b><a href="https://www.github.com/niebert/hamburger_menu_app" target="_blank">App Menu:</a></b> The menu was created with the <a href="https://niehausbert.gitlab.io/jsoneditor4menu/" target="_blank">JSONEditor4Menu</a> as a web-based interface to create a <a href="https://www.github.com/niebert/hamburger_menu_app" target="_blank">Hamburger Menu App</a>.
Editor layout for input is configured by a JSON Schema W to generate tailored JSON
</li>
<li>
<b><a href="https://www.github.com/niebert/icons4menu" target="_blank">used icons for the menu</a> are a icons from <a href="https://jquerymobile.com/download/">JQuery Mobile 1.4.5 Icons</a> and from <a href="https://commons.wikimedia.org/w/index.php?title=Special:Search&limit=50&offset=0&profile=default&search=Font+Awesome&advancedSearch-current={}&ns0=1&ns6=1&ns12=1&ns14=1&ns100=1&ns106=1" target="_blank">Based on WikiCommons Icons:</a></b> <a href="https://www.github.com/niebert/icons4menu" target="_blank">Icons for Menu:</a></b>.
The <a href="https://www.github.com/niebert/icons4menu" target="_blank">used icons for the menu</a> are a icons from <a href="https://jquerymobile.com/download/">JQuery Mobile 1.4.5 Icons</a> and from <a href="https://commons.wikimedia.org/w/index.php?title=Special:Search&limit=50&offset=0&profile=default&search=Font+Awesome&advancedSearch-current={}&ns0=1&ns6=1&ns12=1&ns14=1&ns100=1&ns106=1" target="_blank">WikiCommons</a>. For icons and licensing detail see <a href="img/README_Icons4Menu.html" target="_blank">README_Icons4Menu.html</a>.
</li>
</ul>
This is an <a href='https://en.wikiversity.org/wiki/AppLSAC' target='_blank'>AppLSAC</a>. The application was create with <a href='https://niehausbert.gitlab.io/jsoneditor4menu' target='_blank'>JSONEditor4Menu</a>. See also <a href='https://www.gitlab.com/niehausbert/jsoneditor4menu' target='_blank'>GitLab repository for source code</a> of JSONEditor4Menu
<hr>
<hr>
<center>
<font size="-1">
<b><a href="https://github.com/niebert/jsoneditor_app/archive/master.zip">jsoneditor_app</a></b> is an <a href="https://en.wikiversity.org/wiki/AppLSAC" target="_blank">AppLSAC</a><br>
<a href="https://github.com/niebert/jsoneditor_app" target="_blank">GitHub Repository with <kbd>jsoneditor_app</kbd></a>
<br> Repository uses <a href="https://www.github.com/json-editor/json-editor" target="_blank">JSON-Editor</a>, <a href="https://github.com/niebert/loadfile4dom" target="_blank">LoadFile4DOM</a>, <a href="https://github.com/eligrey/FileSaver.js/" target="_blank">FileSaver</a> and <a href="https://github.com/niebert/icons4menu/" target="_blank">Icons4Menu</a><br>
<a href="https://niehausbert.gitlab.com/JSON2Schema" target="_blank">Create your own jsoneditor_app with JSON2Schema</a><br>
Created 2019/09/24 19:39:29<br>last modified <div id4marker="datetime" style="display: inline-block">2021/03/19 11:52:50</div> - Version <div id4marker="version" style="display: inline-block">1.1.8</div>
</font>
</center>
</div>
</div>
<script>
// This is the starting value for the editor
// We will use this to seed the initial editor
// and to provide a "Restore to Default" button.
var starting_value = [
];
// Initialize the editor
var editor = new JSONEditor(document.getElementById('editor_holder'),{
// Enable fetching schemas via ajax
ajax: true,
// The schema for the editor
// The schema for the editor
schema: vDataJSON.schema4json,
// Seed the form with a starting value
startval: vDataJSON.db_init,
// Seed the form with a starting value
//startval: starting_value,
// Disable additional properties
no_additional_properties: true,
// Require all properties by default
required_by_default: true
});
// Hook up the validation indicator to update its
// status whenever the editor changes
editor.on('change',function() {
// Get an array of errors from the validator
var errors = editor.validate();
var indicator = document.getElementById('valid_indicator');
// Not valid
if(errors.length) {
indicator.style.color = 'red';
indicator.textContent = "not valid";
}
// Valid
else {
indicator.style.color = 'green';
indicator.textContent = "valid";
}
});
</script>
<script>
Handlebars4Code.create_compiler(vDataJSON.tpl);
vDataJSON.out = Handlebars4Code.get_compiler();
// Config Code is defined in settings.configcode by JSONEditor4Menu
//--- init pages ----
app.nav.page("edit");
//--- Assign Toggle Menu Function ----
$('.menu-toggle').click(app.nav.menu.toggle);
// the configuration code can be used to create some constants, local functions or initialize some javascript objects.
</script>
<!-- adding the event listener to the button -->
<script src="js/add_event_listener.js"></script>
<XXscript src="js/bootstrap.js"></scriptXX>
<script>
// Store Template from vDataJSON into textarea
el("tTemplate").value = vDataJSON.tpl.template4json;
</script>
</body>
</html>