Skip to content

Commit da225a3

Browse files
committed
Added docs updated and fix some demo-related files
1 parent 0319e51 commit da225a3

11 files changed

Lines changed: 284 additions & 195 deletions

File tree

demo/scripting/index.htm

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,14 @@
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta http-equiv="X-UA-Compatible" value="IE=9">
66
<title>CommentCoreLibrary - Bilibili Compatible Scripting Playground</title>
7-
<style>
8-
.left-area{width:48%; position:absolute; top:70px; left:10px; bottom: 200px;}
9-
#playerdiv{width:48%; position:absolute; top:70px; bottom: 200px; right:10px;}
10-
#player{
11-
border:1px solid #f88;
12-
width:100%;
13-
top:0; bottom:10px; left: 0px; right:0px;
14-
background-color:#100;
15-
position:absolute;
16-
}
17-
#output{
18-
font-family:Consolas, 'Courier New', monospace; font-size:12px;padding:10px; background:#000;
19-
position:fixed; bottom:0; left:0; right:0; height:150px; overflow:auto; color:#ccc;border-top:1px dotted #fff;
20-
}
21-
.code-input {
22-
position:absolute;
23-
width:100%;
24-
height:auto;
25-
top:40px; bottom:10px; left:0; right:0;
26-
display:block; border:1px solid #f88;
27-
padding:10px;background:#000;color:#f88;font-size:20px;
28-
}
29-
.blue .code-input{
30-
border:1px solid #88f;color:#88f;background:#113;
31-
}
32-
.s-button, .button{
33-
display:block; border:1px solid #f88; padding:8px 6px 8px 6px;
34-
background:#000; color:#f88; float:left;
35-
-moz-user-select: none;
36-
-khtml-user-select: none;
37-
-webkit-user-select: none;
38-
-o-user-select: none;
39-
user-select: none;
40-
cursor:default;
41-
}
42-
.s-button:hover,.button:hover{background:#f88; color:#000;}
43-
.blue .s-button, .blue .button{ border:1px solid #88f;color:#88f;}
44-
.blue .s-button:hover,.blue .button:hover{background:#88f; color:#000;}
45-
.button{font-size:12px;z-index:99;}
46-
47-
pre{margin:0;}
48-
pre.error{color:#f00;}
49-
pre.warning{color:#FFC500;}
50-
</style>
7+
<!-- Stylesheets for the sandbox -->
8+
<link rel="stylesheet" href="sandbox-style.css" />
519
<link rel="stylesheet" href="../../dist/css/style.css" />
5210
<script src="../../dist/scripting/Host.js" type="text/javascript"></script>
5311
<script src="sandbox.js" type="text/javascript" ></script>
5412
</head>
55-
<body style="background:#000;">
56-
<h2 style="color:#fff">CCL Scripting Demo</h2>
13+
<body>
14+
<h2>CCL Scripting Demo</h2>
5715
<div id="codediv" class="left-area">
5816
<div style="clear:both;overflow:auto;width:110%;">
5917
<button class="s-button" id="evaluate-worker">Execute</button>

demo/scripting/sandbox-style.css

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
body {
2+
background-color: #000;
3+
color: #FFF;
4+
}
5+
6+
.left-area {
7+
width: 48%;
8+
position: absolute;
9+
top: 70px;
10+
left: 10px;
11+
bottom: 200px;
12+
}
13+
14+
#playerdiv {
15+
width: 48%;
16+
position: absolute;
17+
top: 70px;
18+
right:10px;
19+
bottom: 200px;
20+
}
21+
22+
#player{
23+
border:1px solid #f88;
24+
width:100%;
25+
top:0; bottom:10px; left: 0px; right:0px;
26+
background-color:#100;
27+
position:absolute;
28+
}
29+
#output{
30+
font-family:Consolas, 'Courier New', monospace; font-size:12px;padding:10px; background:#000;
31+
position:fixed; bottom:0; left:0; right:0; height:150px; overflow:auto; color:#ccc;border-top:1px dotted #fff;
32+
}
33+
.code-input {
34+
position:absolute;
35+
width:100%;
36+
height:auto;
37+
top:40px; bottom:10px; left:0; right:0;
38+
display:block; border:1px solid #f88;
39+
padding:10px;background:#000;color:#f88;font-size:20px;
40+
}
41+
.blue .code-input{
42+
border:1px solid #88f;color:#88f;background:#113;
43+
}
44+
.s-button, .button{
45+
display:block; border:1px solid #f88; padding:8px 6px 8px 6px;
46+
background:#000; color:#f88; float:left;
47+
-moz-user-select: none;
48+
-khtml-user-select: none;
49+
-webkit-user-select: none;
50+
-o-user-select: none;
51+
user-select: none;
52+
cursor:default;
53+
}
54+
.s-button:hover,.button:hover{background:#f88; color:#000;}
55+
.blue .s-button, .blue .button{ border:1px solid #88f;color:#88f;}
56+
.blue .s-button:hover,.blue .button:hover{background:#88f; color:#000;}
57+
.button{font-size:12px;z-index:99;}
58+
59+
pre{margin:0;}
60+
pre.error{color:#f00;}
61+
pre.warning{color:#FFC500;}

demo/scripting/sandbox.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
var $ = function(e){return window.document.getElementById(e);}
2+
var _e = function(text) { return text.replace('&', '&amp;').replace('<', '&lt;');}
23
window.addEventListener('load',function(){
34
window.bscripter = new CCLScripting("../../dist/scripting/Worker.js");
45
bscripter.logger = new function(){
56
this.log = function(t){
6-
$("output").innerHTML = "<pre>" + t.toString() + "</pre>" + $("output").innerHTML;
7+
$("output").innerHTML = "<pre>" + _e(t.toString()) + "</pre>" + $("output").innerHTML;
78
};
89
this.error = function(t){
9-
$("output").innerHTML = "<pre class='error'>" + t.toString() + "</pre>" + $("output").innerHTML;
10+
$("output").innerHTML = "<pre class='error'>" + _e(t.toString()) + "</pre>" + $("output").innerHTML;
1011
};
1112
this.warn = function(t){
12-
$("output").innerHTML = "<pre class='warning'>" + t.toString() + "</pre>" + $("output").innerHTML;
13+
$("output").innerHTML = "<pre class='warning'>" + _e(t.toString()) + "</pre>" + $("output").innerHTML;
1314
};
1415
};
1516
window.sandbox = bscripter.getSandbox($("player"));

0 commit comments

Comments
 (0)