Improved link detection
authorDarren <darren@darrenwhitlen.com>
Sun, 2 Sep 2012 18:51:22 +0000 (19:51 +0100)
committerDarren <darren@darrenwhitlen.com>
Sun, 2 Sep 2012 18:51:22 +0000 (19:51 +0100)
client_backbone/dev/view.js

index eb5528b4d26fa0a6c8c5fdfa11e683ff8d807eb8..8e24ca754df0d08b4ff6b3f0ddfc51a461ca7499 100644 (file)
@@ -189,6 +189,11 @@ kiwi.view.Panel = Backbone.View.extend({
         msg.msg = msg.msg.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]*))?/gi, function (url) {\r
             var nice;\r
 \r
+            // Add the http is no protoocol was found\r
+            if (url.match(/^www\./)) {\r
+                url = 'http://' + url;\r
+            }\r
+\r
             nice = url;\r
             if (nice.length > 100) {\r
                 nice = nice.substr(0, 100) + '...';\r