Created
March 20, 2018 23:32
-
-
Save ohsevin/c0d3c73af79cee7b2606db1d8aa57f30 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/fefilux
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script> | |
(function(){ | |
document.addEventListener('keydown', function(e) { | |
// pressed alt+g | |
if (e.keyCode == 71 && e.shiftKey && !e.ctrlKey && e.altKey && !e.metaKey) { | |
var url = prompt("Dropbox url?",""); | |
if (url != null) | |
{ | |
GM_xmlhttpRequest({ // that would be "func1" | |
"method" : "GET", | |
"url" : url, // first url in the list | |
"onload" : function(xhr) | |
{ | |
var oPage = xhr.responseText; // page contents | |
console.log(oPage); | |
var link = /<a href="(https:\/\/dl.dropboxusercontent.*?)" id="download_button_link"/.exec(oPage)[1]; | |
var textarea = document.querySelector("textarea[name*=description]"); | |
textarea.innerHTML += "\n{html}<img src=\"" + link + "\" width=\"100%\" />{html}"; | |
} | |
}); | |
} | |
} | |
}, false); | |
})(); | |
</script> | |
<script id="jsbin-javascript"> | |
(function(){ | |
document.addEventListener('keydown', function(e) { | |
// pressed alt+g | |
if (e.keyCode == 71 && e.shiftKey && !e.ctrlKey && e.altKey && !e.metaKey) { | |
var url = prompt("Dropbox url?",""); | |
if (url != null) | |
{ | |
GM_xmlhttpRequest({ // that would be "func1" | |
"method" : "GET", | |
"url" : url, // first url in the list | |
"onload" : function(xhr) | |
{ | |
var oPage = xhr.responseText; // page contents | |
console.log(oPage); | |
var link = /<a href="(https:\/\/dl.dropboxusercontent.*?)" id="download_button_link"/.exec(oPage)[1]; | |
var textarea = document.querySelector("textarea[name*=description]"); | |
textarea.innerHTML += "\n{html}<img src=\"" + link + "\" width=\"100%\" />{html}"; | |
} | |
}); | |
} | |
} | |
}, false); | |
})(); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">(function(){ | |
document.addEventListener('keydown', function(e) { | |
// pressed alt+g | |
if (e.keyCode == 71 && e.shiftKey && !e.ctrlKey && e.altKey && !e.metaKey) { | |
var url = prompt("Dropbox url?",""); | |
if (url != null) | |
{ | |
GM_xmlhttpRequest({ // that would be "func1" | |
"method" : "GET", | |
"url" : url, // first url in the list | |
"onload" : function(xhr) | |
{ | |
var oPage = xhr.responseText; // page contents | |
console.log(oPage); | |
var link = /<a href="(https:\/\/dl.dropboxusercontent.*?)" id="download_button_link"/.exec(oPage)[1]; | |
var textarea = document.querySelector("textarea[name*=description]"); | |
textarea.innerHTML += "\n{html}<img src=\"" + link + "\" width=\"100%\" />{html}"; | |
} | |
}); | |
} | |
} | |
}, false); | |
})();</script></body> | |
</html> |
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(){ | |
document.addEventListener('keydown', function(e) { | |
// pressed alt+g | |
if (e.keyCode == 71 && e.shiftKey && !e.ctrlKey && e.altKey && !e.metaKey) { | |
var url = prompt("Dropbox url?",""); | |
if (url != null) | |
{ | |
GM_xmlhttpRequest({ // that would be "func1" | |
"method" : "GET", | |
"url" : url, // first url in the list | |
"onload" : function(xhr) | |
{ | |
var oPage = xhr.responseText; // page contents | |
console.log(oPage); | |
var link = /<a href="(https:\/\/dl.dropboxusercontent.*?)" id="download_button_link"/.exec(oPage)[1]; | |
var textarea = document.querySelector("textarea[name*=description]"); | |
textarea.innerHTML += "\n{html}<img src=\"" + link + "\" width=\"100%\" />{html}"; | |
} | |
}); | |
} | |
} | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment