Skip to content

Commit

Permalink
fix RRGGBB with color=4294967295 (#20)
Browse files Browse the repository at this point in the history
* fix RRGGBB with color=4294967295

example: `<d p="51.609001159668,1,25,4294967295,1480395349,0,c029b6bc,2704017509">233</d>`
example xml: http://comment.bilibili.com/6627392.xml

* avoid ?: operators

* Update bilibili_ASS_Danmaku_Downloader.user.js

* Update bilibili_ASS_Danmaku_Downloader.user.js
  • Loading branch information
myfreeer authored and tiansh committed Nov 30, 2016
1 parent 71ab292 commit e07fb80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bilibili/bilibili_ASS_Danmaku_Downloader.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var fillStr = function (str) {
// 将颜色的数值化为十六进制字符串表示
var RRGGBB = function (color) {
var t = Number(color).toString(16).toUpperCase();
return Array(7 - t.length).join('0') + t;
return (Array(7).join('0') + t).slice(-6);
};

// 将可见度转换为透明度
Expand Down Expand Up @@ -534,7 +534,7 @@ var parseXML = function (content) {
'time': Number(info[0]),
'mode': [undefined, 'R2L', 'R2L', 'R2L', 'BOTTOM', 'TOP'][Number(info[1])],
'size': Number(info[2]),
'color': RRGGBB(Number(info[3])),
'color': RRGGBB(parseInt(info[3], 10) & 0xffffff),
'bottom': Number(info[5]) > 0,
// 'create': new Date(Number(info[4])),
// 'pool': Number(info[5]),
Expand Down

0 comments on commit e07fb80

Please sign in to comment.