2016-11-03 06:40:34 +01:00
|
|
|
!function(a){var b,c={add:"ajaxAdd",del:"ajaxDel",dim:"ajaxDim",process:"process",recolor:"recolor"};b={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(b,c){var d=wpAjax.unserialize(b.attr("href")),e=a("#"+c.element);return c.nonce||d._ajax_nonce||e.find('input[name="_ajax_nonce"]').val()||d._wpnonce||e.find('input[name="_wpnonce"]').val()||0},parseData:function(b,c){var d,e=[];try{d=a(b).data("wp-lists")||"",d=d.match(new RegExp(c+":[\\S]+")),d&&(e=d[0].split(":"))}catch(f){}return e},pre:function(b,c,d){var e,f,g;return c=a.extend({},this.wpList.settings,{element:null,nonce:0,target:b.get(0)},c||{}),!(a.isFunction(c.confirm)&&(e=a("#"+c.element),"add"!==d&&(f=e.css("backgroundColor"),e.css("backgroundColor","#ff9966")),g=c.confirm.call(this,b,c,d,f),"add"!==d&&e.css("backgroundColor",f),!g))&&c},ajaxAdd:function(c,d){var e,f,g,h,i=this,j=a(c),k=b.parseData(j,"add");return d=d||{},d=b.pre.call(i,j,d,"add"),d.element=k[2]||j.prop("id")||d.element||null,d.addColor=k[3]?"#"+k[3]:d.addColor,!!d&&(j.is('[id="'+d.element+'-submit"]')?!d.element||(d.action="add-"+d.what,d.nonce=b.nonce(j,d),!!wpAjax.validateForm("#"+d.element)&&(d.data=a.param(a.extend({_ajax_nonce:d.nonce,action:d.action},wpAjax.unserialize(k[4]||""))),e=a("#"+d.element+" :input").not('[name="_ajax_nonce"], [name="_wpnonce"], [name="action"]'),f=a.isFunction(e.fieldSerialize)?e.fieldSerialize():e.serialize(),f&&(d.data+="&"+f),!(!a.isFunction(d.addBefore)||(d=d.addBefore(d)))||(!d.data.match(/_ajax_nonce=[a-f0-9]+/)||(d.success=function(c){return g=wpAjax.parseAjaxResponse(c,d.response,d.element),h=c,!(!g||g.errors)&&(!0===g||(a.each(g.responses,function(){b.add.call(i,this.data,a.extend({},d,{position:this.position||0,id:this.id||0,oldId:this.oldId||null}))}),i.wpList.recolor(),a(i).trigger("wpListAddEnd",[d,i.wpList]),void b.clear.call(i,"#"+d.element)))},d.complete=function(b,c){a.isFunction(d.addAfter)&&d.addAfter(h,a.extend({xml:b,status:c,parsed:g},d))},a.ajax(d),!1)))):!b.add.call(i,j,d))},ajaxDel:function(c,d){var e,f,g,h=this,i=a(c),j=b.parseData(i,"delete");return d=d||{},d=b.pre.call(h,i,d,"delete"),d.element=j[2]||d.element||null,d.delColor=j[3]?"#"+j[3]:d.delColor,!(!d||!d.element)&&(d.action="delete-"+d.what,d.nonce=b.nonce(i,d),d.data=a.extend({_ajax_nonce:d.nonce,action:d.action,id:d.element.split("-").pop()},wpAjax.unserialize(j[4]||"")),!(!a.isFunction(d.delBefore)||(d=d.delBefore(d,h)))||(!d.data._ajax_nonce||(e=a("#"+d.element),"none"!==d.delColor?e.css("backgroundColor",d.delColor).fadeOut(350,function(){h.wpList.recolor(),a(h).trigger("wpListDelEnd",[d,h.wpList])}):(h.wpList.recolor(),a(h).trigger("wpListDelEnd",[d,h.wpList])),d.success=function(b){if(f=wpAjax.parseAjaxResponse(b,d.response,d.element),g=b,!f||f.errors)return e.stop().stop().css("backgroundColor","#faa").show().queue(function(){h.wpList.recolor(),a(this).dequeue()}),!1},d.complete=function(b,c){a.isFunction(d.delAfter)&&e.queue(function(){d.delAfter(g,a.extend({xml:b,status:c,parsed:f},d))}).dequeue()},a.ajax(d),!1)))},ajaxDim:function(c,d){var e,f,g,h,i,j,k=this,l=a(c),m=b.parseData(l,"dim");return"none"!==l.parent().css("display")&&(d=d||{},d=b.pre.call(k,l,d,"dim"),d.element=m[2]||d.element||null,d.dimClass=m[3]||d.dimClass||null,d.dimAddColor=m[4]?"#"+m[4]:d.dimAddColor,d.dimDelColor=m[5]?"#"+m[5]:d.dimDelColor,!(d&&d.element&&d.dimClass)||(d.action="dim-"+d.what,d.nonce=b.nonce(l,d),d.data=a.extend({_ajax_nonce:d.nonce,action:d.action,id:d.element.split("-").pop(),dimClass:d.dimClass},wpAjax.unserialize(m[6]||"")),!(!a.isFunction(d.dimBefore)||(d=d.dimBefore(d)))||(e=a("#"+d.element),f=e.toggleClass(d.dimClass).is("."+d.dimClass),g=b.getColor(e),h=f?d.dimAddColor:d.dimDelColor,e.toggleClass(d.dimClass),"none"!==h?e.animate({backgroundColor:h},"fast").queue(function(){e.toggleClass(d.dimClass),a(this).dequeue()}).animate({back
|