git @ Cat's Eye Technologies Lexeduct / b7eac32
Build out the UI, but it's still basically non-functional. Chris Pressey 6 years ago
1 changed file(s) with 29 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
1414 <script src="lexeduct-browser.js"></script>
1515 <script src="yoob/element-factory.js"></script>
1616 <script>
17 var container, input, output, process;
17 "use strict";
18
19 var container, input, output, processButton, tranformersPanel;
20
1821 container = document.getElementById('container');
1922 input = yoob.makeTextArea(container, 40, 20, "Hello, there!\nWhat do you think?");
20 process = yoob.makeButton(container, "Process", function() {
23
24 var transformersPanel = yoob.makeDiv(container);
25 transformersPanel.style.border = "2px solid black";
26 transformersPanel.style.display = "inline-block";
27 transformersPanel.style.verticalAlign = "top";
28
29 var transformerNames = [["identity", "---"]];
30 for (var key in makeTransformer) {
31 if (makeTransformer.hasOwnProperty(key)) {
32 transformerNames.push([key, key]);
33 }
34 }
35
36 var MAX_TRANSFORMERS = 8; // TODO dynamic
37 var transformers = new Array(MAX_TRANSFORMERS);
38
39 for (var i = 0; i < MAX_TRANSFORMERS; i++) {
40 yoob.makeSelect(transformersPanel, "Transformer " + (i+1), transformerNames);
41 yoob.makeLineBreak(transformersPanel);
42 yoob.makeTextInput(transformersPanel, 24);
43 yoob.makeLineBreak(transformersPanel);
44 }
45
46 processButton = yoob.makeButton(transformersPanel, "Process", function() {
2147 var t = makeTransformer['upper']({});
2248 output.value = t(input.value);
2349 });
50
2451 output = yoob.makeTextArea(container, 40, 20);
2552 </script>