|
10 | 10 |
|
11 | 11 | <!-- A few helpers to do some decoding/fetching below--> |
12 | 12 | <script src="../../demo/libxml.js"></script> |
13 | | - |
| 13 | +<style> |
| 14 | +pre{margin:0;} |
| 15 | +pre.error{color:#f00;} |
| 16 | +pre.warning{color:#FFC500;} |
| 17 | +</style> |
14 | 18 | <!-- Scripting Extensions --> |
15 | 19 | <script src="../../src/scripting/build/Host.js"></script> |
16 | 20 |
|
17 | 21 | <title>Testrun Sandbox For CCL /w Scripting Enabled</title> |
18 | 22 | </head> |
19 | 23 | <body> |
| 24 | +<div style="position:absolute;right:0; top:0; width: 45%; overflow:auto; height:384px; padding:3px;" id="debug-console"></div> |
20 | 25 | <div id="player-unit" style="width:540px;clear:both;"> |
21 | 26 | <div class="m20 abp" id="player" style="height:384px;"> |
22 | 27 | <div id="commentCanvas" class="container"></div> |
@@ -78,6 +83,37 @@ <h2>Tests</h2> |
78 | 83 |
|
79 | 84 | var cm = new CommentManager($('commentCanvas')); |
80 | 85 | var bscripter = new CCLScripting("../../src/scripting/build/Worker.js"); |
| 86 | +bscripter.logger = new function(){ |
| 87 | + this.log = function(t){ |
| 88 | + var pre = document.createElement("pre"); |
| 89 | + pre.textContent = t.toString(); |
| 90 | + $("debug-console").appendChild(pre); |
| 91 | + while($("debug-console").children.length > 200){ |
| 92 | + $("debug-console").removeChild($("debug-console").children[0]); |
| 93 | + } |
| 94 | + $("debug-console").scrollTop = 100000; |
| 95 | + }; |
| 96 | + this.error = function(t){ |
| 97 | + var pre = document.createElement("pre"); |
| 98 | + pre.textContent = t.toString(); |
| 99 | + pre.className = "error"; |
| 100 | + $("debug-console").appendChild(pre); |
| 101 | + while($("debug-console").children.length > 200){ |
| 102 | + $("debug-console").removeChild($("debug-console").children[0]); |
| 103 | + } |
| 104 | + $("debug-console").scrollTop = 100000; |
| 105 | + }; |
| 106 | + this.warn = function(t){ |
| 107 | + var pre = document.createElement("pre"); |
| 108 | + pre.textContent = t.toString(); |
| 109 | + pre.className = "warning"; |
| 110 | + $("debug-console").appendChild(pre); |
| 111 | + while($("debug-console").children.length > 200){ |
| 112 | + $("debug-console").removeChild($("debug-console").children[0]); |
| 113 | + } |
| 114 | + $("debug-console").scrollTop = 100000; |
| 115 | + }; |
| 116 | +}; |
81 | 117 | cm.scripting = bscripter.getSandbox($("commentCanvas")); |
82 | 118 | cm.init(); |
83 | 119 |
|
|
0 commit comments