X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/a0f942a8498d6f1574c57c5943a7d21eb9634898..2bf6ce4daff354b4d7773dd6471dffbe37ca9bc8:/latinsample.js?ds=sidebyside
diff --git a/latinsample.js b/latinsample.js
index cff51e3..846e500 100644
--- a/latinsample.js
+++ b/latinsample.js
@@ -3,6 +3,10 @@ function appendsample() {
for (var row of rows) {
// append sample column
var samplecol = row.getElementsByClassName('sample');
+ if (!this.value.length) {
+ row.removeChild(samplecol[0]);
+ continue;
+ }
if (samplecol.length) {
samplecol = samplecol[0];
}
@@ -22,6 +26,9 @@ function appendsample() {
cols[++col] = same;
}
}
+ for (var col = 0; col < cols.length; col++) {
+ cols[col] = cols[col].innerHTML.trimRight();
+ }
// copy letters into sample
var output = '';
@@ -29,13 +36,29 @@ function appendsample() {
for (var i = 0; i < input.length; i++) {
var col = input.charCodeAt(i) - 64;
if (col < 1) col = 27; // space
- if (col < cols.length) {
- output += '' + cols[col].innerHTML.trimRight() + '';
+ else if (cols[28] && i && col == input.charCodeAt(i - 1) - 64) {
+ col = 28; // repetition char
+ }
+ if (row.id == 'suetterlin' && col == 19) {
+ var final = input.length == i + 1 || input[i + 1] == ' ';
+ output += cols[col].split(' ')[final ? 1 : 0];
+ }
+ else if (col < cols.length) {
+ var final = cols[col] || ' ';
+ if (!/^