From 94870c557eab21576a0084117767cdd55dd441eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 15 Dec 2011 22:54:49 +0100 Subject: [PATCH] Made every button functional --- file/js/TimWolla.WCF.Chat.js | 17 ++++++++++++++++- template/chat.tpl | 8 ++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/file/js/TimWolla.WCF.Chat.js b/file/js/TimWolla.WCF.Chat.js index 6881004..b6d01aa 100644 --- a/file/js/TimWolla.WCF.Chat.js +++ b/file/js/TimWolla.WCF.Chat.js @@ -58,11 +58,26 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {}; this.submit($(event.target)); }, this)); - $('#chatClear').click(function () { + $('#chatClear').click(function (event) { event.preventDefault(); $('.chatMessage').remove(); $('#chatInput').focus(); }); + + $('.chatToggle').click(function (event) { + var element = $(event.target).parent(); + var icon = $('img', element); + if (element.data('status') == '1') { + element.data('status', 0); + icon.attr('src', icon.attr('src').replace(/enabled(\d?).([a-z]{3})$/, 'disabled$1.$2')); + element.attr('title', element.data('enableMessage')); + } + else { + element.data('status', 1); + icon.attr('src', icon.attr('src').replace(/disabled(\d?).([a-z]{3})$/, 'enabled$1.$2')); + element.attr('title', element.data('disableMessage')); + } + }); }, /** * Changes the chat-room. diff --git a/template/chat.tpl b/template/chat.tpl index f65b429..01cba8d 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -201,22 +201,22 @@