mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-13 06:07:23 +01:00
968d57a6b3
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
1 line
7.1 KiB
JavaScript
1 line
7.1 KiB
JavaScript
!function(r){var t={add:"ajaxAdd",del:"ajaxDel",dim:"ajaxDim",process:"process",recolor:"recolor"},d={settings:{url:ajaxurl,type:"POST",response:"ajax-response",what:"",alt:"alternate",altOffset:0,addColor:null,delColor:null,dimAddColor:null,dimDelColor:null,confirm:null,addBefore:null,addAfter:null,delBefore:null,delAfter:null,dimBefore:null,dimAfter:null},nonce:function(e,t){e=wpAjax.unserialize(e.attr("href"));return t.nonce||e._ajax_nonce||r("#"+t.element+' input[name="_ajax_nonce"]').val()||e._wpnonce||r("#"+t.element+' input[name="_wpnonce"]').val()||0},parseData:function(e,t){var n,a=[];try{(n=(n=r(e).attr("data-wp-lists")||"").match(new RegExp(t+":[\\S]+")))&&(a=n[0].split(":"))}catch(e){}return a},pre:function(e,t,n){var a;return t=r.extend({},this.wpList.settings,{element:null,nonce:0,target:e.get(0)},t||{}),!(r.isFunction(t.confirm)&&("add"!=n&&(a=r("#"+t.element).css("backgroundColor"),r("#"+t.element).css("backgroundColor","#FF9966")),e=t.confirm.call(this,e,t,n,a),"add"!=n&&r("#"+t.element).css("backgroundColor",a),!e))&&t},ajaxAdd:function(e,n){e=r(e),n=n||{};var t,a,s,i=this,o=d.parseData(e,"add");return(n=d.pre.call(i,e,n,"add")).element=o[2]||e.attr("id")||n.element||null,o[3]?n.addColor="#"+o[3]:n.addColor=n.addColor||"#FFFF33",!!n&&(e.is('[id="'+n.element+'-submit"]')?!n.element||(n.action="add-"+n.what,n.nonce=d.nonce(e,n),t=r("#"+n.element+" :input").not('[name="_ajax_nonce"], [name="_wpnonce"], [name="action"]'),!!wpAjax.validateForm("#"+n.element)&&(n.data=r.param(r.extend({_ajax_nonce:n.nonce,action:n.action},wpAjax.unserialize(o[4]||""))),(t=r.isFunction(t.fieldSerialize)?t.fieldSerialize():t.serialize())&&(n.data+="&"+t),!(!r.isFunction(n.addBefore)||(n=n.addBefore(n)))||(!n.data.match(/_ajax_nonce=[a-f0-9]+/)||(n.success=function(e){return a=wpAjax.parseAjaxResponse(e,n.response,n.element),s=e,!(!a||a.errors)&&(!0===a||(jQuery.each(a.responses,function(){d.add.call(i,this.data,r.extend({},n,{pos:this.position||0,id:this.id||0,oldId:this.oldId||null}))}),i.wpList.recolor(),r(i).trigger("wpListAddEnd",[n,i.wpList]),void d.clear.call(i,"#"+n.element)))},n.complete=function(e,t){r.isFunction(n.addAfter)&&(t=r.extend({xml:e,status:t,parsed:a},n),n.addAfter(s,t))},r.ajax(n),!1)))):!d.add.call(i,e,n))},ajaxDel:function(e,a){e=r(e),a=a||{};var s,i,o,t=this,n=d.parseData(e,"delete");return(a=d.pre.call(t,e,a,"delete")).element=n[2]||a.element||null,n[3]?a.delColor="#"+n[3]:a.delColor=a.delColor||"#faa",!(!a||!a.element)&&(a.action="delete-"+a.what,a.nonce=d.nonce(e,a),a.data=r.extend({action:a.action,id:a.element.split("-").pop(),_ajax_nonce:a.nonce},wpAjax.unserialize(n[4]||"")),!(!r.isFunction(a.delBefore)||(a=a.delBefore(a,t)))||(!a.data._ajax_nonce||(s=r("#"+a.element),"none"!=a.delColor?s.css("backgroundColor",a.delColor).fadeOut(350,function(){t.wpList.recolor(),r(t).trigger("wpListDelEnd",[a,t.wpList])}):(t.wpList.recolor(),r(t).trigger("wpListDelEnd",[a,t.wpList])),a.success=function(e){if(i=wpAjax.parseAjaxResponse(e,a.response,a.element),o=e,!i||i.errors)return s.stop().stop().css("backgroundColor","#faa").show().queue(function(){t.wpList.recolor(),r(this).dequeue()}),!1},a.complete=function(t,n){r.isFunction(a.delAfter)&&s.queue(function(){var e=r.extend({xml:t,status:n,parsed:i},a);a.delAfter(o,e)}).dequeue()},r.ajax(a),!1)))},ajaxDim:function(e,a){if("none"==r(e).parent().css("display"))return!1;e=r(e),a=a||{};var s,t,i,o,n=this,l=d.parseData(e,"dim");return(a=d.pre.call(n,e,a,"dim")).element=l[2]||a.element||null,a.dimClass=l[3]||a.dimClass||null,l[4]?a.dimAddColor="#"+l[4]:a.dimAddColor=a.dimAddColor||"#FFFF33",l[5]?a.dimDelColor="#"+l[5]:a.dimDelColor=a.dimDelColor||"#FF3333",!(a&&a.element&&a.dimClass)||(a.action="dim-"+a.what,a.nonce=d.nonce(e,a),a.data=r.extend({action:a.action,id:a.element.split("-").pop(),dimClass:a.dimClass,_ajax_nonce:a.nonce},wpAjax.unserialize(l[6]||"")),!(!r.isFunction(a.dimBefore)||(a=a.dimBefore(a)))||(s=r("#"+a.element),t=s.toggleClass(a.dimClass).is("."+a.dimClass),e=d.getColor(s),s.toggleClass(a.dimClass),"none"!=(l=t?a.dimAddColor:a.dimDelColor)?s.animate({backgroundColor:l},"fast").queue(function(){s.toggleClass(a.dimClass),r(this).dequeue()}).animate({backgroundColor:e},{complete:function(){r(this).css("backgroundColor",""),r(n).trigger("wpListDimEnd",[a,n.wpList])}}):r(n).trigger("wpListDimEnd",[a,n.wpList]),!a.data._ajax_nonce||(a.success=function(e){if(i=wpAjax.parseAjaxResponse(e,a.response,a.element),o=e,!i||i.errors)return s.stop().stop().css("backgroundColor","#FF3333")[t?"removeClass":"addClass"](a.dimClass).show().queue(function(){n.wpList.recolor(),r(this).dequeue()}),!1},a.complete=function(t,n){r.isFunction(a.dimAfter)&&s.queue(function(){var e=r.extend({xml:t,status:n,parsed:i},a);a.dimAfter(o,e)}).dequeue()},r.ajax(a),!1)))},getColor:function(e){return jQuery(e).css("backgroundColor")||"#ffffff"},add:function(e,t){e=r("string"==typeof e?r.trim(e):e);var n,a=r(this),s=!1;return"string"==typeof t&&(t={what:t}),t=r.extend({pos:0,id:0,oldId:null},this.wpList.settings,t),!(!e.length||!t.what)&&(t.oldId&&(s=r("#"+t.what+"-"+t.oldId)),!t.id||t.id==t.oldId&&s&&s.length||r("#"+t.what+"-"+t.id).remove(),s&&s.length?(s.before(e),s.remove()):isNaN(t.pos)?(n="after","-"==t.pos.substr(0,1)&&(t.pos=t.pos.substr(1),n="before"),1===(s=a.find("#"+t.pos)).length?s[n](e):a.append(e)):"comment"==t.what&&0!==r("#"+t.element).length||(t.pos<0?a.prepend(e):a.append(e)),t.alt&&((a.children(":visible").index(e[0])+t.altOffset)%2?e.removeClass(t.alt):e.addClass(t.alt)),"none"!=t.addColor&&(n=d.getColor(e),e.css("backgroundColor",t.addColor).animate({backgroundColor:n},{complete:function(){r(this).css("backgroundColor","")}})),a.each(function(){this.wpList.process(e)}),e)},clear:function(e){var t,n;e=r(e),this.wpList&&e.parents("#"+this.id).length||e.find(":input").each(function(){r(this).parents(".form-no-clear").length||(t=this.type.toLowerCase(),n=this.tagName.toLowerCase(),"text"==t||"password"==t||"textarea"==n?this.value="":"checkbox"==t||"radio"==t?this.checked=!1:"select"==n&&(this.selectedIndex=null))})},process:function(e){var t=this,e=r(e||document);e.delegate('form[data-wp-lists^="add:'+t.id+':"]',"submit",function(){return t.wpList.add(this)}),e.delegate('a[data-wp-lists^="add:'+t.id+':"], input[data-wp-lists^="add:'+t.id+':"]',"click",function(){return t.wpList.add(this)}),e.delegate('[data-wp-lists^="delete:'+t.id+':"]',"click",function(){return t.wpList.del(this)}),e.delegate('[data-wp-lists^="dim:'+t.id+':"]',"click",function(){return t.wpList.dim(this)})},recolor:function(){var e,t,n=this;n.wpList.settings.alt&&((e=r(".list-item:visible",n)).length||(e=r(n).children(":visible")),t=[":even",":odd"],n.wpList.settings.altOffset%2&&t.reverse(),e.filter(t[0]).addClass(n.wpList.settings.alt).end().filter(t[1]).removeClass(n.wpList.settings.alt))},init:function(){var t=this;t.wpList.process=function(e){t.each(function(){this.wpList.process(e)})},t.wpList.recolor=function(){t.each(function(){this.wpList.recolor()})}}};r.fn.wpList=function(e){return this.each(function(){var a=this;this.wpList={settings:r.extend({},d.settings,{what:d.parseData(this,"list")[1]||""},e)},r.each(t,function(e,n){a.wpList[e]=function(e,t){return d[n].call(a,e,t)}})}),d.init.call(this),this.wpList.process(),this}}(jQuery); |