Last active
January 22, 2018 07:40
-
-
Save indatawetrust/091cbf9f92521489048bfac03d1e375c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var module = {}; | |
module.exports = {}; | |
var exports = {}; | |
// https://github.com/yanatan16/nanoajax | |
function getRequest(e){return e&&global.XDomainRequest&&!/MSIE 1/.test(navigator.userAgent)?new XDomainRequest:global.XMLHttpRequest?new XMLHttpRequest:void 0}function setDefault(e,t,o){e[t]=e[t]||o}var reqfields=["responseType","withCredentials","timeout","onprogress"];exports.ajax=function(e,t){function o(e,o){return function(){if(!a){try{t(void 0===u.status?e:u.status,0===u.status?"Error":JSON.parse(u.response||u.responseText||o),u)}catch(r){t(void 0===u.status?e:u.status,0===u.status?"Error":u.response||u.responseText||o,u)}a=!0}}}var r=e.headers||{},s=e.body,n=e.method||(s?"POST":"GET"),a=!1,u=getRequest(e.cors);u.open(n,e.url,!0);var i=u.onload=o(200);u.onreadystatechange=function(){4===u.readyState&&i()},u.onerror=o(null,"Error"),u.ontimeout=o(null,"Timeout"),u.onabort=o(null,"Abort"),s&&(setDefault(r,"X-Requested-With","XMLHttpRequest"),global.FormData&&s instanceof global.FormData||setDefault(r,"Content-Type","application/x-www-form-urlencoded"));for(var l,d=0,f=reqfields.length;f>d;d++)l=reqfields[d],void 0!==e[l]&&(u[l]=e[l]);for(var l in r)u.setRequestHeader(l,r[l]);return u.send(s),u}; | |
/** | |
* Minified by jsDelivr using UglifyJS v3.1.10. | |
* Original file: /npm/[email protected]/src/js.cookie.js | |
* | |
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files | |
*/ | |
!function(e){var n=!1;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var o=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=o,t}}}(function(){function e(){for(var e=0,n={};e<arguments.length;e++){var o=arguments[e];for(var t in o)n[t]=o[t]}return n}function n(o){function t(n,r,i){var c;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(i=e({path:"/"},t.defaults,i)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*i.expires),i.expires=a}i.expires=i.expires?i.expires.toUTCString():"";try{c=JSON.stringify(r),/^[\{\[]/.test(c)&&(r=c)}catch(e){}r=o.write?o.write(r,n):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=(n=(n=encodeURIComponent(String(n))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var s="";for(var f in i)i[f]&&(s+="; "+f,!0!==i[f]&&(s+="="+i[f]));return document.cookie=n+"="+r+s}n||(c={});for(var p=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,u=0;u<p.length;u++){var l=p[u].split("="),C=l.slice(1).join("=");this.json||'"'!==C.charAt(0)||(C=C.slice(1,-1));try{var g=l[0].replace(d,decodeURIComponent);if(C=o.read?o.read(C,g):o(C,g)||C.replace(d,decodeURIComponent),this.json)try{C=JSON.parse(C)}catch(e){}if(n===g){c=C;break}n||(c[g]=C)}catch(e){}}return c}}return t.set=t,t.get=function(e){return t.call(t,e)},t.getJSON=function(){return t.apply({json:!0},[].slice.call(arguments))},t.defaults={},t.remove=function(n,o){t(n,"",e(o,{expires:-1}))},t.withConverter=n,t}return n(function(){})}); | |
//# sourceMappingURL=/sm/f6937b1819ab68f00d8b787ead6c16bfb67977e0c408909621a3b2ff82dbad4a.map | |
nanoajax.ajax({url: 'http://freegeoip.net/json/', method: 'GET'}, function (code, responseText, request) { | |
console.log(responseText) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment