From ee733a92d317f37e3bd72002de10d5ddac9010c4 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 22 Nov 2014 20:53:43 -0500 Subject: no undefined plz --- js/lex.js | 5 ++++- js/matrix.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/lex.js b/js/lex.js index 17884d1..cf7c655 100644 --- a/js/lex.js +++ b/js/lex.js @@ -25,8 +25,11 @@ Lex.prototype.read = function(){ this.char = this.span.innerHTML return this.char } +Lex.prototype.sanitize = function(){ + return this.char == "%" ? '%%' : this.char || " " +} Lex.prototype.irc = function(){ - var char = this.char == "%" ? '%%' : this.char || " " + var char = this.sanitize() if (this.bg == 1 && this.fg == 0) { return char } diff --git a/js/matrix.js b/js/matrix.js index 7549113..1a39742 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -88,7 +88,7 @@ Matrix.prototype.ascii = function () { var last, line = "" row.forEach(function(lex, x) { if (lex.eq(last)) { - line += lex.char + line += lex.sanitize() } else { if (x > 0 && last && (last.bg != 1 || last.fg != 0)) line += "\\x03" -- cgit v1.2.3-70-g09d2