|
|
@ -1,8 +1,6 @@ |
|
|
|
import * as Element from ALTO.Element; |
|
|
|
import * as Dom from UnitJS.Dom; |
|
|
|
|
|
|
|
var workzone = document.getElementById('workzone'); |
|
|
|
workzone.style.width = Element.printSpace.pxWidth + 'px'; |
|
|
|
|
|
|
|
return { |
|
|
|
display: display, |
|
|
@ -19,13 +17,19 @@ function appendTo(element) { |
|
|
|
return function(e) {element.appendChild(e);}; |
|
|
|
} |
|
|
|
|
|
|
|
function display(ALTODoc, thresholdInput) { |
|
|
|
function ifPush(test, elem) { |
|
|
|
return function(t) { |
|
|
|
return test ? t.concat(elem) : t; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function display(ALTODoc, gui) { |
|
|
|
var printSpace = Element.make(ALTODoc.querySelector('Page PrintSpace')); |
|
|
|
Element.setPrintSpace(printSpace); |
|
|
|
workzone.style.height = Element.printSpace.pxHeight + 'px'; |
|
|
|
Dom.clear(workzone); |
|
|
|
gui.workzone.style.height = Element.printSpace.pxHeight + 'px'; |
|
|
|
Dom.clear(gui.workzone); |
|
|
|
onNodes(printSpace.get('TextBlock'), makeTextBlock(printSpace)) |
|
|
|
.forEach(appendTo(workzone)); |
|
|
|
.forEach(appendTo(gui.workzone)); |
|
|
|
|
|
|
|
function makeTextBlock(parentElement) { |
|
|
|
return function(textBlock) { |
|
|
@ -54,9 +58,13 @@ function display(ALTODoc, thresholdInput) { |
|
|
|
function makeString(parentElement) { |
|
|
|
return function(string) { |
|
|
|
var wc = string.getAttribute('WC'); |
|
|
|
var id = string.getAttribute('ID'); |
|
|
|
var dom = Dom.make('span', { |
|
|
|
class: (wc < thresholdInput.value ? ["lowQuality"] : []).concat("String"), |
|
|
|
id: string.getAttribute('ID'), |
|
|
|
class: ifPush(wc < gui.qualityThreshold, "lowQuality")( |
|
|
|
ifPush(gui.deletedWords[id], "deleted")(["String"]) |
|
|
|
), |
|
|
|
onClick: gui.callbacks.wordEdit, |
|
|
|
id: id, |
|
|
|
textContent: string.getAttribute('CONTENT') |
|
|
|
}); |
|
|
|
return Element.make(string, dom, parentElement).dom(); |
|
|
|