WordPress.org

Make WordPress Core

Ticket #12769: 12769.diff

File 12769.diff, 14.5 KB (added by kevdotbadger, 6 years ago)
  • 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 48e635f..c877039 100644
    a b inlineEditPost = { 
    265265
    266266                                if (r) {
    267267                                        if ( -1 !== r.indexOf( '<tr' ) ) {
    268                                                 $(inlineEditPost.what+id).remove();
    269                                                 $('#edit-'+id).before(r).remove();
    270                                                 $(inlineEditPost.what+id).hide().fadeIn();
     268                                                $('#edit-'+id).remove();
     269                                                $(inlineEditPost.what+id).empty().append($(r).html()).fadeIn();
    271270                                        } else {
    272271                                                r = r.replace( /<.[^<>]*?>/g, '' );
    273272                                                $('#edit-'+id+' .inline-edit-save .error').html(r).show();
  • wp-admin/js/inline-edit-post.min.js

    diff --git a/wp-admin/js/inline-edit-post.min.js b/wp-admin/js/inline-edit-post.min.js
    index 7c54650..4e23b7b 100644
    a b  
    1 var inlineEditPost;!function(a){inlineEditPost={init:function(){var b=this,c=a("#inline-edit"),d=a("#bulk-edit");b.type=a("table.widefat").hasClass("pages")?"page":"post",b.what="#post-",c.keyup(function(a){return 27===a.which?inlineEditPost.revert():void 0}),d.keyup(function(a){return 27===a.which?inlineEditPost.revert():void 0}),a("a.cancel",c).click(function(){return inlineEditPost.revert()}),a("a.save",c).click(function(){return inlineEditPost.save(this)}),a("td",c).keydown(function(a){return 13===a.which?inlineEditPost.save(this):void 0}),a("a.cancel",d).click(function(){return inlineEditPost.revert()}),a('#inline-edit .inline-edit-private input[value="private"]').click(function(){var b=a("input.inline-edit-password-input");a(this).prop("checked")?b.val("").prop("disabled",!0):b.prop("disabled",!1)}),a("#the-list").on("click","a.editinline",function(){return inlineEditPost.edit(this),!1}),a("#bulk-edit").find("fieldset:first").after(a("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(a("#inline-edit label.inline-edit-tags").clone()),a('select[name="_status"] option[value="future"]',d).remove(),a("#doaction, #doaction2").click(function(c){var d=a(this).attr("id").substr(2);"edit"===a('select[name="'+d+'"]').val()?(c.preventDefault(),b.setBulk()):a("form#posts-filter tr.inline-editor").length>0&&b.revert()})},toggle:function(b){var c=this;"none"===a(c.what+c.getId(b)).css("display")?c.revert():c.edit(b)},setBulk:function(){var b,c="",d=this.type,e=!0;return this.revert(),a("#bulk-edit td").attr("colspan",a(".widefat:first thead th:visible").length),a("table.widefat tbody").prepend(a("#bulk-edit")),a("#bulk-edit").addClass("inline-editor").show(),a('tbody th.check-column input[type="checkbox"]').each(function(){if(a(this).prop("checked")){e=!1;var b,d=a(this).val();b=a("#inline_"+d+" .post_title").html()||inlineEditL10n.notitle,c+='<div id="ttle'+d+'"><a id="_'+d+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+b+"</div>"}}),e?this.revert():(a("#bulk-titles").html(c),a("#bulk-titles a").click(function(){var b=a(this).attr("id").substr(1);a('table.widefat input[value="'+b+'"]').prop("checked",!1),a("#ttle"+b).remove()}),"post"===d&&(b="post_tag",a('tr.inline-editor textarea[name="tax_input['+b+']"]').suggest(ajaxurl+"?action=ajax-tag-search&tax="+b,{delay:500,minchars:2,multiple:!0,multipleSep:inlineEditL10n.comma})),void a("html, body").animate({scrollTop:0},"fast"))},edit:function(b){var c,d,e,f,g,h,i,j,k,l,m=this,n=!0;for(m.revert(),"object"==typeof b&&(b=m.getId(b)),c=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password","post_format","menu_order"],"page"===m.type&&c.push("post_parent","page_template"),d=a("#inline-edit").clone(!0),a("td",d).attr("colspan",a(".widefat:first thead th:visible").length),a(m.what+b).hasClass("alternate")&&a(d).addClass("alternate"),a(m.what+b).hide().after(d),e=a("#inline_"+b),a(':input[name="post_author"] option[value="'+a(".post_author",e).text()+'"]',d).val()||a(':input[name="post_author"]',d).prepend('<option value="'+a(".post_author",e).text()+'">'+a("#"+m.type+"-"+b+" .author").text()+"</option>"),1===a(':input[name="post_author"] option',d).length&&a("label.inline-edit-author",d).hide(),k=a(".post_format",e).text(),a("option.unsupported",d).each(function(){var b=a(this);b.val()!==k&&b.remove()}),l=0;l<c.length;l++)a(':input[name="'+c[l]+'"]',d).val(a("."+c[l],e).text());if("open"===a(".comment_status",e).text()&&a('input[name="comment_status"]',d).prop("checked",!0),"open"===a(".ping_status",e).text()&&a('input[name="ping_status"]',d).prop("checked",!0),"sticky"===a(".sticky",e).text()&&a('input[name="sticky"]',d).prop("checked",!0),a(".post_category",e).each(function(){var c,e=a(this).text();e&&(c=a(this).attr("id").replace("_"+b,""),a("ul."+c+"-checklist :checkbox",d).val(e.split(",")))}),a(".tags_input",e).each(function(){var c=a(this).text(),e=a(this).attr("id").replace("_"+b,""),f=a("textarea.tax_input_"+e,d),g=inlineEditL10n.comma;c&&(","!==g&&(c=c.replace(/,/g,g)),f.val(c)),f.suggest(ajaxurl+"?action=ajax-tag-search&tax="+e,{delay:500,minchars:2,multiple:!0,multipleSep:inlineEditL10n.comma})}),f=a("._status",e).text(),"future"!==f&&a('select[name="_status"] option[value="future"]',d).remove(),"private"===f&&(a('input[name="keep_private"]',d).prop("checked",!0),a("input.inline-edit-password-input").val("").prop("disabled",!0)),g=a('select[name="post_parent"] option[value="'+b+'"]',d),g.length>0){for(h=g[0].className.split("-")[1],i=g;n&&(i=i.next("option"),0!==i.length);)j=i[0].className.split("-")[1],h>=j?n=!1:(i.remove(),i=g);g.remove()}return a(d).attr("id","edit-"+b).addClass("inline-editor").show(),a(".ptitle",d).focus(),!1},save:function(b){var c,d,e=a(".post_status_page").val()||"";return"object"==typeof b&&(b=this.getId(b)),a("table.widefat .spinner").show(),c={action:"inline-save",post_type:typenow,post_ID:b,edit_date:"true",post_status:e},d=a("#edit-"+b).find(":input").serialize(),c=d+"&"+a.param(c),a.post(ajaxurl,c,function(c){a("table.widefat .spinner").hide(),c?-1!==c.indexOf("<tr")?(a(inlineEditPost.what+b).remove(),a("#edit-"+b).before(c).remove(),a(inlineEditPost.what+b).hide().fadeIn()):(c=c.replace(/<.[^<>]*?>/g,""),a("#edit-"+b+" .inline-edit-save .error").html(c).show()):a("#edit-"+b+" .inline-edit-save .error").html(inlineEditL10n.error).show(),a("#post-"+b).prev().hasClass("alternate")&&a("#post-"+b).removeClass("alternate")},"html"),!1},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");return b&&(a("table.widefat .spinner").hide(),"bulk-edit"===b?(a("table.widefat #bulk-edit").removeClass("inline-editor").hide(),a("#bulk-titles").html(""),a("#inlineedit").append(a("#bulk-edit"))):(a("#"+b).remove(),b=b.substr(b.lastIndexOf("-")+1),a(this.what+b).show())),!1},getId:function(b){var c=a(b).closest("tr").attr("id"),d=c.split("-");return d[d.length-1]}},a(document).ready(function(){inlineEditPost.init()}),a(document).on("heartbeat-tick.wp-check-locked-posts",function(b,c){var d=c["wp-check-locked-posts"]||{};a("#the-list tr").each(function(b,c){var e,f,g=c.id,h=a(c);d.hasOwnProperty(g)?h.hasClass("wp-locked")||(e=d[g],h.find(".column-title .locked-text").text(e.text),h.find(".check-column checkbox").prop("checked",!1),e.avatar_src&&(f=a('<img class="avatar avatar-18 photo" width="18" height="18" />').attr("src",e.avatar_src.replace(/&amp;/g,"&")),h.find(".column-title .locked-avatar").empty().append(f)),h.addClass("wp-locked")):h.hasClass("wp-locked")&&h.removeClass("wp-locked").delay(1e3).find(".locked-info span").empty()})}).on("heartbeat-send.wp-check-locked-posts",function(b,c){var d=[];a("#the-list tr").each(function(a,b){b.id&&d.push(b.id)}),d.length&&(c["wp-check-locked-posts"]=d)}).ready(function(){"undefined"!=typeof wp&&wp.heartbeat&&wp.heartbeat.interval(15)})}(jQuery);
    2  No newline at end of file
     1var inlineEditPost;(function(e){inlineEditPost={init:function(){var t=this,n=e("#inline-edit"),r=e("#bulk-edit");t.type=e("table.widefat").hasClass("pages")?"page":"post";t.what="#post-";n.keyup(function(e){if(e.which===27){return inlineEditPost.revert()}});r.keyup(function(e){if(e.which===27){return inlineEditPost.revert()}});e("a.cancel",n).click(function(){return inlineEditPost.revert()});e("a.save",n).click(function(){return inlineEditPost.save(this)});e("td",n).keydown(function(e){if(e.which===13){return inlineEditPost.save(this)}});e("a.cancel",r).click(function(){return inlineEditPost.revert()});e('#inline-edit .inline-edit-private input[value="private"]').click(function(){var t=e("input.inline-edit-password-input");if(e(this).prop("checked")){t.val("").prop("disabled",true)}else{t.prop("disabled",false)}});e("#the-list").on("click","a.editinline",function(){inlineEditPost.edit(this);return false});e("#bulk-edit").find("fieldset:first").after(e("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(e("#inline-edit label.inline-edit-tags").clone());e('select[name="_status"] option[value="future"]',r).remove();e("#doaction, #doaction2").click(function(n){var r=e(this).attr("id").substr(2);if("edit"===e('select[name="'+r+'"]').val()){n.preventDefault();t.setBulk()}else if(e("form#posts-filter tr.inline-editor").length>0){t.revert()}})},toggle:function(t){var n=this;e(n.what+n.getId(t)).css("display")==="none"?n.revert():n.edit(t)},setBulk:function(){var t="",n=this.type,r,i=true;this.revert();e("#bulk-edit td").attr("colspan",e(".widefat:first thead th:visible").length);e("table.widefat tbody").prepend(e("#bulk-edit"));e("#bulk-edit").addClass("inline-editor").show();e('tbody th.check-column input[type="checkbox"]').each(function(){if(e(this).prop("checked")){i=false;var n=e(this).val(),r;r=e("#inline_"+n+" .post_title").html()||inlineEditL10n.notitle;t+='<div id="ttle'+n+'"><a id="_'+n+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+r+"</div>"}});if(i){return this.revert()}e("#bulk-titles").html(t);e("#bulk-titles a").click(function(){var t=e(this).attr("id").substr(1);e('table.widefat input[value="'+t+'"]').prop("checked",false);e("#ttle"+t).remove()});if("post"===n){r="post_tag";e('tr.inline-editor textarea[name="tax_input['+r+']"]').suggest(ajaxurl+"?action=ajax-tag-search&tax="+r,{delay:500,minchars:2,multiple:true,multipleSep:inlineEditL10n.comma})}e("html, body").animate({scrollTop:0},"fast")},edit:function(t){var n=this,r,i,s,o,u,a,f,l=true,c,h,p;n.revert();if(typeof t==="object"){t=n.getId(t)}r=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password","post_format","menu_order"];if(n.type==="page"){r.push("post_parent","page_template")}i=e("#inline-edit").clone(true);e("td",i).attr("colspan",e(".widefat:first thead th:visible").length);if(e(n.what+t).hasClass("alternate")){e(i).addClass("alternate")}e(n.what+t).hide().after(i);s=e("#inline_"+t);if(!e(':input[name="post_author"] option[value="'+e(".post_author",s).text()+'"]',i).val()){e(':input[name="post_author"]',i).prepend('<option value="'+e(".post_author",s).text()+'">'+e("#"+n.type+"-"+t+" .author").text()+"</option>")}if(e(':input[name="post_author"] option',i).length===1){e("label.inline-edit-author",i).hide()}h=e(".post_format",s).text();e("option.unsupported",i).each(function(){var t=e(this);if(t.val()!==h){t.remove()}});for(p=0;p<r.length;p++){e(':input[name="'+r[p]+'"]',i).val(e("."+r[p],s).text())}if(e(".comment_status",s).text()==="open"){e('input[name="comment_status"]',i).prop("checked",true)}if(e(".ping_status",s).text()==="open"){e('input[name="ping_status"]',i).prop("checked",true)}if(e(".sticky",s).text()==="sticky"){e('input[name="sticky"]',i).prop("checked",true)}e(".post_category",s).each(function(){var n,r=e(this).text();if(r){n=e(this).attr("id").replace("_"+t,"");e("ul."+n+"-checklist :checkbox",i).val(r.split(","))}});e(".tags_input",s).each(function(){var n=e(this).text(),r=e(this).attr("id").replace("_"+t,""),s=e("textarea.tax_input_"+r,i),o=inlineEditL10n.comma;if(n){if(","!==o){n=n.replace(/,/g,o)}s.val(n)}s.suggest(ajaxurl+"?action=ajax-tag-search&tax="+r,{delay:500,minchars:2,multiple:true,multipleSep:inlineEditL10n.comma})});o=e("._status",s).text();if("future"!==o){e('select[name="_status"] option[value="future"]',i).remove()}if("private"===o){e('input[name="keep_private"]',i).prop("checked",true);e("input.inline-edit-password-input").val("").prop("disabled",true)}u=e('select[name="post_parent"] option[value="'+t+'"]',i);if(u.length>0){a=u[0].className.split("-")[1];f=u;while(l){f=f.next("option");if(f.length===0){break}c=f[0].className.split("-")[1];if(c<=a){l=false}else{f.remove();f=u}}u.remove()}e(i).attr("id","edit-"+t).addClass("inline-editor").show();e(".ptitle",i).focus();return false},save:function(t){var n,r,i=e(".post_status_page").val()||"";if(typeof t==="object"){t=this.getId(t)}e("table.widefat .spinner").show();n={action:"inline-save",post_type:typenow,post_ID:t,edit_date:"true",post_status:i};r=e("#edit-"+t).find(":input").serialize();n=r+"&"+e.param(n);e.post(ajaxurl,n,function(n){e("table.widefat .spinner").hide();if(n){if(-1!==n.indexOf("<tr")){e("#edit-"+t).remove();e(inlineEditPost.what+t).empty().append(e(n).html()).fadeIn()}else{n=n.replace(/<.[^<>]*?>/g,"");e("#edit-"+t+" .inline-edit-save .error").html(n).show()}}else{e("#edit-"+t+" .inline-edit-save .error").html(inlineEditL10n.error).show()}if(e("#post-"+t).prev().hasClass("alternate")){e("#post-"+t).removeClass("alternate")}},"html");return false},revert:function(){var t=e("table.widefat tr.inline-editor").attr("id");if(t){e("table.widefat .spinner").hide();if("bulk-edit"===t){e("table.widefat #bulk-edit").removeClass("inline-editor").hide();e("#bulk-titles").html("");e("#inlineedit").append(e("#bulk-edit"))}else{e("#"+t).remove();t=t.substr(t.lastIndexOf("-")+1);e(this.what+t).show()}}return false},getId:function(t){var n=e(t).closest("tr").attr("id"),r=n.split("-");return r[r.length-1]}};e(document).ready(function(){inlineEditPost.init()});e(document).on("heartbeat-tick.wp-check-locked-posts",function(t,n){var r=n["wp-check-locked-posts"]||{};e("#the-list tr").each(function(t,n){var i=n.id,s=e(n),o,u;if(r.hasOwnProperty(i)){if(!s.hasClass("wp-locked")){o=r[i];s.find(".column-title .locked-text").text(o.text);s.find(".check-column checkbox").prop("checked",false);if(o.avatar_src){u=e('<img class="avatar avatar-18 photo" width="18" height="18" />').attr("src",o.avatar_src.replace(/&/g,"&"));s.find(".column-title .locked-avatar").empty().append(u)}s.addClass("wp-locked")}}else if(s.hasClass("wp-locked")){s.removeClass("wp-locked").delay(1e3).find(".locked-info span").empty()}})}).on("heartbeat-send.wp-check-locked-posts",function(t,n){var r=[];e("#the-list tr").each(function(e,t){if(t.id){r.push(t.id)}});if(r.length){n["wp-check-locked-posts"]=r}}).ready(function(){if(typeof wp!=="undefined"&&wp.heartbeat){wp.heartbeat.interval(15)}})})(jQuery)
     2 No newline at end of file