mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-26 08:56:36 +00:00
js/lex.js: encode to mIRC more efficiently.
js/lex.js: remove unused fgOnly.
This commit is contained in:
parent
7e264f8a8b
commit
86e849b122
25
js/lex.js
25
js/lex.js
@ -47,17 +47,24 @@ Lex.prototype.sanitize = function(){
|
|||||||
default: return this.char
|
default: return this.char
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var fgOnly = false
|
var lastBg = -1, lastFg = -1
|
||||||
Lex.prototype.mirc = function(){
|
Lex.prototype.mirc = function(){
|
||||||
var char = this.char || " "
|
var char = this.char || " "
|
||||||
if (fgOnly) {
|
var charIsNaN = isNaN(parseInt(char))
|
||||||
return "\x03" + (this.fg&15) + char
|
if ((lastBg == this.fg) && (lastFg == this.bg)) {
|
||||||
}
|
lastBg = this.bg; lastFg = this.fg
|
||||||
if ((this.bg&15) < 10 && ! isNaN(parseInt(char))) {
|
return "\x16" + char
|
||||||
return "\x03" + (this.fg&15) + ",0" + (this.bg&15) + char
|
} else if ((lastBg != this.bg) && (lastFg != this.fg)) {
|
||||||
}
|
lastBg = this.bg; lastFg = this.fg
|
||||||
else {
|
return "\x03" + (this.fg&15) + "," + ((this.bg&15) < 10 && !charIsNaN ? "0" : "") + (this.bg&15) + char
|
||||||
return "\x03" + (this.fg&15) + "," + (this.bg&15) + char
|
} else if ((lastBg != this.bg) && (lastFg == this.fg)) {
|
||||||
|
lastBg = this.bg
|
||||||
|
return "\x03," + ((this.bg&15) < 10 && !charIsNaN ? "0" : "") + (this.bg&15) + char
|
||||||
|
} else if ((lastBg == this.bg) && (lastFg != this.fg)) {
|
||||||
|
lastFg = this.fg
|
||||||
|
return "\x03" + ((this.fg&15) < 10 && !charIsNaN ? "0" : "") + (this.fg&15) + char
|
||||||
|
} else {
|
||||||
|
return "\x03" + "0,1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Lex.prototype.ansi = function(){
|
Lex.prototype.ansi = function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user