Edit File by line
/home/barbar84/www/wp-admin/js
File: edit-comments.js
/**
[0] Fix | Delete
* Handles updating and editing comments.
[1] Fix | Delete
*
[2] Fix | Delete
* @file This file contains functionality for the admin comments page.
[3] Fix | Delete
* @since 2.1.0
[4] Fix | Delete
* @output wp-admin/js/edit-comments.js
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/* global adminCommentsSettings, thousandsSeparator, list_args, QTags, ajaxurl, wpAjax */
[8] Fix | Delete
/* global commentReply, theExtraList, theList, setCommentsList */
[9] Fix | Delete
[10] Fix | Delete
(function($) {
[11] Fix | Delete
var getCount, updateCount, updateCountText, updatePending, updateApproved,
[12] Fix | Delete
updateHtmlTitle, updateDashboardText, updateInModerationText, adminTitle = document.title,
[13] Fix | Delete
isDashboard = $('#dashboard_right_now').length,
[14] Fix | Delete
titleDiv, titleRegEx,
[15] Fix | Delete
__ = wp.i18n.__;
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* Extracts a number from the content of a jQuery element.
[19] Fix | Delete
*
[20] Fix | Delete
* @since 2.9.0
[21] Fix | Delete
* @access private
[22] Fix | Delete
*
[23] Fix | Delete
* @param {jQuery} el jQuery element.
[24] Fix | Delete
*
[25] Fix | Delete
* @return {number} The number found in the given element.
[26] Fix | Delete
*/
[27] Fix | Delete
getCount = function(el) {
[28] Fix | Delete
var n = parseInt( el.html().replace(/[^0-9]+/g, ''), 10 );
[29] Fix | Delete
if ( isNaN(n) ) {
[30] Fix | Delete
return 0;
[31] Fix | Delete
}
[32] Fix | Delete
return n;
[33] Fix | Delete
};
[34] Fix | Delete
[35] Fix | Delete
/**
[36] Fix | Delete
* Updates an html element with a localized number string.
[37] Fix | Delete
*
[38] Fix | Delete
* @since 2.9.0
[39] Fix | Delete
* @access private
[40] Fix | Delete
*
[41] Fix | Delete
* @param {jQuery} el The jQuery element to update.
[42] Fix | Delete
* @param {number} n Number to be put in the element.
[43] Fix | Delete
*
[44] Fix | Delete
* @return {void}
[45] Fix | Delete
*/
[46] Fix | Delete
updateCount = function(el, n) {
[47] Fix | Delete
var n1 = '';
[48] Fix | Delete
if ( isNaN(n) ) {
[49] Fix | Delete
return;
[50] Fix | Delete
}
[51] Fix | Delete
n = n < 1 ? '0' : n.toString();
[52] Fix | Delete
if ( n.length > 3 ) {
[53] Fix | Delete
while ( n.length > 3 ) {
[54] Fix | Delete
n1 = thousandsSeparator + n.substr(n.length - 3) + n1;
[55] Fix | Delete
n = n.substr(0, n.length - 3);
[56] Fix | Delete
}
[57] Fix | Delete
n = n + n1;
[58] Fix | Delete
}
[59] Fix | Delete
el.html(n);
[60] Fix | Delete
};
[61] Fix | Delete
[62] Fix | Delete
/**
[63] Fix | Delete
* Updates the number of approved comments on a specific post and the filter bar.
[64] Fix | Delete
*
[65] Fix | Delete
* @since 4.4.0
[66] Fix | Delete
* @access private
[67] Fix | Delete
*
[68] Fix | Delete
* @param {number} diff The amount to lower or raise the approved count with.
[69] Fix | Delete
* @param {number} commentPostId The ID of the post to be updated.
[70] Fix | Delete
*
[71] Fix | Delete
* @return {void}
[72] Fix | Delete
*/
[73] Fix | Delete
updateApproved = function( diff, commentPostId ) {
[74] Fix | Delete
var postSelector = '.post-com-count-' + commentPostId,
[75] Fix | Delete
noClass = 'comment-count-no-comments',
[76] Fix | Delete
approvedClass = 'comment-count-approved',
[77] Fix | Delete
approved,
[78] Fix | Delete
noComments;
[79] Fix | Delete
[80] Fix | Delete
updateCountText( 'span.approved-count', diff );
[81] Fix | Delete
[82] Fix | Delete
if ( ! commentPostId ) {
[83] Fix | Delete
return;
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
// Cache selectors to not get duplicates.
[87] Fix | Delete
approved = $( 'span.' + approvedClass, postSelector );
[88] Fix | Delete
noComments = $( 'span.' + noClass, postSelector );
[89] Fix | Delete
[90] Fix | Delete
approved.each(function() {
[91] Fix | Delete
var a = $(this), n = getCount(a) + diff;
[92] Fix | Delete
if ( n < 1 )
[93] Fix | Delete
n = 0;
[94] Fix | Delete
[95] Fix | Delete
if ( 0 === n ) {
[96] Fix | Delete
a.removeClass( approvedClass ).addClass( noClass );
[97] Fix | Delete
} else {
[98] Fix | Delete
a.addClass( approvedClass ).removeClass( noClass );
[99] Fix | Delete
}
[100] Fix | Delete
updateCount( a, n );
[101] Fix | Delete
});
[102] Fix | Delete
[103] Fix | Delete
noComments.each(function() {
[104] Fix | Delete
var a = $(this);
[105] Fix | Delete
if ( diff > 0 ) {
[106] Fix | Delete
a.removeClass( noClass ).addClass( approvedClass );
[107] Fix | Delete
} else {
[108] Fix | Delete
a.addClass( noClass ).removeClass( approvedClass );
[109] Fix | Delete
}
[110] Fix | Delete
updateCount( a, diff );
[111] Fix | Delete
});
[112] Fix | Delete
};
[113] Fix | Delete
[114] Fix | Delete
/**
[115] Fix | Delete
* Updates a number count in all matched HTML elements
[116] Fix | Delete
*
[117] Fix | Delete
* @since 4.4.0
[118] Fix | Delete
* @access private
[119] Fix | Delete
*
[120] Fix | Delete
* @param {string} selector The jQuery selector for elements to update a count
[121] Fix | Delete
* for.
[122] Fix | Delete
* @param {number} diff The amount to lower or raise the count with.
[123] Fix | Delete
*
[124] Fix | Delete
* @return {void}
[125] Fix | Delete
*/
[126] Fix | Delete
updateCountText = function( selector, diff ) {
[127] Fix | Delete
$( selector ).each(function() {
[128] Fix | Delete
var a = $(this), n = getCount(a) + diff;
[129] Fix | Delete
if ( n < 1 ) {
[130] Fix | Delete
n = 0;
[131] Fix | Delete
}
[132] Fix | Delete
updateCount( a, n );
[133] Fix | Delete
});
[134] Fix | Delete
};
[135] Fix | Delete
[136] Fix | Delete
/**
[137] Fix | Delete
* Updates a text about comment count on the dashboard.
[138] Fix | Delete
*
[139] Fix | Delete
* @since 4.4.0
[140] Fix | Delete
* @access private
[141] Fix | Delete
*
[142] Fix | Delete
* @param {Object} response Ajax response from the server that includes a
[143] Fix | Delete
* translated "comment count" message.
[144] Fix | Delete
*
[145] Fix | Delete
* @return {void}
[146] Fix | Delete
*/
[147] Fix | Delete
updateDashboardText = function( response ) {
[148] Fix | Delete
if ( ! isDashboard || ! response || ! response.i18n_comments_text ) {
[149] Fix | Delete
return;
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
$( '.comment-count a', '#dashboard_right_now' ).text( response.i18n_comments_text );
[153] Fix | Delete
};
[154] Fix | Delete
[155] Fix | Delete
/**
[156] Fix | Delete
* Updates the "comments in moderation" text across the UI.
[157] Fix | Delete
*
[158] Fix | Delete
* @since 5.2.0
[159] Fix | Delete
*
[160] Fix | Delete
* @param {Object} response Ajax response from the server that includes a
[161] Fix | Delete
* translated "comments in moderation" message.
[162] Fix | Delete
*
[163] Fix | Delete
* @return {void}
[164] Fix | Delete
*/
[165] Fix | Delete
updateInModerationText = function( response ) {
[166] Fix | Delete
if ( ! response || ! response.i18n_moderation_text ) {
[167] Fix | Delete
return;
[168] Fix | Delete
}
[169] Fix | Delete
[170] Fix | Delete
// Update the "comment in moderation" text across the UI.
[171] Fix | Delete
$( '.comments-in-moderation-text' ).text( response.i18n_moderation_text );
[172] Fix | Delete
// Hide the "comment in moderation" text in the Dashboard "At a Glance" widget.
[173] Fix | Delete
if ( isDashboard && response.in_moderation ) {
[174] Fix | Delete
$( '.comment-mod-count', '#dashboard_right_now' )
[175] Fix | Delete
[ response.in_moderation > 0 ? 'removeClass' : 'addClass' ]( 'hidden' );
[176] Fix | Delete
}
[177] Fix | Delete
};
[178] Fix | Delete
[179] Fix | Delete
/**
[180] Fix | Delete
* Updates the title of the document with the number comments to be approved.
[181] Fix | Delete
*
[182] Fix | Delete
* @since 4.4.0
[183] Fix | Delete
* @access private
[184] Fix | Delete
*
[185] Fix | Delete
* @param {number} diff The amount to lower or raise the number of to be
[186] Fix | Delete
* approved comments with.
[187] Fix | Delete
*
[188] Fix | Delete
* @return {void}
[189] Fix | Delete
*/
[190] Fix | Delete
updateHtmlTitle = function( diff ) {
[191] Fix | Delete
var newTitle, regExMatch, titleCount, commentFrag;
[192] Fix | Delete
[193] Fix | Delete
/* translators: %s: Comments count. */
[194] Fix | Delete
titleRegEx = titleRegEx || new RegExp( __( 'Comments (%s)' ).replace( '%s', '\\([0-9' + thousandsSeparator + ']+\\)' ) + '?' );
[195] Fix | Delete
// Count funcs operate on a $'d element.
[196] Fix | Delete
titleDiv = titleDiv || $( '<div />' );
[197] Fix | Delete
newTitle = adminTitle;
[198] Fix | Delete
[199] Fix | Delete
commentFrag = titleRegEx.exec( document.title );
[200] Fix | Delete
if ( commentFrag ) {
[201] Fix | Delete
commentFrag = commentFrag[0];
[202] Fix | Delete
titleDiv.html( commentFrag );
[203] Fix | Delete
titleCount = getCount( titleDiv ) + diff;
[204] Fix | Delete
} else {
[205] Fix | Delete
titleDiv.html( 0 );
[206] Fix | Delete
titleCount = diff;
[207] Fix | Delete
}
[208] Fix | Delete
[209] Fix | Delete
if ( titleCount >= 1 ) {
[210] Fix | Delete
updateCount( titleDiv, titleCount );
[211] Fix | Delete
regExMatch = titleRegEx.exec( document.title );
[212] Fix | Delete
if ( regExMatch ) {
[213] Fix | Delete
/* translators: %s: Comments count. */
[214] Fix | Delete
newTitle = document.title.replace( regExMatch[0], __( 'Comments (%s)' ).replace( '%s', titleDiv.text() ) + ' ' );
[215] Fix | Delete
}
[216] Fix | Delete
} else {
[217] Fix | Delete
regExMatch = titleRegEx.exec( newTitle );
[218] Fix | Delete
if ( regExMatch ) {
[219] Fix | Delete
newTitle = newTitle.replace( regExMatch[0], __( 'Comments' ) );
[220] Fix | Delete
}
[221] Fix | Delete
}
[222] Fix | Delete
document.title = newTitle;
[223] Fix | Delete
};
[224] Fix | Delete
[225] Fix | Delete
/**
[226] Fix | Delete
* Updates the number of pending comments on a specific post and the filter bar.
[227] Fix | Delete
*
[228] Fix | Delete
* @since 3.2.0
[229] Fix | Delete
* @access private
[230] Fix | Delete
*
[231] Fix | Delete
* @param {number} diff The amount to lower or raise the pending count with.
[232] Fix | Delete
* @param {number} commentPostId The ID of the post to be updated.
[233] Fix | Delete
*
[234] Fix | Delete
* @return {void}
[235] Fix | Delete
*/
[236] Fix | Delete
updatePending = function( diff, commentPostId ) {
[237] Fix | Delete
var postSelector = '.post-com-count-' + commentPostId,
[238] Fix | Delete
noClass = 'comment-count-no-pending',
[239] Fix | Delete
noParentClass = 'post-com-count-no-pending',
[240] Fix | Delete
pendingClass = 'comment-count-pending',
[241] Fix | Delete
pending,
[242] Fix | Delete
noPending;
[243] Fix | Delete
[244] Fix | Delete
if ( ! isDashboard ) {
[245] Fix | Delete
updateHtmlTitle( diff );
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
$( 'span.pending-count' ).each(function() {
[249] Fix | Delete
var a = $(this), n = getCount(a) + diff;
[250] Fix | Delete
if ( n < 1 )
[251] Fix | Delete
n = 0;
[252] Fix | Delete
a.closest('.awaiting-mod')[ 0 === n ? 'addClass' : 'removeClass' ]('count-0');
[253] Fix | Delete
updateCount( a, n );
[254] Fix | Delete
});
[255] Fix | Delete
[256] Fix | Delete
if ( ! commentPostId ) {
[257] Fix | Delete
return;
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
// Cache selectors to not get dupes.
[261] Fix | Delete
pending = $( 'span.' + pendingClass, postSelector );
[262] Fix | Delete
noPending = $( 'span.' + noClass, postSelector );
[263] Fix | Delete
[264] Fix | Delete
pending.each(function() {
[265] Fix | Delete
var a = $(this), n = getCount(a) + diff;
[266] Fix | Delete
if ( n < 1 )
[267] Fix | Delete
n = 0;
[268] Fix | Delete
[269] Fix | Delete
if ( 0 === n ) {
[270] Fix | Delete
a.parent().addClass( noParentClass );
[271] Fix | Delete
a.removeClass( pendingClass ).addClass( noClass );
[272] Fix | Delete
} else {
[273] Fix | Delete
a.parent().removeClass( noParentClass );
[274] Fix | Delete
a.addClass( pendingClass ).removeClass( noClass );
[275] Fix | Delete
}
[276] Fix | Delete
updateCount( a, n );
[277] Fix | Delete
});
[278] Fix | Delete
[279] Fix | Delete
noPending.each(function() {
[280] Fix | Delete
var a = $(this);
[281] Fix | Delete
if ( diff > 0 ) {
[282] Fix | Delete
a.parent().removeClass( noParentClass );
[283] Fix | Delete
a.removeClass( noClass ).addClass( pendingClass );
[284] Fix | Delete
} else {
[285] Fix | Delete
a.parent().addClass( noParentClass );
[286] Fix | Delete
a.addClass( noClass ).removeClass( pendingClass );
[287] Fix | Delete
}
[288] Fix | Delete
updateCount( a, diff );
[289] Fix | Delete
});
[290] Fix | Delete
};
[291] Fix | Delete
[292] Fix | Delete
/**
[293] Fix | Delete
* Initializes the comments list.
[294] Fix | Delete
*
[295] Fix | Delete
* @since 4.4.0
[296] Fix | Delete
*
[297] Fix | Delete
* @global
[298] Fix | Delete
*
[299] Fix | Delete
* @return {void}
[300] Fix | Delete
*/
[301] Fix | Delete
window.setCommentsList = function() {
[302] Fix | Delete
var totalInput, perPageInput, pageInput, dimAfter, delBefore, updateTotalCount, delAfter, refillTheExtraList, diff,
[303] Fix | Delete
lastConfidentTime = 0;
[304] Fix | Delete
[305] Fix | Delete
totalInput = $('input[name="_total"]', '#comments-form');
[306] Fix | Delete
perPageInput = $('input[name="_per_page"]', '#comments-form');
[307] Fix | Delete
pageInput = $('input[name="_page"]', '#comments-form');
[308] Fix | Delete
[309] Fix | Delete
/**
[310] Fix | Delete
* Updates the total with the latest count.
[311] Fix | Delete
*
[312] Fix | Delete
* The time parameter makes sure that we only update the total if this value is
[313] Fix | Delete
* a newer value than we previously received.
[314] Fix | Delete
*
[315] Fix | Delete
* The time and setConfidentTime parameters make sure that we only update the
[316] Fix | Delete
* total when necessary. So a value that has been generated earlier will not
[317] Fix | Delete
* update the total.
[318] Fix | Delete
*
[319] Fix | Delete
* @since 2.8.0
[320] Fix | Delete
* @access private
[321] Fix | Delete
*
[322] Fix | Delete
* @param {number} total Total number of comments.
[323] Fix | Delete
* @param {number} time Unix timestamp of response.
[324] Fix | Delete
* @param {boolean} setConfidentTime Whether to update the last confident time
[325] Fix | Delete
* with the given time.
[326] Fix | Delete
*
[327] Fix | Delete
* @return {void}
[328] Fix | Delete
*/
[329] Fix | Delete
updateTotalCount = function( total, time, setConfidentTime ) {
[330] Fix | Delete
if ( time < lastConfidentTime )
[331] Fix | Delete
return;
[332] Fix | Delete
[333] Fix | Delete
if ( setConfidentTime )
[334] Fix | Delete
lastConfidentTime = time;
[335] Fix | Delete
[336] Fix | Delete
totalInput.val( total.toString() );
[337] Fix | Delete
};
[338] Fix | Delete
[339] Fix | Delete
/**
[340] Fix | Delete
* Changes DOM that need to be changed after a list item has been dimmed.
[341] Fix | Delete
*
[342] Fix | Delete
* @since 2.5.0
[343] Fix | Delete
* @access private
[344] Fix | Delete
*
[345] Fix | Delete
* @param {Object} r Ajax response object.
[346] Fix | Delete
* @param {Object} settings Settings for the wpList object.
[347] Fix | Delete
*
[348] Fix | Delete
* @return {void}
[349] Fix | Delete
*/
[350] Fix | Delete
dimAfter = function( r, settings ) {
[351] Fix | Delete
var editRow, replyID, replyButton, response,
[352] Fix | Delete
c = $( '#' + settings.element );
[353] Fix | Delete
[354] Fix | Delete
if ( true !== settings.parsed ) {
[355] Fix | Delete
response = settings.parsed.responses[0];
[356] Fix | Delete
}
[357] Fix | Delete
[358] Fix | Delete
editRow = $('#replyrow');
[359] Fix | Delete
replyID = $('#comment_ID', editRow).val();
[360] Fix | Delete
replyButton = $('#replybtn', editRow);
[361] Fix | Delete
[362] Fix | Delete
if ( c.is('.unapproved') ) {
[363] Fix | Delete
if ( settings.data.id == replyID )
[364] Fix | Delete
replyButton.text( __( 'Approve and Reply' ) );
[365] Fix | Delete
[366] Fix | Delete
c.find( '.row-actions span.view' ).addClass( 'hidden' ).end()
[367] Fix | Delete
.find( 'div.comment_status' ).html( '0' );
[368] Fix | Delete
[369] Fix | Delete
} else {
[370] Fix | Delete
if ( settings.data.id == replyID )
[371] Fix | Delete
replyButton.text( __( 'Reply' ) );
[372] Fix | Delete
[373] Fix | Delete
c.find( '.row-actions span.view' ).removeClass( 'hidden' ).end()
[374] Fix | Delete
.find( 'div.comment_status' ).html( '1' );
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
diff = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;
[378] Fix | Delete
if ( response ) {
[379] Fix | Delete
updateDashboardText( response.supplemental );
[380] Fix | Delete
updateInModerationText( response.supplemental );
[381] Fix | Delete
updatePending( diff, response.supplemental.postId );
[382] Fix | Delete
updateApproved( -1 * diff, response.supplemental.postId );
[383] Fix | Delete
} else {
[384] Fix | Delete
updatePending( diff );
[385] Fix | Delete
updateApproved( -1 * diff );
[386] Fix | Delete
}
[387] Fix | Delete
};
[388] Fix | Delete
[389] Fix | Delete
/**
[390] Fix | Delete
* Handles marking a comment as spam or trashing the comment.
[391] Fix | Delete
*
[392] Fix | Delete
* Is executed in the list delBefore hook.
[393] Fix | Delete
*
[394] Fix | Delete
* @since 2.8.0
[395] Fix | Delete
* @access private
[396] Fix | Delete
*
[397] Fix | Delete
* @param {Object} settings Settings for the wpList object.
[398] Fix | Delete
* @param {HTMLElement} list Comments table element.
[399] Fix | Delete
*
[400] Fix | Delete
* @return {Object} The settings object.
[401] Fix | Delete
*/
[402] Fix | Delete
delBefore = function( settings, list ) {
[403] Fix | Delete
var note, id, el, n, h, a, author,
[404] Fix | Delete
action = false,
[405] Fix | Delete
wpListsData = $( settings.target ).attr( 'data-wp-lists' );
[406] Fix | Delete
[407] Fix | Delete
settings.data._total = totalInput.val() || 0;
[408] Fix | Delete
settings.data._per_page = perPageInput.val() || 0;
[409] Fix | Delete
settings.data._page = pageInput.val() || 0;
[410] Fix | Delete
settings.data._url = document.location.href;
[411] Fix | Delete
settings.data.comment_status = $('input[name="comment_status"]', '#comments-form').val();
[412] Fix | Delete
[413] Fix | Delete
if ( wpListsData.indexOf(':trash=1') != -1 )
[414] Fix | Delete
action = 'trash';
[415] Fix | Delete
else if ( wpListsData.indexOf(':spam=1') != -1 )
[416] Fix | Delete
action = 'spam';
[417] Fix | Delete
[418] Fix | Delete
if ( action ) {
[419] Fix | Delete
id = wpListsData.replace(/.*?comment-([0-9]+).*/, '$1');
[420] Fix | Delete
el = $('#comment-' + id);
[421] Fix | Delete
note = $('#' + action + '-undo-holder').html();
[422] Fix | Delete
[423] Fix | Delete
el.find('.check-column :checkbox').prop('checked', false); // Uncheck the row so as not to be affected by Bulk Edits.
[424] Fix | Delete
[425] Fix | Delete
if ( el.siblings('#replyrow').length && commentReply.cid == id )
[426] Fix | Delete
commentReply.close();
[427] Fix | Delete
[428] Fix | Delete
if ( el.is('tr') ) {
[429] Fix | Delete
n = el.children(':visible').length;
[430] Fix | Delete
author = $('.author strong', el).text();
[431] Fix | Delete
h = $('<tr id="undo-' + id + '" class="undo un' + action + '" style="display:none;"><td colspan="' + n + '">' + note + '</td></tr>');
[432] Fix | Delete
} else {
[433] Fix | Delete
author = $('.comment-author', el).text();
[434] Fix | Delete
h = $('<div id="undo-' + id + '" style="display:none;" class="undo un' + action + '">' + note + '</div>');
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
el.before(h);
[438] Fix | Delete
[439] Fix | Delete
$('strong', '#undo-' + id).text(author);
[440] Fix | Delete
a = $('.undo a', '#undo-' + id);
[441] Fix | Delete
a.attr('href', 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce);
[442] Fix | Delete
a.attr('data-wp-lists', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1');
[443] Fix | Delete
a.attr('class', 'vim-z vim-destructive aria-button-if-js');
[444] Fix | Delete
$('.avatar', el).first().clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside');
[445] Fix | Delete
[446] Fix | Delete
a.on( 'click', function( e ){
[447] Fix | Delete
e.preventDefault();
[448] Fix | Delete
e.stopPropagation(); // Ticket #35904.
[449] Fix | Delete
list.wpList.del(this);
[450] Fix | Delete
$('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){
[451] Fix | Delete
$(this).remove();
[452] Fix | Delete
$('#comment-' + id).css('backgroundColor', '').fadeIn(300, function(){ $(this).show(); });
[453] Fix | Delete
});
[454] Fix | Delete
});
[455] Fix | Delete
}
[456] Fix | Delete
[457] Fix | Delete
return settings;
[458] Fix | Delete
};
[459] Fix | Delete
[460] Fix | Delete
/**
[461] Fix | Delete
* Handles actions that need to be done after marking as spam or thrashing a
[462] Fix | Delete
* comment.
[463] Fix | Delete
*
[464] Fix | Delete
* The ajax requests return the unix time stamp a comment was marked as spam or
[465] Fix | Delete
* trashed. We use this to have a correct total amount of comments.
[466] Fix | Delete
*
[467] Fix | Delete
* @since 2.5.0
[468] Fix | Delete
* @access private
[469] Fix | Delete
*
[470] Fix | Delete
* @param {Object} r Ajax response object.
[471] Fix | Delete
* @param {Object} settings Settings for the wpList object.
[472] Fix | Delete
*
[473] Fix | Delete
* @return {void}
[474] Fix | Delete
*/
[475] Fix | Delete
delAfter = function( r, settings ) {
[476] Fix | Delete
var total_items_i18n, total, animated, animatedCallback,
[477] Fix | Delete
response = true === settings.parsed ? {} : settings.parsed.responses[0],
[478] Fix | Delete
commentStatus = true === settings.parsed ? '' : response.supplemental.status,
[479] Fix | Delete
commentPostId = true === settings.parsed ? '' : response.supplemental.postId,
[480] Fix | Delete
newTotal = true === settings.parsed ? '' : response.supplemental,
[481] Fix | Delete
[482] Fix | Delete
targetParent = $( settings.target ).parent(),
[483] Fix | Delete
commentRow = $('#' + settings.element),
[484] Fix | Delete
[485] Fix | Delete
spamDiff, trashDiff, pendingDiff, approvedDiff,
[486] Fix | Delete
[487] Fix | Delete
/*
[488] Fix | Delete
* As `wpList` toggles only the `unapproved` class, the approved comment
[489] Fix | Delete
* rows can have both the `approved` and `unapproved` classes.
[490] Fix | Delete
*/
[491] Fix | Delete
approved = commentRow.hasClass( 'approved' ) && ! commentRow.hasClass( 'unapproved' ),
[492] Fix | Delete
unapproved = commentRow.hasClass( 'unapproved' ),
[493] Fix | Delete
spammed = commentRow.hasClass( 'spam' ),
[494] Fix | Delete
trashed = commentRow.hasClass( 'trash' ),
[495] Fix | Delete
undoing = false; // Ticket #35904.
[496] Fix | Delete
[497] Fix | Delete
updateDashboardText( newTotal );
[498] Fix | Delete
updateInModerationText( newTotal );
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function