mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Optimizing our JavaScript
This commit is contained in:
parent
e7e8457ca5
commit
d20fd79ece
@ -47,24 +47,30 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
|
||||
type: 'POST',
|
||||
success: $.proxy(function (data, textStatus, jqXHR) {
|
||||
this.loading = false;
|
||||
$('#loading-' + target.attr('id')).remove();
|
||||
target.css({
|
||||
'float' : 'none',
|
||||
'padding' : '5px 25px 7px 35px',
|
||||
'width' : '',
|
||||
'overflow' : 'visible'
|
||||
});
|
||||
})
|
||||
.siblings('.ajaxLoad')
|
||||
.remove();
|
||||
|
||||
// mark as active;
|
||||
$('.activeMenuItem .chatRoom').parent().removeClass('activeMenuItem');
|
||||
target.parent().addClass('activeMenuItem');
|
||||
|
||||
// set new topic
|
||||
if (data.topic == '') {
|
||||
if(data.topic == '' && $('#topic').text().trim() == '') return;
|
||||
if (data.topic == '' && $('#topic').text().trim() == '') return;
|
||||
|
||||
$('#topic').wcfBlindOut('vertical', function() {
|
||||
$(this).text('');
|
||||
});
|
||||
} else {
|
||||
if($('#topic').text().trim() != '') {
|
||||
$('#topic').text(data.topic);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if ($('#topic').text().trim() != '') $('#topic').text(data.topic);
|
||||
else {
|
||||
$('#topic').text(data.topic);
|
||||
$('#topic').wcfBlindIn();
|
||||
}
|
||||
@ -74,32 +80,30 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
|
||||
$('title').text(this.titleTemplate.fetch(data));
|
||||
}, this),
|
||||
beforeSend: $.proxy(function () {
|
||||
if(this.loading == true || target.parent().attr('class') == "activeMenuItem") return false;
|
||||
|
||||
// mark as active;
|
||||
$('.activeMenuItem .chatRoom').parent().removeClass('activeMenuItem');
|
||||
target.parent().addClass('activeMenuItem');
|
||||
if (this.loading || target.parent().hasClass('activeMenuItem')) return false;
|
||||
|
||||
this.loading = true;
|
||||
//target.append('<img id="loading-' + target.attr('id') + '" src="' + WCF.Icon.get('wcf.global.spinner') + '" />');
|
||||
|
||||
target.css({
|
||||
'width' : target.width() - 19,
|
||||
'float' : 'left',
|
||||
'padding' : '5px 0 7px 35px',
|
||||
'overflow': 'hidden'
|
||||
});
|
||||
target.parent().append('<img id="loading-' + target.attr('id') + '" class="ajaxLoad" src="' + RELATIVE_WCF_DIR + 'icon/spinner1.svg" alt="" />');
|
||||
$('#loading-' + target.attr('id')).css({'marginTop' : function(index) {return (target.parent().height() / 2) - ($(this).height() / 2)}});
|
||||
})
|
||||
.parent()
|
||||
.append('<img class="ajaxLoad" src="' + RELATIVE_WCF_DIR + 'icon/spinner1.svg" alt="" />')
|
||||
.css({'marginTop' : function(index) {return (target.parent().height() / 2) - ($(this).height() / 2)}});
|
||||
}, this)
|
||||
});
|
||||
},
|
||||
toggleUserMenu: function(target) {
|
||||
liUserID = '#' + target.parent().attr('id');
|
||||
if($(liUserID).hasClass('activeMenuItem')) {
|
||||
if ($(liUserID).hasClass('activeMenuItem')) {
|
||||
$(liUserID + ' .chatUserMenu').wcfBlindOut('vertical', function() {
|
||||
$(liUserID).removeClass('activeMenuItem');
|
||||
});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$(liUserID).addClass('activeMenuItem');
|
||||
$(liUserID + ' .chatUserMenu').wcfBlindIn();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user