Chat URLs now open in a new tab

Implement Issue#2
This commit is contained in:
calzoneman 2013-03-17 09:45:16 -05:00
parent a8076f0e15
commit 64bdbe7084

View file

@ -448,7 +448,7 @@ Channel.prototype.sendMessage = function(username, msg, msgclass) {
// I don't want HTML from strangers
msg = msg.replace(/</g, "&lt;").replace(/>/g, "&gt;");
// Match URLs
msg = msg.replace(/(((https?)|(ftp))(:\/\/[0-9a-zA-Z\.]+(:[0-9]+)?[^\s$]+))/, "<a href=\"$1\">$1</a>");
msg = msg.replace(/(((https?)|(ftp))(:\/\/[0-9a-zA-Z\.]+(:[0-9]+)?[^\s$]+))/, "<a href=\"$1\" target=\"_blank\">$1</a>");
this.sendAll('chatMsg', {
username: username,
msg: msg,