From 9545f3430ea4d528db5c347f0fa29426a68ae4cd Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Thu, 21 Jul 2011 00:51:40 +0100 Subject: [PATCH] Fix issue #6 (Clickable channel names) - double-click channel names to /join them --- index.php | 1 + js/front.js | 6 ++++++ node/client/index.html.jade | 1 + 3 files changed, 8 insertions(+) diff --git a/index.php b/index.php index a2a6507..a42c922 100644 --- a/index.php +++ b/index.php @@ -94,6 +94,7 @@ return false; }); $('a.connect').click(function(){ $('.formconnectwindow').submit(); return false; }); + $('a.chan').live('dblclick', function() { front.joinChannel($(this).text()); }); } diff --git a/js/front.js b/js/front.js index 1f013ba..0dfdd74 100644 --- a/js/front.js +++ b/js/front.js @@ -1010,7 +1010,13 @@ tabview.prototype.addMsg = function(time, nick, msg, type, style){ if(next == '') msg =+ ''; } + var re = '\\B(#[^ ,\\007]+)'; + re = new RegExp(re, 'g'); + msg = msg.replace(re, function(match) { + return '' + match + ''; + }); + var line_msg = $('
'+time+'
'+html_nick+'
'+msg+'
'); this.div.append(line_msg); diff --git a/node/client/index.html.jade b/node/client/index.html.jade index ff5713a..3e5d246 100644 --- a/node/client/index.html.jade +++ b/node/client/index.html.jade @@ -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()); }); } -- 2.25.1