diff options
| author | Pitu <[email protected]> | 2017-01-30 05:13:07 -0300 |
|---|---|---|
| committer | Pitu <[email protected]> | 2017-01-30 05:13:07 -0300 |
| commit | 6b7fd3bcf431fd6df9059c83a34f5a15b00fd7b2 (patch) | |
| tree | ad6efa64785c0862d2c8cf8df2a980580c3a4703 /public/js/upload.js | |
| parent | Removed unused dependency (diff) | |
| parent | Bumped version (diff) | |
| download | host.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.js | 20 |
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 |