From d3acfd4a16612be1906c084da6cc03a9ddb66aeb Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Mon, 28 Jan 2013 13:25:17 +0100 Subject: [PATCH] links support --- lib/nsui.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/nsui.js b/lib/nsui.js index bdc35ae..4582351 100644 --- a/lib/nsui.js +++ b/lib/nsui.js @@ -158,7 +158,7 @@ Nsui.prototype.formatInteger = function(num, len) { }; Nsui.prototype.formatMessage = function(msg) { - var dt = new Date(), fmt = ""; + var dt = new Date(), fmt = "", lnk_exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; fmt += '' + this.formatInteger(dt.getHours(), 2) + ':' + this.formatInteger(dt.getMinutes(), 2) + ':' + this.formatInteger(dt.getSeconds(), 2) + '
'; @@ -168,7 +168,8 @@ Nsui.prototype.formatMessage = function(msg) { fmt += '' + document.getElementById('login').value + ': '; } - fmt += this.sanitizeText(msg.message) + '
'; + fmt += this.sanitizeText(msg.message).replace(lnk_exp, '$1'); + fmt += ''; return fmt; };