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

Fix ajaxLoad onSubmit

This commit is contained in:
Tim Düsterhus 2011-12-18 15:33:47 +01:00
parent 9f563de4e8
commit 0bf39ff7a4
2 changed files with 15 additions and 18 deletions

View File

@ -170,27 +170,30 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
if (options.submit) $('#chatForm').submit(); if (options.submit) $('#chatForm').submit();
else $('#chatInput').focus(); else $('#chatInput').focus();
},
refreshRoomList: function() {
$('.chatRoom').unbind('click');
}, },
submit: function (target) { submit: function (target) {
// break if input contains only whitespace // break if input contains only whitespace
if ($('#chatInput').val().trim().length === 0) return false; if ($('#chatInput').val().trim().length === 0) return false;
submitButton = target.find('input[type=image]');
$.ajax($('#chatForm').attr('action'), { $.ajax($('#chatForm').attr('action'), {
data: { data: {
text: $('#chatInput').val() text: $('#chatInput').val()
}, },
type: 'POST', type: 'POST',
beforeSend: $.proxy(function (jqXHR) { beforeSend: $.proxy(function (jqXHR) {
submitButton.addClass('ajaxLoad'); $('#chatInput').addClass('ajaxLoad');
}), }),
success: $.proxy(function (data, textStatus, jqXHR) { success: $.proxy(function (data, textStatus, jqXHR) {
this.getMessages(); this.getMessages();
$('#chatInput').val('').focus(); $('#chatInput').val('').focus();
}, this), }, this),
complete: function() { complete: function() {
submitButton.removeClass('ajaxLoad'); $('#chatInput').removeClass('ajaxLoad');
} }
}); });
}, },

View File

@ -22,10 +22,6 @@
margin-bottom: -20px !important; margin-bottom: -20px !important;
} }
#sidebar {
/*height: 450px;*/
}
aside { aside {
overflow: auto; overflow: auto;
padding: 0 1px 0 0; padding: 0 1px 0 0;
@ -73,10 +69,8 @@
} }
#chatInput { #chatInput {
background-position: right center;
background-repeat: no-repeat;
position: relative; position: relative;
z-index: 10; z-index: 10;
} }
#chatOptions { #chatOptions {
@ -192,13 +186,13 @@
.textCounter { .textCounter {
background: none repeat scroll 0 0 red; background: none repeat scroll 0 0 red;
margin-left: -5px; margin-left: -5px;
padding: 5px; padding: 5px;
position: relative; position: relative;
z-index: 0 !important; z-index: 0 !important;
border-radius: 0px 5px 5px 0px; border-radius: 0px 5px 5px 0px;
background-color: rgba(0, 0, 0, 0.7); background-color: rgba(0, 0, 0, 0.7);
border: 1px solid rgba(255, 255, 255, 0.3); border: 1px solid rgba(255, 255, 255, 0.3);
} }
.textCounter.color-1 { .textCounter.color-1 {