-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.xhrfilter.min.js
1 lines (1 loc) · 2.93 KB
/
jquery.xhrfilter.min.js
1
!function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";var n=r(2)["default"],o=r(1),i=n(o),s=window.jQuery,u=s.ajax,a=[];s.ajaxRegisterFilter=function(e){a.push(e)},s.ajax=function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{},e&&(t.url=e);var r,n={readyState:0,getResponseHeader:function(e){return r?r.getResponseHeader(e):null},getAllResponseHeaders:function(){return r?r.getAllResponseHeaders():null},setRequestHeader:function(e,t){return r&&r.setRequestHeader(e,t),this},overrideMimeType:function(e){return r&&r.overrideMimeType(e),this},statusCode:function(e){return r&&r.statusCode(e),this},abort:function(e){return r&&r.abort(e),this}},o=s.Deferred();o.promise(n);var f=s.extend({},t,{success:s.noop,error:s.noop,complete:s.noop}),c=new i["default"](a);if(c.before([f]),r=u(e,f),r.done(function(e,t,r){var i=this,s=function(){n.readyState=r.readyState,o.resolveWith(i,[e,t,r])},u=function(e){n.readyState=r.readyState,o.rejectWith(i,[r,t,e])},a=function(){var e="The Request was resolved, then rejected and resolved again ... I'm out.";throw u(e),new Error(e)},l=function(e){c.fail([r,e,f,a],function(){u(e)})};c.done([r,e,f,l],s)}),r.fail(function(e,t,i){var s=this,u=function(){n.readyState=e.readyState,o.rejectWith(s,[e,t,i])},a=function(){throw u(),new Error("The Request was rejected, then resolved and rejected again ... I'm out.")},l=function(e,r){n.readyState=r.readyState,o.resolveWith(s,[e,t,r])},h=function(e,t){r==t?c.done([t,e,f,a],function(){l(e,t)}):l(e,t)};c.fail([e,i,f,h],u)}),t.success&&n.done(t.success),t.error&&n.fail(t.error),t.complete){if("function"!=typeof t.complete){var l=t.complete;t.complete=function(){for(var e in l)l.hasOwnProperty(e)&&l[e].apply(this,arguments)}}n.then(function(e,r,n){t.complete.call(this,n,r)},function(){t.complete.apply(this,arguments)})}return n}},function(e,t){"use strict";function r(e){this.filters=e}Object.defineProperty(t,"__esModule",{value:!0}),r.prototype.before=function(e){for(var t=this.filters.length;t>=0;--t)this.filters.hasOwnProperty(t)&&this.filters[t].hasOwnProperty("before")&&this.filters[t].before.apply(null,e)},r.prototype.done=function(e,t){this.method="done",this.run(e,t)},r.prototype.fail=function(e,t){this.method="fail",this.run(e,t)},r.prototype.run=function(e,t){this.args=e,this.args.push(this.next.bind(this)),this["final"]=t,this.current=-1,this.next()},r.prototype.findNext=function(){this.current+=1;for(var e=this.current;e<this.filters.length;++e)if(this.filters.hasOwnProperty(e)&&this.filters[e].hasOwnProperty(this.method))return this.current=e,this.filters[e][this.method]},r.prototype.next=function(){var e=this.findNext();e?e.apply(null,this.args):this["final"]()},t["default"]=r,e.exports=t["default"]},function(e,t){"use strict";t["default"]=function(e){return e&&e.__esModule?e:{"default":e}},t.__esModule=!0}]);