Fix issue #6 (Clickable channel names) - double-click channel names to /join them
authorJack Allnutt <m2ys4u@Gmail.com>
Wed, 20 Jul 2011 23:51:40 +0000 (00:51 +0100)
committerJack Allnutt <m2ys4u@Gmail.com>
Wed, 20 Jul 2011 23:55:15 +0000 (00:55 +0100)
index.php
js/front.js
node/client/index.html.jade

index a2a6507a406417f828469bc102d51c18dbc6cfe1..a42c9222af6c6d105c0bc82361848696ba987daa 100644 (file)
--- a/index.php
+++ b/index.php
@@ -94,6 +94,7 @@
             return false;\r
         });\r
         $('a.connect').click(function(){ $('.formconnectwindow').submit(); return false; });\r
+        $('a.chan').live('dblclick', function() { front.joinChannel($(this).text()); });\r
     }\r
 </script>\r
 \r
index 1f013ba847c15091be40f481cd06a0ff36052f85..0dfdd74cfb61d4257882c5168ba7d18409f3ea6c 100644 (file)
@@ -1010,7 +1010,13 @@ tabview.prototype.addMsg = function(time, nick, msg, type, style){
                if(next == '</u>') msg =+ '</u>';
        }
        
+    var re = '\\B(#[^ ,\\007]+)';
+    re = new RegExp(re, 'g');
        
+    msg = msg.replace(re, function(match) {
+        return '<a class="chan" href="#">' + match + '</a>';
+    });
+
        var line_msg = $('<div class="msg '+type+'"><div class="time">'+time+'</div><div class="nick">'+html_nick+'</div><div class="text" style="'+style+'">'+msg+' </div></div>');
        this.div.append(line_msg);
 
index ff5713ae1d75b298ca694b45d6055d7bd0c3bf6c..3e5d246dc599942f26ffa26be04c3a55ff514c67 100644 (file)
@@ -62,6 +62,7 @@ html(xmlns="http://www.w3.org/1999/xhtml", lang="en-gb")
                     return false;
                 });
                 $('a.connect').click(function(){ $('.formconnectwindow').submit(); return false; });
+                $('a.chan').live('dblclick', function() { front.joinChannel($(this).text()); });
             }