dropzonejs-rails 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/app/assets/javascripts/dropzone.js +502 -353
- data/app/assets/stylesheets/dropzone/dropzone.css.scss +11 -34
- data/lib/dropzonejs-rails/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d506ee623940ef72c0e5c72f89f27bb333eafa30
|
4
|
+
data.tar.gz: f61b4e37d5bbec097f65384463d3479ac7f87f9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa0c259f6208ed5747f4210a789abe2ceb39df6a424dbcb29e64fdec9f56db8a343d811b9ab7f04b52b8afaabc3036c22416640e040e2df1f9fb7050d7f25a68
|
7
|
+
data.tar.gz: 0e27b3a83b81abe845f978cf0207d84cbd045c6fec36787a1a1ae1879f5c0043488ae8d948e0e9bc588f9fd524fe753252c572edd7da79e823a95468301e57e2
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Integrate [Matias Meno's Dropzone](http://www.dropzonejs.com/) awesome file uplo
|
|
4
4
|
|
5
5
|
## Version
|
6
6
|
|
7
|
-
The latest version of this gem bundles **Dropzone v3.
|
7
|
+
The latest version of this gem bundles **Dropzone v3.11.1**.
|
8
8
|
|
9
9
|
## Installation and usage
|
10
10
|
|
@@ -59,10 +59,9 @@ Go to [this secret place](https://github.com/ncuesta/dropzonejs-rails/issues).
|
|
59
59
|
## Changelog
|
60
60
|
|
61
61
|
* v0.5.1
|
62
|
-
* Fixes incorrect references to the old vendor/ directory.
|
63
|
-
* v0.5.0
|
64
62
|
* Moves assets to the `app/` directory so that Rails 4 adds them to the Sprockets
|
65
63
|
pipeline. Kudos to @senny for pointing this out.
|
64
|
+
* Fixes incorrect references to the old vendor/ directory.
|
66
65
|
|
67
66
|
## Licence (MIT)
|
68
67
|
|
@@ -22,6 +22,89 @@ function require(name) {
|
|
22
22
|
return module.exports;
|
23
23
|
}
|
24
24
|
|
25
|
+
/**
|
26
|
+
* Meta info, accessible in the global scope unless you use AMD option.
|
27
|
+
*/
|
28
|
+
|
29
|
+
require.loader = 'component';
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Internal helper object, contains a sorting function for semantiv versioning
|
33
|
+
*/
|
34
|
+
require.helper = {};
|
35
|
+
require.helper.semVerSort = function(a, b) {
|
36
|
+
var aArray = a.version.split('.');
|
37
|
+
var bArray = b.version.split('.');
|
38
|
+
for (var i=0; i<aArray.length; ++i) {
|
39
|
+
var aInt = parseInt(aArray[i], 10);
|
40
|
+
var bInt = parseInt(bArray[i], 10);
|
41
|
+
if (aInt === bInt) {
|
42
|
+
var aLex = aArray[i].substr((""+aInt).length);
|
43
|
+
var bLex = bArray[i].substr((""+bInt).length);
|
44
|
+
if (aLex === '' && bLex !== '') return 1;
|
45
|
+
if (aLex !== '' && bLex === '') return -1;
|
46
|
+
if (aLex !== '' && bLex !== '') return aLex > bLex ? 1 : -1;
|
47
|
+
continue;
|
48
|
+
} else if (aInt > bInt) {
|
49
|
+
return 1;
|
50
|
+
} else {
|
51
|
+
return -1;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return 0;
|
55
|
+
}
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Find and require a module which name starts with the provided name.
|
59
|
+
* If multiple modules exists, the highest semver is used.
|
60
|
+
* This function can only be used for remote dependencies.
|
61
|
+
|
62
|
+
* @param {String} name - module name: `user~repo`
|
63
|
+
* @param {Boolean} returnPath - returns the canonical require path if true,
|
64
|
+
* otherwise it returns the epxorted module
|
65
|
+
*/
|
66
|
+
require.latest = function (name, returnPath) {
|
67
|
+
function showError(name) {
|
68
|
+
throw new Error('failed to find latest module of "' + name + '"');
|
69
|
+
}
|
70
|
+
// only remotes with semvers, ignore local files conataining a '/'
|
71
|
+
var versionRegexp = /(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/;
|
72
|
+
var remoteRegexp = /(.*)~(.*)/;
|
73
|
+
if (!remoteRegexp.test(name)) showError(name);
|
74
|
+
var moduleNames = Object.keys(require.modules);
|
75
|
+
var semVerCandidates = [];
|
76
|
+
var otherCandidates = []; // for instance: name of the git branch
|
77
|
+
for (var i=0; i<moduleNames.length; i++) {
|
78
|
+
var moduleName = moduleNames[i];
|
79
|
+
if (new RegExp(name + '@').test(moduleName)) {
|
80
|
+
var version = moduleName.substr(name.length+1);
|
81
|
+
var semVerMatch = versionRegexp.exec(moduleName);
|
82
|
+
if (semVerMatch != null) {
|
83
|
+
semVerCandidates.push({version: version, name: moduleName});
|
84
|
+
} else {
|
85
|
+
otherCandidates.push({version: version, name: moduleName});
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
if (semVerCandidates.concat(otherCandidates).length === 0) {
|
90
|
+
showError(name);
|
91
|
+
}
|
92
|
+
if (semVerCandidates.length > 0) {
|
93
|
+
var module = semVerCandidates.sort(require.helper.semVerSort).pop().name;
|
94
|
+
if (returnPath === true) {
|
95
|
+
return module;
|
96
|
+
}
|
97
|
+
return require(module);
|
98
|
+
}
|
99
|
+
// if the build contains more than one branch of the same module
|
100
|
+
// you should not use this funciton
|
101
|
+
var module = otherCandidates.pop().name;
|
102
|
+
if (returnPath === true) {
|
103
|
+
return module;
|
104
|
+
}
|
105
|
+
return require(module);
|
106
|
+
}
|
107
|
+
|
25
108
|
/**
|
26
109
|
* Registered modules.
|
27
110
|
*/
|
@@ -234,32 +317,32 @@ module.exports = require("dropzone/lib/dropzone.js");
|
|
234
317
|
});
|
235
318
|
|
236
319
|
require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
237
|
-
/*
|
238
|
-
#
|
239
|
-
# More info at [www.dropzonejs.com](http://www.dropzonejs.com)
|
240
|
-
#
|
241
|
-
# Copyright (c) 2012, Matias Meno
|
242
|
-
#
|
243
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
244
|
-
# of this software and associated documentation files (the "Software"), to deal
|
245
|
-
# in the Software without restriction, including without limitation the rights
|
246
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
247
|
-
# copies of the Software, and to permit persons to whom the Software is
|
248
|
-
# furnished to do so, subject to the following conditions:
|
249
|
-
#
|
250
|
-
# The above copyright notice and this permission notice shall be included in
|
251
|
-
# all copies or substantial portions of the Software.
|
252
|
-
#
|
253
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
254
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
255
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
256
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
257
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
258
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
259
|
-
# THE SOFTWARE.
|
260
|
-
#
|
261
|
-
*/
|
262
320
|
|
321
|
+
/*
|
322
|
+
*
|
323
|
+
* More info at [www.dropzonejs.com](http://www.dropzonejs.com)
|
324
|
+
*
|
325
|
+
* Copyright (c) 2012, Matias Meno
|
326
|
+
*
|
327
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
328
|
+
* of this software and associated documentation files (the "Software"), to deal
|
329
|
+
* in the Software without restriction, including without limitation the rights
|
330
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
331
|
+
* copies of the Software, and to permit persons to whom the Software is
|
332
|
+
* furnished to do so, subject to the following conditions:
|
333
|
+
*
|
334
|
+
* The above copyright notice and this permission notice shall be included in
|
335
|
+
* all copies or substantial portions of the Software.
|
336
|
+
*
|
337
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
338
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
339
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
340
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
341
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
342
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
343
|
+
* THE SOFTWARE.
|
344
|
+
*
|
345
|
+
*/
|
263
346
|
|
264
347
|
(function() {
|
265
348
|
var Dropzone, Em, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without,
|
@@ -276,14 +359,14 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
276
359
|
|
277
360
|
__extends(Dropzone, _super);
|
278
361
|
|
362
|
+
|
279
363
|
/*
|
280
364
|
This is a list of all available events you can register on a dropzone object.
|
281
365
|
|
282
366
|
You can register an event handler like this:
|
283
367
|
|
284
368
|
dropzone.on("dragEnter", function() { });
|
285
|
-
|
286
|
-
|
369
|
+
*/
|
287
370
|
|
288
371
|
Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached"];
|
289
372
|
|
@@ -309,6 +392,7 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
309
392
|
autoQueue: true,
|
310
393
|
addRemoveLinks: false,
|
311
394
|
previewsContainer: null,
|
395
|
+
capture: null,
|
312
396
|
dictDefaultMessage: "Drop files here to upload",
|
313
397
|
dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
|
314
398
|
dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
|
@@ -360,15 +444,13 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
360
444
|
srcRatio = file.width / file.height;
|
361
445
|
info.optWidth = this.options.thumbnailWidth;
|
362
446
|
info.optHeight = this.options.thumbnailHeight;
|
363
|
-
if (
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
info.optHeight = (1 / srcRatio) * info.optWidth;
|
371
|
-
}
|
447
|
+
if ((info.optWidth == null) && (info.optHeight == null)) {
|
448
|
+
info.optWidth = info.srcWidth;
|
449
|
+
info.optHeight = info.srcHeight;
|
450
|
+
} else if (info.optWidth == null) {
|
451
|
+
info.optWidth = srcRatio * info.optHeight;
|
452
|
+
} else if (info.optHeight == null) {
|
453
|
+
info.optHeight = (1 / srcRatio) * info.optWidth;
|
372
454
|
}
|
373
455
|
trgRatio = info.optWidth / info.optHeight;
|
374
456
|
if (file.height < info.optHeight || file.width < info.optWidth) {
|
@@ -387,6 +469,7 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
387
469
|
info.srcY = (file.height - info.srcHeight) / 2;
|
388
470
|
return info;
|
389
471
|
},
|
472
|
+
|
390
473
|
/*
|
391
474
|
Those functions register themselves to the events on init and handle all
|
392
475
|
the user interface specific stuff. Overwriting them won't break the upload
|
@@ -394,8 +477,7 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
394
477
|
You can overwrite them if you don't like the default behavior. If you just
|
395
478
|
want to add an additional event handler, register it on the dropzone object
|
396
479
|
and don't overwrite those options.
|
397
|
-
|
398
|
-
|
480
|
+
*/
|
399
481
|
drop: function(e) {
|
400
482
|
return this.element.classList.remove("dz-drag-hover");
|
401
483
|
},
|
@@ -417,110 +499,129 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
417
499
|
return this.element.classList.remove("dz-started");
|
418
500
|
},
|
419
501
|
addedfile: function(file) {
|
420
|
-
var node, removeFileEvent, removeLink, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results
|
421
|
-
_this = this;
|
502
|
+
var node, removeFileEvent, removeLink, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results;
|
422
503
|
if (this.element === this.previewsContainer) {
|
423
504
|
this.element.classList.add("dz-started");
|
424
505
|
}
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
_ref1 = file.previewElement.querySelectorAll("[data-dz-size]");
|
434
|
-
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
435
|
-
node = _ref1[_j];
|
436
|
-
node.innerHTML = this.filesize(file.size);
|
437
|
-
}
|
438
|
-
if (this.options.addRemoveLinks) {
|
439
|
-
file._removeLink = Dropzone.createElement("<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>" + this.options.dictRemoveFile + "</a>");
|
440
|
-
file.previewElement.appendChild(file._removeLink);
|
441
|
-
}
|
442
|
-
removeFileEvent = function(e) {
|
443
|
-
e.preventDefault();
|
444
|
-
e.stopPropagation();
|
445
|
-
if (file.status === Dropzone.UPLOADING) {
|
446
|
-
return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function() {
|
447
|
-
return _this.removeFile(file);
|
448
|
-
});
|
449
|
-
} else {
|
450
|
-
if (_this.options.dictRemoveFileConfirmation) {
|
451
|
-
return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function() {
|
452
|
-
return _this.removeFile(file);
|
453
|
-
});
|
454
|
-
} else {
|
455
|
-
return _this.removeFile(file);
|
456
|
-
}
|
506
|
+
if (this.previewsContainer) {
|
507
|
+
file.previewElement = Dropzone.createElement(this.options.previewTemplate.trim());
|
508
|
+
file.previewTemplate = file.previewElement;
|
509
|
+
this.previewsContainer.appendChild(file.previewElement);
|
510
|
+
_ref = file.previewElement.querySelectorAll("[data-dz-name]");
|
511
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
512
|
+
node = _ref[_i];
|
513
|
+
node.textContent = file.name;
|
457
514
|
}
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
515
|
+
_ref1 = file.previewElement.querySelectorAll("[data-dz-size]");
|
516
|
+
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
517
|
+
node = _ref1[_j];
|
518
|
+
node.innerHTML = this.filesize(file.size);
|
519
|
+
}
|
520
|
+
if (this.options.addRemoveLinks) {
|
521
|
+
file._removeLink = Dropzone.createElement("<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>" + this.options.dictRemoveFile + "</a>");
|
522
|
+
file.previewElement.appendChild(file._removeLink);
|
523
|
+
}
|
524
|
+
removeFileEvent = (function(_this) {
|
525
|
+
return function(e) {
|
526
|
+
e.preventDefault();
|
527
|
+
e.stopPropagation();
|
528
|
+
if (file.status === Dropzone.UPLOADING) {
|
529
|
+
return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function() {
|
530
|
+
return _this.removeFile(file);
|
531
|
+
});
|
532
|
+
} else {
|
533
|
+
if (_this.options.dictRemoveFileConfirmation) {
|
534
|
+
return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function() {
|
535
|
+
return _this.removeFile(file);
|
536
|
+
});
|
537
|
+
} else {
|
538
|
+
return _this.removeFile(file);
|
539
|
+
}
|
540
|
+
}
|
541
|
+
};
|
542
|
+
})(this);
|
543
|
+
_ref2 = file.previewElement.querySelectorAll("[data-dz-remove]");
|
544
|
+
_results = [];
|
545
|
+
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
|
546
|
+
removeLink = _ref2[_k];
|
547
|
+
_results.push(removeLink.addEventListener("click", removeFileEvent));
|
548
|
+
}
|
549
|
+
return _results;
|
464
550
|
}
|
465
|
-
return _results;
|
466
551
|
},
|
467
552
|
removedfile: function(file) {
|
468
553
|
var _ref;
|
469
|
-
if (
|
470
|
-
_ref
|
554
|
+
if (file.previewElement) {
|
555
|
+
if ((_ref = file.previewElement) != null) {
|
556
|
+
_ref.parentNode.removeChild(file.previewElement);
|
557
|
+
}
|
471
558
|
}
|
472
559
|
return this._updateMaxFilesReachedClass();
|
473
560
|
},
|
474
561
|
thumbnail: function(file, dataUrl) {
|
475
562
|
var thumbnailElement, _i, _len, _ref, _results;
|
476
|
-
file.previewElement
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
563
|
+
if (file.previewElement) {
|
564
|
+
file.previewElement.classList.remove("dz-file-preview");
|
565
|
+
file.previewElement.classList.add("dz-image-preview");
|
566
|
+
_ref = file.previewElement.querySelectorAll("[data-dz-thumbnail]");
|
567
|
+
_results = [];
|
568
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
569
|
+
thumbnailElement = _ref[_i];
|
570
|
+
thumbnailElement.alt = file.name;
|
571
|
+
_results.push(thumbnailElement.src = dataUrl);
|
572
|
+
}
|
573
|
+
return _results;
|
484
574
|
}
|
485
|
-
return _results;
|
486
575
|
},
|
487
576
|
error: function(file, message) {
|
488
577
|
var node, _i, _len, _ref, _results;
|
489
|
-
file.previewElement
|
490
|
-
|
491
|
-
message
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
578
|
+
if (file.previewElement) {
|
579
|
+
file.previewElement.classList.add("dz-error");
|
580
|
+
if (typeof message !== "String" && message.error) {
|
581
|
+
message = message.error;
|
582
|
+
}
|
583
|
+
_ref = file.previewElement.querySelectorAll("[data-dz-errormessage]");
|
584
|
+
_results = [];
|
585
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
586
|
+
node = _ref[_i];
|
587
|
+
_results.push(node.textContent = message);
|
588
|
+
}
|
589
|
+
return _results;
|
498
590
|
}
|
499
|
-
return _results;
|
500
591
|
},
|
501
592
|
errormultiple: noop,
|
502
593
|
processing: function(file) {
|
503
|
-
file.previewElement
|
504
|
-
|
505
|
-
|
594
|
+
if (file.previewElement) {
|
595
|
+
file.previewElement.classList.add("dz-processing");
|
596
|
+
if (file._removeLink) {
|
597
|
+
return file._removeLink.textContent = this.options.dictCancelUpload;
|
598
|
+
}
|
506
599
|
}
|
507
600
|
},
|
508
601
|
processingmultiple: noop,
|
509
602
|
uploadprogress: function(file, progress, bytesSent) {
|
510
603
|
var node, _i, _len, _ref, _results;
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
604
|
+
if (file.previewElement) {
|
605
|
+
_ref = file.previewElement.querySelectorAll("[data-dz-uploadprogress]");
|
606
|
+
_results = [];
|
607
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
608
|
+
node = _ref[_i];
|
609
|
+
if (node.nodeName === 'PROGRESS') {
|
610
|
+
_results.push(node.value = progress);
|
611
|
+
} else {
|
612
|
+
_results.push(node.style.width = "" + progress + "%");
|
613
|
+
}
|
614
|
+
}
|
615
|
+
return _results;
|
516
616
|
}
|
517
|
-
return _results;
|
518
617
|
},
|
519
618
|
totaluploadprogress: noop,
|
520
619
|
sending: noop,
|
521
620
|
sendingmultiple: noop,
|
522
621
|
success: function(file) {
|
523
|
-
|
622
|
+
if (file.previewElement) {
|
623
|
+
return file.previewElement.classList.add("dz-success");
|
624
|
+
}
|
524
625
|
},
|
525
626
|
successmultiple: noop,
|
526
627
|
canceled: function(file) {
|
@@ -592,10 +693,12 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
592
693
|
if ((fallback = this.getExistingFallback()) && fallback.parentNode) {
|
593
694
|
fallback.parentNode.removeChild(fallback);
|
594
695
|
}
|
595
|
-
if (this.options.previewsContainer) {
|
596
|
-
|
597
|
-
|
598
|
-
|
696
|
+
if (this.options.previewsContainer !== false) {
|
697
|
+
if (this.options.previewsContainer) {
|
698
|
+
this.previewsContainer = Dropzone.getElement(this.options.previewsContainer, "previewsContainer");
|
699
|
+
} else {
|
700
|
+
this.previewsContainer = this.element;
|
701
|
+
}
|
599
702
|
}
|
600
703
|
if (this.options.clickable) {
|
601
704
|
if (this.options.clickable === true) {
|
@@ -668,8 +771,7 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
668
771
|
};
|
669
772
|
|
670
773
|
Dropzone.prototype.init = function() {
|
671
|
-
var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1
|
672
|
-
_this = this;
|
774
|
+
var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1;
|
673
775
|
if (this.element.tagName === "form") {
|
674
776
|
this.element.setAttribute("enctype", "multipart/form-data");
|
675
777
|
}
|
@@ -677,38 +779,43 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
677
779
|
this.element.appendChild(Dropzone.createElement("<div class=\"dz-default dz-message\"><span>" + this.options.dictDefaultMessage + "</span></div>"));
|
678
780
|
}
|
679
781
|
if (this.clickableElements.length) {
|
680
|
-
setupHiddenFileInput = function() {
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
_this.hiddenFileInput = document.createElement("input");
|
685
|
-
_this.hiddenFileInput.setAttribute("type", "file");
|
686
|
-
if ((_this.options.maxFiles == null) || _this.options.maxFiles > 1) {
|
687
|
-
_this.hiddenFileInput.setAttribute("multiple", "multiple");
|
688
|
-
}
|
689
|
-
_this.hiddenFileInput.className = "dz-hidden-input";
|
690
|
-
if (_this.options.acceptedFiles != null) {
|
691
|
-
_this.hiddenFileInput.setAttribute("accept", _this.options.acceptedFiles);
|
692
|
-
}
|
693
|
-
_this.hiddenFileInput.style.visibility = "hidden";
|
694
|
-
_this.hiddenFileInput.style.position = "absolute";
|
695
|
-
_this.hiddenFileInput.style.top = "0";
|
696
|
-
_this.hiddenFileInput.style.left = "0";
|
697
|
-
_this.hiddenFileInput.style.height = "0";
|
698
|
-
_this.hiddenFileInput.style.width = "0";
|
699
|
-
document.body.appendChild(_this.hiddenFileInput);
|
700
|
-
return _this.hiddenFileInput.addEventListener("change", function() {
|
701
|
-
var file, files, _i, _len;
|
702
|
-
files = _this.hiddenFileInput.files;
|
703
|
-
if (files.length) {
|
704
|
-
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
705
|
-
file = files[_i];
|
706
|
-
_this.addFile(file);
|
707
|
-
}
|
782
|
+
setupHiddenFileInput = (function(_this) {
|
783
|
+
return function() {
|
784
|
+
if (_this.hiddenFileInput) {
|
785
|
+
document.body.removeChild(_this.hiddenFileInput);
|
708
786
|
}
|
709
|
-
|
710
|
-
|
711
|
-
|
787
|
+
_this.hiddenFileInput = document.createElement("input");
|
788
|
+
_this.hiddenFileInput.setAttribute("type", "file");
|
789
|
+
if ((_this.options.maxFiles == null) || _this.options.maxFiles > 1) {
|
790
|
+
_this.hiddenFileInput.setAttribute("multiple", "multiple");
|
791
|
+
}
|
792
|
+
_this.hiddenFileInput.className = "dz-hidden-input";
|
793
|
+
if (_this.options.acceptedFiles != null) {
|
794
|
+
_this.hiddenFileInput.setAttribute("accept", _this.options.acceptedFiles);
|
795
|
+
}
|
796
|
+
if (_this.options.capture != null) {
|
797
|
+
_this.hiddenFileInput.setAttribute("capture", _this.options.capture);
|
798
|
+
}
|
799
|
+
_this.hiddenFileInput.style.visibility = "hidden";
|
800
|
+
_this.hiddenFileInput.style.position = "absolute";
|
801
|
+
_this.hiddenFileInput.style.top = "0";
|
802
|
+
_this.hiddenFileInput.style.left = "0";
|
803
|
+
_this.hiddenFileInput.style.height = "0";
|
804
|
+
_this.hiddenFileInput.style.width = "0";
|
805
|
+
document.body.appendChild(_this.hiddenFileInput);
|
806
|
+
return _this.hiddenFileInput.addEventListener("change", function() {
|
807
|
+
var file, files, _i, _len;
|
808
|
+
files = _this.hiddenFileInput.files;
|
809
|
+
if (files.length) {
|
810
|
+
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
811
|
+
file = files[_i];
|
812
|
+
_this.addFile(file);
|
813
|
+
}
|
814
|
+
}
|
815
|
+
return setupHiddenFileInput();
|
816
|
+
});
|
817
|
+
};
|
818
|
+
})(this);
|
712
819
|
setupHiddenFileInput();
|
713
820
|
}
|
714
821
|
this.URL = (_ref = window.URL) != null ? _ref : window.webkitURL;
|
@@ -717,22 +824,30 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
717
824
|
eventName = _ref1[_i];
|
718
825
|
this.on(eventName, this.options[eventName]);
|
719
826
|
}
|
720
|
-
this.on("uploadprogress", function() {
|
721
|
-
return
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
this
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
827
|
+
this.on("uploadprogress", (function(_this) {
|
828
|
+
return function() {
|
829
|
+
return _this.updateTotalUploadProgress();
|
830
|
+
};
|
831
|
+
})(this));
|
832
|
+
this.on("removedfile", (function(_this) {
|
833
|
+
return function() {
|
834
|
+
return _this.updateTotalUploadProgress();
|
835
|
+
};
|
836
|
+
})(this));
|
837
|
+
this.on("canceled", (function(_this) {
|
838
|
+
return function(file) {
|
839
|
+
return _this.emit("complete", file);
|
840
|
+
};
|
841
|
+
})(this));
|
842
|
+
this.on("complete", (function(_this) {
|
843
|
+
return function(file) {
|
844
|
+
if (_this.getUploadingFiles().length === 0 && _this.getQueuedFiles().length === 0) {
|
845
|
+
return setTimeout((function() {
|
846
|
+
return _this.emit("queuecomplete");
|
847
|
+
}), 0);
|
848
|
+
}
|
849
|
+
};
|
850
|
+
})(this));
|
736
851
|
noPropagation = function(e) {
|
737
852
|
e.stopPropagation();
|
738
853
|
if (e.preventDefault) {
|
@@ -745,47 +860,61 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
745
860
|
{
|
746
861
|
element: this.element,
|
747
862
|
events: {
|
748
|
-
"dragstart": function(
|
749
|
-
return
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
e
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
863
|
+
"dragstart": (function(_this) {
|
864
|
+
return function(e) {
|
865
|
+
return _this.emit("dragstart", e);
|
866
|
+
};
|
867
|
+
})(this),
|
868
|
+
"dragenter": (function(_this) {
|
869
|
+
return function(e) {
|
870
|
+
noPropagation(e);
|
871
|
+
return _this.emit("dragenter", e);
|
872
|
+
};
|
873
|
+
})(this),
|
874
|
+
"dragover": (function(_this) {
|
875
|
+
return function(e) {
|
876
|
+
var efct;
|
877
|
+
try {
|
878
|
+
efct = e.dataTransfer.effectAllowed;
|
879
|
+
} catch (_error) {}
|
880
|
+
e.dataTransfer.dropEffect = 'move' === efct || 'linkMove' === efct ? 'move' : 'copy';
|
881
|
+
noPropagation(e);
|
882
|
+
return _this.emit("dragover", e);
|
883
|
+
};
|
884
|
+
})(this),
|
885
|
+
"dragleave": (function(_this) {
|
886
|
+
return function(e) {
|
887
|
+
return _this.emit("dragleave", e);
|
888
|
+
};
|
889
|
+
})(this),
|
890
|
+
"drop": (function(_this) {
|
891
|
+
return function(e) {
|
892
|
+
noPropagation(e);
|
893
|
+
return _this.drop(e);
|
894
|
+
};
|
895
|
+
})(this),
|
896
|
+
"dragend": (function(_this) {
|
897
|
+
return function(e) {
|
898
|
+
return _this.emit("dragend", e);
|
899
|
+
};
|
900
|
+
})(this)
|
774
901
|
}
|
775
902
|
}
|
776
903
|
];
|
777
|
-
this.clickableElements.forEach(function(
|
778
|
-
return
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
904
|
+
this.clickableElements.forEach((function(_this) {
|
905
|
+
return function(clickableElement) {
|
906
|
+
return _this.listeners.push({
|
907
|
+
element: clickableElement,
|
908
|
+
events: {
|
909
|
+
"click": function(evt) {
|
910
|
+
if ((clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".dz-message")))) {
|
911
|
+
return _this.hiddenFileInput.click();
|
912
|
+
}
|
784
913
|
}
|
785
914
|
}
|
786
|
-
}
|
787
|
-
}
|
788
|
-
});
|
915
|
+
});
|
916
|
+
};
|
917
|
+
})(this));
|
789
918
|
this.enable();
|
790
919
|
return this.options.init.call(this);
|
791
920
|
};
|
@@ -1030,26 +1159,27 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1030
1159
|
};
|
1031
1160
|
|
1032
1161
|
Dropzone.prototype._addFilesFromDirectory = function(directory, path) {
|
1033
|
-
var dirReader, entriesReader
|
1034
|
-
_this = this;
|
1162
|
+
var dirReader, entriesReader;
|
1035
1163
|
dirReader = directory.createReader();
|
1036
|
-
entriesReader = function(
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
entry.
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1164
|
+
entriesReader = (function(_this) {
|
1165
|
+
return function(entries) {
|
1166
|
+
var entry, _i, _len;
|
1167
|
+
for (_i = 0, _len = entries.length; _i < _len; _i++) {
|
1168
|
+
entry = entries[_i];
|
1169
|
+
if (entry.isFile) {
|
1170
|
+
entry.file(function(file) {
|
1171
|
+
if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
|
1172
|
+
return;
|
1173
|
+
}
|
1174
|
+
file.fullPath = "" + path + "/" + file.name;
|
1175
|
+
return _this.addFile(file);
|
1176
|
+
});
|
1177
|
+
} else if (entry.isDirectory) {
|
1178
|
+
_this._addFilesFromDirectory(entry, "" + path + "/" + entry.name);
|
1179
|
+
}
|
1050
1180
|
}
|
1051
|
-
}
|
1052
|
-
};
|
1181
|
+
};
|
1182
|
+
})(this);
|
1053
1183
|
return dirReader.readEntries(entriesReader, function(error) {
|
1054
1184
|
return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
|
1055
1185
|
});
|
@@ -1069,7 +1199,6 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1069
1199
|
};
|
1070
1200
|
|
1071
1201
|
Dropzone.prototype.addFile = function(file) {
|
1072
|
-
var _this = this;
|
1073
1202
|
file.upload = {
|
1074
1203
|
progress: 0,
|
1075
1204
|
total: file.size,
|
@@ -1079,18 +1208,20 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1079
1208
|
file.status = Dropzone.ADDED;
|
1080
1209
|
this.emit("addedfile", file);
|
1081
1210
|
this._enqueueThumbnail(file);
|
1082
|
-
return this.accept(file, function(
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
_this.
|
1211
|
+
return this.accept(file, (function(_this) {
|
1212
|
+
return function(error) {
|
1213
|
+
if (error) {
|
1214
|
+
file.accepted = false;
|
1215
|
+
_this._errorProcessing([file], error);
|
1216
|
+
} else {
|
1217
|
+
file.accepted = true;
|
1218
|
+
if (_this.options.autoQueue) {
|
1219
|
+
_this.enqueueFile(file);
|
1220
|
+
}
|
1090
1221
|
}
|
1091
|
-
|
1092
|
-
|
1093
|
-
});
|
1222
|
+
return _this._updateMaxFilesReachedClass();
|
1223
|
+
};
|
1224
|
+
})(this));
|
1094
1225
|
};
|
1095
1226
|
|
1096
1227
|
Dropzone.prototype.enqueueFiles = function(files) {
|
@@ -1103,13 +1234,14 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1103
1234
|
};
|
1104
1235
|
|
1105
1236
|
Dropzone.prototype.enqueueFile = function(file) {
|
1106
|
-
var _this = this;
|
1107
1237
|
if (file.status === Dropzone.ADDED && file.accepted === true) {
|
1108
1238
|
file.status = Dropzone.QUEUED;
|
1109
1239
|
if (this.options.autoProcessQueue) {
|
1110
|
-
return setTimeout((function() {
|
1111
|
-
return
|
1112
|
-
|
1240
|
+
return setTimeout(((function(_this) {
|
1241
|
+
return function() {
|
1242
|
+
return _this.processQueue();
|
1243
|
+
};
|
1244
|
+
})(this)), 0);
|
1113
1245
|
}
|
1114
1246
|
} else {
|
1115
1247
|
throw new Error("This file can't be queued because it has already been processed or was rejected.");
|
@@ -1121,25 +1253,27 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1121
1253
|
Dropzone.prototype._processingThumbnail = false;
|
1122
1254
|
|
1123
1255
|
Dropzone.prototype._enqueueThumbnail = function(file) {
|
1124
|
-
var _this = this;
|
1125
1256
|
if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {
|
1126
1257
|
this._thumbnailQueue.push(file);
|
1127
|
-
return setTimeout((function() {
|
1128
|
-
return
|
1129
|
-
|
1258
|
+
return setTimeout(((function(_this) {
|
1259
|
+
return function() {
|
1260
|
+
return _this._processThumbnailQueue();
|
1261
|
+
};
|
1262
|
+
})(this)), 0);
|
1130
1263
|
}
|
1131
1264
|
};
|
1132
1265
|
|
1133
1266
|
Dropzone.prototype._processThumbnailQueue = function() {
|
1134
|
-
var _this = this;
|
1135
1267
|
if (this._processingThumbnail || this._thumbnailQueue.length === 0) {
|
1136
1268
|
return;
|
1137
1269
|
}
|
1138
1270
|
this._processingThumbnail = true;
|
1139
|
-
return this.createThumbnail(this._thumbnailQueue.shift(), function() {
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1271
|
+
return this.createThumbnail(this._thumbnailQueue.shift(), (function(_this) {
|
1272
|
+
return function() {
|
1273
|
+
_this._processingThumbnail = false;
|
1274
|
+
return _this._processThumbnailQueue();
|
1275
|
+
};
|
1276
|
+
})(this));
|
1143
1277
|
};
|
1144
1278
|
|
1145
1279
|
Dropzone.prototype.removeFile = function(file) {
|
@@ -1169,36 +1303,44 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1169
1303
|
};
|
1170
1304
|
|
1171
1305
|
Dropzone.prototype.createThumbnail = function(file, callback) {
|
1172
|
-
var fileReader
|
1173
|
-
_this = this;
|
1306
|
+
var fileReader;
|
1174
1307
|
fileReader = new FileReader;
|
1175
|
-
fileReader.onload = function() {
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
resizeInfo.trgWidth = resizeInfo.optWidth;
|
1185
|
-
}
|
1186
|
-
if (resizeInfo.trgHeight == null) {
|
1187
|
-
resizeInfo.trgHeight = resizeInfo.optHeight;
|
1188
|
-
}
|
1189
|
-
canvas = document.createElement("canvas");
|
1190
|
-
ctx = canvas.getContext("2d");
|
1191
|
-
canvas.width = resizeInfo.trgWidth;
|
1192
|
-
canvas.height = resizeInfo.trgHeight;
|
1193
|
-
drawImageIOSFix(ctx, img, (_ref = resizeInfo.srcX) != null ? _ref : 0, (_ref1 = resizeInfo.srcY) != null ? _ref1 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (_ref2 = resizeInfo.trgX) != null ? _ref2 : 0, (_ref3 = resizeInfo.trgY) != null ? _ref3 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);
|
1194
|
-
thumbnail = canvas.toDataURL("image/png");
|
1195
|
-
_this.emit("thumbnail", file, thumbnail);
|
1196
|
-
if (callback != null) {
|
1197
|
-
return callback();
|
1308
|
+
fileReader.onload = (function(_this) {
|
1309
|
+
return function() {
|
1310
|
+
var img;
|
1311
|
+
if (file.type === "image/svg+xml") {
|
1312
|
+
_this.emit("thumbnail", file, fileReader.result);
|
1313
|
+
if (callback != null) {
|
1314
|
+
callback();
|
1315
|
+
}
|
1316
|
+
return;
|
1198
1317
|
}
|
1318
|
+
img = document.createElement("img");
|
1319
|
+
img.onload = function() {
|
1320
|
+
var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3;
|
1321
|
+
file.width = img.width;
|
1322
|
+
file.height = img.height;
|
1323
|
+
resizeInfo = _this.options.resize.call(_this, file);
|
1324
|
+
if (resizeInfo.trgWidth == null) {
|
1325
|
+
resizeInfo.trgWidth = resizeInfo.optWidth;
|
1326
|
+
}
|
1327
|
+
if (resizeInfo.trgHeight == null) {
|
1328
|
+
resizeInfo.trgHeight = resizeInfo.optHeight;
|
1329
|
+
}
|
1330
|
+
canvas = document.createElement("canvas");
|
1331
|
+
ctx = canvas.getContext("2d");
|
1332
|
+
canvas.width = resizeInfo.trgWidth;
|
1333
|
+
canvas.height = resizeInfo.trgHeight;
|
1334
|
+
drawImageIOSFix(ctx, img, (_ref = resizeInfo.srcX) != null ? _ref : 0, (_ref1 = resizeInfo.srcY) != null ? _ref1 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (_ref2 = resizeInfo.trgX) != null ? _ref2 : 0, (_ref3 = resizeInfo.trgY) != null ? _ref3 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);
|
1335
|
+
thumbnail = canvas.toDataURL("image/png");
|
1336
|
+
_this.emit("thumbnail", file, thumbnail);
|
1337
|
+
if (callback != null) {
|
1338
|
+
return callback();
|
1339
|
+
}
|
1340
|
+
};
|
1341
|
+
return img.src = fileReader.result;
|
1199
1342
|
};
|
1200
|
-
|
1201
|
-
};
|
1343
|
+
})(this);
|
1202
1344
|
return fileReader.readAsDataURL(file);
|
1203
1345
|
};
|
1204
1346
|
|
@@ -1294,8 +1436,7 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1294
1436
|
};
|
1295
1437
|
|
1296
1438
|
Dropzone.prototype.uploadFiles = function(files) {
|
1297
|
-
var file, formData, handleError, headerName, headerValue, headers, i, input, inputName, inputType, key, option, progressObj, response, updateProgress, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5
|
1298
|
-
_this = this;
|
1439
|
+
var file, formData, handleError, headerName, headerValue, headers, i, input, inputName, inputType, key, option, progressObj, response, updateProgress, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
1299
1440
|
xhr = new XMLHttpRequest();
|
1300
1441
|
for (_i = 0, _len = files.length; _i < _len; _i++) {
|
1301
1442
|
file = files[_i];
|
@@ -1304,79 +1445,87 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1304
1445
|
xhr.open(this.options.method, this.options.url, true);
|
1305
1446
|
xhr.withCredentials = !!this.options.withCredentials;
|
1306
1447
|
response = null;
|
1307
|
-
handleError = function() {
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
file = files[_j];
|
1312
|
-
_results.push(_this._errorProcessing(files, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr));
|
1313
|
-
}
|
1314
|
-
return _results;
|
1315
|
-
};
|
1316
|
-
updateProgress = function(e) {
|
1317
|
-
var allFilesFinished, progress, _j, _k, _l, _len1, _len2, _len3, _results;
|
1318
|
-
if (e != null) {
|
1319
|
-
progress = 100 * e.loaded / e.total;
|
1448
|
+
handleError = (function(_this) {
|
1449
|
+
return function() {
|
1450
|
+
var _j, _len1, _results;
|
1451
|
+
_results = [];
|
1320
1452
|
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
|
1321
1453
|
file = files[_j];
|
1322
|
-
|
1323
|
-
progress: progress,
|
1324
|
-
total: e.total,
|
1325
|
-
bytesSent: e.loaded
|
1326
|
-
};
|
1454
|
+
_results.push(_this._errorProcessing(files, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr));
|
1327
1455
|
}
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1456
|
+
return _results;
|
1457
|
+
};
|
1458
|
+
})(this);
|
1459
|
+
updateProgress = (function(_this) {
|
1460
|
+
return function(e) {
|
1461
|
+
var allFilesFinished, progress, _j, _k, _l, _len1, _len2, _len3, _results;
|
1462
|
+
if (e != null) {
|
1463
|
+
progress = 100 * e.loaded / e.total;
|
1464
|
+
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
|
1465
|
+
file = files[_j];
|
1466
|
+
file.upload = {
|
1467
|
+
progress: progress,
|
1468
|
+
total: e.total,
|
1469
|
+
bytesSent: e.loaded
|
1470
|
+
};
|
1471
|
+
}
|
1472
|
+
} else {
|
1473
|
+
allFilesFinished = true;
|
1474
|
+
progress = 100;
|
1475
|
+
for (_k = 0, _len2 = files.length; _k < _len2; _k++) {
|
1476
|
+
file = files[_k];
|
1477
|
+
if (!(file.upload.progress === 100 && file.upload.bytesSent === file.upload.total)) {
|
1478
|
+
allFilesFinished = false;
|
1479
|
+
}
|
1480
|
+
file.upload.progress = progress;
|
1481
|
+
file.upload.bytesSent = file.upload.total;
|
1482
|
+
}
|
1483
|
+
if (allFilesFinished) {
|
1484
|
+
return;
|
1335
1485
|
}
|
1336
|
-
file.upload.progress = progress;
|
1337
|
-
file.upload.bytesSent = file.upload.total;
|
1338
1486
|
}
|
1339
|
-
|
1487
|
+
_results = [];
|
1488
|
+
for (_l = 0, _len3 = files.length; _l < _len3; _l++) {
|
1489
|
+
file = files[_l];
|
1490
|
+
_results.push(_this.emit("uploadprogress", file, progress, file.upload.bytesSent));
|
1491
|
+
}
|
1492
|
+
return _results;
|
1493
|
+
};
|
1494
|
+
})(this);
|
1495
|
+
xhr.onload = (function(_this) {
|
1496
|
+
return function(e) {
|
1497
|
+
var _ref;
|
1498
|
+
if (files[0].status === Dropzone.CANCELED) {
|
1340
1499
|
return;
|
1341
1500
|
}
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1501
|
+
if (xhr.readyState !== 4) {
|
1502
|
+
return;
|
1503
|
+
}
|
1504
|
+
response = xhr.responseText;
|
1505
|
+
if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) {
|
1506
|
+
try {
|
1507
|
+
response = JSON.parse(response);
|
1508
|
+
} catch (_error) {
|
1509
|
+
e = _error;
|
1510
|
+
response = "Invalid JSON response from server.";
|
1511
|
+
}
|
1512
|
+
}
|
1513
|
+
updateProgress();
|
1514
|
+
if (!((200 <= (_ref = xhr.status) && _ref < 300))) {
|
1515
|
+
return handleError();
|
1516
|
+
} else {
|
1517
|
+
return _this._finished(files, response, e);
|
1518
|
+
}
|
1519
|
+
};
|
1520
|
+
})(this);
|
1521
|
+
xhr.onerror = (function(_this) {
|
1522
|
+
return function() {
|
1523
|
+
if (files[0].status === Dropzone.CANCELED) {
|
1524
|
+
return;
|
1365
1525
|
}
|
1366
|
-
}
|
1367
|
-
updateProgress();
|
1368
|
-
if (!((200 <= (_ref = xhr.status) && _ref < 300))) {
|
1369
1526
|
return handleError();
|
1370
|
-
}
|
1371
|
-
|
1372
|
-
}
|
1373
|
-
};
|
1374
|
-
xhr.onerror = function() {
|
1375
|
-
if (files[0].status === Dropzone.CANCELED) {
|
1376
|
-
return;
|
1377
|
-
}
|
1378
|
-
return handleError();
|
1379
|
-
};
|
1527
|
+
};
|
1528
|
+
})(this);
|
1380
1529
|
progressObj = (_ref = xhr.upload) != null ? _ref : xhr;
|
1381
1530
|
progressObj.onprogress = updateProgress;
|
1382
1531
|
headers = {
|
@@ -1469,7 +1618,7 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1469
1618
|
|
1470
1619
|
})(Em);
|
1471
1620
|
|
1472
|
-
Dropzone.version = "3.
|
1621
|
+
Dropzone.version = "3.11.1";
|
1473
1622
|
|
1474
1623
|
Dropzone.options = {};
|
1475
1624
|
|
@@ -1698,13 +1847,13 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1698
1847
|
|
1699
1848
|
Dropzone.SUCCESS = "success";
|
1700
1849
|
|
1850
|
+
|
1701
1851
|
/*
|
1702
1852
|
|
1703
1853
|
Bugfix for iOS 6 and 7
|
1704
1854
|
Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios
|
1705
1855
|
based on the work of https://github.com/stomita/ios-imagefile-megapixel
|
1706
|
-
|
1707
|
-
|
1856
|
+
*/
|
1708
1857
|
|
1709
1858
|
detectVerticalSquash = function(img) {
|
1710
1859
|
var alpha, canvas, ctx, data, ey, ih, iw, py, ratio, sy;
|
@@ -1742,20 +1891,20 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1742
1891
|
return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);
|
1743
1892
|
};
|
1744
1893
|
|
1745
|
-
/*
|
1746
|
-
# contentloaded.js
|
1747
|
-
#
|
1748
|
-
# Author: Diego Perini (diego.perini at gmail.com)
|
1749
|
-
# Summary: cross-browser wrapper for DOMContentLoaded
|
1750
|
-
# Updated: 20101020
|
1751
|
-
# License: MIT
|
1752
|
-
# Version: 1.2
|
1753
|
-
#
|
1754
|
-
# URL:
|
1755
|
-
# http://javascript.nwbox.com/ContentLoaded/
|
1756
|
-
# http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
|
1757
|
-
*/
|
1758
1894
|
|
1895
|
+
/*
|
1896
|
+
* contentloaded.js
|
1897
|
+
*
|
1898
|
+
* Author: Diego Perini (diego.perini at gmail.com)
|
1899
|
+
* Summary: cross-browser wrapper for DOMContentLoaded
|
1900
|
+
* Updated: 20101020
|
1901
|
+
* License: MIT
|
1902
|
+
* Version: 1.2
|
1903
|
+
*
|
1904
|
+
* URL:
|
1905
|
+
* http://javascript.nwbox.com/ContentLoaded/
|
1906
|
+
* http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
|
1907
|
+
*/
|
1759
1908
|
|
1760
1909
|
contentLoaded = function(win, fn) {
|
1761
1910
|
var add, doc, done, init, poll, pre, rem, root, top;
|
@@ -1816,8 +1965,8 @@ require.register("dropzone/lib/dropzone.js", function (exports, module) {
|
|
1816
1965
|
if (typeof exports == "object") {
|
1817
1966
|
module.exports = require("dropzone");
|
1818
1967
|
} else if (typeof define == "function" && define.amd) {
|
1819
|
-
define([], function(){ return require("dropzone"); });
|
1968
|
+
define("Dropzone", [], function(){ return require("dropzone"); });
|
1820
1969
|
} else {
|
1821
|
-
this["Dropzone"] = require("dropzone");
|
1970
|
+
(this || window)["Dropzone"] = require("dropzone");
|
1822
1971
|
}
|
1823
1972
|
})()
|
@@ -3,8 +3,6 @@
|
|
3
3
|
.dropzone *,
|
4
4
|
.dropzone-previews,
|
5
5
|
.dropzone-previews * {
|
6
|
-
-webkit-box-sizing: border-box;
|
7
|
-
-moz-box-sizing: border-box;
|
8
6
|
box-sizing: border-box;
|
9
7
|
}
|
10
8
|
.dropzone {
|
@@ -25,8 +23,6 @@
|
|
25
23
|
}
|
26
24
|
.dropzone .dz-message {
|
27
25
|
opacity: 1;
|
28
|
-
-ms-filter: none;
|
29
|
-
filter: none;
|
30
26
|
}
|
31
27
|
.dropzone.dz-drag-hover {
|
32
28
|
border-color: rgba(0,0,0,0.15);
|
@@ -65,17 +61,13 @@
|
|
65
61
|
}
|
66
62
|
.dropzone .dz-preview .dz-details img,
|
67
63
|
.dropzone-previews .dz-preview .dz-details img {
|
68
|
-
|
69
|
-
top: 0;
|
70
|
-
left: 0;
|
64
|
+
absolute: top left;
|
71
65
|
width: 100px;
|
72
66
|
height: 100px;
|
73
67
|
}
|
74
68
|
.dropzone .dz-preview .dz-details .dz-size,
|
75
69
|
.dropzone-previews .dz-preview .dz-details .dz-size {
|
76
|
-
|
77
|
-
bottom: -28px;
|
78
|
-
left: 3px;
|
70
|
+
absolute: bottom -28px left 3px;
|
79
71
|
height: 28px;
|
80
72
|
line-height: 28px;
|
81
73
|
}
|
@@ -139,9 +131,7 @@
|
|
139
131
|
.dropzone .dz-preview .dz-error-message,
|
140
132
|
.dropzone-previews .dz-preview .dz-error-message {
|
141
133
|
display: none;
|
142
|
-
|
143
|
-
top: -5px;
|
144
|
-
left: -20px;
|
134
|
+
absolute: top -5px left -20px;
|
145
135
|
background: rgba(245,245,245,0.8);
|
146
136
|
padding: 8px 10px;
|
147
137
|
color: #800;
|
@@ -364,47 +354,34 @@
|
|
364
354
|
color: #666;
|
365
355
|
}
|
366
356
|
@-moz-keyframes loading {
|
367
|
-
|
357
|
+
from {
|
368
358
|
background-position: 0 -400px;
|
369
359
|
}
|
370
|
-
|
371
|
-
100% {
|
360
|
+
to {
|
372
361
|
background-position: -7px -400px;
|
373
362
|
}
|
374
363
|
}
|
375
364
|
@-webkit-keyframes loading {
|
376
|
-
|
365
|
+
from {
|
377
366
|
background-position: 0 -400px;
|
378
367
|
}
|
379
|
-
|
380
|
-
100% {
|
368
|
+
to {
|
381
369
|
background-position: -7px -400px;
|
382
370
|
}
|
383
371
|
}
|
384
372
|
@-o-keyframes loading {
|
385
|
-
|
386
|
-
background-position: 0 -400px;
|
387
|
-
}
|
388
|
-
|
389
|
-
100% {
|
390
|
-
background-position: -7px -400px;
|
391
|
-
}
|
392
|
-
}
|
393
|
-
@-ms-keyframes loading {
|
394
|
-
0% {
|
373
|
+
from {
|
395
374
|
background-position: 0 -400px;
|
396
375
|
}
|
397
|
-
|
398
|
-
100% {
|
376
|
+
to {
|
399
377
|
background-position: -7px -400px;
|
400
378
|
}
|
401
379
|
}
|
402
380
|
@keyframes loading {
|
403
|
-
|
381
|
+
from {
|
404
382
|
background-position: 0 -400px;
|
405
383
|
}
|
406
|
-
|
407
|
-
100% {
|
384
|
+
to {
|
408
385
|
background-position: -7px -400px;
|
409
386
|
}
|
410
387
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dropzonejs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Nahuel Cuesta Luengo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
93
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.4.
|
94
|
+
rubygems_version: 2.4.2
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: Integrates Dropzone JS File upload into Rails Asset pipeline.
|