From f8024bbf2b646df20056c1d9683b971f1c9d1168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 11 Dec 2011 13:01:35 +0100 Subject: [PATCH] Adding insertText method --- file/js/TimWolla.WCF.Chat.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/file/js/TimWolla.WCF.Chat.js b/file/js/TimWolla.WCF.Chat.js index a6d56d2..07b12f3 100644 --- a/file/js/TimWolla.WCF.Chat.js +++ b/file/js/TimWolla.WCF.Chat.js @@ -18,9 +18,9 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {}; this.bindEvents(); }, bindEvents: function () { - $('.smiley').click(function (event) { - alert($(event.target).attr('alt')); - }); + $('.smiley').click($.proxy(function (event) { + this.insertText($(event.target).attr('alt')); + }, this)); // $(window).bind('beforeunload', function() { // return false; @@ -116,10 +116,14 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {}; } $('.chatMessage').animate({scrollTop: $('.chatMessage ul').height()}, 10000); }, + insertText: function (text) { + // TODO: Add options here + $('#chatInput').val(text); + }, toggleUserMenu: function (target) { liUserID = '#' + target.parent().attr('id'); if ($(liUserID).hasClass('activeMenuItem')) { - $(liUserID + ' .chatUserMenu').wcfBlindOut('vertical', function() { + $(liUserID + ' .chatUserMenu').wcfBlindOut('vertical', function () { $(liUserID).removeClass('activeMenuItem'); }); }