Skip to content
Snippets Groups Projects
Commit 24a979bb authored by Commander-lol's avatar Commander-lol
Browse files

Quick fix to tinyDOM.ajax()

tinyDOM.ajax() now returns the XMLHttpRequest, as it should have to
begin with
parent 173f9631
No related branches found
No related tags found
No related merge requests found
......@@ -142,6 +142,7 @@
}
req.send(params.data);
return req;
};
if(!window.μ){
......
!function(){var a=function(a){return new b(a)},b=function(a){var b=document.querySelectorAll(a);this.length=b.length;for(var c=0;c<b.length;c++){var d=b.item(c);"undefined"==typeof d.td_prop&&(d.td_prop={isHidden:!1}),this[c]=b.item(c)}return this};a.fn=b.prototype={each:function(a){for(var b=this.length;b--;)a(b,this[b],this);return this},hide:function(){return this.each(function(a,b){b.td_prop.isHidden||(b.style.td_previousDisplay=b.style.display,b.style.display="none",b.td_prop.isHidden=!0)}),this},show:function(){return this.each(function(a,b){b.td_prop.isHidden===!0&&(b.style.display="undefined"!=typeof b.style.td_previousDisplay?b.style.td_previousDisplay:"block",b.td_prop.isHidden=!1)}),this},on:function(a,b){return this.each(function(c,d){d.addEventListener(a,b)}),this},first:function(){return"undefined"!=typeof this[0]?this[0]:null},data:function(a,b){var c=this[0];return"undefined"!=typeof b?(c.setAttribute("data-"+a,b),this):c.getAttribute("data-"+a)}},a.exists=function(a){return null!==a&&"undefined"!=typeof a},a.merge=function(a,b){if(this.exists(a)&&this.exists(b)){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}return null},a.ajax=function(a){var b=new XMLHttpRequest,c=this,d={method:"GET",url:"",async:!0,user:null,password:null,responseType:"text",data:null,headers:[],success:null,error:null};this.merge(d,a),b.responseType=d.responseType,b.onreadystatechange=function(){b.readyState>1&&(200===b.status?4===b.readyState&&c.exists(d.success)&&d.success(b.response,b):(b.abort(),c.exists(d.error)&&d.error({status:b.status,message:b.statusText},b)))},b.open(d.method,d.url,d.async,d.user,d.password);for(var e=0;e<d.headers.length;e++)b.setRequestHeader(d.headers[e].header,d.headers[e].value);b.send(d.data)},window.μ||(window.μ=a),window.mu||(window.mu=a)}();
!function(){var a=function(a){return new b(a)},b=function(a){var b=document.querySelectorAll(a);this.length=b.length;for(var c=0;c<b.length;c++){var d=b.item(c);"undefined"==typeof d.td_prop&&(d.td_prop={isHidden:!1}),this[c]=b.item(c)}return this};a.fn=b.prototype={each:function(a){for(var b=this.length;b--;)a(b,this[b],this);return this},hide:function(){return this.each(function(a,b){b.td_prop.isHidden||(b.style.td_previousDisplay=b.style.display,b.style.display="none",b.td_prop.isHidden=!0)}),this},show:function(){return this.each(function(a,b){b.td_prop.isHidden===!0&&(b.style.display="undefined"!=typeof b.style.td_previousDisplay?b.style.td_previousDisplay:"block",b.td_prop.isHidden=!1)}),this},on:function(a,b){return this.each(function(c,d){d.addEventListener(a,b)}),this},first:function(){return"undefined"!=typeof this[0]?this[0]:null},data:function(a,b){var c=this[0];return"undefined"!=typeof b?(c.setAttribute("data-"+a,b),this):c.getAttribute("data-"+a)}},a.exists=function(a){return null!==a&&"undefined"!=typeof a},a.merge=function(a,b){if(this.exists(a)&&this.exists(b)){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}return null},a.ajax=function(a){var b=new XMLHttpRequest,c=this,d={method:"GET",url:"",async:!0,user:null,password:null,responseType:"text",data:null,headers:[],success:null,error:null};this.merge(d,a),b.responseType=d.responseType,b.onreadystatechange=function(){b.readyState>1&&(200===b.status?4===b.readyState&&c.exists(d.success)&&d.success(b.response,b):(b.abort(),c.exists(d.error)&&d.error({status:b.status,message:b.statusText},b)))},b.open(d.method,d.url,d.async,d.user,d.password);for(var e=0;e<d.headers.length;e++)b.setRequestHeader(d.headers[e].header,d.headers[e].value);return b.send(d.data),b},window.μ||(window.μ=a),window.mu||(window.mu=a)}();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment