Last active
October 22, 2016 02:41
-
-
Save dcadenas/49d15389cfe494af0e064f18ff877c4b to your computer and use it in GitHub Desktop.
Testing rawgit
This file contains 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
(function(){ | |
var url = 'https://api.ipify.org/?format=json'; | |
var createCORSRequest = function(method, url) { | |
var xhr = new XMLHttpRequest(); | |
if ("withCredentials" in xhr) { | |
xhr.open(method, url, true); | |
} else if (typeof XDomainRequest != "undefined") { | |
xhr = new XDomainRequest(); | |
xhr.open(method, url); | |
} else { | |
alert(`no cors for gets to ${url}`); | |
xhr = null; | |
} | |
return xhr; | |
}; | |
var method = 'GET'; | |
var xhr = createCORSRequest(method, url); | |
xhr.onload = function() { | |
alert("Your ip is : " + xhr.responseText) | |
}; | |
xhr.onerror = function() { | |
alert("error") | |
}; | |
xhr.send(); | |
})(); |
This file contains 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
(function(){ | |
var start= function($){ | |
$("div").remove() | |
alert('oops! removed all divs. lol'); | |
} | |
var withJQuery = function (e, a, g, h, f, c, b, d) { | |
if (!(f = e.jQuery) || g > f.fn.jquery || h(f)) { | |
c = a.createElement("script"); | |
c.type = "text/javascript"; | |
c.src = "//ajax.googleapis.com/ajax/libs/jquery/" + g + "/jquery.min.js"; | |
c.onload = c.onreadystatechange = function () { | |
if (!b && (!(d = this.readyState) || d == "loaded" || d == "complete")) { | |
h((f = e.jQuery).noConflict(1), b = 1); | |
f(c).remove() | |
} | |
}; | |
a.body.appendChild(c); | |
} | |
} | |
withJQuery(window, document, "3.1.1", function ($, L) { | |
start($); | |
}); | |
})(); |
Author
dcadenas
commented
Oct 22, 2016
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment