File: tableauen.html

package info (click to toggle)
giac 1.9.0.93%2Bdfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 117,732 kB
  • sloc: cpp: 404,272; ansic: 205,462; python: 30,548; javascript: 28,788; makefile: 17,997; yacc: 2,690; lex: 2,464; sh: 705; perl: 314; lisp: 216; asm: 62; java: 41; xml: 36; sed: 16; csh: 7; pascal: 6
file content (1052 lines) | stat: -rw-r--r-- 53,002 bytes parent folder | download | duplicates (2)
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
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
<html>

<head>
<title>Tableaunoir</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, target-densitydpi=device-dpi, initial-scale=1.0, minimum-scale=0.4, maximum-scale=1.0" />
<!--
, user-scalable=no
-->
<link rel="stylesheet" type="text/css" href="magnets/style.css" />
<script src="tableau.js"></script>
</head>

<body>

<div id="controls">
  <span id="mobile_controls">
  <span class="spanlink" id='themailto'></span>
  <button class="bouton" id="buttonMenu" onmousedown="event.preventDefault()" onclick="if (UI.focused!=0){ UI.open_menu();} else Menu.toggle();">&#x2630;</button>
  <button class="bouton" id="buttonCancel"  onmousedown="event.preventDefault()" title="Cancel last action" onclick="if (UI.focused!=0) UI.focused.undo(); else BoardManager.cancel();" >↩</button>
  <button class="bouton" id="buttonLeft"
  onmousedown="event.preventDefault()" onclick="if (UI.focused!=0)
  UI.moveCaret(UI.focused,-1); else
  BoardManager.left();" title="Go left">←</button><button id="buttonRight" onmousedown="event.preventDefault()" onclick="if (UI.focused!=0) UI.moveCaret(UI.focused,1); else BoardManager.right();" title="Go right">→</button>
  <button class="bouton" id="addmagnetbutton" title="Add or eval magnet" onmousedown="event.preventDefault()" onclick="if (UI.focused!=0) UI.toggle($id('assistant_keys'));  else {welcome.hidden=true;Welcome.hide();UI.addmagnet(container.scrollLeft, 100);}">+</button>
  </span>
  <span id="pc_controls">
<div id="readonly_msg" style="display:none">Readonly mode. Type w to unlock.</div>
  <button id="buttonMenu2" onmousedown="event.preventDefault()" onclick="if (UI.focused!=0){ UI.open_menu();} else Menu.toggle();">Menu</button>
  <button id="buttonCancel2"  onmousedown="event.preventDefault()" title="Cancel last action" onclick="if (UI.focused!=0) UI.focused.undo(); else BoardManager.cancel();">↩ Undo</button>
  <button id="buttonRedo" onmousedown="event.preventDefault()" title="Redo last action" onclick="if (UI.focused!=0) UI.focused.redo(); else BoardManager.redo();">↪ Redo</button>
  <button id="buttonLeft2" onmousedown="event.preventDefault()" onclick="if (UI.focused!=0) UI.moveCaret(UI.focused,-1); else BoardManager.left();" title="Go left">←</button><button id="buttonRight2" onmousedown="event.preventDefault()" onclick="if (UI.focused!=0) UI.moveCaret(UI.focused,1); else BoardManager.right();" title="Go right">→</button>
<span id="pc_controls_readonly_hidden">
  <button id="buttonDivide" title="Divide the screen vertically in two">| Divide</button><span>d</span>
  <button id="addmagnetbutton2" title="Add or eval magnet" onmousedown="event.preventDefault()" onclick="if (UI.focused!=0) UI.toggle($id('assistant_keys')); else {welcome.hidden=true;Welcome.hide();UI.addmagnet(container.scrollLeft, 100);}">Magnet</button>
  <button id="buttonColors" title="Choose your color">🎨 </button><span>c</span>
  <button id="buttonEraser" title="Switch between erase and draw">⌫</button><span>e</span>
  <span class="spanlink" style="display:none" id='themailtopc'></span>
  <span class="spanlink" style="display:none" id='thelink'></span>
  <textarea id='theforumlink' style="display:none"></textarea>
</span>
  <button id="buttonCloseControls" title="Hide this toolbar (it can be shown again in the menu)"
  onclick="controls.hidden = true; welcome.hidden = true;">Hide</button>
  </span>
</div>


<div id="online_help" style="display:none">
  <textarea cols="9" id="helptxt"
  title="Short help on a command" rows=1 onkeypress="if (event.keyCode!=13) return true;UI.addhelp('?',value); return false;"></textarea>
  <button class="bouton" onmousedown="event.preventDefault()" title="Erase"
  onclick="var helptxt=$id('helptxt'); UI.backspace(helptxt);">&#x232b; </button>
  <button class="bouton" onmousedown="event.preventDefault()" title="Close"
  onclick="$id('online_help').style.display='none';">X</button>
  <div id="helpoutput" style="backgroundColor:white"></div>
</div>

<div id="assistant_cas" style="display:none">
  <div id="assistant_menu">
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_math').style.display='block';" title="">Math</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_arit').style.display='block';" title="">Arith.</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_rewrite').style.display='block';" title="">Algebra</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_proba').style.display='block';" title="">Proba</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_math').style.display='block';" title="">Math</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_graph').style.display='block';" title="">Plots</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_statgraph').style.display='block';" title="">Stats</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_prog').style.display='block';" title="">Prog</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="$id('assistant_cas').style.display='none';"    title="Close">X</button>
  </div>

  <div id="assistant_proba" style="display:none">
    <button class="bouton" title="Random integer" onmousedown="event.preventDefault()" onclick="UI.insert_focused('randint(')">randint</button>
    <button class="bouton" title="Random real" onmousedown="event.preventDefault()" onclick="UI.insert_focused('rand(')">rand</button>
    <button class="bouton" title="Normal distribution" onmousedown="event.preventDefault()" onclick="UI.insert_focused('normald')">norm</button>
    <button class="bouton" title="Exponential distribution" onmousedown="event.preventDefault()" onclick="UI.insert_focused('exponentiald')">exp</button>
    <button class="bouton" title="Poisson law" onmousedown="event.preventDefault()" onclick="UI.insert_focused('poisson')">poisson</button>
    <button class="bouton" title="cumulated distribution suffix" onmousedown="event.preventDefault()" onclick="UI.insert_focused('_cdf(')">cdf</button>
    <button class="bouton" title="inverse cumulated distribution function suffix" onmousedown="event.preventDefault()" onclick="UI.insert_focused('_icdf(')">icdf</button>
    <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.close_menus()" title="Close">X</button></div>
  </div>

  <div id="assistant_math" style="display:none">
      <input type="button" class="bouton" name="add_cos"
             id="add_cos"
             value="cos" onmousedown="event.preventDefault()" onClick="UI.insert_focused(value+'(')" title="cosinus function, type acos for arccosinus">
      <input type="button" class="bouton" name="add_sin" id="add_sin"
      value="sin" onmousedown="event.preventDefault()"
      onClick="UI.insert_focused(value+'(')" title="sinus function, type asin for arcsin">
      <input type="button" class="bouton" name="add_tan"
             id="add_tan"
             value="tan" onmousedown="event.preventDefault()"
      onClick="UI.insert_focused(value+'(')" title="tangent function, type atan for arctangent">
      <input type="button" class="bouton" name="add_ln"
             id="add_ln"
             value="ln" onmousedown="event.preventDefault()"
      onClick="UI.insert_focused(value+'(')" title="natural logarithm">
      <input type="button" class="bouton" name="add_ln"
             id="add_log10"
             value="log10" onmousedown="event.preventDefault()"
      onClick="UI.insert_focused(value+'(')" title="log base 10">
      <input type="button" class="bouton" name="add_ln"
             id="add_exp"
             value="exp" onmousedown="event.preventDefault()"
      onClick="UI.insert_focused(value+'(')" title="exponential function">
      <input type="button" class="bouton" name="add_ln"
             id="add_floor"
             value="floor" onmousedown="event.preventDefault()"
      onClick="UI.insert_focused(value+'(')" title="integer part">
      <input type="button" class="bouton" name="add_round"
             id="add_round"
             value="round" onmousedown="event.preventDefault()" onClick="UI.insert_focused(value+'(')" title="arrondi">
      <input type="button" class="bouton" name="add_^" id="add_^" value="^" onmousedown="event.preventDefault()" onClick="UI.insert_focused('^')">
<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.close_menus()" title="Fermer">X</button></div>
  </div>

  <div id="assistant_arit" style="display:none">
    <button class="bouton" title="euclidean division remainder" onmousedown="event.preventDefault()" onclick="UI.insert_focused('irem(')">irem</button>
    <button class="bouton" title="euclidean division quotient" onmousedown="event.preventDefault()" onclick="UI.insert_focused('iquo(')">iquo</button>
    <button class="bouton" title="greatest common divisor" onmousedown="event.preventDefault()" onclick="UI.insert_focused('gcd(')">gcd</button>
    <button class="bouton" title="least common multiple" onmousedown="event.preventDefault()" onclick="UI.insert_focused('lcm(')">lcm</button>
    <button class="bouton" title="Extended GCD" onmousedown="event.preventDefault()" onclick="UI.insert_focused('iegcd(')">iegcd</button>
    <button class="bouton" title="Primality testing" onmousedown="event.preventDefault()" onclick="UI.insert_focused('isprime(')">isprime</button>
    <button class="bouton" title="Next prime number" onmousedown="event.preventDefault()" onclick="UI.insert_focused('nextprime(')">next</button>
    <button class="bouton" title="Factor integer" onmousedown="event.preventDefault()" onclick="UI.insert_focused('ifactor(')">ifactor</button>
    <button class="bouton" title="Fast modular powering" onmousedown="event.preventDefault()" onclick="UI.insert_focused('powmod(')">powmod</button>
<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.close_menus()" title="Fermer">X</button></div>
  </div>

<div id="assistant_prog" style="display:none">
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="UI.insert_focused('def f(x):\n    return',0);" title="Function definition">def</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="UI.insert_focused('return ',0);" title="Test">ret</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="UI.insert_focused('if :',0);" title="Test">if</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="UI.insert_focused('else :\n',0);" title="Test">else</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="UI.insert_focused('while :\n',0);" title="Boucle tantque">while</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="UI.insert_focused('for  in range():\n',0);" title="Boucle dans un intervalle">range</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="UI.insert_focused('print(',0)" title="Affiche">print</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="UI.insert_focused('input(',0)" title="Affiche">input</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="UI.menu_modules();" title="Affiche">import</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="UI.close_menus();" title="Fermer le menu">X</button>
</div>

<div id="assistant_modules" style="display:none">
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_math_module').style.display='block';" title="">math</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_arit_module').style.display='block';" title="">arit</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_linalg_module').style.display='block';" title="">linalg</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_graphic_module').style.display='block';" title="">graphic</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.close_menus();$id('assistant_turtle_module').style.display='block';" title="">turtle</button>
</div>

