kbin-kes
kbin-kes copied to clipboard
[MOD] Upload image from clipboard via Ctrl-V binding
I want this function in script form.
If I understood correctly, you want to copy images to your clipboard from some other program, then paste in the comment submission area, and it will insert the image as a thumbnail post?
Cf.
document.onpaste = function(event){
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
console.log(JSON.stringify(items)); // will give you the mime types
for (index in items) {
var item = items[index];
if (item.kind === 'file') {
var blob = item.getAsFile();
var reader = new FileReader();
reader.onload = function(event){
console.log(event.target.result)}; // data url!
reader.readAsDataURL(blob);
}
}
}
@aclist Yes, this is exactly the point.
Understood. I think it is technically possible, but fairly complicated. We will investigate the feasibility.