mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-15 07:46:06 +10:00
Creating v1.0.0 of jQuery-ajaxTransport-XDomainRequest
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* jQuery-ajaxTransport-XDomainRequest - v1.0.0 - 2013-06-11
|
||||
* https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest
|
||||
* Copyright (c) 2013 Jason Moon (@JSONMOON)
|
||||
* Licensed MIT (/blob/master/LICENSE.txt)
|
||||
*/
|
||||
if(!jQuery.support.cors&&jQuery.ajaxTransport&&window.XDomainRequest){var httpRegEx=/^https?:\/\//i;var getOrPostRegEx=/^get|post$/i;var sameSchemeRegEx=new RegExp('^'+location.protocol,'i');var htmlRegEx=/text\/html/i;var jsonRegEx=/\/json/i;var xmlRegEx=/\/xml/i;jQuery.ajaxTransport('text html xml json',function(i,j,k){if(i.crossDomain&&i.async&&getOrPostRegEx.test(i.type)&&httpRegEx.test(i.url)&&sameSchemeRegEx.test(i.url)){var l=null;var m=(j.dataType||'').toLowerCase();return{send:function(f,g){l=new XDomainRequest();if(/^\d+$/.test(j.timeout)){l.timeout=j.timeout}l.ontimeout=function(){g(500,'timeout')};l.onload=function(){var a='Content-Length: '+l.responseText.length+'\r\nContent-Type: '+l.contentType;var b={code:200,message:'success'};var c={text:l.responseText};try{if(m==='html'||htmlRegEx.test(l.contentType)){c.html=l.responseText}else if(m==='json'||(m!=='text'&&jsonRegEx.test(l.contentType))){try{c.json=jQuery.parseJSON(l.responseText)}catch(e){b.code=500;b.message='parseerror'}}else if(m==='xml'||(m!=='text'&&xmlRegEx.test(l.contentType))){var d=new ActiveXObject('Microsoft.XMLDOM');d.async=false;try{d.loadXML(l.responseText)}catch(e){d=undefined}if(!d||!d.documentElement||d.getElementsByTagName('parsererror').length){b.code=500;b.message='parseerror';throw'Invalid XML: '+l.responseText;}c.xml=d}}catch(parseMessage){throw parseMessage;}finally{g(b.code,b.message,c,a)}};l.onprogress=function(){};l.onerror=function(){g(500,'error',{text:l.responseText})};var h='';if(j.data){h=(jQuery.type(j.data)==='string')?j.data:jQuery.param(j.data)}l.open(i.type,i.url);l.send(h)},abort:function(){if(l){l.abort()}}}}})}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "jQuery-ajaxTransport-XDomainRequest",
|
||||
"filename": "jquery.xdomainrequest.min.js",
|
||||
"version": "1.0.0",
|
||||
"description": "Implements automatic Cross Origin Resource Sharing support using the XDomainRequest object for IE8 and IE9 when using the ajax function in jQuery 1.5+.",
|
||||
"homepage": "https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest",
|
||||
"keywords": [
|
||||
"ajax",
|
||||
"cors",
|
||||
"jquery",
|
||||
"xdomainrequest",
|
||||
"ajaxtransport",
|
||||
"ie8",
|
||||
"ie9"
|
||||
],
|
||||
"demos": [
|
||||
"http://jsfiddle.net/MoonScript/Q7bVG/"
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": ">=1.5"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Jason Moon",
|
||||
"email": "jason@moonscript.com",
|
||||
"web": "https://github.com/MoonScript/"
|
||||
}
|
||||
],
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest.git"
|
||||
}
|
||||
],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest/blob/master/LICENSE.txt"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user