mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-14 14:45:45 +01:00
40a294d21e
This backports several build and test tool improvements to the 5.3 branch. Most notably, this includes: - The changes required to allow each workflow to be triggered by the `workflow_dispatch` event so that tests can be run on a schedule [50590]. - The ability to run PHPUnit tests from `src` instead of `build` [50441-50443]. - Splitting single site and multisite tests into parallel jobs [50379]. - Split slow tests into separate, parallel jobs for PHP 5.6 [50444]. - Better branch and path scoping for GitHub Action workflows when running on `pull_request` [50432,50479]. - Several `devDependency` updates. Merges [50267,50299,50379,50387,50413,50416,50432,50435-50436,50441-50444,50446,50473-50474,50476,50479,50485-50487,50545,50579,50590,50598] to the 5.3 branch. See #50401, #51734, #51801, #51802, #52548, #52608, #52612, #52623, #52624, #52625, #52645, #52653, #52658, #52660, #52667. Built from https://develop.svn.wordpress.org/branches/5.3@50605 git-svn-id: http://core.svn.wordpress.org/branches/5.3@50218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
!function(y){var o,s,i=document.title,w=y("#dashboard_right_now").length,x=function(t){t=parseInt(t.html().replace(/[^0-9]+/g,""),10);return isNaN(t)?0:t},r=function(t,e){var n="";if(!isNaN(e)){if(3<(e=e<1?"0":e.toString()).length){for(;3<e.length;)n=thousandsSeparator+e.substr(e.length-3)+n,e=e.substr(0,e.length-3);e+=n}t.html(e)}},b=function(n,t){var e=".post-com-count-"+t,a="comment-count-no-comments",o="comment-count-approved";k("span.approved-count",n),t&&(t=y("span."+o,e),e=y("span."+a,e),t.each(function(){var t=y(this),e=x(t)+n;0===(e=e<1?0:e)?t.removeClass(o).addClass(a):t.addClass(o).removeClass(a),r(t,e)}),e.each(function(){var t=y(this);0<n?t.removeClass(a).addClass(o):t.addClass(a).removeClass(o),r(t,n)}))},k=function(t,n){y(t).each(function(){var t=y(this),e=x(t)+n;r(t,e=e<1?0:e)})},L=function(t){w&&t&&t.i18n_comments_text&&y(".comment-count a","#dashboard_right_now").text(t.i18n_comments_text)},E=function(t){t&&t.i18n_moderation_text&&(y(".comments-in-moderation-text").text(t.i18n_moderation_text),w&&t.in_moderation&&y(".comment-mod-count","#dashboard_right_now")[0<t.in_moderation?"removeClass":"addClass"]("hidden"))},l=function(t){var e,n,a;s=s||new RegExp(adminCommentsL10n.docTitleCommentsCount.replace("%s","\\([0-9"+thousandsSeparator+"]+\\)")+"?"),o=o||y("<div />"),e=i,1<=(t=(a=s.exec(document.title))?(a=a[0],o.html(a),x(o)+t):(o.html(0),t))?(r(o,t),(n=s.exec(document.title))&&(e=document.title.replace(n[0],adminCommentsL10n.docTitleCommentsCount.replace("%s",o.text())+" "))):(n=s.exec(e))&&(e=e.replace(n[0],adminCommentsL10n.docTitleComments)),document.title=e},I=function(n,t){var e=".post-com-count-"+t,a="comment-count-no-pending",o="post-com-count-no-pending",s="comment-count-pending";w||l(n),y("span.pending-count").each(function(){var t=y(this),e=x(t)+n;e<1&&(e=0),t.closest(".awaiting-mod")[0===e?"addClass":"removeClass"]("count-0"),r(t,e)}),t&&(t=y("span."+s,e),e=y("span."+a,e),t.each(function(){var t=y(this),e=x(t)+n;0===(e=e<1?0:e)?(t.parent().addClass(o),t.removeClass(s).addClass(a)):(t.parent().removeClass(o),t.addClass(s).removeClass(a)),r(t,e)}),e.each(function(){var t=y(this);0<n?(t.parent().removeClass(o),t.removeClass(a).addClass(s)):(t.parent().addClass(o),t.addClass(a).removeClass(s)),r(t,n)}))};window.setCommentsList=function(){var i,v=0,g=y('input[name="_total"]',"#comments-form"),l=y('input[name="_per_page"]',"#comments-form"),m=y('input[name="_page"]',"#comments-form"),_=function(t,e,n){e<v||(n&&(v=e),g.val(t.toString()))},t=function(t,e){var n,a,o,s=y("#"+e.element);!0!==e.parsed&&(o=e.parsed.responses[0]),a=y("#replyrow"),n=y("#comment_ID",a).val(),a=y("#replybtn",a),s.is(".unapproved")?(e.data.id==n&&a.text(adminCommentsL10n.replyApprove),s.find(".row-actions span.view").addClass("hidden").end().find("div.comment_status").html("0")):(e.data.id==n&&a.text(adminCommentsL10n.reply),s.find(".row-actions span.view").removeClass("hidden").end().find("div.comment_status").html("1")),i=y("#"+e.element).is("."+e.dimClass)?1:-1,o?(L(o.supplemental),E(o.supplemental),I(i,o.supplemental.postId),b(-1*i,o.supplemental.postId)):(I(i),b(-1*i))},e=function(t,e){var n,a,o,s,i=!1,r=y(t.target).attr("data-wp-lists");return t.data._total=g.val()||0,t.data._per_page=l.val()||0,t.data._page=m.val()||0,t.data._url=document.location.href,t.data.comment_status=y('input[name="comment_status"]',"#comments-form").val(),-1!=r.indexOf(":trash=1")?i="trash":-1!=r.indexOf(":spam=1")&&(i="spam"),i&&(n=r.replace(/.*?comment-([0-9]+).*/,"$1"),a=y("#comment-"+n),o=y("#"+i+"-undo-holder").html(),a.find(".check-column :checkbox").prop("checked",!1),a.siblings("#replyrow").length&&commentReply.cid==n&&commentReply.close(),o=a.is("tr")?(r=a.children(":visible").length,s=y(".author strong",a).text(),y('<tr id="undo-'+n+'" class="undo un'+i+'" style="display:none;"><td colspan="'+r+'">'+o+"</td></tr>")):(s=y(".comment-author",a).text(),y('<div id="undo-'+n+'" style="display:none;" class="undo un'+i+'">'+o+"</div>")),a.before(o),y("strong","#undo-"+n).text(s),(s=y(".undo a","#undo-"+n)).attr("href","comment.php?action=un"+i+"comment&c="+n+"&_wpnonce="+t.data._ajax_nonce),s.attr("data-wp-lists","delete:the-comment-list:comment-"+n+"::un"+i+"=1"),s.attr("class","vim-z vim-destructive aria-button-if-js"),y(".avatar",a).first().clone().prependTo("#undo-"+n+" ."+i+"-undo-inside"),s.click(function(t){t.preventDefault(),t.stopPropagation(),e.wpList.del(this),y("#undo-"+n).css({backgroundColor:"#ceb"}).fadeOut(350,function(){y(this).remove(),y("#comment-"+n).css("backgroundColor","").fadeIn(300,function(){y(this).show()})})})),t},n=function(t,e){var n,a,o,s,i=!0===e.parsed?{}:e.parsed.responses[0],r=!0===e.parsed?"":i.supplemental.status,l=!0===e.parsed?"":i.supplemental.postId,m=!0===e.parsed?"":i.supplemental,d=y(e.target).parent(),p=y("#"+e.element),c=p.hasClass("approved")&&!p.hasClass("unapproved"),u=p.hasClass("unapproved"),h=p.hasClass("spam"),f=p.hasClass("trash"),p=!1;L(m),E(m),d.is("span.undo")?(d.hasClass("unspam")?(n=-1,"trash"===r?a=1:"1"===r?s=1:"0"===r&&(o=1)):d.hasClass("untrash")&&(a=-1,"spam"===r?n=1:"1"===r?s=1:"0"===r&&(o=1)),p=!0):d.is("span.spam")?(c?s=-1:u?o=-1:f&&(a=-1),n=1):d.is("span.unspam")?(c?o=1:u?s=1:(f||h)&&(d.hasClass("approve")?s=1:d.hasClass("unapprove")&&(o=1)),n=-1):d.is("span.trash")?(c?s=-1:u?o=-1:h&&(n=-1),a=1):d.is("span.untrash")?(c?o=1:u?s=1:f&&(d.hasClass("approve")?s=1:d.hasClass("unapprove")&&(o=1)),a=-1):d.is("span.approve:not(.unspam):not(.untrash)")?o=-(s=1):d.is("span.unapprove:not(.unspam):not(.untrash)")?(s=-1,o=1):d.is("span.delete")&&(h?n=-1:f&&(a=-1)),o&&(I(o,l),k("span.all-count",o)),s&&(b(s,l),k("span.all-count",s)),n&&k("span.spam-count",n),a&&k("span.trash-count",a),("trash"===e.data.comment_status&&!x(y("span.trash-count"))||"spam"===e.data.comment_status&&!x(y("span.spam-count")))&&y("#delete_all").hide(),w||(a=g.val()?parseInt(g.val(),10):0,y(e.target).parent().is("span.undo")?a++:a--,a<0&&(a=0),"object"==typeof t?i.supplemental.total_items_i18n&&v<i.supplemental.time?((e=i.supplemental.total_items_i18n||"")&&(y(".displaying-num").text(e.replace(" ",String.fromCharCode(160))),y(".total-pages").text(i.supplemental.total_pages_i18n.replace(" ",String.fromCharCode(160))),y(".tablenav-pages").find(".next-page, .last-page").toggleClass("disabled",i.supplemental.total_pages==y(".current-page").val())),_(a,i.supplemental.time,!0)):i.supplemental.time&&_(a,i.supplemental.time,!1):_(a,t,!1)),theExtraList&&0!==theExtraList.length&&0!==theExtraList.children().length&&!p&&(theList.get(0).wpList.add(theExtraList.children(":eq(0):not(.no-items)").remove().clone()),C(),t=function(){y("#the-comment-list tr:visible").length||theList.get(0).wpList.add(theExtraList.find(".no-items").clone())},(p=y(":animated","#the-comment-list")).length?p.promise().done(t):t())},C=function(t){var e=y.query.get(),n=y(".total-pages").text(),a=y('input[name="_per_page"]',"#comments-form").val();e.paged||(e.paged=1),e.paged>n||(t?(theExtraList.empty(),e.number=Math.min(8,a)):(e.number=1,e.offset=Math.min(8,a)-1),e.no_placeholder=!0,e.paged++,!0===e.comment_type&&(e.comment_type=""),e=y.extend(e,{action:"fetch-list",list_args:list_args,_ajax_fetch_list_nonce:y("#_ajax_fetch_list_nonce").val()}),y.ajax({url:ajaxurl,global:!1,dataType:"json",data:e,success:function(t){theExtraList.get(0).wpList.add(t.rows)}}))};window.theExtraList=y("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"}),window.theList=y("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:t,delAfter:n,addColor:"none"}).bind("wpListDelEnd",function(t,e){var n=y(e.target).attr("data-wp-lists"),e=e.element.replace(/[^0-9]+/g,"");-1==n.indexOf(":trash=1")&&-1==n.indexOf(":spam=1")||y("#undo-"+e).fadeIn(300,function(){y(this).show()})})},window.commentReply={cid:"",act:"",originalContent:"",init:function(){var t=y("#replyrow");y(".cancel",t).click(function(){return commentReply.revert()}),y(".save",t).click(function(){return commentReply.send()}),y("input#author-name, input#author-email, input#author-url",t).keypress(function(t){if(13==t.which)return commentReply.send(),t.preventDefault(),!1}),y("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(y(this).parent())}),y("#doaction, #doaction2, #post-query-submit").click(function(){0<y("#the-comment-list #replyrow").length&&commentReply.close()}),this.comments_listing=y('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(t){t.each(function(){y(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(y(this).parent())})})},toggle:function(t){"none"!==y(t).css("display")&&(y("#replyrow").parent().is("#com-reply")||window.confirm(adminCommentsL10n.warnQuickEdit))&&y(t).find("button.vim-q").click()},revert:function(){if(y("#the-comment-list #replyrow").length<1)return!1;y("#replyrow").fadeOut("fast",function(){commentReply.close()})},close:function(){var t=y(),e=y("#replyrow");e.parent().is("#com-reply")||(this.cid&&(t=y("#comment-"+this.cid)),"edit-comment"===this.act&&t.fadeIn(300,function(){t.show().find(".vim-q").attr("aria-expanded","false").focus()}).css("backgroundColor",""),"replyto-comment"===this.act&&t.find(".vim-r").attr("aria-expanded","false").focus(),"undefined"!=typeof QTags&&QTags.closeAllTags("replycontent"),y("#add-new-comment").css("display",""),e.hide(),y("#com-reply").append(e),y("#replycontent").css("height","").val(""),y("#edithead input").val(""),y(".notice-error",e).addClass("hidden").find(".error").empty(),y(".spinner",e).removeClass("is-active"),this.cid="",this.originalContent="")},open:function(t,e,n){var a,o,s,i,r=y("#comment-"+t),l=r.height();return this.discardCommentChanges()&&(this.close(),this.cid=t,a=y("#replyrow"),o=y("#inline-"+t),s=this.act=("edit"==(n=n||"replyto")?"edit":"replyto")+"-comment",this.originalContent=y("textarea.comment",o).val(),i=y("> th:visible, > td:visible",r).length,a.hasClass("inline-edit-row")&&0!==i&&y("td",a).attr("colspan",i),y("#action",a).val(s),y("#comment_post_ID",a).val(e),y("#comment_ID",a).val(t),"edit"==n?(y("#author-name",a).val(y("div.author",o).text()),y("#author-email",a).val(y("div.author-email",o).text()),y("#author-url",a).val(y("div.author-url",o).text()),y("#status",a).val(y("div.comment_status",o).text()),y("#replycontent",a).val(y("textarea.comment",o).val()),y("#edithead, #editlegend, #savebtn",a).show(),y("#replyhead, #replybtn, #addhead, #addbtn",a).hide(),120<l&&(l=500<l?500:l,y("#replycontent",a).css("height",l+"px")),r.after(a).fadeOut("fast",function(){y("#replyrow").fadeIn(300,function(){y(this).show()})})):"add"==n?(y("#addhead, #addbtn",a).show(),y("#replyhead, #replybtn, #edithead, #editlegend, #savebtn",a).hide(),y("#the-comment-list").prepend(a),y("#replyrow").fadeIn(300)):(n=y("#replybtn",a),y("#edithead, #editlegend, #savebtn, #addhead, #addbtn",a).hide(),y("#replyhead, #replybtn",a).show(),r.after(a),r.hasClass("unapproved")?n.text(adminCommentsL10n.replyApprove):n.text(adminCommentsL10n.reply),y("#replyrow").fadeIn(300,function(){y(this).show()})),setTimeout(function(){var t=y("#replyrow").offset().top,e=t+y("#replyrow").height(),n=window.pageYOffset||document.documentElement.scrollTop,a=document.documentElement.clientHeight||window.innerHeight||0;n+a-20<e?window.scroll(0,e-a+35):t-20<n&&window.scroll(0,t-35),y("#replycontent").focus().keyup(function(t){27==t.which&&commentReply.revert()})},600)),!1},send:function(){var e={};y("#replysubmit .error-notice").addClass("hidden"),y("#replysubmit .spinner").addClass("is-active"),y("#replyrow input").not(":button").each(function(){var t=y(this);e[t.attr("name")]=t.val()}),e.content=y("#replycontent").val(),e.id=e.comment_post_ID,e.comments_listing=this.comments_listing,e.p=y('[name="p"]').val(),y("#comment-"+y("#comment_ID").val()).hasClass("unapproved")&&(e.approve_parent=1),y.ajax({type:"POST",url:ajaxurl,data:e,success:function(t){commentReply.show(t)},error:function(t){commentReply.error(t)}})},show:function(t){var e,n,a,o=this;return"string"==typeof t?(o.error({responseText:t}),!1):(e=wpAjax.parseAjaxResponse(t)).errors?(o.error({responseText:wpAjax.broken}),!1):(o.revert(),t="#comment-"+(e=e.responses[0]).id,"edit-comment"==o.act&&y(t).remove(),void(e.supplemental.parent_approved&&(a=y("#comment-"+e.supplemental.parent_approved),I(-1,e.supplemental.parent_post_id),"moderated"==this.comments_listing)?a.animate({backgroundColor:"#CCEEBB"},400,function(){a.fadeOut()}):(e.supplemental.i18n_comments_text&&(L(e.supplemental),E(e.supplemental),b(1,e.supplemental.parent_post_id),k("span.all-count",1)),e=y.trim(e.data),y(e).hide(),y("#replyrow").after(e),t=y(t),o.addEvents(t),n=t.hasClass("unapproved")?"#FFFFE0":t.closest(".widefat, .postbox").css("backgroundColor"),t.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:n},300,function(){a&&a.length&&a.animate({backgroundColor:"#CCEEBB"},300).animate({backgroundColor:n},300).removeClass("unapproved").addClass("approved").find("div.comment_status").html("1")}))))},error:function(t){var e=t.statusText,n=y("#replysubmit .notice-error"),a=n.find(".error");y("#replysubmit .spinner").removeClass("is-active"),(e=t.responseText?t.responseText.replace(/<.[^<>]*?>/g,""):e)&&(n.removeClass("hidden"),a.html(e))},addcomment:function(t){var e=this;y("#add-new-comment").fadeOut(200,function(){e.open(0,t,"add"),y("table.comments-box").css("display",""),y("#no-comments").remove()})},discardCommentChanges:function(){var t=y("#replyrow");return this.originalContent===y("#replycontent",t).val()||window.confirm(adminCommentsL10n.warnCommentChanges)}},y(document).ready(function(){var t,e,n,a;setCommentsList(),commentReply.init(),y(document).on("click","span.delete a.delete",function(t){t.preventDefault()}),void 0!==y.table_hotkeys&&(t=function(n){return function(){var t="next"==n?"first":"last",e=y(".tablenav-pages ."+n+"-page:not(.disabled)");e.length&&(window.location=e[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+t+"=1")}},e=function(t,e){window.location=y("span.edit a",e).attr("href")},n=function(){y("#cb-select-all-1").data("wp-toggle",1).trigger("click").removeData("wp-toggle")},a=function(e){return function(){var t=y('select[name="action"]');y('option[value="'+e+'"]',t).prop("selected",!0),y("#doaction").click()}},y.table_hotkeys(y("table.widefat"),["a","u","s","d","r","q","z",["e",e],["shift+x",n],["shift+a",a("approve")],["shift+s",a("spam")],["shift+d",a("delete")],["shift+t",a("trash")],["shift+z",a("untrash")],["shift+u",a("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:t("prev"),next_page_link_cb:t("next"),hotkeys_opts:{disableInInput:!0,type:"keypress",noDisable:'.check-column input[type="checkbox"]'},cycle_expr:"#the-comment-list tr",start_row_index:0})),y("#the-comment-list").on("click",".comment-inline",function(){var t=y(this),e="replyto";void 0!==t.data("action")&&(e=t.data("action")),y(this).attr("aria-expanded","true"),commentReply.open(t.data("commentId"),t.data("postId"),e)})})}(jQuery); |