1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2025-01-10 00:30:09 +00:00

Adding options-object for insertText

This commit is contained in:
Tim Düsterhus 2011-12-12 16:16:24 +01:00
parent 1d8b96aefc
commit c7d867905f

View File

@ -114,10 +114,18 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
} }
$('.chatMessageContainer').animate({scrollTop: $('.chatMessageContainer ul').height()}, 10000); $('.chatMessageContainer').animate({scrollTop: $('.chatMessageContainer ul').height()}, 10000);
}, },
insertText: function (text) { insertText: function (text, options) {
// TODO: Add options here options = $.extend({
var input = $('#chatInput'); append: true,
input.val(input.val() + ' ' + text + ' '); submit: false
}, options || {});
if (options.append) {
text = $('#chatInput').val() + text;
}
$('#chatInput').val(text);
if (options.submit) $('#chatForm').submit();
}, },
toggleUserMenu: function (target) { toggleUserMenu: function (target) {
liUserID = '#' + target.parent().parent().attr('id'); liUserID = '#' + target.parent().parent().attr('id');