]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/ui/colour.js
3bd29ea51990425b7dd82cacc52b08cdd009a74a
1 function Colourise(line
, entity
) {
8 var xline
= line
.split("");
9 var element
= document
.createElement("span");
11 entity
.addClass("colourline");
14 return x
>= '0' && x
<= '9';
17 function parseColours(xline
, i
) {
18 if(!isNum(xline
[i
+ 1])) {
24 if(isNum(xline
[i
+ 1])) {
25 fg
= parseInt(xline
[i
] + xline
[i
+ 1]);
28 fg
= parseInt(xline
[i
]);
30 if(xline
[i
+ 1] != ",")
32 if(!isNum(xline
[i
+ 2]))
36 if(isNum(xline
[i
+ 1])) {
37 bg
= parseInt(xline
[i
] + xline
[i
+ 1]);
40 bg
= parseInt(xline
[i
]);
45 function emitEndToken() {
47 element
.appendChild(document
.createTextNode(out
.join("")));
48 entity
.appendChild(element
);
51 element
= document
.createElement("span");
53 function emitStartToken() {
56 classes
.push("Xc" + fg
);
58 classes
.push("Xbc" + bg
);
63 element
.className
= classes
.join(" ");
66 for(i
=0;i
<xline
.length
;i
++) {
74 } else if(lc
== "\x1F") {
77 underline
= !underline
;
80 } else if(lc
== "\x0F") {
87 } else if(lc
== "\x03") {
90 i
= parseColours(xline
, i
);