Coding Standards: Wrap some long lines in `js/_enqueues/admin/post.js` per the JS coding standards for better readability.
See #53359. Built from https://develop.svn.wordpress.org/trunk@52228 git-svn-id: http://core.svn.wordpress.org/trunk@51820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
742cd201e6
commit
c9ecd13aca
|
@ -135,21 +135,26 @@ window.wp = window.wp || {};
|
|||
* @global
|
||||
*/
|
||||
window.WPRemoveThumbnail = function(nonce){
|
||||
$.post(ajaxurl, {
|
||||
action: 'set-post-thumbnail', post_id: $( '#post_ID' ).val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
|
||||
},
|
||||
$.post(
|
||||
ajaxurl, {
|
||||
action: 'set-post-thumbnail',
|
||||
post_id: $( '#post_ID' ).val(),
|
||||
thumbnail_id: -1,
|
||||
_ajax_nonce: nonce,
|
||||
cookie: encodeURIComponent( document.cookie )
|
||||
},
|
||||
/**
|
||||
* Handle server response
|
||||
*
|
||||
* @param {string} str Response, will be '0' when an error occurred otherwise contains link to add Featured Image.
|
||||
*/
|
||||
function(str){
|
||||
if ( str == '0' ) {
|
||||
alert( __( 'Could not set that as the thumbnail image. Try a different attachment.' ) );
|
||||
} else {
|
||||
WPSetThumbnailHTML(str);
|
||||
if ( str == '0' ) {
|
||||
alert( __( 'Could not set that as the thumbnail image. Try a different attachment.' ) );
|
||||
} else {
|
||||
WPSetThumbnailHTML(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -207,7 +212,9 @@ window.wp = window.wp || {};
|
|||
height: 64,
|
||||
alt: '',
|
||||
src: received.lock_error.avatar_src,
|
||||
srcset: received.lock_error.avatar_src_2x ? received.lock_error.avatar_src_2x + ' 2x' : undefined
|
||||
srcset: received.lock_error.avatar_src_2x ?
|
||||
received.lock_error.avatar_src_2x + ' 2x' :
|
||||
undefined
|
||||
} );
|
||||
wrap.find('div.post-locked-avatar').empty().append( avatar );
|
||||
}
|
||||
|
@ -666,11 +673,15 @@ jQuery( function($) {
|
|||
});
|
||||
|
||||
// Sync checked items between "All {taxonomy}" and "Most used" lists.
|
||||
$('#' + taxonomy + 'checklist, #' + taxonomy + 'checklist-pop').on( 'click', 'li.popular-category > label input[type="checkbox"]', function() {
|
||||
var t = $(this), c = t.is(':checked'), id = t.val();
|
||||
if ( id && t.parents('#taxonomy-'+taxonomy).length )
|
||||
$('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c );
|
||||
});
|
||||
$('#' + taxonomy + 'checklist, #' + taxonomy + 'checklist-pop').on(
|
||||
'click',
|
||||
'li.popular-category > label input[type="checkbox"]',
|
||||
function() {
|
||||
var t = $(this), c = t.is(':checked'), id = t.val();
|
||||
if ( id && t.parents('#taxonomy-'+taxonomy).length )
|
||||
$('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c );
|
||||
}
|
||||
);
|
||||
|
||||
}); // End cats.
|
||||
|
||||
|
@ -749,11 +760,28 @@ jQuery( function($) {
|
|||
mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val();
|
||||
|
||||
attemptedDate = new Date( aa, mm - 1, jj, hh, mn );
|
||||
originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val() );
|
||||
currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val() );
|
||||
originalDate = new Date(
|
||||
$('#hidden_aa').val(),
|
||||
$('#hidden_mm').val() -1,
|
||||
$('#hidden_jj').val(),
|
||||
$('#hidden_hh').val(),
|
||||
$('#hidden_mn').val()
|
||||
);
|
||||
currentDate = new Date(
|
||||
$('#cur_aa').val(),
|
||||
$('#cur_mm').val() -1,
|
||||
$('#cur_jj').val(),
|
||||
$('#cur_hh').val(),
|
||||
$('#cur_mn').val()
|
||||
);
|
||||
|
||||
// Catch unexpected date problems.
|
||||
if ( attemptedDate.getFullYear() != aa || (1 + attemptedDate.getMonth()) != mm || attemptedDate.getDate() != jj || attemptedDate.getMinutes() != mn ) {
|
||||
if (
|
||||
attemptedDate.getFullYear() != aa ||
|
||||
(1 + attemptedDate.getMonth()) != mm ||
|
||||
attemptedDate.getDate() != jj ||
|
||||
attemptedDate.getMinutes() != mn
|
||||
) {
|
||||
$timestampdiv.find('.timestamp-wrap').addClass('form-invalid');
|
||||
return false;
|
||||
} else {
|
||||
|
@ -820,7 +848,10 @@ jQuery( function($) {
|
|||
);
|
||||
|
||||
// Show or hide the "Save Draft" button.
|
||||
if ( $('option:selected', postStatus).val() == 'private' || $('option:selected', postStatus).val() == 'publish' ) {
|
||||
if (
|
||||
$('option:selected', postStatus).val() == 'private' ||
|
||||
$('option:selected', postStatus).val() == 'publish'
|
||||
) {
|
||||
$('#save-post').hide();
|
||||
} else {
|
||||
$('#save-post').show();
|
||||
|
@ -994,7 +1025,10 @@ jQuery( function($) {
|
|||
$el = $( '#editable-post-name' );
|
||||
revert_e = $el.html();
|
||||
|
||||
buttons.html( '<button type="button" class="save button button-small">' + __( 'OK' ) + '</button> <button type="button" class="cancel button-link">' + __( 'Cancel' ) + '</button>' );
|
||||
buttons.html(
|
||||
'<button type="button" class="save button button-small">' + __( 'OK' ) + '</button> ' +
|
||||
'<button type="button" class="cancel button-link">' + __( 'Cancel' ) + '</button>'
|
||||
);
|
||||
|
||||
// Save permalink changes.
|
||||
buttons.children( '.save' ).on( 'click', function() {
|
||||
|
@ -1050,7 +1084,10 @@ jQuery( function($) {
|
|||
slug_value = ( c > full.length / 4 ) ? '' : full;
|
||||
slug_label = __( 'URL Slug' );
|
||||
|
||||
$el.html( '<label for="new-post-slug" class="screen-reader-text">' + slug_label + '</label><input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" spellcheck="false" />' ).children( 'input' ).on( 'keydown', function( e ) {
|
||||
$el.html(
|
||||
'<label for="new-post-slug" class="screen-reader-text">' + slug_label + '</label>' +
|
||||
'<input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" spellcheck="false" />'
|
||||
).children( 'input' ).on( 'keydown', function( e ) {
|
||||
var key = e.which;
|
||||
// On [Enter], just save the new slug, don't save the post.
|
||||
if ( 13 === key ) {
|
||||
|
@ -1224,7 +1261,12 @@ jQuery( function($) {
|
|||
$textarea.on( 'keydown.wp-autosave', function( event ) {
|
||||
// Key [S] has code 83.
|
||||
if ( event.which === 83 ) {
|
||||
if ( event.shiftKey || event.altKey || ( isMac && ( ! event.metaKey || event.ctrlKey ) ) || ( ! isMac && ! event.ctrlKey ) ) {
|
||||
if (
|
||||
event.shiftKey ||
|
||||
event.altKey ||
|
||||
( isMac && ( ! event.metaKey || event.ctrlKey ) ) ||
|
||||
( ! isMac && ! event.ctrlKey )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9-alpha-52227';
|
||||
$wp_version = '5.9-alpha-52228';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue