Skip to content

Commit 797dfdf

Browse files
committed
Fixed text wrapping issues in chrome+firefox. Regression introduced with nowrap
1 parent 0c3f430 commit 797dfdf

File tree

7 files changed

+17
-6292
lines changed

7 files changed

+17
-6292
lines changed

build/CommentCoreLibrary.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/base.css

+1-10
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ div.abp{
2222
padding:3px 0 0 0;margin:0;
2323
line-height:100%;
2424
font-family:Simhei,Simsun,Heiti,"MS Mincho","Meiryo","Microsoft Yahei",monospace;
25-
font-weight:bold;
2625
text-decoration:none;
2726
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
2827
color:#fff;
@@ -33,7 +32,7 @@ div.abp{
3332
text-wrap:none;
3433
-webkit-text-size-adjust: none;
3534
text-size-adjust: none;
36-
white-space: nowrap;
35+
white-space: pre;
3736
}
3837
.cmt.noshadow{
3938
text-shadow: none !important;
@@ -42,11 +41,3 @@ div.abp{
4241
.cmt.rshadow{
4342
text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white !important;
4443
}
45-
.webkit-helper{
46-
text-shadow: none;
47-
-webkit-text-stroke: 0.2px black;
48-
font-weight:bold;
49-
}
50-
.webkit-helper.rshadow{
51-
-webkit-text-stroke: 0.2px white !important;
52-
}

demo/libxml.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ function CommentLoader(url,xcm,mode){
3131
}
3232
}
3333
}
34-
}
34+
}
35+
/*************************
36+
* Tiny Shorthand
37+
**************************/
38+
$ = function(a){return document.getElementById(a);};

docs/CommentProperties.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* pool 弹幕池编号
1515
* hash 作者哈希
1616
* border 是否有边框
17+
* hold 暂停弹幕
1718
* duration 生命周期
1819
* x 横坐标
1920
* y 纵坐标
@@ -69,6 +70,10 @@
6970
类型限制:无
7071
弹幕的边框,类型为布尔值,默认为false,最好携带此参数,发送新弹幕的弹幕,默认此值为true。为true时,生成的弹幕对象外围将被蓝色的边框框住。
7172

73+
### hold
74+
类型限制:无
75+
如果此值是true则暂停弹幕不动
76+
7277
### duration
7378
类型限制:mode > 6
7479
弹幕生存时间,为微秒计时,决定多少秒后高级/定位弹幕被移除舞台。
@@ -106,4 +111,4 @@
106111

107112
### font
108113
类型限制:无
109-
设定弹幕渲染字体(如果为空,则使用默认字体)。
114+
设定弹幕渲染字体(如果为空,则使用默认字体)。

src/CommentCoreLibrary.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@
33
* Author : Jim Chen
44
* Licensing : MIT License
55
******/
6-
$ = function(a){return document.getElementById(a);};
7-
var ABGlobal = {
8-
is_webkit:function(){
9-
try{
10-
if(/webkit/.test( navigator.userAgent.toLowerCase())) return true;
11-
}catch(e){return false;}
12-
return false;
13-
}
14-
};
156
Array.prototype.remove = function(obj){
167
for(var a = 0; a < this.length;a++)
178
if(this[a] == obj){
@@ -72,7 +63,6 @@ function CommentManager(stageObject){
7263
/** Private **/
7364
this.initCmt = function(cmt,data){
7465
cmt.className = 'cmt';
75-
if(ABGlobal.is_webkit() && data.mode < 7) cmt.className+=" webkit-helper";
7666
cmt.stime = data.stime;
7767
cmt.mode = data.mode;
7868
cmt.data = data;
@@ -287,6 +277,9 @@ CommentManager.prototype.finish = function(cmt){
287277
CommentManager.prototype.onTimerEvent = function(timePassed,cmObj){
288278
for(var i=0;i<cmObj.runline.length;i++){
289279
var cmt = cmObj.runline[i];
280+
if(cmt.hold){
281+
continue;
282+
}
290283
cmt.ttl -= timePassed;
291284
if(cmt.mode == 1 || cmt.mode == 2) cmt.style.left = (cmt.ttl / cmt.dur) * (cmObj.stage.width + cmt.w) - cmt.w + "px";
292285
else if(cmt.mode == 6) cmt.style.left = (1 - cmt.ttl / cmt.dur) * (cmObj.stage.width + cmt.w) - cmt.w + "px";

src/base.css

+1-10
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ div.abp{
2222
padding:3px 0 0 0;margin:0;
2323
line-height:100%;
2424
font-family:Simhei,Simsun,Heiti,"MS Mincho","Meiryo","Microsoft Yahei",monospace;
25-
font-weight:bold;
2625
text-decoration:none;
2726
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
2827
color:#fff;
@@ -33,7 +32,7 @@ div.abp{
3332
text-wrap:none;
3433
-webkit-text-size-adjust: none;
3534
text-size-adjust: none;
36-
white-space: nowrap;
35+
white-space: pre;
3736
}
3837
.cmt.noshadow{
3938
text-shadow: none !important;
@@ -42,11 +41,3 @@ div.abp{
4241
.cmt.rshadow{
4342
text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white !important;
4443
}
45-
.webkit-helper{
46-
text-shadow: none;
47-
-webkit-text-stroke: 0.2px black;
48-
font-weight:bold;
49-
}
50-
.webkit-helper.rshadow{
51-
-webkit-text-stroke: 0.2px white !important;
52-
}

0 commit comments

Comments
 (0)