Skip to content

Instantly share code, notes, and snippets.

@NeoTech
Last active August 29, 2015 13:57
Show Gist options
  • Save NeoTech/9761740 to your computer and use it in GitHub Desktop.
Save NeoTech/9761740 to your computer and use it in GitHub Desktop.
JS Website debugger
(function() {
var scriptURI = prompt('Enter your script','https://gist.githubusercontent.com/NeoTech/6778e791e297151dd4a5/raw/b4604119b690d797ae350e0f6ef6eaa5775b07f1/screenshot.js');
var callback = prompt('Enter a Callback', "(function() { console.log('Script loaded'); })");
var getScript = (function getScript(url,success) {
var head=document.getElementsByTagName('body')[0],done=false;
var script=document.createElement('script');
script.src=url;
script.onload=script.onreadystatechange=function(){
if(!done && (!this.readyState || this.readyState=='loaded' || this.readyState=='complete')) {
done=true;
if(typeof(success) === 'function') { success(); }
}
};
head.appendChild(script);
});
callback = eval(callback);
getScript(scriptURI,callback);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment