Fix IE8 reply to comments from admin fade in/out, decrease comment undo timeout, hide comment reply when moving to trash, fixes #9896

git-svn-id: http://svn.automattic.com/wordpress/trunk@12139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-11-03 08:28:59 +00:00
parent 872e7cc3eb
commit 59c0c60e1c
4 changed files with 51 additions and 33 deletions

View File

@ -2309,9 +2309,9 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
?> ?>
<form method="get" action=""> <form method="get" action="">
<?php if ( $table_row ) : ?> <?php if ( $table_row ) : ?>
<table style="display:none;"><tbody id="com-reply"><tr id="replyrow"><td colspan="<?php echo $col_count; ?>"> <table style="display:none;"><tbody id="com-reply"><tr id="replyrow" style="display:none;"><td colspan="<?php echo $col_count; ?>">
<?php else : ?> <?php else : ?>
<div id="com-reply" style="display:none;"><div id="replyrow"> <div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
<?php endif; ?> <?php endif; ?>
<div id="replyhead" style="display:none;"><?php _e('Reply to Comment'); ?></div> <div id="replyhead" style="display:none;"><?php _e('Reply to Comment'); ?></div>

View File

@ -44,6 +44,9 @@ setCommentsList = function() {
el = $('#comment-' + id); el = $('#comment-' + id);
note = $('#undo-holder').html(); note = $('#undo-holder').html();
if ( el.siblings('#replyrow').length && commentReply.cid == id )
commentReply.close();
if ( el.is('tr') ) { if ( el.is('tr') ) {
n = el.children(':visible').length; n = el.children(':visible').length;
author = $('.author strong', el).html(); author = $('.author strong', el).html();
@ -55,23 +58,23 @@ setCommentsList = function() {
el.before(h); el.before(h);
$('strong', '#trashundo-' + id).html(author); $('strong', '#trashundo-' + id).html(author + ' ');
a = $('a.undo-trash', '#trashundo-' + id); a = $('a.undo-trash', '#trashundo-' + id);
a.attr('href', 'comment.php?action=untrashcomment&c=' + id + '&_ajax_nonce=' + settings.data._ajax_nonce); a.attr('href', 'comment.php?action=untrashcomment&c=' + id + '&_ajax_nonce=' + settings.data._ajax_nonce);
a.attr('className', 'delete:the-comment-list:comment-' + id + '::untrash=1 vim-z vim-destructive'); a.attr('className', 'delete:the-comment-list:comment-' + id + '::untrash=1 vim-z vim-destructive');
a.click(function(){ a.click(function(){
list.wpList.del(this); list.wpList.del(this);
$('#trashundo-' + id).fadeOut(250, function(){ $('#trashundo-' + id).fadeOut(300, function(){
$(this).remove(); $(this).remove();
$('#comment-' + id).css('backgroundColor', '').fadeIn(300); $('#comment-' + id).css('backgroundColor', '').fadeIn(300, function(){ $(this).show() });
}); });
return false; return false;
}); });
to = window.setTimeout( function(){ to = window.setTimeout( function(){
$('#trashundo-' + id).fadeOut('slow', function(){ $(this).remove(); }); $('#trashundo-' + id).fadeOut('slow', function(){ $(this).remove(); });
}, 200000 ); }, 7000 );
} }
return settings; return settings;
@ -207,11 +210,13 @@ setCommentsList = function() {
var id = s.element.replace(/[^0-9]+/g, ''); var id = s.element.replace(/[^0-9]+/g, '');
if ( s.target.className.indexOf(':trash=1') != -1 ) if ( s.target.className.indexOf(':trash=1') != -1 )
$('#trashundo-' + id).fadeIn(300); $('#trashundo-' + id).fadeIn(300, function(){ $(this).show() });
}); });
}; };
commentReply = { commentReply = {
cid : '',
act : '',
init : function() { init : function() {
var row = $('#replyrow'); var row = $('#replyrow');
@ -266,25 +271,38 @@ commentReply = {
}, },
close : function() { close : function() {
$(this.o).fadeIn('fast').css('backgroundColor', ''); var c;
$('#com-reply').append( $('#replyrow') );
$('#replycontent').val(''); if ( this.cid ) {
$('#edithead input').val(''); c = $('#comment-' + this.cid);
$('#replysubmit .error').html('').hide();
$('#replysubmit .waiting').hide(); if ( this.act == 'edit-comment' )
if ( $.browser.msie ) c.fadeIn(300, function(){ c.show() }).css('backgroundColor', '');
$('#replycontainer, #replycontent').css('height', '120px');
else $('#replyrow').hide();
$('#replycontainer').resizable('destroy').css('height', '120px'); $('#com-reply').append( $('#replyrow') );
$('#replycontent').val('');
$('input', '#edithead').val('');
$('.error', '#replysubmit').html('').hide();
$('.waiting', '#replysubmit').hide();
if ( $.browser.msie )
$('#replycontainer, #replycontent').css('height', '120px');
else
$('#replycontainer').resizable('destroy').css('height', '120px');
this.cid = '';
}
}, },
open : function(id, p, a) { open : function(id, p, a) {
var t = this, editRow, act, h; var t = this, editRow, rowData, act, h, c = $('#comment-' + id);
t.close(); t.close();
t.o = '#comment-'+id; t.cid = id;
$('#replyrow td').attr('colspan', $('.widefat thead th:visible').length); $('td', '#replyrow').attr('colspan', $('table.widefat thead th:visible').length);
editRow = $('#replyrow'), rowData = $('#inline-'+id); editRow = $('#replyrow');
rowData = $('#inline-'+id);
act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment'; act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment';
$('#action', editRow).val(act); $('#action', editRow).val(act);
@ -300,21 +318,21 @@ commentReply = {
$('#edithead, #savebtn', editRow).show(); $('#edithead, #savebtn', editRow).show();
$('#replyhead, #replybtn', editRow).hide(); $('#replyhead, #replybtn', editRow).hide();
h = $(t.o).height(); h = c.height();
if ( h > 220 ) if ( h > 220 )
if ( $.browser.msie ) if ( $.browser.msie )
$('#replycontainer, #replycontent', editRow).height(h-105); $('#replycontainer, #replycontent', editRow).height(h-105);
else else
$('#replycontainer', editRow).height(h-105); $('#replycontainer', editRow).height(h-105);
$(t.o).after(editRow.hide()).fadeOut('fast', function(){ c.after( editRow ).fadeOut('fast', function(){
$('#replyrow').fadeIn('fast'); $('#replyrow').fadeIn(300, function(){ $(this).show() });
}); });
} else { } else {
$('#edithead, #savebtn', editRow).hide(); $('#edithead, #savebtn', editRow).hide();
$('#replyhead, #replybtn', editRow).show(); $('#replyhead, #replybtn', editRow).show();
$(t.o).after(editRow); c.after(editRow);
$('#replyrow').hide().fadeIn('fast'); $('#replyrow').fadeIn(300, function(){ $(this).show() });
} }
if ( ! $.browser.msie ) if ( ! $.browser.msie )
@ -342,7 +360,8 @@ commentReply = {
window.scroll(0, rtop - 35); window.scroll(0, rtop - 35);
$('#replycontent').focus().keyup(function(e){ $('#replycontent').focus().keyup(function(e){
if (e.which == 27) commentReply.revert(); // close on Escape if ( e.which == 27 )
commentReply.revert(); // close on Escape
}); });
}, 600); }, 600);
@ -387,16 +406,15 @@ commentReply = {
return false; return false;
} }
if ( 'edit-comment' == this.act )
$(this.o).remove();
r = r.responses[0]; r = r.responses[0];
c = r.data; c = r.data;
id = '#comment-' + r.id;
if ( 'edit-comment' == this.act )
$(id).remove();
$(c).hide() $(c).hide()
$('#replyrow').after(c); $('#replyrow').after(c);
this.o = id = '#comment-'+r.id;
this.revert(); this.revert();
this.addEvents($(id)); this.addEvents($(id));
bg = $(id).hasClass('unapproved') ? '#ffffe0' : '#fff'; bg = $(id).hasClass('unapproved') ? '#ffffe0' : '#fff';

File diff suppressed because one or more lines are too long

View File

@ -253,7 +253,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' ); $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
$scripts->add_data( 'user-profile', 'group', 1 ); $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'), '20091020' ); $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20091102' );
$scripts->add_data( 'admin-comments', 'group', 1 ); $scripts->add_data( 'admin-comments', 'group', 1 );
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array( $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),