X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/da9b71275d04f35c77a48e3bbaee356c04fd24b2..ecafe82fb6cb293e9cf45a6a2f6474858f429221:/latinsample.js
diff --git a/latinsample.js b/latinsample.js
index b576f95..37d3231 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 = '';
@@ -34,11 +41,18 @@ function appendsample() {
}
if (col < cols.length) {
- output += '' + (cols[col].innerHTML.trimRight() || ' ') + '';
+ output += '' + (cols[col] || ' ') + '';
}
else {
output += ' ';
}
+ if (row.parentNode.tagName == 'THEAD') {
+ output += col < 26 ? ' ' : '· '; // number separator
+ }
+ }
+ if (cols[29] && !cols[28]) {
+ // circumfix sign if no repetition
+ output = cols[29] + output + cols[29];
}
samplecol.innerHTML = output;
}