From 0dc1dc7957ba4a3361b42b92acb8ed4055ff5e66 Mon Sep 17 00:00:00 2001 From: Darren Date: Sun, 6 Nov 2011 16:49:44 +0000 Subject: [PATCH] Nicklist faulty clickHandler fixed No idea why it's fixed.. but a small cleanup seems to have done it :/ --- client/js/front.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/client/js/front.js b/client/js/front.js index e5ab3e7..eaf2019 100644 --- a/client/js/front.js +++ b/client/js/front.js @@ -987,26 +987,30 @@ UserList.prototype.setWidth = function (newWidth) { */ UserList.prototype.clickHandler = function () { var li = $(this).parent(), - user = li.data('user'); - + user = li.data('user'), + userbox; + // Remove any existing userboxes $('#kiwi .userbox').remove(); - if ($(li).data('userbox') === this) { - $(li).removeData('userbox'); + if (li.data('userbox') === true) { + // This li already has the userbox, show remove it instead + li.removeData('userbox'); + } else { - $('#tmpl_user_box').tmpl({nick: user.nick}).appendTo(li); + // We don't have a userbox so create one + userbox = $('#tmpl_user_box').tmpl({nick: user.nick}).appendTo(li); - $('#kiwi .userbox .userbox_query').click(function (ev) { + $('.userbox_query', userbox).click(function (ev) { var nick = $('#kiwi .userbox_nick').val(); kiwi.front.run('/query ' + nick); }); - $('#kiwi .userbox .userbox_whois').click(function (ev) { + $('.userbox_whois', userbox).click(function (ev) { var nick = $('#kiwi .userbox_nick').val(); kiwi.front.run('/whois ' + nick); }); - $(li).data('userbox', this); + li.data('userbox', true); } }; -- 2.25.1