<div id="assistant_math_module" style="display:none">
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('from math import *\n',0);"  title="">import</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('exp(',0);"  title="">exp</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('log(',0);"  title="">log</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('cos(',0);"  title="">cos</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('sin(',0);"  title="">sin</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('tan(',0);"  title="">tan</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('floor(',0);"  title="">floor</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('round(',0);"  title="">round</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('abs(',0);"  title="">abs</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('sqrt(',0);"  title="">sqrt</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('sign(',0);"  title="">sign</button>
  <button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.menu_modules()" title="">x</button>
</div>

<div id="assistant_arit_module" style="display:none">
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('from arit import *\n',0);"  title="">import</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('ifactor(',0);"  title="">ifactor</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('isprime(',0);"  title="">isprime</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('gcd(',0);"  title="">gcd</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('iegcd(',0);"  title="">iegcd</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('pow(',0);"  title="pow(a,n,m) calcule a**n modulo n">pow</button>
  <button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.menu_modules()" title="">x</button>
</div>

<div id="assistant_linalg_module" style="display:none">
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('from linalg import *\n',0);"  title="">import</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('matrix(',0);"  title="">matrix</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('add(',0);"  title="">add</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('sub(',0);"  title="">sub</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('mul(',0);"  title="">mul</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('inv(',0);"  title="">inv</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('rref(',0);"  title="">rref</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('det(',0);"  title="">det</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('eig(',0);"  title="">eig</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('transpose(',0);"  title="">transp</button>
  <button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.menu_modules()" title="">x</button>
</div>

<div id="assistant_turtle_module" style="display:none">
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('from turtle import *\n',0);"  title="">import</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('reset(',0);"  title="">reset</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('forward(',0);"  title="">fd</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('left(',0);"  title="">left</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('right(',0);"  title="">right</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('pen(',0);"  title="">pen</button>
<button class="bouton" onmousedown="event.preventDefault()"
  title=". sur une ligne de commande pour afficher la tortue" onclick="UI.insert_focused(',',0);"  title="">.</button>
  <button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.menu_modules()" title="">x</button>
</div>

<div id="assistant_graphic_module" style="display:none">
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('from graphic import *\n',0);"  title="">import</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('draw_pixel(',0);"  title="">pixel</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('draw_line(',0);"  title="">line</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('draw_rectangle(',0);"  title="">rect</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('fill_rect(',0);"  title="">filled</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('draw_circle(',0);"  title="">circle</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused('draw_filled_circle(,',0);"  title="">filled</button>
<button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.insert_focused(';',0);"  title="; sur une ligne vide affiche le graphique">,</button>
  <button class="bouton" onmousedown="event.preventDefault()"  onclick="UI.menu_modules()" title="">x</button>
</div>


<div id="assistant_graph" style="display:none">
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.insert_focused('plotfunc(');"
          title="Graph an expression, for example plotfunc(sin(x),x===-5..5,xstep===0.1)">plot
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.insert_focused('plotparam(');"
          title="Graph a parametric curve, for example plotparam([cos(t),sin(t)],t===0..2*pi,tstep=0.1)">param
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.insert_focused('plotpolar(');"
          title="Graph a polar curve, for example plotpolar(sin(3*t),t)">polar
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.insert_focused('plotimplicit(');"
          title="Graphe an implicit curve, for example plotimplicit(x^2+x*y+y^2===3)">impl.
  </button>
<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('plotcontour(')"
title="2-var function levels">level
</button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.insert_focused('plotfield(');"
          title="Slopefield of a differential equation, for example plotfield(sin(t*y),[t===-5..5,y===-3..3],xstep===0.5,ystep===0.5))">field
  </button>
  <button class="bouton" onclick="UI.insert_focused('plotode(')"
          title="Graph of a solution of a differential equation">ode
  </button>
<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('plotarea(')"
title="Area under curve">area
</button>
  <button class="bouton" onclick="UI.insert_focused('plotseq(')"
          title="Web graph of a recurrent sequence"
  >u_n
  </button>
  <button class="bouton" onclick="UI.insert_focused('plotlist(')"
          title="Draw points (i,y_i) for a list [y_i]"
  >list
  </button>
<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.close_menus()" title="Close">X</button>
</div>
<div id="assistant_statgraph" style="display:none">
  <button class="bouton" onclick="UI.insert_focused('moustache(')"
          title="Boxwhiskers">whisker
  </button>
  <button class="bouton" onclick="UI.insert_focused('histogram(')"
          title="Histogram">histo.
  </button>
  <button class="bouton" onclick="UI.insert_focused('scatterplot(')"
          title="Scatterplot">scatter
  </button>
  <button class="bouton" onclick="UI.insert_focused('polygonplot(')"
          title="Polygonal line from a list of points"
  >polyg.
  </button>
  <button class="bouton" onclick="UI.insert_focused('linear_regression_plot(')"
          title="Linear regression plot"
  >regr.
  </button>
  <button class="bouton" onclick="UI.insert_focused('bar_plot(')"
          title="Barplot">bar
  </button>
  <button class="bouton" onclick="UI.insert_focused('plotcontour(')"
          title="Level curves for a 2-var function"
  >level
  </button>
  <button class="bouton" onclick="UI.insert_focused('plotarea(')"
          title="Area under the curve"
  >area
  </button>
<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.close_menus()" title="Close">X</button>
</div>  

