comparison scripttags.js @ 104:648659961e0e

Get editor working again
author Mike Pavone <pavone@retrodev.com>
date Thu, 11 Apr 2013 00:12:21 -0700
parents 4d87c38404d6
children da7f585bf626
comparison
equal deleted inserted replaced
103:182c311a9fed 104:648659961e0e
1 1
2 function compileAndRun(src) 2 function compileAndRun(src)
3 { 3 {
4 var ast = parser.parse(src); 4 var ast = parser.parse(src);
5 var js = ast.toJSModule(); 5 asyncProcessTopLevelJS(toplevel, function() {
6 mainModule = eval(js)(); 6 var js = makeJSProg(ast);
7 eval(js);
8 });
9 /*.toJSModule();
10 mainModule = eval(js);
7 if (mainModule.strue) { 11 if (mainModule.strue) {
8 each(mainModule.strue, function(key, val) { 12 each(mainModule.strue, function(key, val) {
9 if(val instanceof Function) { 13 if(val instanceof Function) {
10 Boolean.prototype[key] = function() { 14 Boolean.prototype[key] = function() {
11 return this.valueOf() ? mainModule.strue[key].apply(mainModule.strue, arguments) : mainModule.sfalse[key].apply(mainModule.sfalse, arguments); 15 return this.valueOf() ? mainModule.strue[key].apply(mainModule.strue, arguments) : mainModule.sfalse[key].apply(mainModule.sfalse, arguments);
12 }; 16 };
13 } 17 }
14 }); 18 });
15 } 19 }
16 mainModule.main(); 20 mainModule.main();*/
17 } 21 }
18 22
19 onReady(function() { 23 onReady(function() {
20 var tags = qall('script[type="text/tabletprog"]'); 24 toplevel.onReady( function() {
21 for (var i = 0; i < tags.length; ++i) { 25 var tags = qall('script[type="text/tabletprog"]');
22 if (tags[i].src) { 26
23 get(tags[i].src, function(req) { 27 for (var i = 0; i < tags.length; ++i) {
24 compileAndRun(req.responseText); 28 if (tags[i].src) {
25 }); 29 get(tags[i].src, function(req) {
26 } else { 30 compileAndRun(req.responseText);
27 compileAndRun(tags[i].innerHTML); 31 });
32 } else {
33 compileAndRun(tags[i].innerHTML);
34 }
28 } 35 }
29 } 36 });
30 }); 37 });