Edit File by line
/home/zeestwma/richards.../wp-admin.../js
File: inline-edit-post.js
/**
[0] Fix | Delete
* This file contains the functions needed for the inline editing of posts.
[1] Fix | Delete
*
[2] Fix | Delete
* @since 2.7.0
[3] Fix | Delete
* @output wp-admin/js/inline-edit-post.js
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/* global ajaxurl, typenow, inlineEditPost */
[7] Fix | Delete
[8] Fix | Delete
window.wp = window.wp || {};
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Manages the quick edit and bulk edit windows for editing posts or pages.
[12] Fix | Delete
*
[13] Fix | Delete
* @namespace inlineEditPost
[14] Fix | Delete
*
[15] Fix | Delete
* @since 2.7.0
[16] Fix | Delete
*
[17] Fix | Delete
* @type {Object}
[18] Fix | Delete
*
[19] Fix | Delete
* @property {string} type The type of inline editor.
[20] Fix | Delete
* @property {string} what The prefix before the post ID.
[21] Fix | Delete
*
[22] Fix | Delete
*/
[23] Fix | Delete
( function( $, wp ) {
[24] Fix | Delete
[25] Fix | Delete
window.inlineEditPost = {
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* Initializes the inline and bulk post editor.
[29] Fix | Delete
*
[30] Fix | Delete
* Binds event handlers to the Escape key to close the inline editor
[31] Fix | Delete
* and to the save and close buttons. Changes DOM to be ready for inline
[32] Fix | Delete
* editing. Adds event handler to bulk edit.
[33] Fix | Delete
*
[34] Fix | Delete
* @since 2.7.0
[35] Fix | Delete
*
[36] Fix | Delete
* @memberof inlineEditPost
[37] Fix | Delete
*
[38] Fix | Delete
* @return {void}
[39] Fix | Delete
*/
[40] Fix | Delete
init : function(){
[41] Fix | Delete
var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit');
[42] Fix | Delete
[43] Fix | Delete
t.type = $('table.widefat').hasClass('pages') ? 'page' : 'post';
[44] Fix | Delete
// Post ID prefix.
[45] Fix | Delete
t.what = '#post-';
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* Binds the Escape key to revert the changes and close the quick editor.
[49] Fix | Delete
*
[50] Fix | Delete
* @return {boolean} The result of revert.
[51] Fix | Delete
*/
[52] Fix | Delete
qeRow.on( 'keyup', function(e){
[53] Fix | Delete
// Revert changes if Escape key is pressed.
[54] Fix | Delete
if ( e.which === 27 ) {
[55] Fix | Delete
return inlineEditPost.revert();
[56] Fix | Delete
}
[57] Fix | Delete
});
[58] Fix | Delete
[59] Fix | Delete
/**
[60] Fix | Delete
* Binds the Escape key to revert the changes and close the bulk editor.
[61] Fix | Delete
*
[62] Fix | Delete
* @return {boolean} The result of revert.
[63] Fix | Delete
*/
[64] Fix | Delete
bulkRow.on( 'keyup', function(e){
[65] Fix | Delete
// Revert changes if Escape key is pressed.
[66] Fix | Delete
if ( e.which === 27 ) {
[67] Fix | Delete
return inlineEditPost.revert();
[68] Fix | Delete
}
[69] Fix | Delete
});
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* Reverts changes and close the quick editor if the cancel button is clicked.
[73] Fix | Delete
*
[74] Fix | Delete
* @return {boolean} The result of revert.
[75] Fix | Delete
*/
[76] Fix | Delete
$( '.cancel', qeRow ).on( 'click', function() {
[77] Fix | Delete
return inlineEditPost.revert();
[78] Fix | Delete
});
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* Saves changes in the quick editor if the save(named: update) button is clicked.
[82] Fix | Delete
*
[83] Fix | Delete
* @return {boolean} The result of save.
[84] Fix | Delete
*/
[85] Fix | Delete
$( '.save', qeRow ).on( 'click', function() {
[86] Fix | Delete
return inlineEditPost.save(this);
[87] Fix | Delete
});
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* If Enter is pressed, and the target is not the cancel button, save the post.
[91] Fix | Delete
*
[92] Fix | Delete
* @return {boolean} The result of save.
[93] Fix | Delete
*/
[94] Fix | Delete
$('td', qeRow).on( 'keydown', function(e){
[95] Fix | Delete
if ( e.which === 13 && ! $( e.target ).hasClass( 'cancel' ) ) {
[96] Fix | Delete
return inlineEditPost.save(this);
[97] Fix | Delete
}
[98] Fix | Delete
});
[99] Fix | Delete
[100] Fix | Delete
/**
[101] Fix | Delete
* Reverts changes and close the bulk editor if the cancel button is clicked.
[102] Fix | Delete
*
[103] Fix | Delete
* @return {boolean} The result of revert.
[104] Fix | Delete
*/
[105] Fix | Delete
$( '.cancel', bulkRow ).on( 'click', function() {
[106] Fix | Delete
return inlineEditPost.revert();
[107] Fix | Delete
});
[108] Fix | Delete
[109] Fix | Delete
/**
[110] Fix | Delete
* Disables the password input field when the private post checkbox is checked.
[111] Fix | Delete
*/
[112] Fix | Delete
$('#inline-edit .inline-edit-private input[value="private"]').on( 'click', function(){
[113] Fix | Delete
var pw = $('input.inline-edit-password-input');
[114] Fix | Delete
if ( $(this).prop('checked') ) {
[115] Fix | Delete
pw.val('').prop('disabled', true);
[116] Fix | Delete
} else {
[117] Fix | Delete
pw.prop('disabled', false);
[118] Fix | Delete
}
[119] Fix | Delete
});
[120] Fix | Delete
[121] Fix | Delete
/**
[122] Fix | Delete
* Binds click event to the .editinline button which opens the quick editor.
[123] Fix | Delete
*/
[124] Fix | Delete
$( '#the-list' ).on( 'click', '.editinline', function() {
[125] Fix | Delete
$( this ).attr( 'aria-expanded', 'true' );
[126] Fix | Delete
inlineEditPost.edit( this );
[127] Fix | Delete
});
[128] Fix | Delete
[129] Fix | Delete
$('#bulk-edit').find('fieldset:first').after(
[130] Fix | Delete
$('#inline-edit fieldset.inline-edit-categories').clone()
[131] Fix | Delete
).siblings( 'fieldset:last' ).prepend(
[132] Fix | Delete
$( '#inline-edit .inline-edit-tags-wrap' ).clone()
[133] Fix | Delete
);
[134] Fix | Delete
[135] Fix | Delete
$('select[name="_status"] option[value="future"]', bulkRow).remove();
[136] Fix | Delete
[137] Fix | Delete
/**
[138] Fix | Delete
* Adds onclick events to the apply buttons.
[139] Fix | Delete
*/
[140] Fix | Delete
$('#doaction').on( 'click', function(e){
[141] Fix | Delete
var n;
[142] Fix | Delete
[143] Fix | Delete
t.whichBulkButtonId = $( this ).attr( 'id' );
[144] Fix | Delete
n = t.whichBulkButtonId.substr( 2 );
[145] Fix | Delete
[146] Fix | Delete
if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) {
[147] Fix | Delete
e.preventDefault();
[148] Fix | Delete
t.setBulk();
[149] Fix | Delete
} else if ( $('form#posts-filter tr.inline-editor').length > 0 ) {
[150] Fix | Delete
t.revert();
[151] Fix | Delete
}
[152] Fix | Delete
});
[153] Fix | Delete
},
[154] Fix | Delete
[155] Fix | Delete
/**
[156] Fix | Delete
* Toggles the quick edit window, hiding it when it's active and showing it when
[157] Fix | Delete
* inactive.
[158] Fix | Delete
*
[159] Fix | Delete
* @since 2.7.0
[160] Fix | Delete
*
[161] Fix | Delete
* @memberof inlineEditPost
[162] Fix | Delete
*
[163] Fix | Delete
* @param {Object} el Element within a post table row.
[164] Fix | Delete
*/
[165] Fix | Delete
toggle : function(el){
[166] Fix | Delete
var t = this;
[167] Fix | Delete
$( t.what + t.getId( el ) ).css( 'display' ) === 'none' ? t.revert() : t.edit( el );
[168] Fix | Delete
},
[169] Fix | Delete
[170] Fix | Delete
/**
[171] Fix | Delete
* Creates the bulk editor row to edit multiple posts at once.
[172] Fix | Delete
*
[173] Fix | Delete
* @since 2.7.0
[174] Fix | Delete
*
[175] Fix | Delete
* @memberof inlineEditPost
[176] Fix | Delete
*/
[177] Fix | Delete
setBulk : function(){
[178] Fix | Delete
var te = '', type = this.type, c = true;
[179] Fix | Delete
var checkedPosts = $( 'tbody th.check-column input[type="checkbox"]:checked' );
[180] Fix | Delete
var categories = {};
[181] Fix | Delete
this.revert();
[182] Fix | Delete
[183] Fix | Delete
$( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
[184] Fix | Delete
[185] Fix | Delete
// Insert the editor at the top of the table with an empty row above to maintain zebra striping.
[186] Fix | Delete
$('table.widefat tbody').prepend( $('#bulk-edit') ).prepend('<tr class="hidden"></tr>');
[187] Fix | Delete
$('#bulk-edit').addClass('inline-editor').show();
[188] Fix | Delete
[189] Fix | Delete
/**
[190] Fix | Delete
* Create a HTML div with the title and a link(delete-icon) for each selected
[191] Fix | Delete
* post.
[192] Fix | Delete
*
[193] Fix | Delete
* Get the selected posts based on the checked checkboxes in the post table.
[194] Fix | Delete
*/
[195] Fix | Delete
$( 'tbody th.check-column input[type="checkbox"]' ).each( function() {
[196] Fix | Delete
[197] Fix | Delete
// If the checkbox for a post is selected, add the post to the edit list.
[198] Fix | Delete
if ( $(this).prop('checked') ) {
[199] Fix | Delete
c = false;
[200] Fix | Delete
var id = $( this ).val(),
[201] Fix | Delete
theTitle = $( '#inline_' + id + ' .post_title' ).html() || wp.i18n.__( '(no title)' ),
[202] Fix | Delete
buttonVisuallyHiddenText = wp.i18n.sprintf(
[203] Fix | Delete
/* translators: %s: Post title. */
[204] Fix | Delete
wp.i18n.__( 'Remove &#8220;%s&#8221; from Bulk Edit' ),
[205] Fix | Delete
theTitle
[206] Fix | Delete
);
[207] Fix | Delete
[208] Fix | Delete
te += '<li class="ntdelitem"><button type="button" id="_' + id + '" class="button-link ntdelbutton"><span class="screen-reader-text">' + buttonVisuallyHiddenText + '</span></button><span class="ntdeltitle" aria-hidden="true">' + theTitle + '</span></li>';
[209] Fix | Delete
}
[210] Fix | Delete
});
[211] Fix | Delete
[212] Fix | Delete
// If no checkboxes where checked, just hide the quick/bulk edit rows.
[213] Fix | Delete
if ( c ) {
[214] Fix | Delete
return this.revert();
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
// Populate the list of items to bulk edit.
[218] Fix | Delete
$( '#bulk-titles' ).html( '<ul id="bulk-titles-list" role="list">' + te + '</ul>' );
[219] Fix | Delete
[220] Fix | Delete
// Gather up some statistics on which of these checked posts are in which categories.
[221] Fix | Delete
checkedPosts.each( function() {
[222] Fix | Delete
var id = $( this ).val();
[223] Fix | Delete
var checked = $( '#category_' + id ).text().split( ',' );
[224] Fix | Delete
[225] Fix | Delete
checked.map( function( cid ) {
[226] Fix | Delete
categories[ cid ] || ( categories[ cid ] = 0 );
[227] Fix | Delete
// Just record that this category is checked.
[228] Fix | Delete
categories[ cid ]++;
[229] Fix | Delete
} );
[230] Fix | Delete
} );
[231] Fix | Delete
[232] Fix | Delete
// Compute initial states.
[233] Fix | Delete
$( '.inline-edit-categories input[name="post_category[]"]' ).each( function() {
[234] Fix | Delete
if ( categories[ $( this ).val() ] == checkedPosts.length ) {
[235] Fix | Delete
// If the number of checked categories matches the number of selected posts, then all posts are in this category.
[236] Fix | Delete
$( this ).prop( 'checked', true );
[237] Fix | Delete
} else if ( categories[ $( this ).val() ] > 0 ) {
[238] Fix | Delete
// If the number is less than the number of selected posts, then it's indeterminate.
[239] Fix | Delete
$( this ).prop( 'indeterminate', true );
[240] Fix | Delete
if ( ! $( this ).parent().find( 'input[name="indeterminate_post_category[]"]' ).length ) {
[241] Fix | Delete
// Get the term label text.
[242] Fix | Delete
var label = $( this ).parent().text();
[243] Fix | Delete
// Set indeterminate states for the backend. Add accessible text for indeterminate inputs.
[244] Fix | Delete
$( this ).after( '<input type="hidden" name="indeterminate_post_category[]" value="' + $( this ).val() + '">' ).attr( 'aria-label', label.trim() + ': ' + wp.i18n.__( 'Some selected posts have this category' ) );
[245] Fix | Delete
}
[246] Fix | Delete
}
[247] Fix | Delete
} );
[248] Fix | Delete
[249] Fix | Delete
$( '.inline-edit-categories input[name="post_category[]"]:indeterminate' ).on( 'change', function() {
[250] Fix | Delete
// Remove accessible label text. Remove the indeterminate flags as there was a specific state change.
[251] Fix | Delete
$( this ).removeAttr( 'aria-label' ).parent().find( 'input[name="indeterminate_post_category[]"]' ).remove();
[252] Fix | Delete
} );
[253] Fix | Delete
[254] Fix | Delete
$( '.inline-edit-save button' ).on( 'click', function() {
[255] Fix | Delete
$( '.inline-edit-categories input[name="post_category[]"]' ).prop( 'indeterminate', false );
[256] Fix | Delete
} );
[257] Fix | Delete
[258] Fix | Delete
/**
[259] Fix | Delete
* Binds on click events to handle the list of items to bulk edit.
[260] Fix | Delete
*
[261] Fix | Delete
* @listens click
[262] Fix | Delete
*/
[263] Fix | Delete
$( '#bulk-titles .ntdelbutton' ).click( function() {
[264] Fix | Delete
var $this = $( this ),
[265] Fix | Delete
id = $this.attr( 'id' ).substr( 1 ),
[266] Fix | Delete
$prev = $this.parent().prev().children( '.ntdelbutton' ),
[267] Fix | Delete
$next = $this.parent().next().children( '.ntdelbutton' );
[268] Fix | Delete
[269] Fix | Delete
$( 'input#cb-select-all-1, input#cb-select-all-2' ).prop( 'checked', false );
[270] Fix | Delete
$( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false );
[271] Fix | Delete
$( '#_' + id ).parent().remove();
[272] Fix | Delete
wp.a11y.speak( wp.i18n.__( 'Item removed.' ), 'assertive' );
[273] Fix | Delete
[274] Fix | Delete
// Move focus to a proper place when items are removed.
[275] Fix | Delete
if ( $next.length ) {
[276] Fix | Delete
$next.focus();
[277] Fix | Delete
} else if ( $prev.length ) {
[278] Fix | Delete
$prev.focus();
[279] Fix | Delete
} else {
[280] Fix | Delete
$( '#bulk-titles-list' ).remove();
[281] Fix | Delete
inlineEditPost.revert();
[282] Fix | Delete
wp.a11y.speak( wp.i18n.__( 'All selected items have been removed. Select new items to use Bulk Actions.' ) );
[283] Fix | Delete
}
[284] Fix | Delete
});
[285] Fix | Delete
[286] Fix | Delete
// Enable auto-complete for tags when editing posts.
[287] Fix | Delete
if ( 'post' === type ) {
[288] Fix | Delete
$( 'tr.inline-editor textarea[data-wp-taxonomy]' ).each( function ( i, element ) {
[289] Fix | Delete
/*
[290] Fix | Delete
* While Quick Edit clones the form each time, Bulk Edit always re-uses
[291] Fix | Delete
* the same form. Let's check if an autocomplete instance already exists.
[292] Fix | Delete
*/
[293] Fix | Delete
if ( $( element ).autocomplete( 'instance' ) ) {
[294] Fix | Delete
// jQuery equivalent of `continue` within an `each()` loop.
[295] Fix | Delete
return;
[296] Fix | Delete
}
[297] Fix | Delete
[298] Fix | Delete
$( element ).wpTagsSuggest();
[299] Fix | Delete
} );
[300] Fix | Delete
}
[301] Fix | Delete
[302] Fix | Delete
// Set initial focus on the Bulk Edit region.
[303] Fix | Delete
$( '#bulk-edit .inline-edit-wrapper' ).attr( 'tabindex', '-1' ).focus();
[304] Fix | Delete
// Scrolls to the top of the table where the editor is rendered.
[305] Fix | Delete
$('html, body').animate( { scrollTop: 0 }, 'fast' );
[306] Fix | Delete
},
[307] Fix | Delete
[308] Fix | Delete
/**
[309] Fix | Delete
* Creates a quick edit window for the post that has been clicked.
[310] Fix | Delete
*
[311] Fix | Delete
* @since 2.7.0
[312] Fix | Delete
*
[313] Fix | Delete
* @memberof inlineEditPost
[314] Fix | Delete
*
[315] Fix | Delete
* @param {number|Object} id The ID of the clicked post or an element within a post
[316] Fix | Delete
* table row.
[317] Fix | Delete
* @return {boolean} Always returns false at the end of execution.
[318] Fix | Delete
*/
[319] Fix | Delete
edit : function(id) {
[320] Fix | Delete
var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, f, val, pw;
[321] Fix | Delete
t.revert();
[322] Fix | Delete
[323] Fix | Delete
if ( typeof(id) === 'object' ) {
[324] Fix | Delete
id = t.getId(id);
[325] Fix | Delete
}
[326] Fix | Delete
[327] Fix | Delete
fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password', 'post_format', 'menu_order', 'page_template'];
[328] Fix | Delete
if ( t.type === 'page' ) {
[329] Fix | Delete
fields.push('post_parent');
[330] Fix | Delete
}
[331] Fix | Delete
[332] Fix | Delete
// Add the new edit row with an extra blank row underneath to maintain zebra striping.
[333] Fix | Delete
editRow = $('#inline-edit').clone(true);
[334] Fix | Delete
$( 'td', editRow ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
[335] Fix | Delete
[336] Fix | Delete
// Remove the ID from the copied row and let the `for` attribute reference the hidden ID.
[337] Fix | Delete
$( 'td', editRow ).find('#quick-edit-legend').removeAttr('id');
[338] Fix | Delete
$( 'td', editRow ).find('p[id^="quick-edit-"]').removeAttr('id');
[339] Fix | Delete
[340] Fix | Delete
$(t.what+id).removeClass('is-expanded').hide().after(editRow).after('<tr class="hidden"></tr>');
[341] Fix | Delete
[342] Fix | Delete
// Populate fields in the quick edit window.
[343] Fix | Delete
rowData = $('#inline_'+id);
[344] Fix | Delete
if ( !$(':input[name="post_author"] option[value="' + $('.post_author', rowData).text() + '"]', editRow).val() ) {
[345] Fix | Delete
[346] Fix | Delete
// The post author no longer has edit capabilities, so we need to add them to the list of authors.
[347] Fix | Delete
$(':input[name="post_author"]', editRow).prepend('<option value="' + $('.post_author', rowData).text() + '">' + $('#post-' + id + ' .author').text() + '</option>');
[348] Fix | Delete
}
[349] Fix | Delete
if ( $( ':input[name="post_author"] option', editRow ).length === 1 ) {
[350] Fix | Delete
$('label.inline-edit-author', editRow).hide();
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
for ( f = 0; f < fields.length; f++ ) {
[354] Fix | Delete
val = $('.'+fields[f], rowData);
[355] Fix | Delete
[356] Fix | Delete
/**
[357] Fix | Delete
* Replaces the image for a Twemoji(Twitter emoji) with it's alternate text.
[358] Fix | Delete
*
[359] Fix | Delete
* @return {string} Alternate text from the image.
[360] Fix | Delete
*/
[361] Fix | Delete
val.find( 'img' ).replaceWith( function() { return this.alt; } );
[362] Fix | Delete
val = val.text();
[363] Fix | Delete
$(':input[name="' + fields[f] + '"]', editRow).val( val );
[364] Fix | Delete
}
[365] Fix | Delete
[366] Fix | Delete
if ( $( '.comment_status', rowData ).text() === 'open' ) {
[367] Fix | Delete
$( 'input[name="comment_status"]', editRow ).prop( 'checked', true );
[368] Fix | Delete
}
[369] Fix | Delete
if ( $( '.ping_status', rowData ).text() === 'open' ) {
[370] Fix | Delete
$( 'input[name="ping_status"]', editRow ).prop( 'checked', true );
[371] Fix | Delete
}
[372] Fix | Delete
if ( $( '.sticky', rowData ).text() === 'sticky' ) {
[373] Fix | Delete
$( 'input[name="sticky"]', editRow ).prop( 'checked', true );
[374] Fix | Delete
}
[375] Fix | Delete
[376] Fix | Delete
/**
[377] Fix | Delete
* Creates the select boxes for the categories.
[378] Fix | Delete
*/
[379] Fix | Delete
$('.post_category', rowData).each(function(){
[380] Fix | Delete
var taxname,
[381] Fix | Delete
term_ids = $(this).text();
[382] Fix | Delete
[383] Fix | Delete
if ( term_ids ) {
[384] Fix | Delete
taxname = $(this).attr('id').replace('_'+id, '');
[385] Fix | Delete
$('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(','));
[386] Fix | Delete
}
[387] Fix | Delete
});
[388] Fix | Delete
[389] Fix | Delete
/**
[390] Fix | Delete
* Gets all the taxonomies for live auto-fill suggestions when typing the name
[391] Fix | Delete
* of a tag.
[392] Fix | Delete
*/
[393] Fix | Delete
$('.tags_input', rowData).each(function(){
[394] Fix | Delete
var terms = $(this),
[395] Fix | Delete
taxname = $(this).attr('id').replace('_' + id, ''),
[396] Fix | Delete
textarea = $('textarea.tax_input_' + taxname, editRow),
[397] Fix | Delete
comma = wp.i18n._x( ',', 'tag delimiter' ).trim();
[398] Fix | Delete
[399] Fix | Delete
// Ensure the textarea exists.
[400] Fix | Delete
if ( ! textarea.length ) {
[401] Fix | Delete
return;
[402] Fix | Delete
}
[403] Fix | Delete
[404] Fix | Delete
terms.find( 'img' ).replaceWith( function() { return this.alt; } );
[405] Fix | Delete
terms = terms.text();
[406] Fix | Delete
[407] Fix | Delete
if ( terms ) {
[408] Fix | Delete
if ( ',' !== comma ) {
[409] Fix | Delete
terms = terms.replace(/,/g, comma);
[410] Fix | Delete
}
[411] Fix | Delete
textarea.val(terms);
[412] Fix | Delete
}
[413] Fix | Delete
[414] Fix | Delete
textarea.wpTagsSuggest();
[415] Fix | Delete
});
[416] Fix | Delete
[417] Fix | Delete
// Handle the post status.
[418] Fix | Delete
var post_date_string = $(':input[name="aa"]').val() + '-' + $(':input[name="mm"]').val() + '-' + $(':input[name="jj"]').val();
[419] Fix | Delete
post_date_string += ' ' + $(':input[name="hh"]').val() + ':' + $(':input[name="mn"]').val() + ':' + $(':input[name="ss"]').val();
[420] Fix | Delete
var post_date = new Date( post_date_string );
[421] Fix | Delete
status = $('._status', rowData).text();
[422] Fix | Delete
if ( 'future' !== status && Date.now() > post_date ) {
[423] Fix | Delete
$('select[name="_status"] option[value="future"]', editRow).remove();
[424] Fix | Delete
} else {
[425] Fix | Delete
$('select[name="_status"] option[value="publish"]', editRow).remove();
[426] Fix | Delete
}
[427] Fix | Delete
[428] Fix | Delete
pw = $( '.inline-edit-password-input' ).prop( 'disabled', false );
[429] Fix | Delete
if ( 'private' === status ) {
[430] Fix | Delete
$('input[name="keep_private"]', editRow).prop('checked', true);
[431] Fix | Delete
pw.val( '' ).prop( 'disabled', true );
[432] Fix | Delete
}
[433] Fix | Delete
[434] Fix | Delete
// Remove the current page and children from the parent dropdown.
[435] Fix | Delete
pageOpt = $('select[name="post_parent"] option[value="' + id + '"]', editRow);
[436] Fix | Delete
if ( pageOpt.length > 0 ) {
[437] Fix | Delete
pageLevel = pageOpt[0].className.split('-')[1];
[438] Fix | Delete
nextPage = pageOpt;
[439] Fix | Delete
while ( pageLoop ) {
[440] Fix | Delete
nextPage = nextPage.next('option');
[441] Fix | Delete
if ( nextPage.length === 0 ) {
[442] Fix | Delete
break;
[443] Fix | Delete
}
[444] Fix | Delete
[445] Fix | Delete
nextLevel = nextPage[0].className.split('-')[1];
[446] Fix | Delete
[447] Fix | Delete
if ( nextLevel <= pageLevel ) {
[448] Fix | Delete
pageLoop = false;
[449] Fix | Delete
} else {
[450] Fix | Delete
nextPage.remove();
[451] Fix | Delete
nextPage = pageOpt;
[452] Fix | Delete
}
[453] Fix | Delete
}
[454] Fix | Delete
pageOpt.remove();
[455] Fix | Delete
}
[456] Fix | Delete
[457] Fix | Delete
$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
[458] Fix | Delete
$('.ptitle', editRow).trigger( 'focus' );
[459] Fix | Delete
[460] Fix | Delete
return false;
[461] Fix | Delete
},
[462] Fix | Delete
[463] Fix | Delete
/**
[464] Fix | Delete
* Saves the changes made in the quick edit window to the post.
[465] Fix | Delete
* Ajax saving is only for Quick Edit and not for bulk edit.
[466] Fix | Delete
*
[467] Fix | Delete
* @since 2.7.0
[468] Fix | Delete
*
[469] Fix | Delete
* @param {number} id The ID for the post that has been changed.
[470] Fix | Delete
* @return {boolean} False, so the form does not submit when pressing
[471] Fix | Delete
* Enter on a focused field.
[472] Fix | Delete
*/
[473] Fix | Delete
save : function(id) {
[474] Fix | Delete
var params, fields, page = $('.post_status_page').val() || '';
[475] Fix | Delete
[476] Fix | Delete
if ( typeof(id) === 'object' ) {
[477] Fix | Delete
id = this.getId(id);
[478] Fix | Delete
}
[479] Fix | Delete
[480] Fix | Delete
$( 'table.widefat .spinner' ).addClass( 'is-active' );
[481] Fix | Delete
[482] Fix | Delete
params = {
[483] Fix | Delete
action: 'inline-save',
[484] Fix | Delete
post_type: typenow,
[485] Fix | Delete
post_ID: id,
[486] Fix | Delete
edit_date: 'true',
[487] Fix | Delete
post_status: page
[488] Fix | Delete
};
[489] Fix | Delete
[490] Fix | Delete
fields = $('#edit-'+id).find(':input').serialize();
[491] Fix | Delete
params = fields + '&' + $.param(params);
[492] Fix | Delete
[493] Fix | Delete
// Make Ajax request.
[494] Fix | Delete
$.post( ajaxurl, params,
[495] Fix | Delete
function(r) {
[496] Fix | Delete
var $errorNotice = $( '#edit-' + id + ' .inline-edit-save .notice-error' ),
[497] Fix | Delete
$error = $errorNotice.find( '.error' );
[498] Fix | Delete
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function