<div id="assistant_rewrite" style="display:none">
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('simplify(')"
          title="Tries to simplify an expression.">simpl.
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('normal(')"
          title="Expands, reduce to an irreducible fraction">normal
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('factor(')" title="Factorization, for example factor(x^4-1). Use cfactor to factor over C">factor</button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('partfrac(')" title="Partial fraction decomposition. Use cpartfrac over C">partf</button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('subst(')" title="Substitution">subst</button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('reorder(')" title="Change variable order in a polynomial">reord</button>
  <br>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('texpand(')"
          title="Expand sin/cos/tan/exp/ln">texpand
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('tlin(')"
          title="Linearize trigonometric expressions">tlin
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('trigsin(')"
          title="Rewrite with sin">→sin
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('trigcos(')"
          title="Rewrite with cos">cos
  </button>
  <button class="bouton"
          onmousedown="event.preventDefault()" onclick="UI.insert_focused('halftan(')"
          title="Rewrite in terms of tan of the half angle">half
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('trigtan(')"
          title="Rewrite with tan">tan
  </button>
<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.close_menus()" title="Close">X</button>
</div>

<div id="assistant_calculus" style="display:none">
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('rsolve(')"
          title="Solve a recurrence relation">r
</button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('solve(')"
          title="Solve an equation or a system">solve
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.insert_focused('limit(')" title="limit of an expression as a variable tends to a limite, for example limit(sin(x)/x,x,0). For unidirectional limit add 1 or -1 as last argument">limit</button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.insert_focused('diff(')" title="Derivative of an expression. For a function f, for example f(x):=sin(x^2), the derivative of f is f', for example g:=f' or f'(2)">∂
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.insert_focused('series(')" title="Taylor/series expansion, for example series(sin(x),x=0,5,polynom). Without the polynom option, no remainder term is returned. For unidirectional series expansion, add optional parameter 1 or -1 before polynom"> series
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.insert_focused('sum(')" title="Discrete sum, for example ∑(k,k,1,n) ou ∑(1/n^2,n,1,inf)"> ∑
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.insert_focused('integrate(')"
          title="Integrals computation, for example ∫(x^2*sin(x)*exp(x),x) or ∫(1/(x^4+1),x,0,inf)">∫
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('ilaplace(')"
          title="ilaplace: inverse Laplace transform">i
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('laplace(')"
          title="Laplace transform">laplace
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('odesolve(')"
          title="odesolve: differential equation numeric solver">o
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('desolve(')"
          title="desolve: differential equation exact solver">desolve
  </button>
<!--
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('ifft(')"
          title="ifft: inverse fast Fourier transform">i
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('fft(')"
          title="fft: fast Fourier transform">fft
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('invztrans(')"
          title="invztrans:inverse z-transform of a rational fraction">inv
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('ztrans(')"
          title="z-transform of a sequence">ztrans
</button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('grad(')"
          title="Gradient">grad
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('hessian(')"
          title="Hessien">hess
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('curl(')"
          title="Rotationnel">rot
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('divergence(')"
          title="Divergence">div
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('vpotential(')"
          title="vpotential: potentiel vecteur">v
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert_focused('potential(')"
          title="Potentiel">poten.
  </button>
-->
<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.close_menus()" title="Close">X</button>
</div>

</div>

<div id="assistant_keys" style="display:none">
  &nbsp;
  &nbsp;
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="if (UI.focused!=0) UI.tableaueval(UI.focused);"
  title="Indente ou compl&egrave;te">OK
  </button>
<button class="bouton" onmousedown="event.preventDefault()"
  onClick="if (UI.focused!=0)  UI.moveCaretUpDown(UI.focused,-1);"
  title=" ">↑</button>  
<button class="bouton" onmousedown="event.preventDefault()"
  onClick="if (UI.focused!=0) UI.moveCaretUpDown(UI.focused,1);"
  title=" ">↓</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="if (UI.focused!=0) UI.indent_or_complete(UI.focused);"
  title="Indente ou compl&egrave;te">→|</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="if (UI.focused!=0) UI.completion(UI.focused,false);$id('online_help').style.display='block';"
  title="Aide">?</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onClick="if (UI.focused!=0) UI.backspace(UI.focused);"
  title=" ">&#x232b;
  </button>
</div>

<div id="content">
  <canvas id="canvasBackground" width=16384 height=1200 ></canvas>
  <canvas id="canvas3d" width=0 height=0></canvas>
<div id="container">
<div id="magnets"></div>
<svg id="svg" width=2500 height=800></svg>
<div id="cursors"></div>
<div id="palette" class="PaletteHide"></div>
<div id="board">
  <canvas width=2000 height=800 id="canvas"></canvas>
</div>
</div>
</div>

<div class="pageNumberHidden" id="pageNumber">1</div>
<div id="welcome" style="display:none"  class="MenuPanel">
<div class="divMenuHide"><button onclick="welcome.hidden = true">X</button>Esc.</div>


<h1>Welcome to Tableaunoir</h1>

<div class="explanation">
  This <em>online blackboard</em> is ideally used with a <em>graphics
  tablet</em>. Your audience is <em>concentrated
  on the content</em> if you hide the toolbar and use keyboard shortcuts.

</div>

<div class="explanation">
  <img src="magnets/welcome_magnets.png" />
  You may create <em>magnets</em> (think of them as fridge magnets) for making
  <em>interactive
  courses</em>,
  presentations and discussions with students.</em>
</div>

<!--
<div class="explanation">
  <img src="img/shareInEverybodyWritesMode.png" />
  Blackboards are sharable in order to <em>collaborate</em> with your friends (feature still in development).
  Open the menu!
</div>
-->

<div class="explanation">
  Work
  best on
  Firefox, Chrome or Chromium, last versions.
  </div>



</div>


<div id="menu" class="menuHide MenuPanel">
<div class="tabs">
  <button class="tablink" id="defaultOpen" onclick="Menu.openPage('MyBlackboard', this)">⎕ My Board</button>
  <!-- button class="tablink" onclick="Menu.openPage('Share', this)"> Share</button> -->
  <button class="tablink" onclick="Menu.openPage('Magnets', this)">🎊 Magnets</button>
  
  <button class="tablink" onclick="Menu.openPage('Options', this)">⚛ Options</button>

  <button class="tablink" onclick="Menu.openPage('KeyboardShortcuts', this)" id="defaultOpen">⌨ Shortcuts</button>
  <button class="tablink" onclick="Menu.openPage('Help', this)" id="defaultOpen">? Help</button>

  <button class="tablink" onclick="Menu.openPage('About', this)" id="defaultOpen">About</button>
  <button class="tablink" onclick="Menu.hide();">OK</button>
</div>
<div>
<div id="menucontent"></div>
<div id="About" class="tabcontent">
  <h2>About Tableaunoir</h2>
<div class="explanation">
  Tableaunoir is an <em>online blackboard</em>. It is ideally used with a <em>graphics
  tablet</em>. Your audience is <em>concentrated
  on the content</em> if you hide the toolbar and use keyboard shortcuts.
  
</div>

<div class="explanation">
  <img src="magnets/welcome_magnets.png" />
  You may create <em>magnets</em> (think of them as fridge magnets) for making
  <em>interactive
  courses</em>,
  presentations and discussions with students.</em>
</div>

<!--
<div class="explanation">
  <img src="img/shareInEverybodyWritesMode.png" />
  Blackboards are sharable in order to <em>collaborate</em> with your friends (feature still in
  development). Open the menu!
</div>
-->

<div class="explanation">
  Work best on Firefox, Chrome or Chromium, last versions.
 <br>
  Tableaunoirxcas is an <em>open source</em> project (GPL3 license).
  It is a pure JavaScript fork of the 2020 November 1st
  version of 
  <a target="_blank" rel="noopener noreferrer"
  href="https://github.com/tableaunoir/tableaunoir.github.io">tableaunoir</a>
  made by Francois Schwarzentruber.
  It is
  maintained by Bernard Parisse, you can get the <a target="_blank"
  href="https://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/xcashtml.zip">source
  here</a>. It adds the opportunity to evaluate text magnets
  with the Giac/Xcas CAS, <a target="_blank" href="https://micropython.org/">MicroPython</a> (Damien P. George et al)
  or Javascript  
  (<a target="_blank" href="https://bellard.org/quickjs/">QuickJS</a> engine by
  Fabrice Bellard and Charlie Gordon).
  It may be used offline (unzip the source above and open the file index.html).
 
</div>
</div>

<!-- <h2>Videos</h2>
<a target="_blank" rel="noopener noreferrer" href="https://www.youtube.com/watch?v=P6_lhqiPBow">Video of
that presents tableaunoir (in french)</a>
-->
</div>

<div id="MyBlackboard" class="tabcontent">
  <span id="share_submenu" style="display:none;"> 
  <h2>Share</h2>
  <span class="spanlink" id='themailtomenu'></span>
  <span class="spanlink" id='thelinkmenu'></span>
  <textarea id="forum_url" cols="60" rows="1" onkeypress="if (event.keyCode!=13){ return true; } event.preventDefault(); if (value=='') UI.eraseCookie('xcas_forum_url'); else { UI.forum_url=value; UI.createCookie('xcas_forum_url');} this.blur();">https://xcas.univ-grenoble-alpes.fr/forum/viewforum.php?f=25</textarea>
  Warning <button id="warnlink_yes" onclick="UI.set_warnlink(true);">Yes</button>
  <button id="warnlink_no" onclick="UI.set_warnlink(false);">No</button> 
  </span>
  
<h2>Read-only</h2>
<button id="readonly_yes" onclick="UI.set_readonly(true) ; Menu.hide();">Yes</button>
  <button onclick="UI.set_readonly(true); BoardManager.cancel(0); Menu.hide();">Presentation</button>
<button id="readonly_no" onclick="UI.set_readonly(false) ; Menu.hide();">No</button>

  <h2>Export</h2>
  <button id="png_export" onclick="UI.png_export($id('export_filename').value+'.png')">PNG</button>
  <button id="pdf_export" onclick="UI.pdf_export($id('export_filename').value+'.pdf',0)">PDF</button>
  <button id="pdf_export_inverted" onclick="UI.pdf_export($id('export_filename').value+'.pdf',1)">PDF inverted</button>
  <textarea id="export_filename">blackboard</textarea>

  <h2>Cleaning</h2>
<div class="menuDiv">
  <button class="buttonClear" id="blackboardClear">
  clear the board</button>
  <button class="buttonClear" id="clearMagnet">
  Remove all the magnets</button>
</div>
<h2>Add a background</h2>
<button id="buttonNoBackground">
No background</button>
<button class="buttonMusicScore" id="buttonMusicScore">
Music score</button>

<h2>Load</h2>
<div class="menuDiv">
  <input id="loadfileinput" accept=".tableaunoir" type="file"
  title="Cliquer ici pour charger un tableau sauvegard&eacute;e" onchange="LoadSave.loadFile((this.files)[0]);">
  or drag and drop your <em>.tableaunoir file</em> in the application.
</div>
<h2>Save</h2>

<div class="menuDiv">
  Name: <input id="name" value="myblackboard"></input><button id="save" onclick="LoadSave.save();Menu.hide();">Save</button>

</div>
</div>

<div id="Options" class="tabcontent">
  <b>Xcas</b>
  Angles:
  <button id="angle_radian_yes" onclick="UI.radian(1);">Rad</button>
  <button id="angle_radian_no" onclick="UI.radian(0);">Deg</button>  
  <br>
  <button id="blackBoardSwitch" hidden>Switch to
  blackboard</button>
  <button id="whiteBoardSwitch">Switch to
  whiteboard</button>
  <button id="controlsToggle" onclick="controls.hidden = !controls.hidden; Menu.hide()">
  Show/hide toolbar</button>

