From: Darren Date: Sun, 2 Sep 2012 18:29:34 +0000 (+0100) Subject: Clickable links X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4c925907ba07a674e035ca9e01fe56db6842ef61;p=KiwiIRC.git Clickable links --- diff --git a/client_backbone/dev/view.js b/client_backbone/dev/view.js index f18866d..eb5528b 100644 --- a/client_backbone/dev/view.js +++ b/client_backbone/dev/view.js @@ -185,6 +185,19 @@ kiwi.view.Panel = Backbone.View.extend({ }); + // Make links clickable + msg.msg = msg.msg.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]*))?/gi, function (url) { + var nice; + + nice = url; + if (nice.length > 100) { + nice = nice.substr(0, 100) + '...'; + } + + return '' + nice + ''; + }); + + // Convert IRC formatting into HTML formatting msg.msg = formatIRCMsg(msg.msg);