-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
533 lines (508 loc) · 29.6 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
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
<!doctype html>
<html>
<head>
<title>Paleo Codage - A machine-readable way to describe cuneiform characters paleographically</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/css/theme.blue.min.css" integrity="sha256-Xj5kQBWJMyOV0+sPr+wIBUHXdoZ00TPgT+RuiyOXtzo=" crossorigin="anonymous" />
<script src="https://hongru.github.io/proj/canvas2image/canvas2image.js"></script>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script src="js/canvas2svg.js"></script>
<script src="js/signlist.js"></script>
<script src="js/paleocodes.js"></script>
<script src="https://cdn.jsdelivr.net/npm/opentype.js@latest/dist/opentype.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/stringify.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/virtual-keyboard/1.30.1/css/keyboard.min.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://unpkg.com/string-similarity/umd/string-similarity.min.js"></script>
<script
src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/jquery.tabletojson.min.js" integrity="sha256-AqDz23QC5g2yyhRaZcEGhMMZwQnp8fC6sCZpf+e7pnw=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/jquery.tablesorter.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.1/js/jquery.tablesorter.widgets.min.js" integrity="sha256-Xx4HRK+CKijuO3GX6Wx7XOV2IVmv904m0HKsjgzvZiY=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/virtual-keyboard/1.30.1/js/jquery.keyboard.min.js"></script>
<script src="https://unpkg.com/[email protected]/build/geometric.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/virtual-keyboard/1.30.1/js/jquery.keyboard.min.js"></script>
<script src="js/paleocodage.js"></script>
<script>
var signcounter=0;
function htmlTableToJSON(filename,ext){
var table = $('#examples').tableToJSON(); // Convert the table into a javascript object
saveTextAsFile(JSON.stringify(table),ext,filename)
console.log(table);
}
function paintCharacter(){
selectionStart=$('#canvasinput').prop('selectionStart')
selectionEnd=$('#canvasinput').prop('selectionEnd')
strokeParser(document.getElementById('canvasinput').value)
}
function paintCharacterBlur(){
selectionStart=0
selectionEnd=0
strokeParser(document.getElementById('canvasinput').value)
}
</script>
<link rel="stylesheet" type="text/css" href="css/paleocodage.css" />
</head>
<body>
<div class="page-header text-center">
<h1>Paleo Codage</h1><h5>A machine-readable way to describe cuneiform characters paleographically</h5>
</div>
<br/><br/>
<div class="container">
<div class="row">
<div class="left col-sm-12">
<span id="similarspan"></span>
</div></div>
<div class="row">
<div class="left col-sm-5">
<canvas id="myCanvas" width="300" height="100" style="border:1px solid #d3d3d3;">Your browser does not support the HTML5 canvas tag.</canvas><img id="canvasImg"/> <br/>
Stroke Order Input: <input type="text" id="canvasinput" onKeyUp="paintCharacter()" onClick="paintCharacter()" onSelect="paintCharacter()" onBlur="paintCharacterBlur()"/> <br/>
Assign Sign Name: <input type="text" id="signnameinput"/><button id="addsigntotable" onclick="addSignToTable(document.getElementById('signnameinput').value,document.getElementById('canvasinput').value)">Add Sign</button><br/>
<button id="clearcanvas" onClick="clearCanvas()">Clear Canvas</button><button id="refreshsvg" onClick="createOpenFont('examples')">Refresh Font</button>
<button id="simplify" onclick="simplifyPaleoCode(document.getElementById('canvasinput').value)">Simplify</button><!--<button id="activatekeyboard" onclick="activateKeyboard()">Keyboard</button>--><br/>
Style: <select id="styleselect" onchange='changeColors(document.getElementById("styleselect").value,document.getElementById("canvasinput").value)'>
<option value="#000000;#000000" selected="selected">Traditional</option>
<option value="#000000;#FFFFFF">Variant</option></select>
Stroke Color: <input type="color" id="strokeColor" onchange='changeStrokeColor(document.getElementById("strokeColor").value,document.getElementById("canvasinput").value)'/>
Fill Color: <input type="color" id="fillColor" onchange='changeFillColor(document.getElementById("fillColor").value,document.getElementById("canvasinput").value)'/> <br/>
Head Type: <select id="headtype" onchange='loadHeadSVG(document.getElementById("headtype").value)'>
<option value="defaulthead" selected="selected">Triangular</option>
<option value="defaultshorthead">Triangular Short</option>
<option value="defaultlonghead">Triangular Long</option>
<option value="curvedsideshead">Curved Sides</option>
<option value="cursivehead">Cursive</option>
<option value="flaghead">Flagged Head</option>
<option value="widestrokehead">Wide Stroke</option>
<option value="widestrokecurvedsidehead">Wide Stroke Curved Sides</option>
<option value="widestrokecurvedhead">Wide Stroke Curved</option>
<option value="rectanglehead">Rectangle</option>
<option value="starhead">Star</option>
</select><br/>
Winkelhaken Type: <select id="winkelhakentype" onchange='loadWinkelhakenSVG(document.getElementById("winkelhakentype").value)'>
<option value="defaulthead">Triangular</option>
<option value="defaultshorthead">Triangular Short</option>
<option value="defaultlonghead">Triangular Long</option>
<option value="curvedsideshead">Curved Sides</option>
<option value="cursivehead" selected="selected">Cursive</option>
<option value="flaghead">Flagged Head</option>
<option value="widestrokehead" >Wide Stroke</option>
<option value="widestrokecurvedsidehead">Wide Stroke Curved Sides</option>
<option value="widestrokecurvedhead">Wide Stroke Curved</option>
<option value="rectanglehead">Rectangle</option>
<option value="starhead">Star</option>
</select><br/>
<button id="downloadImage" onClick="to_image()">Download Image</button>
<button id="downloadSVG" onClick="to_svg()">Download SVG</button>
<button id="createFont" onClick="createFont()">Create Font</button> <br/><br/>
Options:<br/>
Similarity Measure: <select id="similaritymeasure"><option value="substring">Substring</option><option value="dice">Dice Coefficient</option><!--<option value="lev">Levenshtein Distance</option>--></select><br/><br/>
Tutorial:
<table>
<tr><td><b>a</b>
<button id="horizontal" onClick="appendCharacter('a',document.getElementById('canvasinput'))">Horizontal Stroke (a)</button>
<button id="D" onClick="appendCharacter('A',document.getElementById('canvasinput'))">Big (A)</button>
<button id="sa" onClick="appendCharacter('sa',document.getElementById('canvasinput'))">Small (sa)</button>
</td></tr>
<tr><td><b>b</b>
<button id="vertical" onClick="appendCharacter('b')">Vertical Stroke (b)</button>
<button id="D" onClick="appendCharacter('B',document.getElementById('canvasinput'))">Big (B)</button>
<button id="sb" onClick="appendCharacter('sb',document.getElementById('canvasinput'))">Small (sb)</button>
</td></tr>
<tr><td><b>c</b>
<button id="diagonal1" onClick="appendCharacter('c',document.getElementById('canvasinput'))">Diagonal Stroke1 (c)</button>
<button id="C" onClick="appendCharacter('C',document.getElementById('canvasinput'))">Big (C)</button>
<button id="sc" onClick="appendCharacter('sc',document.getElementById('canvasinput'))">Small (sc)</button>
</td></tr>
<tr><td><b>d</b>
<button id="diagonal2" onClick="appendCharacter('d',document.getElementById('canvasinput'))">Diagonal Stroke2 (d)</button>
<button id="D" onClick="appendCharacter('D',document.getElementById('canvasinput'))">Big (D)</button>
<button id="sd" onClick="appendCharacter('sd',document.getElementById('canvasinput'))">Small (sd)</button>
</td></tr>
<tr><td><b>e</b>
<button id="diagonal3" onClick="appendCharacter('e',document.getElementById('canvasinput'))">Diagonal Stroke3 (e)</button>
<button id="E" onClick="appendCharacter('E',document.getElementById('canvasinput'))">Big (E)</button>
<button id="se" onClick="appendCharacter('se',document.getElementById('canvasinput'))">Small (se)</button>
</td></tr>
<tr><td><b>f</b>
<button id="diagonal4" onClick="appendCharacter('f',document.getElementById('canvasinput'))">Diagonal Stroke4 (f)</button>
<button id="F" onClick="appendCharacter('F',document.getElementById('canvasinput'))">Big (F)</button>
<button id="sf" onClick="appendCharacter('sf',document.getElementById('canvasinput'))">Small (sf)</button>
</td></tr>
<tr><td><b>w</b>
<button id="wedge" onClick="appendCharacter('w',document.getElementById('canvasinput'))">Winkelhaken (w)</button>
<button id="W" onClick="appendCharacter('W',document.getElementById('canvasinput'))">Big (W)</button>
<button id="sw" onClick="appendCharacter('sw',document.getElementById('canvasinput'))">Small (sw)</button>
</td></tr>
<tr><td><b>x</b>
<button id="seal" onClick="appendCharacter('x',document.getElementById('canvasinput'))">Seal (x)</button>
<button id="X" onClick="appendCharacter('X',document.getElementById('canvasinput'))">Big (X)</button>
<button id="sx" onClick="appendCharacter('sx',document.getElementById('canvasinput'))">Small (sx)</button>
</td></tr>
<tr><td><b>y</b>
<button id="sealhalf" onClick="appendCharacter('y',document.getElementById('canvasinput'))">Seal (Half) (y)</button>
<button id="Y" onClick="appendCharacter('Y',document.getElementById('canvasinput'))">Big (Y)</button>
<button id="sy" onClick="appendCharacter('sy',document.getElementById('canvasinput'))">Small (sy)</button>
</td></tr>
<tr><td><b>-</b> right of the current stroke passing through other strokes</td></tr>
<tr><td><b>_</b> right of the current stroke NOT passing through other strokes</td></tr>
<tr><td><b>:</b> under the current stroke passing through other strokes</td></tr>
<tr><td><b>;</b> under the current stroke NOT passing through other strokes</td></tr>
<tr><td><b>/</b> half the distance of <b>:</b> under the current stroke passing through other strokes </td></tr>
<tr><td><b>\</b> above the current stroke passing through other strokes </td></tr>
<tr><td><b>.</b> diagonal right under the current stroke</td></tr>
<tr><td><b>,</b> diagonal left above the current stroke</td></tr>
<tr><td><b>(FACTOR)</b> using a factor on any previous operator for higher precision <i><small>(e.g. <(22) turns 22° left, :(3) uses : three times, H(120) scales up the size of the head 20%)</small></i></td></tr>
<tr><td><b>s</b> smaller version of the stroke <i><small>(e.g. sb, sc)</small></i></td></tr>
<tr><td><b>!</b> mirrored version of the stroke <i><small>(e.g. !a, !A, !sa)</small></i></td></tr>
<tr><td><b>Whitespace</b> Enough distance to start a new character</td></tr>
<tr><td><b>[CHARACTERNAME]</b> Reuse of already defined characters in new definitions <i><small>(e.g. [A], ![TAB], s[LAL])</small></i></td></tr>
</table>
</div>
<div class="left col-sm-7">
<span id="amount"></span>
<div class="table-wrapper-scroll-y">
<table align="center" id="examples" class="tablesorter" cellpadding="2">
<thead>
<tr><th>Sign</th><th>Code point</th><th>Transliteration</th><th>Borger</th><th>PaleoCode</th><th>SVG</th><th>Gottstein</th><th>Comment</th><th>Source</th><th>Epoch</th><th>Location</th><th>Meaning</th><th>Options</th></tr><tr>
</thead><tbody id="exampleContent">
</tbody></table>
</div>
</div>
</div>
</div>
<footer class="page-footer font-small blue pt-4">
<!-- Footer Links -->
<div class="container-fluid text-center text-md-left">
<!-- Grid row -->
<div class="row">
<!-- Grid column -->
<div class="col-md-6 mt-md-0 mt-3">
<!-- Content -->
<h5>Description</h5><!--<svg height="210" width="400" id="testsvg">
<path d="M150 0 L75 200 L225 200 Z" />
</svg>-->
<p>This website uses JavaScript to allow the user to describe their cuneiform characters using PaleoCodage, a system to describe the shape of cuneiform characters.<br/>
The system is described in detail in the following short paper publication:<br/>
<a href="https://dh2019.adho.org/short-papers/">Paleo Codage - A machine-readable way to describe cuneiform characters paleographically</a>
The result of the description can be saved as a PNG image, as SVG or can be incorporated into an OpenType font.<br/>
Similar to the implementation at <a href="https://symbolset.com">https://symbolset.com</a>,<br/>
the font can be used to replace modified cuneiform transliteration texts with correct sign variants defined in PaleoCodage which is demonstrated above.</p>
</div>
<!-- Grid column -->
<hr class="clearfix w-100 d-md-none pb-3">
<!-- Grid column -->
<div class="col-md-3 mb-md-0 mb-3">
<!-- Links -->
<h5>Downloads</h5>
<ul class="list-unstyled">
<li>
<button id="asjson" onclick="htmlTableToJSON('paleocodes','.json')">PaleoCodes as JSON</button>
</li>
<li>
<button id="asttl" onclick="createTTL()">PaleoCodes as TTL</button>
</li>
</ul>
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="col-md-3 mb-md-0 mb-3">
<!-- Links -->
<h5>Links</h5>
<ul class="list-unstyled">
<li>
<a href="https://dh2019.adho.org/" target="_blank">DH2019</a>
</li>
<li>
<a href="https://github.com/situx/PaleoCodage" target="_blank">PaleoCodage Repository Github</a>
</li>
<li>
<a href="https://situx.github.io/PaleoCodage/graph.html" target="_blank">Similarity Graph</a>
</li>
<li>
<a href="https://situx.github.io/PaleoCodage/fonttester.html" target="_blank">Fonttester</a>
</li>
<li>
<a href="https://situx.github.io/PaleoCodage/fontbuilder.html" target="_blank">Fontbuilder</a>
</li>
<li>
<a href="https://www.mainzed.org" target="_blank">mainzed</a>
</li>
</ul>
</div>
<!-- Grid column -->
</div>
<!-- Grid row -->
</div>
<!-- Footer Links -->
<!-- Copyright -->
<div class="footer-copyright text-center py-3"></div>
<!-- Copyright -->
</footer>
<div class="container">
<h1 id="fontFamilyName"></h1>
<p>This font is generated dynamically in the browser.</p>
<button onclick="font.download()">Download Font</button>
<div id="glyphs"></div>
</div>
<div id="graphDiv" width="1000" height="600"></div>
<div id="jsonFont"></div>
<script>
function simplifyPaleoCode(input){
var result=simplifyInput($('#canvasinput').val())
document.getElementById('canvasinput').value=result
}
function exampleListing(){
var tablehtml="";
for(code in paleocodestore){
tablehtml+="<tr id="+signcounter+"><td contenteditable class=\"sign\">"+paleocodestore[code]["Sign"]+"</td><td contenteditable class=\"codepoint\">"+paleocodestore[code]["Code point"]+"</td>"
tablehtml+="<td contenteditable class=\"transliteration\" id=\""+paleocodestore[code]["Transliteration"]+"\">"+paleocodestore[code]["Transliteration"]+"</td>"
tablehtml+="<td contenteditable class=\"borger\">"+paleocodestore[code]["Borger"]+"</td><td contenteditable ><button class=\"codebutton\" id=\""+paleocodestore[code]["Transliteration"]+"_button\" onClick=\"showCharacter(document.getElementById('"+(paleocodestore[code]["Transliteration"]?paleocodestore[code]["Transliteration"].trim():"")+"_button').textContent)\">"+paleocodestore[code]["PaleoCode"]+"</button></td><td class=\"svg\"><div class=\"svgcontainer\"></div></td>"
tablehtml+="<td class=\"gottstein\">"+paleocodestore[code]["Gottstein"]+"</td><td contenteditable class=\"comment\">"+paleocodestore[code]["Comment"]+"</td><td contenteditable >"
+paleocodestore[code]["Source"]+"</td><td contenteditable >"+paleocodestore[code]["Epoch"]+"</td><td>"+paleocodestore[code]["Location"]+"</td><td>"
+(("Meaning" in paleocodestore[code] && "Concept" in paleocodestore[code])?"<a href=\""+paleocodestore[code]["Concept"]+"\">"+paleocodestore[code]["Meaning"]:"")+"</td><td><button onClick=\"deleteRow("+signcounter+++")\">Delete</button></td></tr>"
}
console.log("Table: " + tablehtml);
$('#exampleContent').html(tablehtml)
}
function deleteRow(rownumber){
$( "#"+rownumber ).remove();
var count = $('#examples tr').length;
$('#amount').html((count-1)+" characters");
}
function addSignToTable(signname,paleocode){
$("#exampleContent").append("<tr id="+signcounter+"><td contenteditable class=\"sign\"></td><td contenteditable class=\"codepoint\"></td><td contenteditable class=\"transliteration\" id=\""+signname+"\">"+signname+"</td><td contenteditable class=\"borger\"></td><td contenteditable><button class=\"codebutton\" id=\""+signname+"_button\" onClick=\"showCharacter(document.getElementById('"+signname.trim()+"_button').textContent)\">"+paleocode+"</button></td><td class=\"svgcontainer\"></td><td class=\"gottstein\"></td><td contenteditable class=\"comment\"></td><td contenteditable></td><td contenteditable></td><td contenteditable></td><td><button onClick=\"deleteRow("+signcounter+++")\">Delete</button></td></tr>");
$('#examples').trigger('updateAll');
var count = $('#examples tr').length;
$('#amount').html((count-1)+" characters");
}
$(function() {
exampleListing();
var count = $('#examples tr').length;
$('#amount').html((count-1)+" characters");
createOpenFont('examples');
$("#examples").tablesorter({ theme: 'blue',widthFixed: false,widgets: [ 'uitheme', 'zebra', 'filter', 'scroller' ],widgetOptions: {
zebra: ["even", "odd"],
filter_reset: ".reset",
filter_cssFilter: "form-control",
scroller_upAfterSort: true,
scroller_jumpToHeader: true,
scroller_height: 0,
scroller_fixedColumns: 3,
scroller_addFixedOverlay: false,
scroller_rowHighlight: 'hover',
scroller_barWidth: null
}});
//console.log(getCoordinatesFromSVGPath("M150 0 L75 200 L225 200 Z"));
});
function inputacceptance(e){
console.log(e.which)
var which=e.which
var key=e.key
if(e.which==1){
which=e.action.charCodeAt(0)
}
if(!key){
key=parseInt(e.action);
}
console.log(which)
console.log(key)
if((typeof e.target) === 'undefined')
return
var carpos=e.target.selectionStart
var inbracket=false;
var infactorbracket=false;
console.log(carpos)
console.log(bracketpositions)
console.log(factorbracketpositions)
for(pos in bracketpositions){
if(bracketpositions[pos]["start"]<carpos && (bracketpositions[pos]["end"]>carpos || bracketpositions[pos]["end"]==-1)){
inbracket=true;
break;
}
}
for(pos in factorbracketpositions){
if(factorbracketpositions[pos]["start"]<carpos && (factorbracketpositions[pos]["end"]>carpos || factorbracketpositions[pos]["end"]==-1)){
infactorbracket=true;
break;
}
}
console.log("InBracket: "+inbracket)
if(which==56 && key=='[' && inbracket){
return false;
}else if(which==57 && key==']' && !inbracket){
return false;
}
if(which==56 && key=='(' && infactorbracket){
return false;
}else if(which==57 && key==')' && !infactorbracket){
return false;
}
console.log("InFactorBracket: "+infactorbracket)
if(infactorbracket){
if( key == 0
|| key == 1
|| key == 2
|| key == 3
|| key == 4
|| key == 5
|| key == 6
|| key == 7
|| key == 8
|| key == 9
|| which == 8 // BACKSPACE
|| which == 17 // STRG
|| (which == 17 && which == 65) // STRG + A
|| (which == 17 && which == 67) // STRG + C
|| (which == 17 && which == 90) // STRG + Z
|| (which >36 && which <41) // LEFT UP RIGHT DOWN
|| which == 46 // DEL
|| which == 57 // 9 )
|| which == 116 // F5
){
return true;
}
}else if (inbracket
|| which == 8 // BACKSPACE
|| which == 32 // SPACE
|| (which >36 && which <41) // LEFT UP RIGHT DOWN
|| which == 46 // DEL
|| which == 48
|| which == 49
|| (which == 55 && key!=7) // 7 /
|| (which == 56 && key!=8) // 8 (
|| (which == 57 && key!=9) // 9 )
|| which == 60 // < > |
|| (which >64 && which < 71) // aA bB cC dD eE fF
|| which == 83 // sS
|| which == 87 // wW
|| which == 88 // xX
|| which == 89 // yY
|| which == 110 // NUM,
|| which == 111 // NUM/
|| which == 163
|| which == 171 // *~
|| which == 173 // - _
|| (which >=186 && which <=192) // x ,; x .: x
|| which == 219
|| which == 220
|| which == 226
|| which == 16 // SHIFT
|| which == 17 // STRG
|| which == 18 // ALT ALTGR
//|| e.which == 63 // \
|| which == 72 // hH
|| which == 76 // lL
|| which == 86 // vV
|| which == 90 // zZ
|| which == 116 // F5
){
return true;
}
return false;
}
$("#canvasinput").bind({
keydown: function(e){
return inputacceptance(e)
}
});
</script>
<script>
//Gitlab API here https://docs.gitlab.com/ee/api/repository_files.html#update-existing-file-in-repository
function commitChangesToGitlab(){
var newversion = $('#examples').tableToJSON();
commitChanges("",paleocodes)
}
//Github API here: https://developer.github.com/v3/repos/contents/ PUT /repos/:owner/:repo/contents/:path
function commitChangesToGithub(){
var newversion = $('#examples').tableToJSON();
commitChanges("",paleocodes)
}
function commitChanges(url,changes){
$.ajax({
url: url,
type: 'POST',
contentType:'application/json',
data: JSON.stringify(changes),
dataType:'json'
});
}
$('#similaritymeasure').change(function() {
var curval=$('#similaritymeasure').val();
switch(curval){
case "substring":
substringgraph();
break;
case "dice":
similarityDiceCoefficientGraph(0.6)
break;
case "lev":
similarityLevenshteinDistanceGraph(0.7)
break;
}
});
function activateKeyboard(){
$('#canvasinput').keyboard({
layout: 'custom',
acceptValid: true,
customLayout: {
'normal' : [
'1 2 3 4 5 6 7 8 9 0 {bksp}',
'{A} {B} {C} {D} {E} {F} {W} {X} {Y}',
'{a} {b} {c} {d} {e} {f} {w} {x} {y}',
'sa sb sc sd se sf sx sy',
'- _ : ; . , [ ] ( ) !',
]
},
validate: function(keyboard,value,isClosing){return inputacceptance(value)},
change: function(event, keyboard, el) {
if(inputacceptance(event)){
strokeParser(keyboard.$preview.val())
return true;
}
return false;
},
display: {
// including a colon in the url breaks the image :(
A: 'A:<svg width="40" height="40" viewBox="0 0 14 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M0 0 L12 0 L6 12 L0 0 M6 12 L6 48"></path><title>Big (A)</title></svg>',
a: 'a:<svg width="40" height="40" viewBox="0 0 14 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M0 6 L12 6 L6 18 L0 6 M6 18 L6 42 Z"></path><title>Horizontal Stroke (a)</title></svg>',
sa: 'sa:<svg width="40" height="40" viewBox="0 0 14 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M0 12 L12 12 L6 24 L0 12 M6 24 L6 36 Z"></path><title>Small (sa)</title></svg>',
B: 'B:<svg width="40" height="40" viewBox="0 0 56 14" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M0 10 L0 0 L10 5 L0 10 M10 5 L55 5"></path><title>Big (B)</title></svg>',
b: 'b:<svg width="40" height="40" viewBox="0 0 56 14" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M5.5 10 L5.5 0 L15.5 5 L5.5 10 M15.5 5 L45.5 5 Z"></path><title>Vertical Stroke (b)</title></svg>',
sb: 'sb:<svg width="40" height="40" viewBox="0 0 56 14" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M10.5 10 L10.5 0 L20.5 5 L10.5 10 M20.5 5 L35.5 5 Z"></path><title>Small (sb)</title></svg>',
C: 'C:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M4.52 14.59 L11.59 7.52 L15.13 18.13 L4.52 14.59 M15.13 18.13 L46.95 49.95 Z"></path><title>Big (C)</title></svg>',
c: 'c:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M9.32 18.89 L16.39 11.82 L19.93 22.43 L9.32 18.89 M19.93 22.43 L41.14 43.64 Z"></path><title>Diagonal Stroke1 (c)</title></svg>',
sc: 'sc:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M11.63 24.45 L18.7 17.38 L22.23 27.98 L11.63 24.45 M22.23 27.98 L32.84 38.59 Z"></path><title>Small (sc)</title></svg>',
D: 'D:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M11.59 49.48 L4.52 42.41 L15.13 38.87 L11.59 49.48 M15.13 38.87 L46.95 7.05 Z"></path><title>Big (D)</title></svg>',
d: 'd:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M15.39 44.18 L8.32 37.11 L18.93 33.57 L15.39 44.18 M18.93 33.57 L40.14 12.36 Z"></path><title>Diagonal Stroke2 (d)</title></svg>',
sd: 'sd:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M18.7 38.62 L11.63 31.55 L22.23 28.02 L18.7 38.62 M22.23 28.02 L32.84 17.41 Z"></path><title>Small (sd)</title></svg>',
E: 'E:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M47.23 42.41 L40.16 49.48 L36.62 38.87 L47.23 42.41 M36.62 38.87 L4.8 7.05 Z"></path><title>Big (E)</title></svg>',
e: 'e:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M40.18 36.61 L33.11 43.68 L29.57 33.07 L40.18 36.61 M29.57 33.07 L8.36 11.86 Z"></path><title>Diagonal Stroke3 (e)</title></svg>',
se: 'se:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M32.87 31.55 L25.8 38.62 L22.27 28.02 L32.87 31.55 M22.27 28.02 L11.66 17.41 Z"></path><title>Small (se)</title></svg>',
F: 'F:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M40.16 7.02 L47.23 14.09 L36.62 17.63 L40.16 7.02 M36.62 17.63 L4.8 49.45 Z"></path><title>Big (F)</title></svg>',
f: 'f:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M33.11 11.82 L40.18 18.89 L29.57 22.43 L33.11 11.82 M29.57 22.43 L8.36 43.64 Z"></path><title>Diagonal Stroke4 (f)</title></svg>',
sf: 'sf:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M25.8 17.38 L32.87 24.45 L22.27 27.98 L25.8 17.38 M22.27 27.98 L11.66 38.59 Z"></path><title>Small (sf)</title></svg>',
W: 'W:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M30.33 10.89 L12.56 28.67 L30.33 46.44 L30.33 10.89 Z"></path><title>Big (W)</title></svg>',
w: 'w:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M28 14.67 L14.67 28 L28 41.33 L28 14.67 Z"></path><title>Winkelhaken (w)</title></svg>',
sw: 'sw:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M24.67 19.45 L15.78 28.33 L24.67 37.22 L24.67 19.45 Z"></path><title>Small (sw)</title></svg>',
x: 'x:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M 28, 30 m -15, 0 a 15,15 0 1,0 30,0 a 15,15 0 1,0 -30,0"></path><title>Seal (x)</title></svg>',
X: 'X:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M 32, 30 m -25, 0 a 20,20 0 1,0 40,0 a 20,20 0 1,0 -40,0"></path><title>Big (X)</title></svg>',
sx: 'sx:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><path fill="currentColor" stroke="currentColor" d="M 28, 30 m -10, 0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0"></path><title>Small (sx)</title></svg>',
y: 'Y:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><g transform="rotate(-90.1 30 30)"><path fill="currentColor" stroke="currentColor" d="M 15, 20 a 15,15 0 1,0 30,0"></path></g><title>Seal (Half) (y)</title></svg>',
Y: 'Y:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><g transform="rotate(-90.1 30 30)"><path fill="currentColor" stroke="currentColor" d="M 10, 20 a 20,20 0 1,0 40,0"></path></g><title>Big (Y)</title></svg>',
sy: 'sy:<svg width="40" height="40" viewBox="0 0 56 56" class="staticsvg"><g transform="rotate(-90.1 30 30)"><path fill="currentColor" stroke="currentColor" d="M 20, 20 a 10,10 0 1,0 20,0"></path></g><title>Small (sy)</title></svg>'
},
usePreview: false // no preveiw
});
}
//activateKeyboard();
</script>
</body>
</html>