2019-10-05 15:49:10 -04:00
|
|
|
!function(u){var p,n={add:"ajaxAdd",del:"ajaxDel",dim:"ajaxDim",process:"process",recolor:"recolor"};p={settings:{url:ajaxurl,type:"POST",response:"ajax-response",what:"",alt:"alternate",altOffset:0,addColor:"#ffff33",delColor:"#faafaa",dimAddColor:"#ffff33",dimDelColor:"#ff3333",confirm:null,addBefore:null,addAfter:null,delBefore:null,delAfter:null,dimBefore:null,dimAfter:null},nonce:function(e,t){var n=wpAjax.unserialize(e.attr("href")),i=u("#"+t.element);return t.nonce||n._ajax_nonce||i.find('input[name="_ajax_nonce"]').val()||n._wpnonce||i.find('input[name="_wpnonce"]').val()||0},parseData:function(e,t){var n,i=[];try{(n=(n=u(e).data("wp-lists")||"").match(new RegExp(t+":[\\S]+")))&&(i=n[0].split(":"))}catch(e){}return i},pre:function(e,t,n){var i,o,s;return t=u.extend({},this.wpList.settings,{element:null,nonce:0,target:e.get(0)},t||{}),!(u.isFunction(t.confirm)&&(i=u("#"+t.element),"add"!==n&&(o=i.css("backgroundColor"),i.css("backgroundColor","#ff9966")),s=t.confirm.call(this,e,t,n,o),"add"!==n&&i.css("backgroundColor",o),!s))&&t},ajaxAdd:function(e,n){var t,i,o,s,a=this,l=u(e),r=p.parseData(l,"add");return n=n||{},(n=p.pre.call(a,l,n,"add")).element=r[2]||l.prop("id")||n.element||null,n.addColor=r[3]?"#"+r[3]:n.addColor,!!n&&(l.is('[id="'+n.element+'-submit"]')?!n.element||(n.action="add-"+n.what,n.nonce=p.nonce(l,n),!!wpAjax.validateForm("#"+n.element)&&(n.data=u.param(u.extend({_ajax_nonce:n.nonce,action:n.action},wpAjax.unserialize(r[4]||""))),t=u("#"+n.element+" :input").not('[name="_ajax_nonce"], [name="_wpnonce"], [name="action"]'),(i=u.isFunction(t.fieldSerialize)?t.fieldSerialize():t.serialize())&&(n.data+="&"+i),!(!u.isFunction(n.addBefore)||(n=n.addBefore(n)))||(!n.data.match(/_ajax_nonce=[a-f0-9]+/)||(n.success=function(e){return o=wpAjax.parseAjaxResponse(e,n.response,n.element),s=e,!(!o||o.errors)&&(!0===o||(u.each(o.responses,function(){p.add.call(a,this.data,u.extend({},n,{position:this.position||0,id:this.id||0,oldId:this.oldId||null}))}),a.wpList.recolor(),u(a).trigger("wpListAddEnd",[n,a.wpList]),void p.clear.call(a,"#"+n.element)))},n.complete=function(e,t){u.isFunction(n.addAfter)&&n.addAfter(s,u.extend({xml:e,status:t,parsed:o},n))},u.ajax(n),!1)))):!p.add.call(a,l,n))},ajaxDel:function(e,n){var i,o,s,t=this,a=u(e),l=p.parseData(a,"delete");return n=n||{},(n=p.pre.call(t,a,n,"delete")).element=l[2]||n.element||null,n.delColor=l[3]?"#"+l[3]:n.delColor,!(!n||!n.element)&&(n.action="delete-"+n.what,n.nonce=p.nonce(a,n),n.data=u.extend({_ajax_nonce:n.nonce,action:n.action,id:n.element.split("-").pop()},wpAjax.unserialize(l[4]||"")),!(!u.isFunction(n.delBefore)||(n=n.delBefore(n,t)))||(!n.data._ajax_nonce||(i=u("#"+n.element),"none"!==n.delColor?i.css("backgroundColor",n.delColor).fadeOut(350,function(){t.wpList.recolor(),u(t).trigger("wpListDelEnd",[n,t.wpList])}):(t.wpList.recolor(),u(t).trigger("wpListDelEnd",[n,t.wpList])),n.success=function(e){if(o=wpAjax.parseAjaxResponse(e,n.response,n.element),s=e,!o||o.errors)return i.stop().stop().css("backgroundColor","#faa").show().queue(function(){t.wpList.recolor(),u(this).dequeue()}),!1},n.complete=function(e,t){u.isFunction(n.delAfter)&&i.queue(function(){n.delAfter(s,u.extend({xml:e,status:t,parsed:o},n))}).dequeue()},u.ajax(n),!1)))},ajaxDim:function(e,i){var o,s,t,n,a,l,r=this,d=u(e),c=p.parseData(d,"dim");return"none"!==d.parent().css("display")&&(i=i||{},(i=p.pre.call(r,d,i,"dim")).element=c[2]||i.element||null,i.dimClass=c[3]||i.dimClass||null,i.dimAddColor=c[4]?"#"+c[4]:i.dimAddColor,i.dimDelColor=c[5]?"#"+c[5]:i.dimDelColor,!(i&&i.element&&i.dimClass)||(i.action="dim-"+i.what,i.nonce=p.nonce(d,i),i.data=u.extend({_ajax_nonce:i.nonce,action:i.action,id:i.element.split("-").pop(),dimClass:i.dimClass},wpAjax.unserialize(c[6]||"")),!(!u.isFunction(i.dimBefore)||(i=i.dimBefore(i)))||(o=u("#"+i.element),s=o.toggleClass(i.dimClass).is("."+i.dimClass),t=p.getColor(o),n=s?i.dimAddColor:i.dimDelColor,o.toggleClass(i.dimClass),"none"!==n?o.animate({backgroundColor:n},"fast").queue(function(){o.toggleClass(i.dimClass),u(this).dequeue()}).animate({back
|