Smoooth animations for comment move to trash and undo, see #4529

git-svn-id: https://develop.svn.wordpress.org/trunk@12050 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2009-10-18 05:59:03 +00:00
parent 6b03fbb997
commit 226abaca88
5 changed files with 22 additions and 19 deletions

View File

@ -54,7 +54,6 @@ setCommentsList = function() {
}
el.before(h);
h.fadeIn(400);
$('strong', '#trashundo-' + id).html(author);
a = $('a.undo-trash', '#trashundo-' + id);
@ -65,7 +64,7 @@ setCommentsList = function() {
list.wpList.del(this);
$('#trashundo-' + id).fadeOut(250, function(){
$(this).remove();
$('#comment-' + id).css('backgroundColor', '').fadeIn(400);
$('#comment-' + id).css('backgroundColor', '').fadeIn(300);
});
return false;
});
@ -203,8 +202,13 @@ setCommentsList = function() {
};
theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );
theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } )
.bind('wpListDelEnd', function(e, s){
var id = s.element.replace(/[^0-9]+/g, '');
if ( s.target.className.indexOf(':trash=1') != -1 )
$('#trashundo-' + id).fadeIn(300);
});
};
commentReply = {

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@ var fs = {add:'ajaxAdd',del:'ajaxDel',dim:'ajaxDim',process:'process',recolor:'r
wpList = {
settings: {
url: wpListL10n.url, type: 'POST',
url: ajaxurl, type: 'POST',
response: 'ajax-response',
what: '',
@ -107,6 +107,7 @@ wpList = {
};
}
list.wpList.recolor();
$(list).trigger( 'wpListAddEnd', [ s, list.wpList ] );
wpList.clear.call(list,'#' + s.element);
};
@ -116,7 +117,7 @@ wpList = {
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;
@ -143,14 +144,13 @@ wpList = {
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) {
@ -213,7 +213,9 @@ wpList = {
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; }

File diff suppressed because one or more lines are too long

View File

@ -101,11 +101,8 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20091012' );
$scripts->add_data( 'autosave', 'group', 1 );
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20091007' );
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20091017' );
$scripts->add_data( 'wp-lists', 'group', 1 );
$scripts->localize( 'wp-lists', 'wpListL10n', array(
'url' => admin_url('admin-ajax.php')
) );
$scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.0');
$scripts->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0');
@ -256,7 +253,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
$scripts->add_data( 'user-profile', 'group', 1 );
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20091008' );
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20091017' );
$scripts->add_data( 'admin-comments', 'group', 1 );
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),