X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/53f4633144ed68c8b8fb5861f992b5489894a940..bd54ad7dcd1cbf3b37f7822f71ca57b742f00a77:/wp-admin/js/inline-edit-post.js diff --git a/wp-admin/js/inline-edit-post.js b/wp-admin/js/inline-edit-post.js index 02f5c76e..3a65805e 100644 --- a/wp-admin/js/inline-edit-post.js +++ b/wp-admin/js/inline-edit-post.js @@ -1,7 +1,8 @@ /* global inlineEditL10n, ajaxurl, typenow */ +window.wp = window.wp || {}; var inlineEditPost; -(function($) { +( function( $, wp ) { inlineEditPost = { init : function(){ @@ -48,9 +49,9 @@ inlineEditPost = { }); // add events - $('#the-list').on('click', 'a.editinline', function(){ + $('#the-list').on( 'click', 'a.editinline', function( e ) { + e.preventDefault(); inlineEditPost.edit(this); - return false; }); $('#bulk-edit').find('fieldset:first').after( @@ -62,7 +63,11 @@ inlineEditPost = { $('select[name="_status"] option[value="future"]', bulkRow).remove(); $('#doaction, #doaction2').click(function(e){ - var n = $(this).attr('id').substr(2); + var n; + + t.whichBulkButtonId = $( this ).attr( 'id' ); + n = t.whichBulkButtonId.substr( 2 ); + if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) { e.preventDefault(); t.setBulk(); @@ -117,7 +122,7 @@ inlineEditPost = { }, edit : function(id) { - var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, cur_format, f, val, pw; + var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, f, val, pw; t.revert(); if ( typeof(id) === 'object' ) { @@ -145,15 +150,6 @@ inlineEditPost = { $('label.inline-edit-author', editRow).hide(); } - // hide unsupported formats, but leave the current format alone - cur_format = $('.post_format', rowData).text(); - $('option.unsupported', editRow).each(function() { - var $this = $(this); - if ( $this.val() !== cur_format ) { - $this.remove(); - } - }); - for ( f = 0; f < fields.length; f++ ) { val = $('.'+fields[f], rowData); // Deal with Twemoji @@ -244,6 +240,7 @@ inlineEditPost = { return false; }, + // Ajax saving is only for Quick Edit. save : function(id) { var params, fields, page = $('.post_status_page').val() || ''; @@ -267,39 +264,55 @@ inlineEditPost = { // make ajax request $.post( ajaxurl, params, function(r) { + var $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' ); + $( 'table.widefat .spinner' ).removeClass( 'is-active' ); + $( '.ac_results' ).hide(); if (r) { if ( -1 !== r.indexOf( '