links support
This commit is contained in:
parent
cd12e722c8
commit
d3acfd4a16
1 changed files with 3 additions and 2 deletions
|
@ -158,7 +158,7 @@ Nsui.prototype.formatInteger = function(num, len) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Nsui.prototype.formatMessage = function(msg) {
|
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">';
|
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 += '<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;
|
return fmt;
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue