Skip to content

Commit 0e9a848

Browse files
committed
Added font alias css. Now Test7 is very good
1 parent 42ee86f commit 0e9a848

File tree

11 files changed

+104
-17
lines changed

11 files changed

+104
-17
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ ifneq ($(ACSRC),)
3333
endif
3434

3535
css:
36-
cp src/base.css build/base.css
36+
cp src/base.css build/base.css
37+
cp src/fontalias.css build/fontalias.css
38+
cat build/base.css build/fontalias.css > build/style.css
39+
rm -f build/base.css
40+
rm -f build/fontalias.css
3741

3842
concat-only: $(BUILD_MINIFY)
3943
cat $^ > build/CommentCoreLibrary.tmp

build/base.css renamed to build/style.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,18 @@ div.abp{
4141
.cmt.rshadow{
4242
text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white !important;
4343
}
44+
/** Here because some UP-ers use chinese font names, and some of us are on Linux **/
45+
@font-face{
46+
font-family: "\9ED1\4F53";
47+
src:local('SimHei');
48+
}
49+
50+
@font-face{
51+
font-family: "\5B8B\4F53";
52+
src:local('SimSun');
53+
}
54+
55+
@font-face{
56+
font-family: "\5E7C\5706";
57+
src:local('YouYuan');
58+
}

demo/index.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta http-equiv="X-UA-Compatible" value="IE=9">
66
<link rel="stylesheet" href="default.css" />
7-
<link rel="stylesheet" href="../build/base.css" />
7+
<link rel="stylesheet" href="../build/style.css" />
88
<!-- Run 'make' to build the file -->
99
<script src="../build/CommentCoreLibrary.js"></script>
1010

experimental/scripting/ccl.htm

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta http-equiv="X-UA-Compatible" value="IE=9">
66
<link rel="stylesheet" href="../../demo/default.css" />
7-
<link rel="stylesheet" href="../../build/base.css" />
8-
<link rel="stylesheet" href="fontalias.css" />
7+
<link rel="stylesheet" href="../../build/style.css" />
98
<!-- Run 'make' to build the file -->
109
<script src="../../build/CommentCoreLibrary.js"></script>
1110

@@ -18,16 +17,25 @@
1817
<title>Testrun Sandbox For CCL /w Scripting Enabled</title>
1918
</head>
2019
<body>
21-
<div class="m20 abp" id="player">
22-
<div id="commentCanvas" class="container"></div>
23-
<video id="abpVideo" autobuffer="true" data-setup="{}" width="100%" height="100%" style="z-index:-1;width:100%;height:100%;top:0;left:0;right:0;bottom:0;" preload="auto">
24-
</video>
20+
<div id="player-unit" style="width:540px;">
21+
<div class="m20 abp" id="player" style="height:384px;">
22+
<div id="commentCanvas" class="container"></div>
23+
<video id="abpVideo" autobuffer="true" data-setup="{}" width="100%" height="100%" style="z-index:-1;width:100%;height:100%;top:0;left:0;right:0;bottom:0;" preload="auto">
24+
</video>
25+
</div>
26+
<div class="controls">
27+
<a class="button" onclick="stop();" href="javascript:;">Stop</a>
28+
<a class="button" onclick="resume();" href="javascript:;">Resume</a>
29+
<div style="clear:both;"></div>
30+
<div>
31+
<h2>Tests</h2>
32+
<div class="controls">
33+
<a class="button" onclick="load('../../tests/kanpai.xml');" href="javascript:;">Run Scripting 1 (Pure)</a>
34+
<a class="button" onclick="load('../../tests/tsubasa.xml');" href="javascript:;">Run Scripting 2 (Mixed)</a>
35+
<div style="clear:both;"></div>
36+
</div>
37+
<div style="clear:both;"></div>
2538
</div>
26-
<a onclick="stop();" href="javascript:;">Stop</a>
27-
<a onclick="resume();" href="javascript:;">Resume</a>
28-
<a onclick="load('../../tests/kanpai.xml');" href="javascript:;">Run Scripting 1 (Pure)</a>
29-
<a onclick="load('../../tests/tsubasa.xml');" href="javascript:;">Run Scripting 2 (Mixed)</a>
30-
3139
<p>Scripting: <a href="../../demo/">&larr; Back to main test</a> </p>
3240
<script>
3341
var isWindowedFullscreen = false;

src/fontalias.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/** Here because some UP-ers use chinese font names, and some of us are on Linux **/
2+
@font-face{
3+
font-family: "\9ED1\4F53";
4+
src:local('SimHei');
5+
}
6+
7+
@font-face{
8+
font-family: "\5B8B\4F53";
9+
src:local('SimSun');
10+
}
11+
12+
@font-face{
13+
font-family: "\5E7C\5706";
14+
src:local('YouYuan');
15+
}

src/scripting/Host.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@ var CCLScripting = function(workerUrl){
342342
this.setX(data.x);
343343
this.setY(data.y);
344344

345+
/** Other **/
346+
this.setText = function(text){
347+
this.DOM.innerHTML = "";
348+
this.DOM.appendChild(_("text",text));
349+
};
350+
345351
this.setFilters = function(params){
346352
for(var i = 0; i < params[0].length; i++){
347353
var filter = params[0][i];

src/scripting/api/Display.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ var $ = new function(){
338338
});
339339

340340
this.__defineSetter__("x", function(x){
341+
data.x = x;
341342
__pchannel("Runtime:CallMethod", {
342343
"id":id,
343344
"method":"setX",
@@ -346,13 +347,27 @@ var $ = new function(){
346347
});
347348

348349
this.__defineSetter__("y", function(y){
350+
data.y = y;
349351
__pchannel("Runtime:CallMethod", {
350352
"id":id,
351353
"method":"setY",
352354
"params":y
353355
});
354356
});
355357
}
358+
if(this.__defineGetter__){
359+
this.__defineGetter__("filters", function(){
360+
return [];
361+
});
362+
363+
this.__defineGetter__("x", function(){
364+
return data.x;
365+
});
366+
367+
this.__defineGetter__("y", function(){
368+
return data.y;
369+
});
370+
}
356371
// Life time monitor
357372
if(data.lifeTime){
358373
var self = this;
@@ -539,6 +554,10 @@ var $ = new function(){
539554
"params":fmt.serialize()
540555
});
541556
};
557+
558+
this.setText = function(text){
559+
this.text = text;
560+
};
542561
// Life time monitor
543562
if(data.lifeTime){
544563
var self = this;

src/scripting/api/Runtime.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var Runtime = new function(){
22
function MetaObject (nm, callback){
3+
this.unload = function(){};
34
this.dispatchEvent = function(event, data){
45
if(callback){
56
callback(event, data);
@@ -86,7 +87,12 @@ var Runtime = new function(){
8687
};
8788

8889
this.clear = function(){
89-
__achannel("Runtime::clear", "::Runtime", msg);
90+
for(var i in registeredObjects){
91+
if(registeredObjects[i].unload){
92+
registeredObjects[i].unload();
93+
}
94+
};
95+
__achannel("Runtime::clear", "::Runtime", {});
9096
};
9197

9298
this.crash = function(){

src/scripting/api/ScriptManager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var ScriptManager = new function(){
22
this.clearTimer = function(){
33
Runtime.deregisterAllListeners("__self");
4+
Utils.clearTimers();
45
};
56

67
this.clearEL = function(){

src/scripting/api/Utils.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,20 @@ var Utils = new function(){
9090
}
9191
};
9292

93+
/** Allow the scripting global timer to be halted **/
94+
__schannel("Utils:Timer", function(pld){
95+
if(pld.action === "halt"){
96+
stopMasterTimer();
97+
}else if(pld.action === "resume"){
98+
startMasterTimer();
99+
}
100+
});
101+
102+
this.clearTimers = function(){
103+
__timers = [];
104+
stopMasterTimer();
105+
};
106+
/** Utils **/
93107
this.rgb = function(r,g,b){
94108
return (r * 256 * 256 + g * 256 + b);
95109
};

0 commit comments

Comments
 (0)