wpList = {
settings: {
- url: wpListL10n.url, type: 'POST',
+ url: ajaxurl, type: 'POST',
response: 'ajax-response',
what: '',
};
}
list.wpList.recolor();
+ $(list).trigger( 'wpListAddEnd', [ s, list.wpList ] );
wpList.clear.call(list,'#' + s.element);
};
ajaxDel: function( e, s ) {
e = $(e); s = s || {};
- var list = this, cls = wpList.parseClass(e,'delete'), element, anim;
+ var list = this, cls = wpList.parseClass(e,'delete'), element;
s = wpList.pre.call( list, e, s, 'delete' );
s.element = cls[2] || s.element || null;
if ( cls[3] ) { s.delColor = '#' + cls[3]; }
- else { s.delColor = s.delColor || '#FF3333'; }
+ else { s.delColor = s.delColor || '#faa'; }
if ( !s || !s.element ) { return false; }
);
if ( $.isFunction(s.delBefore) ) {
- s = s.delBefore( s );
+ s = s.delBefore( s, list );
if ( !s ) { return true; }
}
if ( !s.data._ajax_nonce ) { return true; }
element = $('#' + s.element);
if ( 'none' != s.delColor ) {
- anim = 'slideUp';
- if ( element.css( 'display' ).match(/table/) )
- anim = 'fadeOut'; // Can't slideup table rows and other table elements. Known jQuery bug
- element
- .animate( { backgroundColor: s.delColor }, 'fast' )[anim]( 'fast' )
- .queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+ element.css( 'backgroundColor', s.delColor ).fadeOut( 350, function(){
+ list.wpList.recolor();
+ $(list).trigger( 'wpListDelEnd', [ s, list.wpList ] );
+ });
} else {
list.wpList.recolor();
+ $(list).trigger( 'wpListDelEnd', [ s, list.wpList ] );
}
s.success = function(r) {
var res = wpAjax.parseAjaxResponse(r, s.response, s.element), o;
if ( !res || res.errors ) {
- element.stop().stop().css( 'backgroundColor', '#FF3333' ).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+ element.stop().stop().css( 'backgroundColor', '#faa' ).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
return false;
}
if ( $.isFunction(s.delAfter) ) {
element
.animate( { backgroundColor: dimColor }, 'fast' )
.queue( function() { element.toggleClass(s.dimClass); $(this).dequeue(); } )
- .animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
+ .animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); $(list).trigger( 'wpListDimEnd', [ s, list.wpList ] ); } } );
+ } else {
+ $(list).trigger( 'wpListDimEnd', [ s, list.wpList ] );
}
if ( !s.data._ajax_nonce ) { return true; }