</div>

<div id="KeyboardShortcuts" class="tabcontent">
  <h2>Blackboard keyboard shortcuts</h2>
  
<div class="menuDiv">
  <table>
    <tr>
      <td><span class="keyboardkey">Esc.</span> or <span class="keyboardkey">F1</span></td>
      <td>show/hide this <em>menu</em></td>
    </tr>
      <td><span class="keyboardkey">h</span></td>
      <td>hide <em>toolbar</em></td>
    </tr>
    <tr>
      <td><span class="keyboardkey">e</span></td>
      <td>switch between chalk and <em>eraser</em></td>
    </tr>
    <tr>
      <td><span class="keyboardkey">c</span></td>
      <td>change the <em>color</em> of the chalk or of the selected magnet</td>
    </tr>
    <tr>
      <td><span class="keyboardkey">d</span></td>
      <td><em>divide</em> the screen</td>
    </tr>
    <tr>
      <td><span class="keyboardkey">3</span></td>
      <td><em>divide</em> the screen in three parts.</td> 
    </tr>
    <tr>
      <td><span class="keyboardkey">Ctrl+Z</span></td>
      <td><em>cancel</em> the last action</td>
    </tr>
    <tr>
      <td><span class="keyboardkey">Ctrl+Y</span> or <span class="keyboardkey">Ctrl+Shift+Z</span>
      </td>
      <td><em>redo</em> the last action</td>
    </tr>
    <tr>
      <td><span class="keyboardkey">←</span> <span class="keyboardkey">→</span>
      </td>
      <td><em>move</em> in the board</td>
    </tr>
  </table>
  
  <h2>Text Magnet keyboard shortcuts</h2>
  
  <table>
    <tr>
      <td><span class="keyboardkey">k</span> or <span
    class="keyboardkey">p</span> or <span class="keyboardkey">j</span></td>
    <td>create a new magnet with a commandline to be eval-ed with
      Giac/Xcas, MicroPython or Javascript
    </td>
    </tr>
    <tr>
      <td><span class="keyboardkey">Ctrl + Enter</span></td>
      <td>inside a magnet, evaluate magnet with Giac/Xcas, MicroPython
    or Javascript</td>
    </tr>
    <tr>
      <td><span class="keyboardkey">Esc.</span></td>
      <td><em>exit</em> the text edition in a magnet</td>
    </tr>
    <tr>
      <td><span class="keyboardkey">Ctrl + +</span></td>
      <td><em>increase</em> the size of the text</td>
    </tr>
    <tr>
      <td><span class="keyboardkey">Ctrl + -</span></td>
      <td><em>decrease</em> the size of the text</td>
    </tr>
  </table>
  
  <h2>Magnet keyboard shortcuts</h2>
  <table>
    <tr>
      <td><span class="keyboardkey">Del</span></td>
      <td><em>delete</em> the current magnet</td>
    </tr>
    <tr>
      <td><span class="keyboardkey">Ctrl+x</span></td>
      <td><em>cut</em> the content inside the drawn contour into a magnet</td>
    </tr>
    <tr>
      <td><span class="keyboardkey">Ctrl+c</span></td>
      <td><em>copy</em> the content inside the drawn contour into a magnet</td>
    </tr>
    <tr>
      <td><span class="keyboardkey">m</span></td>
      <td><em>cut</em> the content inside the drawn contour into a magnet / <em>flatten</em> the
	current magnet to the
	blackboard
      </td>
    </tr>
    <tr>
      <td><span class="keyboardkey">Ctrl+v</span></td>
      <td><em>print</em> the current magnet (like rubber stamping)</td>
    </tr>
  </table>
  
  
</div>
</div>

<div id="Share" class="tabcontent">
<div class="warning" id="ShareGithub">
  Warning: Share boards does not work since tableaunoir.github.io is
  a showcase. You have to install tableaunoir on your own server, or you may try <a
  href="http://tableaunoir.irisa.fr">http://tableaunoir.irisa.fr</a>
  if it works!
</div>
<div class="warning">Warning: this functionnality is still under development and may not work perfectly.
  In particular, magnets are not shared yet.
</div>
<div class="warning">Warning: The server will not save your board.
</div>
  
<div id="shareAndJoin">
  <h2>Make a shared board</h2>
  
  If you want some of your friends to see and modify your board, make a <em>shared</em> board.
  <button id="shareButton">Make a shared board</button>
    
  </br />
<div id="join">
  <h2>Join an existing board</h2>
  In order to <em>join</em> an existing shared board, type its URL:<br />
  <input id="joinUrl" value=""></input>
  <button id="joinButton">Join</button>
</div>
</div>

<div hidden id="shareInfo">
  <h2>Share with others</h2>
  In order to <em>share</em> the board with your friends, give them the following URL:<br />
  <input id="shareUrl" value=""></input>
  
<div hidden id="shareMode">
  <h2>Share mode</h2>
  <button id="shareInTeacherMode"><img src="img/shareInTeacherMode.png" /><br />You write and the
  other users only see</button>
  <button id="shareInEverybodyWritesMode"><img
  src="img/shareInEverybodyWritesMode.png" /><br />All users can write</button>
</div>

<h2>Connected Users</h2>
<div id="users"></div>

</div>
</div>
<div id="Magnets" class="tabcontent">
  <h2>Text magnets</h2>
  <button id="order_magnets" onclick="UI.reorder_magnets();Menu.hide();">Sort</button>,  
  execute
  <button id="eval_all"
  onclick="UI.exec_magnets(); Menu.hide(); Welcome.hide();">now</button>,
  at load <button id="allow_exec_yes" onclick="UI.allow_exec=true;">Yes</button>
  <button id="allow_exec_no"
  onclick="UI.allow_exec=false;">No</button>
  <br>
  <button id="restore_trash"
  onclick="UI.restore_trash();Menu.hide();">Restore</button> or
  <button id="empty_trash" onclick="UI.empty_trash();Menu.hide();">empty</button>
  the magnets trash.
  <br>
  The Magnet (or +) button will create a magnet of type
  <button id="eval_xcas" onclick="UI.ckswitch('xcas',0);Welcome.hide();">Xcas
  </button> (keyboard shortcut x),
  <button id="eval_js"
  onclick="UI.ckswitch('javascript',0);Welcome.hide();">Javascript </button> (j),
  <button id="eval_mp"
  onclick="UI.ckswitch('python',0);Welcome.hide();">Python</button> (p) or
  <button id="eval_comment" onclick="UI.ckswitch('comment',0);"
  style="font-weight:900">Text ($Math$</button> (l).
  <br>
  Type Esc to cancel edition
  or type Ctrl-Enter to <em>evaluate</em> the magnet.<br>
  Examples:
  <ul>
    <li>type <tt>k 1/3+2/7 Ctrl-Enter</tt> to get a computation,
    <li>type <tt>l x/2 Ctrl-Enter</tt> to get the fraction x over
    2.
    <li> type <tt>k factor(x^4-1) Ctrl-Enter</tt>
    to get x^4-1 factored.
    <li> type <tt>k plot(sin(x)) Ctrl-Enter</tt> to get
    the graph of sin(x)
    <li> <tt>k circle(0,1) Ctrl-Enter</tt> to get a circle
  </ul>
  If you select a Javascript magnet, it will be eval-ed by <a target="_blank" href="https://bellard.org/quickjs/">QuickJS</a> in math mode, unless your commandline
  starts with <tt>@</tt> (QuickJS without math mode) or <tt>@@</tt> (browser interpreter).
  
  <h2>Quick magnet manipulations</h2>
  
<div class="menuDiv">
  <button id="magnetsArrange">Arrange the magnets on the
  board</button>
  <button id="magnetsCreateGraph">Create graph from the
  magnets</button>
</div>

<br />




<h2>Using existing images</h2>
<div class="menuDiv">
  In order to <em>use existing images as magnets</em>, drag and drop .png/.svg/.gif/.jpg files.
</div>

<br />

<h2>Predefined Magnet collections</h2>

<div class="menuDiv">
  <h3>Algorithms</h3>
  <button class="magnetCollectionButton" id="magnetGS">Gale-Shapley algorithm</button>
  <button class="magnetCollectionButton" id="magnetSorting">Sorting</button>
  <button class="magnetCollectionButton" id="magnetBTrees">B trees</button>
  <button class="magnetCollectionButton" id="magnetGraphNodes">Graph nodes</button>
  <button class="magnetCollectionButton" id="magnetGraphSimCity">Simcity graph nodes</button>
  <button class="magnetCollectionButton" id="magnetFloydsAlgorithm">Floyd's algorithm</button>
  <!-- <button class="magnetCollectionButton" id="magnetUnionFind">Union-find</button> -->
  <h3>Complexity theory</h3>
  <button class="magnetCollectionButton" id="magnetTilings">Tilings</button>
</div>

</div>
<div id="Help" class="tabcontent">
  <h2>How to create a magnet?</h2>
  <img src="magnets/createmagnet.gif" />
  <ul>
    <li>Draw a contour around the picture</li>
    <li>Then press <span class="keyboardkey">Ctrl+X</span></li>
  </ul>
  
</div>
</div>
<div class="divMenuHide"><button onclick="Menu.hide()">X</button>Esc.</div>
</div>
<div id="error" hidden></div>
<div id="status">Downloading...</div>
<div>
  <progress value="0" max="100" id="progress" hidden=1></progress>
</div>
<div id="output" style="max-height: 200px; overflow:auto; background-color:white"></div>
<div id="consolediv" style="display:none">
  <button class="bouton" title="Effacer la console (Ctrl-N)" onclick="var field=$id('output');field.innerHTML='';$id('consolediv').style.display='none';">Efface</button>
  <button class="bouton" title="Augmenter le nombre de lignes" onclick="var field=$id('output');var s=field.style.maxHeight; s=s.substr(0,s.length-2);s=eval(s)+20 ;s=s+'px';field.style.maxHeight =s ;">+</button>
  <button class="bouton" title="Diminuer le nombre de lignes" onclick="var field=$id('output');var s=field.style.maxHeight; s=s.substr(0,s.length-2);s=Math.max(eval(s)-20,40) ;s=s+'px';field.style.maxHeight =s ;">-</button>
</div>

<script src="codemirror.js"></script>
<script src="longhelp_en.js"></script>
<link rel="stylesheet" href="codemirror.css">
<link rel="stylesheet" href="show-hint.css">
<script src="search.js"></script>
<script src="searchcursor.js"></script>
<script src="jump-to-line.js"></script>
<script src="dialog.js"></script>
<link rel="stylesheet" href="dialog.css">
<script src="xcasmode.js"></script>
<script src="python.js"></script>
<script src="micropy.js"></script>
<script src="matchbrackets.js"></script>
<script src="show-hint.js"></script>

<style type="text/css">
  .CodeMirror {
    border: 1px solid black;
    height: auto;
  }

  dt {
    font-family: monospace;
    color: #666;
  }
</style>

<script src="giactableau.js"></script>
<script type='text/javascript'>
    // $id('output').style.display = 'none';
    // $id("config").reset();
    // connect to canvas
    var Module = {
        // TOTAL_MEMORY:134217728,
        worker: false,
        htmlcheck: true,
        htmlbuffer: '',
        preRun: [],
        postRun: [],
        lastrefresh:0,
        print_target:0,
        print: function (text) {
                var element=Module.print_target; if (element==0) return;
                //console.log('Module.print',text);
                if (text.length == 1 && text.charCodeAt(0) == 12) {
                    element.innerHTML = '';
                    return;
                }
                if (text.length >= 1 && text.charCodeAt(0) == 2) {
                    console.log('STX');
                    Module.htmlcheck = false;
                    htmlbuffer = '';
                    return;
                }
                if (text.length >= 1 && text.charCodeAt(0) == 3) {
                    console.log('ETX');
                    Module.htmlcheck = true; 
                    // element.style.display = 'block';
                    element.innerHTML += htmlbuffer;
                    htmlbuffer = '';
                    // element.scrollTop = 99999;
                    return;
                } 
                if (Module.htmlcheck) {
                    // These replacements are necessary if you render to raw HTML
                    text = '' + text;
                    console.log(text); 
                    text = text.replace(/&/g, "&amp;");
                    text = text.replace(/</g, "&lt;");
                    text = text.replace(/>/g, "&gt;");
                    text = text.replace(/\n/g, '<br>');
                    text += '<br>';
                    // var tmp = $id('consolediv');
                    //if (tmp.style.display != 'block') {
                        //tmp.style.display = 'block';
                        //UI.set_config_width();
                    //}
                    // element.style.display = 'block';
                    element.innerHTML += '<em>'+text+'</em>'; // element.value += text + "\n";
                    // element.scrollTop = 99999; // focus on bottom
                } else htmlbuffer += text;
                // element.scrollIntoView();
        },
        printErr: function (text) {
                console.log(text);
        },
        canvas: $id('canvas3d'),
        setStatus: function (text) {
            if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
            var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
            var statusElement = $id('status');
            var progressElement = $id('progress');
            if (m) {
                text = m[1];
                progressElement.value = parseInt(m[2]) * 100;
                progressElement.max = parseInt(m[4]) * 100;
                progressElement.hidden = false;
            } else {
                progressElement.value = null;
                progressElement.max = null;
                progressElement.hidden = true;
            }
            statusElement.innerHTML = text;
        },
        totalDependencies: 0,
        monitorRunDependencies: function (left) {
            this.totalDependencies = Math.max(this.totalDependencies, left);
            Module.setStatus(left ? 'Preparation... (' + (this.totalDependencies - left) + '/' + this.totalDependencies + ')' : 'Telechargements termines.');
        }
    };
    Module.setStatus('T&eacute;l&eacute;chargement et pr&eacute;paration (peut prendre 1 ou 2 minutes la premi&egrave;re fois)');
    Module['onRuntimeInitialized'] = function () {
        //alert('UI is ready');
        UI.ready = true;
        var hashParams = window.location.hash.substr(1);
        if (hashParams.length>0){ UI.tableauloadlink(hashParams); } else $id('welcome').style.display='inline';
        b=document.getElementById('board');b.focus();
    }
</script>
<script language="javascript" async>
    //$id('thelink').innerHTML='<a href="'+UI.forum_url+'" target=_blank>Forum</a>';
    CodeMirror.registerHelper("hintWords", "simplemode", UI.xcascmd);
    var ua = window.navigator.userAgent;
    var old_ie = ua.indexOf('MSIE ');
    var new_ie = ua.indexOf('Trident/');
    if ((old_ie > -1) || (new_ie > -1) || Boolean(window.chrome)) {
        (function () {
            var script = document.createElement("script");
            script.type = "text/javascript";
            //script.src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_CHTML";
            script.src ="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";
            script.id="MathJax-script"; console.log(script.src);
            document.getElementsByTagName("head")[0].appendChild(script);
        })();
    }
</script>

<script async>
    var script = document.createElement("script");
    script.type = "text/javascript";
    var supported = (function () {
        try {
            if (typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function") {
                var module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
                if (module instanceof WebAssembly.Module)
                    return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;
            }
        } catch (e) {}
        return false;
    })();
    if (Boolean(window.chrome)){
      UI.usemathjax=true;
      if (UI.detectmob() || window.location.href.substr(0,4)=='file')
      supported=false;
    }
    var webAssemblyAvailable = supported;
    /*
    if (Boolean(window.chrome)){
    if (!UI.detectmob()) webAssemblyAvailable = !!window.WebAssembly && window.location.href.substr(0,4)!='file';
    }
    else {
    var ua = window.navigator.userAgent;
    var old_ie = ua.indexOf('MSIE ');
    var new_ie = ua.indexOf('Trident/');
    if (!UI.detectmob() && old_ie<=-1 && new_ie<=-1)
      webAssemblyAvailable =!!window.WebAssembly;
    } */
    if (webAssemblyAvailable) {
        var ck = UI.readCookie('xcas_wasm');
        if (ck) {
            //var form = $id('config');
            //form.wasm_mode.checked = (ck == '1');
            webAssemblyAvailable = (ck == '1') ;
        }
     }
    //alert(webAssemblyAvailable?'true':'false');
    console.log('wasm ', supported, webAssemblyAvailable);
    if (webAssemblyAvailable) // fixme: enable
        script.src = "giacwasm.js";
    else
        script.src = "giac.js";
    document.getElementsByTagName("head")[0].appendChild(script);
</script>
<script src="html2canvas.js"></script>
<script src="jspdf.umd.min.js"></script>

<script language="javascript">
UI.init_xcas();
UI.langue=0;
</script>
	
</body>