33< head >
44 < meta http-equiv ="Content-Type " content ="text/html; charset=utf-8 " />
55 < meta http-equiv ="X-UA-Compatible " value ="IE=9 ">
6- < title > CCL-Compat BScript Test </ title >
6+ < title > CommentCoreLibrary - Bilibili Compatible Scripting Playground </ title >
77 < style >
88 # codediv {width : 48% ; position : absolute; left : 10px ;}
99 # playerdiv {width : 48% ; float : right; position : absolute; right : 10px ;}
10- # output {font-family : Consolas, 'Courier New' , monospace; font-size : 12px ;padding : 10px ; background : # 000 ;
11- position : fixed; bottom : 0 ; left : 0 ; right : 0 ; height : 150px ; overflow : auto; color : # ccc ;border-top : 1px dotted # fff ;}
10+ # output {
11+ font-family : Consolas, 'Courier New' , monospace; font-size : 12px ;padding : 10px ; background : # 000 ;
12+ position : fixed; bottom : 0 ; left : 0 ; right : 0 ; height : 150px ; overflow : auto; color : # ccc ;border-top : 1px dotted # fff ;
13+ }
1214 # player {border : 1px solid # f88 ; width : 100% ;background-color : # 100 ;position : relative;}
13- # code-input {width : 100% ;height : 340px ;display : block; border : 1px solid # f88 ; padding : 10px ;background : # 000 ;color : # f88 ;font-size : 20px ;}
14- .s-button , .button {display : block; border : 1px solid # f88 ; padding : 8px 6px 8px 6px ; background : # 000 ; color : # f88 ; float : left;-moz-user-select : none; -khtml-user-select : none; -webkit-user-select : none; -o-user-select : none; user-select : none; cursor : default;}
15+ # code-input {
16+ width : 100% ;height : 340px ;display : block; border : 1px solid # f88 ;
17+ padding : 10px ;background : # 000 ;color : # f88 ;font-size : 20px ;
18+ }
19+ .s-button , .button {
20+ display : block; border : 1px solid # f88 ; padding : 8px 6px 8px 6px ;
21+ background : # 000 ; color : # f88 ; float : left;
22+ -moz-user-select : none;
23+ -khtml-user-select : none;
24+ -webkit-user-select : none;
25+ -o-user-select : none;
26+ user-select : none;
27+ cursor : default;
28+ }
1529 .s-button : hover , .button : hover {background : # f88 ; color : # 000 ;}
1630 .button {font-size : 12px ;z-index : 99 ;}
31+
1732 pre {margin : 0 ;}
1833 pre .error {color : # f00 ;}
1934 pre .warning {color : # FFC500 ;}
2035 </ style >
36+ < link rel ="stylesheet " href ="../../build/style.css " />
2137 < script type ="text/javascript "> var $ = function ( e ) { return window . document . getElementById ( e ) ; } </ script >
2238 < script src ="../../src/scripting/build/Host.js " type ="text/javascript "> </ script >
2339</ head >
2440< body style ="background:#000; ">
2541 < h2 style ="color:#fff "> CCL Scripting Demo</ h2 >
2642 < div id ="codediv ">
2743 < div style ="clear:both;overflow:auto;width:110%; ">
28- < button class ="s-button " id ="evaluate "> Execute (Sandbox) </ button > < button class ="s-button " id ="debug-basic "> Debug Basic</ button > < button class ="s-button " id ="debug-svg "> Debug SVGDraw GreenDam </ button > < button class ="s-button " id ="debug-svg-madoka "> Debug Madoka</ button > < button class ="s-button " id ="debug-3dsphere "> Debug 3D</ button > < button class ="s-button " id ="debug-clear "> Clear.Runtime </ button >
44+ < button class ="s-button " id ="evaluate "> Execute</ button > < button class ="s-button " id ="debug-basic "> Debug Basic</ button > < button class ="s-button " id ="debug-svg "> Debug SVG </ button > < button class ="s-button " id ="debug-svg-madoka "> Debug Madoka</ button > < button class ="s-button " id ="debug-3dsphere "> Debug 3D</ button > < button class ="s-button " id ="debug-custom " > Load Custom </ button > < button class =" s-button " id =" debug- clear "> Clear</ button >
2945 </ div >
3046 < textarea id ="code-input "> </ textarea >
3147 </ div >
3248 < div id ="playerdiv ">
3349 < div id ="player " style ="height:400px;clear:both;overflow:hidden; "> </ div >
3450 </ div >
35- < div id ="output "> [Msg] 有关具体API信息请阅读 docs/scripting</ div >
51+ < div id ="output "> [Msg] 有关具体API信息请阅读 docs/scripting< br > [Msg] Supported Custom Tests: 3dterrain.biliscript < /div >
3652 < script type ="text/javascript ">
3753 bscripter = new CCLScripting ( "../../src/scripting/build/Worker.js" ) ;
3854 bscripter . logger = new function ( ) {
@@ -57,24 +73,32 @@ <h2 style="color:#fff">CCL Scripting Demo</h2>
5773 function fetchFile ( filename ) {
5874 var xhr = new XMLHttpRequest ( ) ;
5975 xhr . onreadystatechange = function ( ) {
60- if ( xhr . readyState == 4 && xhr . status == 200 ) {
76+ if ( xhr . readyState === 4 && xhr . status == 200 ) {
6177 $ ( "code-input" ) . value = xhr . responseText ;
78+ } else if ( xhr . readyState === 4 ) {
79+ bscripter . logger . warn ( "Load file failed. Server responded with status code " + xhr . status + "." ) ;
6280 }
6381 } ;
6482 xhr . open ( "GET" , filename , true ) ;
6583 xhr . send ( ) ;
6684 }
6785 $ ( "debug-basic" ) . addEventListener ( "click" , function ( ) {
68- fetchFile ( "manzoku.biliscript" ) ;
86+ fetchFile ( "../../tests/scripting/ manzoku.biliscript" ) ;
6987 } ) ;
7088 $ ( "debug-svg-madoka" ) . addEventListener ( "click" , function ( ) {
71- fetchFile ( "madoka.biliscript" ) ;
89+ fetchFile ( "../../tests/scripting/ madoka.biliscript" ) ;
7290 } ) ;
7391 $ ( "debug-svg" ) . addEventListener ( "click" , function ( ) {
74- fetchFile ( "greendam.biliscript" ) ;
92+ fetchFile ( "../../tests/scripting/ greendam.biliscript" ) ;
7593 } ) ;
7694 $ ( "debug-3dsphere" ) . addEventListener ( "click" , function ( ) {
77- fetchFile ( "3dsphere.biliscript" ) ;
95+ fetchFile ( "../../tests/scripting/3dsphere.biliscript" ) ;
96+ } ) ;
97+ $ ( "debug-custom" ) . addEventListener ( "click" , function ( ) {
98+ var file = prompt ( "Please input test file name:" ) ;
99+ if ( file !== null && file !== "" ) {
100+ fetchFile ( "../../tests/scripting/" + file ) ;
101+ }
78102 } ) ;
79103 $ ( "debug-clear" ) . addEventListener ( "click" , function ( ) {
80104 //bscripter.clear();
0 commit comments