WordPress/wp-admin/js/common.min.js
desrosj a68590b382 Build/Test Tools: Support NodeJS 14.x in the 4.8 branch.
This updates the 4.8 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy.

This also replaces the `npm-shrinkwrap.json` with a `package-lock.json` file. Lock files were not supported in earlier versions of NPM, but can now be used.

In addition to backporting the package updates that happened after branching 4.8, dependencies that were removed in future releases have also been updated to their latest versions.

Props desrosj, dd32, netweb, jorbin.
Merges [42460-42461,42463,42887,43320,43323,43977,44219,44233,44728,45321,45765,46404,46408-46409,47404,47867-47869,47872-47873,48705,49636,49933,49937,49939,50017,50126,50176,50185,50192] to the 4.8 branch.
See #52341.
Built from https://develop.svn.wordpress.org/branches/4.8@50203


git-svn-id: http://core.svn.wordpress.org/branches/4.8@49877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-05 04:10:38 +00:00

1 line
14 KiB
JavaScript

var showNotice,adminMenu,columns,validateForm,screenMeta;!function(V,q){var e,t,B=V(document),H=V(q),Q=V(document.body);function n(){B.trigger("wp-window-resized")}adminMenu={init:function(){},fold:function(){},restoreMenuState:function(){},toggle:function(){},favorites:function(){}},columns={init:function(){var n=this;V(".hide-column-tog","#adv-settings").click(function(){var e=V(this),t=e.val();e.prop("checked")?n.checked(t):n.unchecked(t),columns.saveManageColumnsState()})},saveManageColumnsState:function(){var e=this.hidden();V.post(ajaxurl,{action:"hidden-columns",hidden:e,screenoptionnonce:V("#screenoptionnonce").val(),page:pagenow})},checked:function(e){V(".column-"+e).removeClass("hidden"),this.colSpanChange(1)},unchecked:function(e){V(".column-"+e).addClass("hidden"),this.colSpanChange(-1)},hidden:function(){return V(".manage-column[id]").filter(":hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return V(".hide-column-tog").not(":checked").map(function(){var e=this.id;return e.substring(e,e.length-5)}).get().join(",")}},colSpanChange:function(e){var t=V("table").find(".colspanchange");t.length&&(e=parseInt(t.attr("colspan"),10)+e,t.attr("colspan",e.toString()))}},B.ready(function(){columns.init()}),validateForm=function(e){return!V(e).find(".form-required").filter(function(){return""===V(":input:visible",this).val()}).addClass("form-invalid").find(":input:visible").change(function(){V(this).closest(".form-invalid").removeClass("form-invalid")}).length},showNotice={warn:function(){var e=commonL10n.warnDelete||"";return!!confirm(e)},note:function(e){alert(e)}},screenMeta={element:null,toggles:null,page:null,init:function(){this.element=V("#screen-meta"),this.toggles=V("#screen-meta-links").find(".show-settings"),this.page=V("#wpcontent"),this.toggles.click(this.toggleEvent)},toggleEvent:function(){var e=V("#"+V(this).attr("aria-controls"));e.length&&(e.is(":visible")?screenMeta.close(e,V(this)):screenMeta.open(e,V(this)))},open:function(e,t){V("#screen-meta-links").find(".screen-meta-toggle").not(t.parent()).css("visibility","hidden"),e.parent().show(),e.slideDown("fast",function(){e.focus(),t.addClass("screen-meta-active").attr("aria-expanded",!0)}),B.trigger("screen:options:open")},close:function(e,t){e.slideUp("fast",function(){t.removeClass("screen-meta-active").attr("aria-expanded",!1),V(".screen-meta-toggle").css("visibility",""),e.parent().hide()}),B.trigger("screen:options:close")}},V(".contextual-help-tabs").delegate("a","click",function(e){var t=V(this);if(e.preventDefault(),t.is(".active a"))return!1;V(".contextual-help-tabs .active").removeClass("active"),t.parent("li").addClass("active"),t=V(t.attr("href")),V(".help-tab-content").not(t).removeClass("active").hide(),t.addClass("active").show()}),B.ready(function(){var n,i,o,s,e,t,a,r,c,l,d=!1,u=V("input.current-page"),p=u.val(),f=/iPhone|iPad|iPod/.test(navigator.userAgent),h=-1!==navigator.userAgent.indexOf("Android"),m=V(document.documentElement).hasClass("ie8"),v=V("#adminmenuwrap"),w=V("#wpwrap"),g=V("#adminmenu"),b=V("#wp-responsive-overlay"),k=V("#wp-toolbar"),C=k.find('a[aria-haspopup="true"]'),x=V(".meta-box-sortables"),y=!1,S=V("#wpadminbar"),M=0,T=!1,D=!1,E=0,A=!1,j={window:H.height(),wpwrap:w.height(),adminbar:S.height(),menu:v.height()},I=V(".wp-header-end");function U(){var e=V("a.wp-has-current-submenu");"folded"===r?e.attr("aria-haspopup","true"):e.attr("aria-haspopup","false")}function K(e){var t=e.find(".wp-submenu"),n=e.offset().top,i=H.scrollTop(),o=n-i-30,e=n+t.height()+1,n=60+e-w.height(),i=H.height()+i-50;1<(n=o<(n=i<e-n?e-i:n)?o:n)?t.css("margin-top","-"+n+"px"):t.css("margin-top","")}function z(){V(".notice.is-dismissible").each(function(){var t=V(this),e=V('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),n=commonL10n.dismiss||"";e.find(".screen-reader-text").text(n),e.on("click.wp-dismiss-notice",function(e){e.preventDefault(),t.fadeTo(100,0,function(){t.slideUp(100,function(){t.remove()})})}),t.append(e)})}function N(){c.prop("disabled",""===l.map(function(){return V(this).val()}).get().join(""))}function O(e){var t=H.scrollTop(),e=!e||"scroll"!==e.type;if(!(f||m||g.data("wp-responsive")))if(j.menu+j.adminbar<j.window||j.menu+j.adminbar+20>j.wpwrap)W();else{if(A=!0,j.menu+j.adminbar>j.window){if(t<0)return void(T||(D=!(T=!0),v.css({position:"fixed",top:"",bottom:""})));if(t+j.window>B.height()-1)return void(D||(T=!(D=!0),v.css({position:"fixed",top:"",bottom:0})));M<t?T?(T=!1,(E=v.offset().top-j.adminbar-(t-M))+j.menu+j.adminbar<t+j.window&&(E=t+j.window-j.menu-j.adminbar),v.css({position:"absolute",top:E,bottom:""})):!D&&v.offset().top+j.menu<t+j.window&&(D=!0,v.css({position:"fixed",top:"",bottom:0})):t<M?D?(D=!1,(E=v.offset().top-j.adminbar+(M-t))+j.menu>t+j.window&&(E=t),v.css({position:"absolute",top:E,bottom:""})):!T&&v.offset().top>=t+j.adminbar&&(T=!0,v.css({position:"fixed",top:"",bottom:""})):e&&(T=D=!1,0<(E=t+j.window-j.menu-j.adminbar-1)?v.css({position:"absolute",top:E,bottom:""}):W())}M=t}}function P(){j={window:H.height(),wpwrap:w.height(),adminbar:S.height(),menu:v.height()}}function W(){!f&&A&&(T=D=A=!1,v.css({position:"",top:"",bottom:""}))}function L(){P(),g.data("wp-responsive")?(Q.removeClass("sticky-menu"),W()):j.menu+j.adminbar>j.window?(O(),Q.removeClass("sticky-menu")):(Q.addClass("sticky-menu"),W())}function F(){V(".aria-button-if-js").attr("role","button")}function R(){var e=!1;return e=q.innerWidth?Math.max(q.innerWidth,document.documentElement.clientWidth):e}function _(){var e=R()||961;r=e<=782?"responsive":Q.hasClass("folded")||Q.hasClass("auto-fold")&&e<=960&&782<e?"folded":"open",B.trigger("wp-menu-state-set",{state:r})}g.on("click.wp-submenu-head",".wp-submenu-head",function(e){V(e.target).parent().siblings("a").get(0).click()}),V("#collapse-button").on("click.collapse-menu",function(){var e=R()||961;V("#adminmenu div.wp-submenu").css("margin-top",""),r=e<960?Q.hasClass("auto-fold")?(Q.removeClass("auto-fold").removeClass("folded"),setUserSetting("unfold",1),setUserSetting("mfold","o"),"open"):(Q.addClass("auto-fold"),setUserSetting("unfold",0),"folded"):Q.hasClass("folded")?(Q.removeClass("folded"),setUserSetting("mfold","o"),"open"):(Q.addClass("folded"),setUserSetting("mfold","f"),"folded"),B.trigger("wp-collapse-menu",{state:r})}),B.on("wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate",U),("ontouchstart"in q||/IEMobile\/[1-9]/.test(navigator.userAgent))&&(e=f?"touchstart":"click",Q.on(e+".wp-mobile-hover",function(e){g.data("wp-responsive")||V(e.target).closest("#adminmenu").length||g.find("li.opensub").removeClass("opensub")}),g.find("a.wp-has-submenu").on(e+".wp-mobile-hover",function(e){var t=V(this).parent();g.data("wp-responsive")||t.hasClass("opensub")||t.hasClass("wp-menu-open")&&!(t.width()<40)||(e.preventDefault(),K(t),g.find("li.opensub").removeClass("opensub"),t.addClass("opensub"))})),f||h||(g.find("li.wp-has-submenu").hoverIntent({over:function(){var e=V(this),t=e.find(".wp-submenu"),t=parseInt(t.css("top"),10);isNaN(t)||-5<t||g.data("wp-responsive")||(K(e),g.find("li.opensub").removeClass("opensub"),e.addClass("opensub"))},out:function(){g.data("wp-responsive")||V(this).removeClass("opensub").find(".wp-submenu").css("margin-top","")},timeout:200,sensitivity:7,interval:90}),g.on("focus.adminmenu",".wp-submenu a",function(e){g.data("wp-responsive")||V(e.target).closest("li.menu-top").addClass("opensub")}).on("blur.adminmenu",".wp-submenu a",function(e){g.data("wp-responsive")||V(e.target).closest("li.menu-top").removeClass("opensub")}).find("li.wp-has-submenu.wp-not-current-submenu").on("focusin.adminmenu",function(){K(V(this))})),I.length||(I=V(".wrap h1, .wrap h2").first()),V("div.updated, div.error, div.notice").not(".inline, .below-h2").insertAfter(I),B.on("wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error",z),screenMeta.init(),Q.on("click","tbody > tr > .check-column :checkbox",function(e){if("undefined"==e.shiftKey)return!0;if(e.shiftKey){if(!d)return!0;n=V(d).closest("form").find(":checkbox").filter(":visible:enabled"),i=n.index(d),o=n.index(this),s=V(this).prop("checked"),0<i&&0<o&&i!=o&&(i<o?n.slice(i,o):n.slice(o,i)).prop("checked",function(){return!!V(this).closest("tr").is(":visible")&&s})}var t=V(d=this).closest("tbody").find(":checkbox").filter(":visible:enabled").not(":checked");return V(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0===t.length}),!0}),Q.on("click.wp-toggle-checkboxes","thead .check-column :checkbox, tfoot .check-column :checkbox",function(e){var t=V(this),n=t.closest("table"),i=t.prop("checked"),o=e.shiftKey||t.data("wp-toggle");n.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!V(this).is(":hidden,:disabled")&&(o?!V(this).prop("checked"):!!i)}),n.children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!o&&!!i})}),V("#wpbody-content").on({focusin:function(){clearTimeout(t),a=V(this).find(".row-actions"),V(".row-actions").not(this).removeClass("visible"),a.addClass("visible")},focusout:function(){t=setTimeout(function(){a.removeClass("visible")},30)}},".has-row-actions"),V("tbody").on("click",".toggle-row",function(){V(this).closest("tr").toggleClass("is-expanded")}),V("#default-password-nag-no").click(function(){return setUserSetting("default_password_nag","hide"),V("div.default-password-nag").hide(),!1}),V("#newcontent").bind("keydown.wpevent_InsertTab",function(e){var t,n,i,o,s=e.target;if(27==e.keyCode)return e.preventDefault(),void V(s).data("tab-out",!0);9!=e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||(V(s).data("tab-out")?V(s).data("tab-out",!1):(t=s.selectionStart,n=s.selectionEnd,i=s.value,document.selection?(s.focus(),document.selection.createRange().text="\t"):0<=t&&(o=this.scrollTop,s.value=i.substring(0,t).concat("\t",i.substring(n)),s.selectionStart=s.selectionEnd=t+1,this.scrollTop=o),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()))}),u.length&&u.closest("form").submit(function(){-1==V('select[name="action"]').val()&&-1==V('select[name="action2"]').val()&&u.val()==p&&u.val("1")}),V('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function(){V('select[name^="action"]').val("-1")}),V("#contextual-help-link, #show-settings-link").on("focus.scroll-into-view",function(e){e.target.scrollIntoView&&e.target.scrollIntoView(!1)}),(I=V("form.wp-upload-form")).length&&(c=I.find('input[type="submit"]'),l=I.find('input[type="file"]'),N(),l.on("change",N)),f||(H.on("scroll.pin-menu",O),B.on("tinymce-editor-init.pin-menu",function(e,t){t.on("wp-autoresize",P)})),q.wpResponsive={init:function(){var e=this;B.on("wp-responsive-activate.wp-responsive",function(){e.activate()}).on("wp-responsive-deactivate.wp-responsive",function(){e.deactivate()}),V("#wp-admin-bar-menu-toggle a").attr("aria-expanded","false"),V("#wp-admin-bar-menu-toggle").on("click.wp-responsive",function(e){e.preventDefault(),S.find(".hover").removeClass("hover"),w.toggleClass("wp-responsive-open"),w.hasClass("wp-responsive-open")?(V(this).find("a").attr("aria-expanded","true"),V("#adminmenu a:first").focus()):V(this).find("a").attr("aria-expanded","false")}),g.on("click.wp-responsive","li.wp-has-submenu > a",function(e){g.data("wp-responsive")&&(V(this).parent("li").toggleClass("selected"),e.preventDefault())}),e.trigger(),B.on("wp-window-resized.wp-responsive",V.proxy(this.trigger,this)),H.on("load.wp-responsive",function(){(-1<navigator.userAgent.indexOf("AppleWebKit/")?H.width():q.innerWidth)<=782&&e.disableSortables()})},activate:function(){L(),Q.hasClass("auto-fold")||Q.addClass("auto-fold"),g.data("wp-responsive",1),this.disableSortables()},deactivate:function(){L(),g.removeData("wp-responsive"),this.enableSortables()},trigger:function(){var e=R();e&&(e<=782?y||(B.trigger("wp-responsive-activate"),y=!0):y&&(B.trigger("wp-responsive-deactivate"),y=!1),e<=480?this.enableOverlay():this.disableOverlay())},enableOverlay:function(){0===b.length&&(b=V('<div id="wp-responsive-overlay"></div>').insertAfter("#wpcontent").hide().on("click.wp-responsive",function(){k.find(".menupop.hover").removeClass("hover"),V(this).hide()})),C.on("click.wp-responsive",function(){b.show()})},disableOverlay:function(){C.off("click.wp-responsive"),b.hide()},disableSortables:function(){if(x.length)try{x.sortable("disable")}catch(e){}},enableSortables:function(){if(x.length)try{x.sortable("enable")}catch(e){}}},V(document).ajaxComplete(function(){F()}),B.on("wp-window-resized.set-menu-state",_),B.on("wp-menu-state-set wp-collapse-menu",function(e,t){var n=V("#collapse-button"),i="true",o=commonL10n.collapseMenu;"folded"===t.state&&(i="false",o=commonL10n.expandMenu),n.attr({"aria-expanded":i,"aria-label":o})}),q.wpResponsive.init(),L(),_(),U(),z(),F(),B.on("wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu",L),V(".wp-initial-focus").focus(),Q.on("click",".js-update-details-toggle",function(){var e=V(this).closest(".js-update-details"),t=V("#"+e.data("update-details"));t.hasClass("update-details-moved")||t.insertAfter(e).addClass("update-details-moved"),t.toggle(),V(this).attr("aria-expanded",t.is(":visible"))})}),H.on("resize.wp-fire-once",function(){q.clearTimeout(e),e=q.setTimeout(n,200)}),"-ms-user-select"in document.documentElement.style&&navigator.userAgent.match(/IEMobile\/10\.0/)&&((t=document.createElement("style")).appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.getElementsByTagName("head")[0].appendChild(t))}(jQuery,window);