/
cas4wiki_plotcommands.html
848 lines (787 loc) · 36.8 KB
/
cas4wiki_plotcommands.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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<!-- HTML File Content WebApp - generated 2023/01/27 11:13:14 -->
<link href="css/bootstrap-brown.css" rel="stylesheet">
<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>CAS4Wiki - 1.1.22</title>
<!-- generated CSS files by jsoneditor4menu -->
<!--
<Xlink href="css/main.css" rel="stylesheet">
<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">
<!-- MathJax Load -->
<script src="mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script>
<!-- MathJax Load PanDoc-GitHub TeX-MML-AM_CHTML -->
<!--
<script derfer src="./mathjax/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script>
<script src="ace/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
-->
<script src="js/algebrite4browser.js"></script>
<script src="js/math4js.js"></script>
<script src="js/plotly.js"></script>
<script src="js/closingbracket.js"></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.js"></script>
<!-- js/printcode.js is generated by JSONEditor4Menu -->
<script src="js/linkparam.js"></script>
<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.min.js"></script>
<script>
var vEditor;
var ced;
var vDataJSON = {
"tpl":{},
"out":{},
"db":{}
};
</script>
<!-- Load Init DB - JSON data -->
<script src="db/plotcommands.db.js"></script>
<!-- Load SCHEMAS: vSchemaID = "class_schema" -->
<script src="schema/cas4wiki.schema.js"></script>
<!-- Load SCHEMAS: vSchemaID = "class_schema" -->
<script src="tpl/cas4wiki.tpl.js"></script>
<script>
// alert("vDataJSON.db.initdb="+JSON.stringify(vDataJSON.db.initdb,null,2));
// Set the default CSS theme and icon library globally
JSONEditor.defaults.theme = 'bootstrap3';
JSONEditor.defaults.iconlib = 'icons4menu';
//--- Handlebars4Code: see https://www.github.com/niebert/HandleBars4Code ---
var ced;
var vLinkParam = new LinkParam();
vLinkParam.init(document);
function load_cas_demo() {
if (vEditor && vEditor.setValue) {
vEditor.setValue(vDataJSON.db['initdb']);
} else {
console.warn("JSON editor 'vEditor' is not defined - setValue-call failed");
}
app.nav.page('edit')
}
function loadJSON2HDD() {
/*
var ed = vEditor;
if (vEditor) {
alert("BEFORE vEditor exists");
} else {
alert("BEFORE vEditor is missing");
};
*/
vEditor.loadJSON();
app.nav.page('edit');
/*
if (vEditor) {
alert("AFTER vEditor exists");
if (vEditor.getEditor) {
alert("AFTER vEditor.getEditor() exists");
} else {
alert("AFTER vEditor.getEditor() is missing");
}
} else {
alert("AFTER vEditor is missing");
};
//window.vEditor = vEditor;
//return false;
*/
}
function saveFile2HDD(pFilename,pContent) {
var file = new File([pContent], {type: "text/plain;charset=utf-8"});
saveAs(file,pFilename);
}
function saveJSON2HDD() {
var vJSON = vEditor.getValue();
if (vJSON) {
var vContent = JSON.stringify(vJSON,null,4);
var vFilename = el("jsonfile").value;
saveFile2HDD(vFilename,vContent)
}
}
function get_cas_editors() {
if (ced) {
alert("ced exists!");
return ced
} else {
if (vEditor && vEditor.getEditor) {
return {
"title4cas": vEditor.getEditor('root.title4cas'),
"title4commands": vEditor.getEditor('root.title4commands'),
"title4functions": vEditor.getEditor('root.title4functions'),
"title4variables": vEditor.getEditor('root.title4variables'),
"commands": vEditor.getEditor('root.commands'),
"casfunctions": vEditor.getEditor('root.casfunctions'),
"casvariables": vEditor.getEditor('root.casvariables')
}
} else {
alert("JSON editor 'vEditor' is not defined - getEditor failed");
return null;
}
}
}
function getMap2DOM() {
return {
"title4cas": document.getElementById('btTitle4CAS'),
"title4commands": document.getElementById('btTitle4Commands'),
"title4functions": document.getElementById('btTitle4Functions'),
"title4variables": document.getElementById('btTitle4Variables')
}
}
function getInput2DOM() {
return {
"title4cas": document.getElementById('tTitle4CAS'),
"title4commands": document.getElementById('tTitle4Commands'),
"title4functions": document.getElementById('tTitle4Functions'),
"title4variables": document.getElementById('tTitle4Variables')
}
}
function setValue4Settings(id4editor,val) {
var input2dom = getInput2DOM();
if (input2dom[id4editor]) {
input2dom[id4editor].value = val;
}
setButtons4Editor(id4editor,val);
}
function setButtons4Editor(id4editor,val) {
var map2dom = getMap2DOM();
if (map2dom[id4editor]) {
map2dom[id4editor].innerHTML = "";
var textNode = document.createTextNode(val);
map2dom[id4editor].appendChild(textNode);
}
}
function setLabel4Editor(id4editor,val) {
var ced = get_cas_editors();
if (ced[id4editor]) {
ced[id4editor].setValue(val);
}
setButtons4Editor(id4editor,val);
};
function hide_all () {
var ced = get_cas_editors();
ced.commands.hide();
ced.casfunctions.hide();
ced.casvariables.hide();
}
function show_all () {
var ced = get_cas_editors();
ced.commands.show();
ced.casfunctions.show();
ced.casvariables.show();
}
function show_commands() {
var ced = get_cas_editors();
ced.commands.show();
ced.casfunctions.hide();
ced.casvariables.hide();
}
function show_functions() {
var ced = get_cas_editors();
ced.commands.hide();
ced.casfunctions.show();
ced.casvariables.hide();
}
function show_variables() {
var ced = get_cas_editors();
ced.commands.hide();
ced.casfunctions.hide();
ced.casvariables.show();
}
function delete_cas() {
var ced = get_cas_editors();
ced.commands.setValue([]);
ced.casfunctions.setValue([]);
ced.casvariables.setValue([]);
show_commands();
app.nav.page('edit')
}
function delete_commands() {
var ced = get_cas_editors();
ced.commands.setValue([
{
"cmdtitle": "CAS Command",
"cmd": "3*4+5",
"result4cmd": " "
},
]);
show_commands();
app.nav.page('edit')
}
function delete_results() {
var ced = get_cas_editors();
var cmd_arr = ced.commands.getValue();
for (var i = 0; i < cmd_arr.length; i++) {
cmd_arr[i].result4cmd = " ";
}
ced.commands.setValue(cmd_arr);
show_commands();
app.nav.page('edit')
}
function delete_functions() {
var ced = get_cas_editors();
ced.casfunctions.setValue([
{
"name": "f",
"args": "x",
"def": "x^2"
}
]);
show_functions();
app.nav.page('edit')
}
function delete_variables() {
var ced = get_cas_editors();
ced.casvariables.setValue([
{
"name": "c1",
"def": "12!"
}
]);
show_variables();
app.nav.page('edit')
}
function saveTemplate2HDD(pContent) {
var vFilename = getBaseFileName()+".tpl";
saveFile2HDD(vFilename,pContent)
}
function downloadCAS4Web() {
window.open("https://github.com/niebert/WikiversityDoc/archive/refs/heads/master.zip");
}
function createURL4JSON(pServerID,pID,pJSONID) {
var vNode = el(pID);
var vServerNode = el(pServerID);
var vJSONNode = el(pJSONID);
if (vEditor) {
vLinkParam.setValue("filename",el('jsonfile').value);
//vLinkParam.setValue("title",el('tTitle4CAS').value);
vLinkParam.deleteValue("title");
vLinkParam.setValue("title",el('tTitle4CAS').value);
//vLinkParam.setValue("title",vEditor.getTitle());
var vJSON = vEditor.getValue();
var value = JSON.stringify(vJSON);
var value4out = JSON.stringify(vJSON,null,2);
if (value4out && vJSONNode) {
vJSONNode.value = value4out
}
if (value) {
if (vLinkParam ) {
//alert("Test Create JSON")
vLinkParam.setValue("casdata",value);
var vLink = vLinkParam.getParam4URL();
//alert("vLink='"+vLink+"'");
//vLink = vLinkParam.getLink4URL();
if (vServerNode) {
vNode.value = vServerNode.value + vLink;
}
} else {
console.error("vLinkParam is not defined");
}
} else {
console.error("Value of JSON editor undefined");
}
} else {
console.error("JSON Editor for CAS4Web not defined");
}
}
</script>
</head>
<!--
<body onload="lf4d.create()">
-->
<body>
<div class="wrapper">
<nav class="site-nav">
<h1 class="menu-logo">CAS4Wiki <span><div id4marker="version" style="display: inline-block">1.1.22</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 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(vEditor.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="loadJSON2HDD();return false">
<!-- <button id="bJSONLoad" class="btn4menu" onclick="lf4d.open_dialog('mytxtfile');return false"> -->
<img src="img/icons-svg/fa-folder-open-white.svg">
Load JSON
</button>
<ul>
<li>
You can restore your previous work by loading a JSON file from your computer into the webbased Computer Algebra System, if you saved your work in a previous session as JSON.
</li>
<li>
As an alternative you can restore your session with a link, in which the commands are encoded in the URL as parameter. <b><a href="#" onclick="app.nav.page('settings');return false">See settings</a></b> if you want to create such a link for your currently used commands.
</li>
</ul>
<button id="bJSONLoadDemo" class="btn4menu" onclick="load_cas_demo();return false">
<img src="img/icons-svg/fa-folder-open-white.svg">
Load Demo Commands
</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)
-->
<h3 id="btTitle4CAS">CAS4Wiki</h3>
<button id='bSave4JSON' class="btn4menu" onclick="saveJSON2HDD();return false">
<img src="img/icons-svg/fa-file-save-white.svg">
Save JSON
</button>
<input type="text" id="jsonfile" length="10" value="commands4cas.json">
<br>
The JSON stores the current commands and defined function/variables of the
Computer Algebra System in your 'Download' folder. You can restore your settings with the JSON or share your defined commands with others.
<!-- 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='bShowTemplate' class="btn4menu" onclick="app.nav.page('settings');return false">
<img src="img/icons-svg/gear-white.svg">
Settings
</button>
</div>
<div class="pages-app" data-role="page" id="edit">
<h2>Edit -
<button id='bShowCommands' class="btn4menu" onclick="show_commands()">
<img src="img/icons-svg/gear-white.svg">
<span id="btTitle4Commands">Commands</span>
</button>
<button id='bShowFunctions' class="btn4menu" onclick="show_functions()">
<img src="img/icons-svg/gear-white.svg">
<span id="btTitle4">Functions</span>
</button>
<button id='bShowVariables' class="btn4menu" onclick="show_variables()">
<img src="img/icons-svg/gear-white.svg">
<span id="btTitle4">Variables</span>
</button>
</h2>
<center>
<span style="display:none">
<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>
</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='';delete_cas();return false" style="min-width: 35%;text-align:left">
<img class="menu-icon" src="img/icons-svg/fa-trash-white.svg">
Clear CAS Content
</button>
<ul>
<li>
<button id='bDeleteResults' class="btn4menu" onclick="delete_results();return false" style="min-width: 35%;text-align:left">
<img class="menu-icon" src="img/icons-svg/fa-trash-white.svg">
Results
</button> Clear all Results
</li>
<li>
<button id='bDeleteCommands' class="btn4menu" onclick="delete_commands();return false" style="min-width: 35%;text-align:left">
<img class="menu-icon" src="img/icons-svg/fa-trash-white.svg">
Commands
</button>
Clear all commands and insert a demo command
</li>
<li>
<button id='bDeleteFunctions' class="btn4menu" onclick="delete_functions();return false" style="min-width: 35%;text-align:left">
<img class="menu-icon" src="img/icons-svg/fa-trash-white.svg">
Functions
</button>
delete all definition of functions
</li>
<li>
<button id='bDeleteVariables' class="btn4menu" onclick="delete_variables();return false" style="min-width: 35%;text-align:left">
<img class="menu-icon" src="img/icons-svg/fa-trash-white.svg">
Variables
</button>
Delete all definitions of variables
</li>
</ul>
<!--
-->
<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="document.getElementById('app_editor').value=JSON.stringify(vEditor.getValue(),null,4);printTextArea('app_editor');return false">Print JSON</button>
<button class="btn4menu" onclick="app.evt.show_json();printTextArea('app_editor');return false">Print Commands</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' -->
<br>
<table border=0>
<tr>
<td>
<b>Create URL for JSON:</b>
</td>
<td>
The current commands and defined functions can be encoded with a URL and via parameter. A specific set of commands can be shared with that URL.
</td>
</tr>
<tr>
<td>
<b>Title: </b>
</td>
<td>
<input type='text' id='tTitle4CAS' value='CAS Demo' style="width:30%" onchange="setLabel4Editor('title4cas',this.value);return false">
</td>
</tr>
<tr>
<td>
<b>CAS4Web:</b>
</td>
<td>
<input type='text' id='tCAS4WebURL' value='https://niebert.github.io/WikiversityDoc/cas4wiki.html' style="width:70%">
<button id='bCreateURL4CAS' class="btn4menu" onclick="createURL4JSON('tCAS4WebURL','tURL4CMD','tJSON4CMD');return false;">
<img src="img/icons-svg/fa-globe-white.svg">
Create URL
</button>
</td>
</tr>
<tr>
<td>
<b>URL:</b>
</td>
<td>
<input type='text' id='tURL4CMD' value='' style="width:100%">
</td>
</tr>
<tr>
<td valign="top">
<b>JSON for URL:</b>
</td>
<td>
<textarea rows="8" id='tJSON4CMD' value='' style="width:100%">
</textarea>
</td>
</tr>
</table>
<hr>
<button id='bDownloadCAS' class="btn4menu" onclick="downloadCAS4Web()">
<img src="img/icons-svg/fa-globe-white.svg">
Download CAS4Web ZIP
</button>
- The <a href="https://www.github.com/niebert/WikiversityDoc" target="_blank">CAS4Web</a> can be downloaded as ZIP - The WebApp is based on:
<ul>
<li>
<a href="https://github.com/davidedc/Algebrite" target="_blank">Algebrite - Computer Algebra</a>
</li>
<li>
<a href="https://github.com/plotly/plotly.js" target="_blank">Plotly - Graphs</a>
</li>
<li>
<a href="https://www.jeremydorn.com/json-editor" target="_blank">JSON Editor by Jeremy Dorn</a>
</li>
</ul>
<hr>
<h3>Language Settings</h3>
<table style="width:70%">
<tr>
<td style="width:30%">
<b>Title Commands: </b>
</td>
<td>
<input type='text' id='tTitle4Commands' value='Commands' style="width:100%" onchange="setLabel4Editor('title4commands',this.value);return false">
</td>
</tr>
<tr>
<td style="width:30%">
<b>Title Functions: </b>
</td>
<td>
<input type='text' id='tTitle4Functions' value='Functions' style="width:100%" onchange="setLabel4Editor('title4functions',this.value);return false">
</td>
</tr>
<tr>
<td style="width:30%">
<b>Title Variables: </b>
</td>
<td>
<input type='text' id='tTitle4Variables' value='Variables' style="width:100%" onchange="setLabel4Editor('title4variables',this.value);return false">
</td>
</tr>
</table>
<div style="display:none">
<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>
<div class="pages-app" data-role="page" id="about">
<h2>About</h2>
<h3>
<a href="https://en.wikiversity.org/wiki/CAS4Wiki" target="_blank">CAS4Wiki</a> - JSON-Editor <div id4marker="version" style="display: inline-block">1.1.22</div>
</h3>
<h4>
<a href="https://www.github.com/niebert/WikiversityDoc" target="_blank">AppLSAC - Computer Algebra System</a>
</h4>
This is a <a href="https://github.com/niebert/WikiversityDoc/archive/refs/heads/main.zip" target="_blank">CAS4Wiki-JSON editor</a> with Load, Save and Print features running completely in the browser without submission of loaded data to remote servers.
<ul>
<li>
<a href="https://github.com/davidedc/Algebrite" target="_blank"><b>Algebrite</b></a> The <a href="https://github.com/niebert/WikiversityDoc" target="_blank">CAS4Wiki JSON-Editor</a> uses <a href="https://www.algebrite.org" target="_blank">Algebrite</a> as web-based Computer Algebra System (CAS).
CAS4Wiki layout for input is configured by a JSON Schema W to generate tailored JSON
</li>
<li>
<a href="https://github.com/plotly/plotly.js" target="_blank"><b>Plotly - Graphs</b></a> The <a href="https://github.com/niebert/WikiversityDoc" target="_blank">CAS4Wiki JSON-Editor</a> uses <a href="https://github.com/plotly/plotly.js" target="_blank">Plotly - Javascript</a> for plotting 2D and 3D Graphs and Traces of functions.
CAS4Wiki layout for input is configured by a JSON Schema W to generate tailored JSON
</li>
<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/WikiversityDoc/archive/refs/heads/main.zip">CAS4Wiki App</a></b> is an <a href="https://en.wikiversity.org/wiki/AppLSAC" target="_blank">AppLSAC</a><br>
<a href="https://github.com/niebert/WikiversityDoc" target="_blank">GitHub Repository with <kbd>CAS4Wiki 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 2022/09/24 10:31:12<br>last modified <div id4marker="datetime" style="display: inline-block">2022/12/01 15:45:43</div> - Version <div id4marker="version" style="display: inline-block">1.1.22</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 = vDataJSON.db.initdb || [];
//---------------------------------------
//------READ LINKPARAMETER---------------
//---------------------------------------
var vID4AppLSAC = "CAS4Wiki8910381309";
//------ TiTLE --------------------------
if (vLinkParam.exists("title")) {
// e.g. index.html?title=Normen,_Metriken,_Topologie
if (vDataJSON && vDataJSON.schema4json) {
vDataJSON.schema4json.title= vLinkParam.getValue("title");
}
document.getElementById('tTitle4CAS').value = vLinkParam.getValue("title");
};
if (vLinkParam.exists("casdata")) {
var vJSONstring = vLinkParam.getValue("casdata");
var vJSON = null;
// Parse JSON and check if syntax is valid.
// console.log("handle_json() Loaded File:\n"+vFile);
try {
vJSON = JSON.parse(vJSONstring);
} catch (err) {
vJSON = null; // Init with an empty class
console.error("ERROR: LinkParam - onload JSON with errors - "+err); // error in the above string (in this case, yes)!
// call onload handler with a ppopulated error err,
}
if (vJSON) {
//alert("JSON defined ="+JSON.stringify(vJSON,null,4));
starting_value = vJSON;
} else {
//alert("JSON undefined");
starting_value = vDataJSON.db.initdb;
}
} else {
if (window.localStorage && localStorage && localStorage[vID4AppLSAC] && false) {
var vJSONstring = localStorage.getItem(vID4AppLSAC);
var vJSON = null;
// Parse JSON and check if syntax is valid.
// console.log("handle_json() Loaded File:\n"+vFile);
try {
vJSON = JSON.parse(vJSONstring);
} catch (err) {
vJSON = null; // Init with an empty class
console.error("ERROR: LocalStorage - getValue JSON with errors - "+err); // error in the above string (in this case, yes)!
// call onload handler with a ppopulated error err,
}
}
if (vJSON) {
//alert("JSON defined ="+JSON.stringify(vJSON,null,4));
starting_value = vJSON;
} else {
//alert("JSON undefined");
starting_value = vDataJSON.db.initdb;
}
};
//------ FILENAME -------------------------
if (vLinkParam.exists("filename")) {
// e.g. index.html?author=Engelbert_Niehaus
document.getElementById('jsonfile').value = vLinkParam.getValue("filename");
};
//------------------------------------------
//alert("starting_value="+JSON.stringify(starting_value,null,2));
// Initialize the editor
vEditor = 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: starting_value,
// Seed the form with a starting value
//startval: starting_value,
// Disable additional properties
no_additional_properties: false,
// Require all properties by default
required_by_default: true
});
// Hook up the validation indicator to update its
// status whenever the editor changes
vEditor.on('change',function() {
if (vEditor && vEditor.getValue) {
if (window.localStorage) {
localStorage.setItem(vID4AppLSAC,JSON.stringify(vEditor.getValue()));
}
}
// Get an array of errors from the validator
/*
if (vEditor && vEditor.validate) {
var errors = vEditor.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";
}
} else {
console.warn("vEditor is not defined");
}
*/
});
</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>
<script>
// Store Template from vDataJSON into textarea
//el("tTemplate").value = vDataJSON.tpl.template4json;
var vJSON = vEditor.getValue();
setValue4Settings('title4cas',vJSON.title4cas);
setValue4Settings('title4commands',vJSON.title4commands);
setValue4Settings('title4functions',vJSON.title4functions);
setValue4Settings('title4variables',vJSON.title4variables);
show_commands();
</script>
</body>
</html>