git @ Cat's Eye Technologies Lexeduct / 0.1-2018.0626
Change how the demo page is populated (use launcher script.) Chris Pressey 3 years ago
2 changed file(s) with 63 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
0 function launch(prefix, container, config) {
1 if (typeof container === 'string') {
2 container = document.getElementById(container);
3 }
4 config = config || {};
5
6 function loadThese(deps, callback) {
7 var loaded = 0;
8 for (var i = 0; i < deps.length; i++) {
9 var elem = document.createElement('script');
10 elem.src = prefix + deps[i];
11 elem.onload = function() {
12 if (++loaded < deps.length) return;
13 callback();
14 }
15 document.body.appendChild(elem);
16 }
17 }
18
19 loadThese([
20 "lexeduct-transformers.js",
21 "yoob/element-factory.js",
22 "lexeduct-browser.js"
23 ], function() {
24 var initialText = "" +
25 "A thing of beauty is a joy for ever:\n" +
26 "Its loveliness increases; it will never\n" +
27 "Pass into nothingness; but still will keep\n" +
28 "A bower quiet for us, and a sleep\n" +
29 "Full of sweet dreams, and health, and quiet breathing.\n" +
30 "Therefore, on every morrow, are we wreathing\n" +
31 "A flowery band to bind us to the earth,\n" +
32 "Spite of despondence, of the inhuman dearth\n" +
33 "Of noble natures, of the gloomy days,\n" +
34 "Of all the unhealthy and o'er-darkened ways\n" +
35 "Made for our searching: yes, in spite of all,\n" +
36 "Some shape of beauty moves away the pall\n" +
37 "From our dark spirits. Such the sun, the moon,\n" +
38 "Trees old and young, sprouting a shady boon\n" +
39 "For simple sheep; and such are daffodils\n" +
40 "With the green world they live in; and clear rills\n" +
41 "That for themselves a cooling covert make\n" +
42 "'Gainst the hot season; the mid forest brake,\n" +
43 "Rich with a sprinkling of fair musk-rose blooms:\n" +
44 "And such too is the grandeur of the dooms\n" +
45 "We have imagined for the mighty dead;\n" +
46 "All lovely tales that we have heard or read:\n" +
47 "An endless fountain of immortal drink,\n" +
48 "Pouring unto us from the heaven's brink.\n";
49
50 (new LexeductUI()).init({
51 container: container,
52 initialText: initialText,
53 liveMode: true
54 });
55 });
56 }
66
77 <header>
88 <h1>Lexeduct</h1>
9 <p>
10 <i>If the page is blank and says <code>lexeduct-transformers.js</code> can't be loaded,
11 you need to run <code>make.sh</code>.</i>
12 </p>
913 </header>
1014
1115 <div id="container"></div>
1216
13 <pre style="display: none;" id="initial-text">
14 A thing of beauty is a joy for ever:
15 Its loveliness increases; it will never
16 Pass into nothingness; but still will keep
17 A bower quiet for us, and a sleep
18 Full of sweet dreams, and health, and quiet breathing.
19 Therefore, on every morrow, are we wreathing
20 A flowery band to bind us to the earth,
21 Spite of despondence, of the inhuman dearth
22 Of noble natures, of the gloomy days,
23 Of all the unhealthy and o'er-darkened ways
24 Made for our searching: yes, in spite of all,
25 Some shape of beauty moves away the pall
26 From our dark spirits. Such the sun, the moon,
27 Trees old and young, sprouting a shady boon
28 For simple sheep; and such are daffodils
29 With the green world they live in; and clear rills
30 That for themselves a cooling covert make
31 'Gainst the hot season; the mid forest brake,
32 Rich with a sprinkling of fair musk-rose blooms:
33 And such too is the grandeur of the dooms
34 We have imagined for the mighty dead;
35 All lovely tales that we have heard or read:
36 An endless fountain of immortal drink,
37 Pouring unto us from the heaven's brink.
38 </pre>
39
4017 </body>
41 <script src="lexeduct-transformers.js"></script>
42 <script src="yoob/element-factory.js"></script>
43 <script src="lexeduct-browser.js"></script>
18 <script src="launch-lexeduct.js"></script>
4419 <script>
45 (new LexeductUI()).init({
46 container: document.getElementById('container'),
47 initialText: document.getElementById('initial-text').innerHTML,
48 liveMode: true
49 });
20 launch("", "container");
5021 </script>