},
toggle : function(el) {
- if ( $(el).css('display') != 'none' )
- $(el).find('a.vim-q').click();
+ if ( 'none' !== $( el ).css( 'display' ) && ( $( '#replyrow' ).parent().is('#com-reply') || window.confirm( adminCommentsL10n.warnQuickEdit ) ) ) {
+ $( el ).find( 'a.vim-q' ).click();
+ }
},
revert : function() {
$('#com-reply').append( replyrow );
$('#replycontent').css('height', '').val('');
$('#edithead input').val('');
- $('.error', replyrow).html('').hide();
- $('.spinner', replyrow).hide();
+ $('.error', replyrow).empty().hide();
+ $( '.spinner', replyrow ).removeClass( 'is-active' );
this.cid = '';
},
var editRow, rowData, act, replyButton, editHeight,
t = this,
c = $('#comment-' + comment_id),
- h = c.height();
+ h = c.height(),
+ colspanVal = 0;
t.close();
t.cid = comment_id;
action = action || 'replyto';
act = 'edit' == action ? 'edit' : 'replyto';
act = t.act = act + '-comment';
+ colspanVal = $( 'th:visible, td:visible', c ).length;
+
+ // Make sure it's actually a table and there's a `colspan` value to apply.
+ if ( editRow.hasClass( 'inline-edit-row' ) && 0 !== colspanVal ) {
+ $( 'td', editRow ).attr( 'colspan', colspanVal );
+ }
$('#action', editRow).val(act);
$('#comment_post_ID', editRow).val(post_id);
});
} else if ( action == 'add' ) {
$('#addhead, #addbtn', editRow).show();
- $('#replyhead, #replybtn, #edithead, #editbtn', editRow).hide();
+ $('#replyhead, #replybtn, #edithead, #savebtn', editRow).hide();
$('#the-comment-list').prepend(editRow);
$('#replyrow').fadeIn(300);
} else {
var post = {};
$('#replysubmit .error').hide();
- $('#replysubmit .spinner').show();
+ $( '#replysubmit .spinner' ).addClass( 'is-active' );
$('#replyrow input').not(':button').each(function() {
var t = $(this);
error : function(r) {
var er = r.statusText;
- $('#replysubmit .spinner').hide();
+ $( '#replysubmit .spinner' ).removeClass( 'is-active' );
if ( r.responseText )
er = r.responseText.replace( /<.[^<>]*?>/g, '' );
disableInInput: true,
type: 'keypress',
noDisable: '.check-column input[type="checkbox"]'
- }
+ },
+ cycle_expr: '#the-comment-list tr',
+ start_row_index: 0
}
);
}
+
+ // Quick Edit and Reply have an inline comment editor.
+ $( '#the-comment-list' ).on( 'click', '.comment-inline', function (e) {
+ e.preventDefault();
+ var $el = $( this ),
+ action = 'replyto';
+
+ if ( 'undefined' !== typeof $el.data( 'action' ) ) {
+ action = $el.data( 'action' );
+ }
+
+ commentReply.open( $el.data( 'commentId' ), $el.data( 'postId' ), action );
+ } );
});
})(jQuery);