Last active
April 12, 2017 12:48
-
-
Save Gaspadlo/cf7d37e5aafcc56cea43e12be896e8e8 to your computer and use it in GitHub Desktop.
javascript Bookmarklet
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
javascript:document.body.innerHTML += "<textarea style='" + | |
"position:fixed;" + | |
"top: 0;" + | |
"left:0;" + | |
"width:80%;" + | |
"margin:auto;" + | |
"border:2px solid;" + | |
"z-index:999999;" + | |
"resize:vertical;" + | |
"height:25%;' id='ToBase64' " + | |
"onkeypress='if (event.keyCode == 13)ToBase64.remove();'>Press Enter To Close</textarea>"; | |
var ToBase64 = document.getElementById("ToBase64"); | |
ToBase64.addEventListener("paste", function (c) { | |
for (var b = 0; b < c.clipboardData.items.length; b++) { | |
if ((c.clipboardData.items[b].kind == "file" && c.clipboardData.items[b].type == "image/png")) { | |
var a = new FileReader(); | |
a.onloadend = function () { | |
ToBase64.innerHTML = a.result | |
}; | |
a.readAsDataURL(c.clipboardData.items[b].getAsFile()); | |
break | |
} | |
} | |
}); |
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
javascript:document.body.innerHTML+="<textarea style='position:fixed;top: 0;left:0;width:80%;margin:auto;border:2px solid;z-index:999999;resize:vertical;height:25%;' id='ToBase64' onkeypress='if (event.keyCode == 13)ToBase64.remove();'>Press Enter To Close</textarea>";var ToBase64=document.getElementById("ToBase64");ToBase64.addEventListener("paste",function(f){for(var d=0;d<f.clipboardData.items.length;d++){if((f.clipboardData.items[d].kind=="file"&&f.clipboardData.items[d].type=="image/png")){var e=new FileReader();e.onloadend=function(){ToBase64.innerHTML=e.result};e.readAsDataURL(f.clipboardData.items[d].getAsFile());break}}}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment