aboutsummaryrefslogtreecommitdiff
path: root/public/js/upload.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-01-30 05:13:07 -0300
committerPitu <[email protected]>2017-01-30 05:13:07 -0300
commit6b7fd3bcf431fd6df9059c83a34f5a15b00fd7b2 (patch)
treead6efa64785c0862d2c8cf8df2a980580c3a4703 /public/js/upload.js
parentRemoved unused dependency (diff)
parentBumped version (diff)
downloadhost.fuwn.me-6b7fd3bcf431fd6df9059c83a34f5a15b00fd7b2.tar.xz
host.fuwn.me-6b7fd3bcf431fd6df9059c83a34f5a15b00fd7b2.zip
Merged dev into master
Diffstat (limited to 'public/js/upload.js')
-rw-r--r--public/js/upload.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/public/js/upload.js b/public/js/upload.js
index ba67d15..b52f670 100644
--- a/public/js/upload.js
+++ b/public/js/upload.js
@@ -36,7 +36,6 @@ upload.verifyToken = function(token, reloadOnError){
reloadOnError = false;
axios.post('/api/tokens/verify', {
- type: 'client',
token: token
})
.then(function (response) {
@@ -101,10 +100,11 @@ upload.prepareDropzone = function(){
maxFiles: 1000,
autoProcessQueue: true,
headers: {
- 'auth': upload.token
+ 'token': upload.token
},
init: function() {
this.on('addedfile', function(file) {
+ myDropzone = this;
document.getElementById('uploads').style.display = 'block';
});
}
@@ -139,6 +139,22 @@ upload.prepareDropzone = function(){
}
+//Handle image paste event
+window.addEventListener('paste', function(event) {
+ var items = (event.clipboardData || event.originalEvent.clipboardData).items;
+ for (index in items) {
+ var item = items[index];
+ if (item.kind === 'file') {
+ var blob = item.getAsFile();
+ console.log(blob.type);
+ var file = new File([blob], "pasted-image."+blob.type.match(/(?:[^\/]*\/)([^;]*)/)[1]);
+ file.type = blob.type;
+ console.log(file);
+ myDropzone.addFile(file);
+ }
+ }
+});
+
window.onload = function () {
upload.checkIfPublic();
}; \ No newline at end of file