links support

This commit is contained in:
Rodolphe Breard 2013-01-28 13:25:17 +01:00
parent cd12e722c8
commit d3acfd4a16

View file

@ -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 += '<span class="chat-timestamp">' + this.formatInteger(dt.getHours(), 2) + ':' + this.formatInteger(dt.getMinutes(), 2) + ':' + this.formatInteger(dt.getSeconds(), 2) + '</span><div class="chat-message-body">';
@ -168,7 +168,8 @@ Nsui.prototype.formatMessage = function(msg) {
fmt += '<span class="spk-me">' + document.getElementById('login').value + ': </span>';
}
fmt += this.sanitizeText(msg.message) + '</div>';
fmt += this.sanitizeText(msg.message).replace(lnk_exp, '<a href="$1" target="_blank">$1</a>');
fmt += '</div>';
return fmt;
};