WordPress/wp-admin/js/common.min.js
desrosj 968d57a6b3 Build/Test Tools: Support NodeJS 14.x in the 4.5 branch.
This updates the 4.5 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.

Because older branches use (really) old versions of NodeJS, the local Docker environment cannot be backported since the needed dependencies will not run on these older versions (see #48301). This also blocks the ability to move automated testing over to GitHub Actions (see #50401).

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.5, dependencies that were removed in future releases have also been updated to their latest versions.

Props desrosj, dd32, netweb, jorbin.
Merges [37185,37212,37612,38111,38688,39110,39113-39119,39478,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.5 branch.
See #52341.
Built from https://develop.svn.wordpress.org/branches/4.5@50208


git-svn-id: http://core.svn.wordpress.org/branches/4.5@49880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-05 04:20:44 +00:00

1 line
13 KiB
JavaScript

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