PageSourceSearch

https://zeusauction.com/js/dropzone.js?v=1.9.0

js zeusauction.com collected 2026-10-05 10:44:47 UTC 63,870 bytes, 1,752 lines download raw bytes

1
2/*
3 *
4 * More info at [www.dropzonejs.com](http://www.dropzonejs.com)
5 *
6 * Copyright (c) 2012, Matias Meno
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 *
26 */
27
28(function() {
29  var Dropzone, Emitter, camelize, contentLoaded, detectVerticalSquash, drawImageIOSFix, noop, without,
30    __slice = [].slice,
31    __hasProp = {}.hasOwnProperty,
32    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
33
34  noop = function() {};
35
36  Emitter = (function() {
37    function Emitter() {}
38
39    Emitter.prototype.addEventListener = Emitter.prototype.on;
40
41    Emitter.prototype.on = function(event, fn) {
42      this._callbacks = this._callbacks || {};
43      if (!this._callbacks[event]) {
44        this._callbacks[event] = [];
45      }
46      this._callbacks[event].push(fn);
47      return this;
48    };
49
50    Emitter.prototype.emit = function() {
51      var args, callback, callbacks, event, _i, _len;
52      event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
53      this._callbacks = this._callbacks || {};
54      callbacks = this._callbacks[event];
55      if (callbacks) {
56        for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
57          callback = callbacks[_i];
58          callback.apply(this, args);
59        }
60      }
61      return this;
62    };
63
64    Emitter.prototype.removeListener = Emitter.prototype.off;
65
66    Emitter.prototype.removeAllListeners = Emitter.prototype.off;
67
68    Emitter.prototype.removeEventListener = Emitter.prototype.off;
69
70    Emitter.prototype.off = function(event, fn) {
71      var callback, callbacks, i, _i, _len;
72      if (!this._callbacks || arguments.length === 0) {
73        this._callbacks = {};
74        return this;
75      }
76      callbacks = this._callbacks[event];
77      if (!callbacks) {
78        return this;
79      }
80      if (arguments.length === 1) {
81        delete this._callbacks[event];
82        return this;
83      }
84      for (i = _i = 0, _len = callbacks.length; _i < _len; i = ++_i) {
85        callback = callbacks[i];
86        if (callback === fn) {
87          callbacks.splice(i, 1);
88          break;
89        }
90      }
91      return this;
92    };
93
94    return Emitter;
95
96  })();
97
98  Dropzone = (function(_super) {
99    var extend, resolveOption;
100
101    __extends(Dropzone, _super);
102
103    Dropzone.prototype.Emitter = Emitter;
104
105
106    /*
107    This is a list of all available events you can register on a dropzone object.
108    
109    You can register an event handler like this:
110    
111        dropzone.on("dragEnter", function() { });
112     */
113
114    Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "addedfiles", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached", "queuecomplete"];
115
116    Dropzone.prototype.defaultOptions = {
117      url: null,
118      method: "post",
119      withCredentials: false,
120      parallelUploads: 2,
121      uploadMultiple: false,
122      maxFilesize: 256,
123      paramName: "file",
124      createImageThumbnails: true,
125      maxThumbnailFilesize: 10,
126      thumbnailWidth: 120,
127      thumbnailHeight: 120,
128      filesizeBase: 1000,
129      maxFiles: null,
130      params: {},
131      clickable: true,
132      ignoreHiddenFiles: true,
133      acceptedFiles: null,
134      acceptedMimeTypes: null,
135      autoProcessQueue: true,
136      autoQueue: true,
137      addRemoveLinks: false,
138      previewsContainer: null,
139      hiddenInputContainer: "body",
140      capture: null,
141      dictDefaultMessage: "Drop files here to upload",
142      dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
143      dictFallbackText: "Please use the fallback form below to upload your files like in the olde
143n days.",
144      dictFileTooBig: "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",
145      dictInvalidFileType: "You can't upload files of this type.",
146      dictResponseError: "Server responded with {{statusCode}} code.",
147      dictCancelUpload: "Cancel upload",
148      dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
149      dictRemoveFile: "Remove file",
150      dictRemoveFileConfirmation: null,
151      dictMaxFilesExceeded: "You can not upload any more files.",
152      accept: function(file, done) {
153        return done();
154      },
155      init: function() {
156        return noop;
157      },
158      forceFallback: false,
159      fallback: function() {
160        var child, messageElement, span, _i, _len, _ref;
161        this.element.className = "" + this.element.className + " dz-browser-not-supported";
162        _ref = this.element.getElementsByTagName("div");
163        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
164          child = _ref[_i];
165          if (/(^| )dz-message($| )/.test(child.className)) {
166            messageElement = child;
167            child.className = "dz-message";
168            continue;
169          }
170        }
171        if (!messageElement) {
172          messageElement = Dropzone.createElement("<div class=\"dz-message\"><span></span></div>");
173          this.element.appendChild(messageElement);
174        }
175        span = messageElement.getElementsByTagName("span")[0];
176        if (span) {
177          if (span.textContent != null) {
178            span.textContent = this.options.dictFallbackMessage;
179          } else if (span.innerText != null) {
180            span.innerText = this.options.dictFallbackMessage;
181          }
182        }
183        return this.element.appendChild(this.getFallbackForm());
184      },
185      resize: function(file) {
186        var info, srcRatio, trgRatio;
187        info = {
188          srcX: 0,
189          srcY: 0,
190          srcWidth: file.width,
191          srcHeight: file.height
192        };
193        srcRatio = file.width / file.height;
194        info.optWidth = this.options.thumbnailWidth;
195        info.optHeight = this.options.thumbnailHeight;
196        if ((info.optWidth == null) && (info.optHeight == null)) {
197          info.optWidth = info.srcWidth;
198          info.optHeight = info.srcHeight;
199        } else if (info.optWidth == null) {
200          info.optWidth = srcRatio * info.optHeight;
201        } else if (info.optHeight == null) {
202          info.optHeight = (1 / srcRatio) * info.optWidth;
203        }
204        trgRatio = info.optWidth / info.optHeight;
205        if (file.height < info.optHeight || file.width < info.optWidth) {
206          info.trgHeight = info.srcHeight;
207          info.trgWidth = info.srcWidth;
208        } else {
209          if (srcRatio > trgRatio) {
210            info.srcHeight = file.height;
211            info.srcWidth = info.srcHeight * trgRatio;
212          } else {
213            info.srcWidth = file.width;
214            info.srcHeight = info.srcWidth / trgRatio;
215          }
216        }
217        info.srcX = (file.width - info.srcWidth) / 2;
218        info.srcY = (file.height - info.srcHeight) / 2;
219        return info;
220      },
221
222      /*
223      Those functions register themselves to the events on init and handle all
224      the user interface specific stuff. Overwriting them won't break the upload
225      but can break the way it's displayed.
226      You can overwrite them if you don't like the default behavior. If you just
227      want to add an additional event handler, register it on the dropzone object
228      and don't overwrite those options.
229       */
230      drop: function(e) {
231        return this.element.classList.remove("dz-drag-hover");
232      },
233      dragstart: noop,
234      dragend: function(e) {
235        return this.element.classList.remove("dz-drag-hover");
236      },
237      dragenter: function(e) {
238        return this.element.classList.add("dz-drag-hover");
239      },
240      dragover: function(e) {
241        return this.element.classList.add("dz-drag-hover");
242      },
243      dragleave: function(e) {
244        return this.element.classList.remove("dz-drag-hover");
245      },
246      paste: noop,
247      reset: function() {
248        return this.element.classList.remove("dz-started");
249      },
250      addedfile: function(file) {
251        var node, removeFileEvent, removeLink, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results;
252        if (this.element === this.previewsContainer) {
253          this.element.classList.add("dz-started");
254        }
255        if (this.previewsContainer) {
256          file.previewElement = Dropzone.createElement(this.options.previewTemplate.trim());
257          file.previewTemplate = file.previewElement;
258          this.previewsContainer.appendChild(file.previewElement);
259          _ref = file.previewElement.querySelectorAll("[data-dz-name]");
260          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
261            node = _ref[_i];
262            node.textContent = file.name;
263          }
264          _ref1 = file.previewElement.querySelectorAll("[data-dz-size]");
265          for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
266            node = _ref1[_j];
267            node.innerHTML = this.filesize(file.size);
268          }
269          if (this.options.addRemoveLinks) {
270            file._removeLink = Dropzone.createElement("<a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>" + this.options.dictRemoveFile + "</a>");
271            file.previewElement.appendChild(file._removeLink);
272          }
273          removeFileEvent = (function(_this) {
274            return function(e) {
275              e.preventDefault();
276              e.stopPropagation();
277              if (file.status === Dropzone.UPLOADING) {
278                return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function() {
279                  return _this.removeFile(file);
280                });
281              } else {
282                if (_this.options.dictRemoveFileConfirmation) {
283                  return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function() {
284                    return _this.removeFile(file);
285                  });
286                } else {
287                  return _this.removeFile(file);
288                }
289              }
290            };
291          })(this);
292          _ref2 = file.previewElement.querySelectorAll("[data-dz-remove]");
293          _results = [];
294          for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
295            removeLink = _ref2[_k];
296            _results.push(removeLink.addEventListener("click", removeFileEvent));
297          }
298          return _results;
299        }
300      },
301      removedfile: function(file) {
302        var _ref;
303        if (file.previewElement) {
304          if ((_ref = file.previewElement) != null) {
305            _ref.parentNode.removeChild(file.previewElement);
306          }
307        }
308        return this._updateMaxFilesReachedClass();
309      },
310      thumbnail: function(file, dataUrl) {
311        var thumbnailElement, _i, _len, _ref;
312        if (file.previewElement) {
313          file.previewElement.classList.remove("dz-file-preview");
314          _ref = file.previewElement.querySelectorAll("[data-dz-thumbnail]");
315          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
316            thumbnailElement = _ref[_i];
317            thumbnailElement.alt = file.name;
318            thumbnailElement.src = dataUrl;
319          }
320          return setTimeout(((function(_this) {
321            return function() {
322              return file.previewElement.classList.add("dz-image-preview");
323            };
324          })(this)), 1);
325        }
326      },
327      error: function(file, message) {
328        var node, _i, _len, _ref, _results;
329        if (file.previewElement) {
330          file.previewElement.classList.add("dz-error");
331          if (typeof message !== "String" && message.error) {
332            message = message.error;
333          }
334          _ref = file.previewElement.querySelectorAll("[data-dz-errormessage]");
335          _results = [];
336          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
337            node = _ref[_i];
338            _results.push(node.textContent = message);
339          }
340          return _results;
341        }
342      },
343      errormultiple: noop,
344      processing: function(file) {
345        if (file.previewElement) {
346          file.previewElement.classList.add("dz-processing");
347          if (file._removeLink) {
348            return file._removeLink.textContent = this.options.dictCancelUpload;
349          }
350        }
351      },
352      processingmultiple: noop,
353      uploadprogress: function(file, progress, bytesSent) {
354        var node, _i, _len, _ref, _results;
355        if (file.previewElement) {
356          _ref = file.previewElement.querySelectorAll("[data-dz-uploadprogress]");
357          _results = [];
358          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
359            node = _ref[_i];
360            if (node.nodeName === 'PROGRESS') {
361              _results.push(node.value = progress);
362            } else {
363              _results.push(node.style.width = "" + progress + "%");
364            }
365          }
366          return _results;
367        }
368      },
369      totaluploadprogress: noop,
370      sending: noop,
371      sendingmultiple: noop,
372      success: function(file) {
373        if (file.previewElement) {
374          return file.previewElement.classList.add("dz-success");
375        }
376      },
377      successmultiple: noop,
378      canceled: function(file) {
379        return this.emit("error", file, "Upload canceled.");
380      },
381      canceledmultiple: noop,
382      complete: function(file) {
383        if (file._removeLink) {
384          file._removeLink.textContent = this.options.dictRemoveFile;
385        }
386        if (file.previewElement) {
387          return file.previewElement.classList.add("dz-complete");
388        }
389      },
390      completemultiple: noop,
391      maxfilesexceeded: noop,
392      maxfilesreached: noop,
393      queuecomplete: noop,
394      addedfiles: noop,
395      previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n  <div class=\"dz-image\"><img data-dz-thumbnail /></div>\n  <div class=\"dz-details\">\n    <div class=\"dz-size\"><span data-dz-size></span></div>\n    <div class=\"dz-filename\"><span data-dz-name></span></div>\n  </div>\n  <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n  <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n  <div class=\"dz-success-mark\">\n    <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n      <title>Check</title>\n      <defs></defs>\n      <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n        <path d=\"M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" stroke-opacity=\"0.198794158\" stroke=\"#747474\" fill-opacity=\"0.816519475\" fill=\"#FFFFFF\" sketch:type=\"MSShapeGroup\"></path>\n      </g>\n    </svg>\n  </div>\n  <div class=\"dz-error-mark\">\n    <svg width=\"54px\" height=\"54px\" viewBox=\"0 0 54 54\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:sketch=\"http://www.bohemiancoding.com/sketch/ns\">\n      <title>Error</title>\n      <defs></defs>\n      <g id=\"Page-1\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" sketch:type=\"MSPage\">\n        <g id=\"Check-+-Oval-2\" sketch:type=\"MSLayerGroup\" stroke=\"#747474\" stroke-opacity=\"0.198794158\" fill=\"#FFFFFF\" fill-opacity=\"0.816519475\">\n          <path d=\"M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z\" id=\"Oval-2\" sketch:type=\"MSShapeGroup\"></path>\n        </g>\n      </g>\n    </svg>\n  </div>\n</div>"
396    };
397
398    extend = function() {
399      var key, object, objects, target, val, _i, _len;
400      target = arguments[0], objects = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
401      for (_i = 0, _len = objects.length; _i < _len; _i++) {
402        object = objects[_i];
403        for (key in object) {
404          val = object[key];
405          target[key] = val;
406        }
407      }
408      return target;
409    };
410
411    function Dropzone(element, options) {
412      var elementOptions, fallback, _ref;
413      this.element = element;
414      this.version = Dropzone.version;
415      this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(/\n*/g, "");
416      this.clickableElements = [];
417      this.listeners = [];
418      this.files = [];
419      if (typeof this.element === "string") {
420        this.element = document.querySelector(this.element);
421      }
422      if (!(this.element && (this.element.nodeType != null))) {
423        throw new Error("Invalid dropzone element.");
424      }
425      if (this.element.dropzone) {
426        throw new Error("Dropzone already attached.");
427      }
428      Dropzone.instances.push(this);
429      this.element.dropzone = this;
430      elementOptions = (_ref = Dropzone.optionsForElement(this.element)) != null ? _ref : {};
431      this.options = extend({}, this.defaultOptions, elementOptions, options != null ? options : {});
432      if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
433        return this.options.fallback.call(this);
434      }
435      if (this.options.url == null) {
436        this.options.url = this.element.getAttribute("action");
437      }
438      if (!this.options.url) {
439        throw new Error("No URL provided.");
440      }
441      if (this.options.acceptedFiles && this.options.acceptedMimeTypes) {
442        throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");
443      }
444      if (this.options.acceptedMimeTypes) {
445        this.options.acceptedFiles = this.options.acceptedMimeTypes;
446        delete this.options.acceptedMimeTypes;
447      }
448      this.options.method = this.options.method.toUpperCase();
449      if ((fallback = this.getExistingFallback()) && fallback.parentNode) {
450        fallback.parentNode.removeChild(fallback);
451      }
452      if (this.options.previewsContainer !== false) {
453        if (this.options.previewsContainer) {
454          this.previewsContainer = Dropzone.getElement(this.options.previewsContainer, "previewsContainer");
455        } else {
456          this.previewsContainer = this.element;
457        }
458      }
459      if (this.options.clickable) {
460        if (this.options.clickable === true) {
461          this.clickableElements = [this.element];
462        } else {
463          this.clickableElements = Dropzone.getElements(this.options.clickable, "clickable");
464        }
465      }
466      this.init();
467    }
468
469    Dropzone.prototype.getAcceptedFiles = function() {
470      var file, _i, _len, _ref, _results;
471      _ref = this.files;
472      _results = [];
473      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
474        file = _ref[_i];
475        if (file.accepted) {
476          _results.push(file);
477        }
478      }
479      return _results;
480    };
481
482    Dropzone.prototype.getRejectedFiles = function() {
483      var file, _i, _len, _ref, _results;
484      _ref = this.files;
485      _results = [];
486      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
487        file = _ref[_i];
488        if (!file.accepted) {
489          _results.push(file);
490        }
491      }
492      return _results;
493    };
494
495    Dropzone.prototype.getFilesWithStatus = function(status) {
496      var file, _i, _len, _ref, _results;
497      _ref = this.files;
498      _results = [];
499      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
500        file = _ref[_i];
501        if (file.status === status) {
502          _results.push(file);
503        }
504      }
505      return _results;
506    };
507
508    Dropzone.prototype.getQueuedFiles = function() {
509      return this.getFilesWithStatus(Dropzone.QUEUED);
510    };
511
512    Dropzone.prototype.getUploadingFiles = function() {
513      return this.getFilesWithStatus(Dropzone.UPLOADING);
514    };
515
516    Dropzone.prototype.getAddedFiles = function() {
517      return this.getFilesWithStatus(Dropzone.ADDED);
518    };
519
520    Dropzone.prototype.getActiveFiles = function() {
521      var file, _i, _len, _ref, _results;
522      _ref = this.files;
523      _results = [];
524      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
525        file = _ref[_i];
526        if (file.status === Dropzone.UPLOADING || file.status === Dropzone.QUEUED) {
527          _results.push(file);
528        }
529      }
530      return _results;
531    };
532
533    Dropzone.prototype.init = function() {
534      var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1;
535      if (this.element.tagName === "form") {
536        this.element.setAttribute("enctype", "multipart/form-data");
537      }
538      if (this.element.classList.contains("dropzone") && !this.element.querySelector(".dz-message")) {
539        this.element.appendChild(Dropzone.createElement("<div class=\"dz-default dz-message\"><span>" + this.options.dictDefaultMessage + "</span></div>"));
540      }
541      if (this.clickableElements.length) {
542        setupHiddenFileInput = (function(_this) {
543          return function() {
544            if (_this.hiddenFileInput) {
545              _this.hiddenFileInput.parentNode.removeChild(_this.hiddenFileInput);
546            }
547            _this.hiddenFileInput = document.createElement("input");
548            _this.hiddenFileInput.setAttribute("type", "file");
549            if ((_this.options.maxFiles == null) || _this.options.maxFiles > 1) {
550              _this.hiddenFileInput.setAttribute("multiple", "multiple");
551            }
552            _this.hiddenFileInput.className = "dz-hidden-input";
553            if (_this.options.acceptedFiles != null) {
554              _this.hiddenFileInput.setAttribute("accept", _this.options.acceptedFiles);
555            }
556            if (_this.options.capture != null) {
557              _this.hiddenFileInput.setAttribute("capture", _this.options.capture);
558            }
559            _this.hiddenFileInput.style.visibility = "hidden";
560            _this.hiddenFileInput.style.position = "absolute";
561            _this.hiddenFileInput.style.top = "0";
562            _this.hiddenFileInput.style.left = "0";
563            _this.hiddenFileInput.style.height = "0";
564            _this.hiddenFileInput.style.width = "0";
565            document.querySelector(_this.options.hiddenInputContainer).appendChild(_this.hiddenFileInput);
566            return _this.hiddenFileInput.addEventListener("change", function() {
567              var file, files, _i, _len;
568              files = _this.hiddenFileInput.files;
569              if (files.length) {
570                for (_i = 0, _len = files.length; _i < _len; _i++) {
571                  file = files[_i];
572                  _this.addFile(file);
573                }
574              }
575              _this.emit("addedfiles", files);
576              return setupHiddenFileInput();
577            });
578          };
579        })(this);
580        setupHiddenFileInput();
581      }
582      this.URL = (_ref = window.URL) != null ? _ref : window.webkitURL;
583      _ref1 = this.events;
584      for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
585        eventName = _ref1[_i];
586        this.on(eventName, this.options[eventName]);
587      }
588      this.on("uploadprogress", (function(_this) {
589        return function() {
590          return _this.updateTotalUploadProgress();
591        };
592      })(this));
593      this.on("removedfile", (function(_this) {
594        return function() {
595          return _this.updateTotalUploadProgress();
596        };
597      })(this));
598      this.on("canceled", (function(_this) {
599        return function(file) {
600          return _this.emit("complete", file);
601        };
602      })(this));
603      this.on("complete", (function(_this) {
604        return function(file) {
605          if (_this.getAddedFiles().length === 0 && _this.getUploadingFiles().length === 0 && _this.getQueuedFiles().length === 0) {
606            return setTimeout((function() {
607              return _this.emit("queuecomplete");
608            }), 0);
609          }
610        };
611      })(this));
612      noPropagation = function(e) {
613        e.stopPropagation();
614        if (e.preventDefault) {
615          return e.preventDefault();
616        } else {
617          return e.returnValue = false;
618        }
619      };
620      this.listeners = [
621        {
622          element: this.element,
623          events: {
624            "dragstart": (function(_this) {
625              return function(e) {
626                return _this.emit("dragstart", e);
627              };
628            })(this),
629            "dragenter": (function(_this) {
630              return function(e) {
631                noPropagation(e);
632                return _this.emit("dragenter", e);
633              };
634            })(this),
635            "dragover": (function(_this) {
636              return function(e) {
637                var efct;
638                try {
639                  efct = e.dataTransfer.effectAllowed;
640                } catch (_error) {}
641                e.dataTransfer.dropEffect = 'move' === efct || 'linkMove' === efct ? 'move' : 'copy';
642                noPropagation(e);
643                return _this.emit("dragover", e);
644              };
645            })(this),
646            "dragleave": (function(_this) {
647              return function(e) {
648                return _this.emit("dragleave", e);
649              };
650            })(this),
651            "drop": (function(_this) {
652              return function(e) {
653                noPropagation(e);
654                return _this.drop(e);
655              };
656            })(this),
657            "dragend": (function(_this) {
658              return function(e) {
659                return _this.emit("dragend", e);
660              };
661            })(this)
662          }
663        }
664      ];
665      this.clickableElements.forEach((function(_this) {
666        return function(clickableElement) {
667          return _this.listeners.push({
668            element: clickableElement,
669            events: {
670              "click": function(evt) {
671                if ((clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".dz-message")))) {
672                  _this.hiddenFileInput.click();
673                }
674                return true;
675              }
676            }
677          });
678        };
679      })(this));
680      this.enable();
681      return this.options.init.call(this);
682    };
683
684    Dropzone.prototype.destroy = function() {
685      var _ref;
686      this.disable();
687      this.removeAllFiles(true);
688      if ((_ref = this.hiddenFileInput) != null ? _ref.parentNode : void 0) {
689        this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);
690        this.hiddenFileInput = null;
691      }
692      delete this.element.dropzone;
693      return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1);
694    };
695
696    Dropzone.prototype.updateTotalUploadProgress = function() {
697      var activeFiles, file, totalBytes, totalBytesSent, totalUploadProgress, _i, _len, _ref;
698      totalBytesSent = 0;
699      totalBytes = 0;
700      activeFiles = this.getActiveFiles();
701      if (activeFiles.length) {
702        _ref = this.getActiveFiles();
703        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
704          file = _ref[_i];
705          totalBytesSent += file.upload.bytesSent;
706          totalBytes += file.upload.total;
707        }
708        totalUploadProgress = 100 * totalBytesSent / totalBytes;
709      } else {
710        totalUploadProgress = 100;
711      }
712      return this.emit("totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent);
713    };
714
715    Dropzone.prototype._getParamName = function(n) {
716      if (typeof this.options.paramName === "function") {
717        return this.options.paramName(n);
718      } else {
719        return "" + this.options.paramName + (this.options.uploadMultiple ? "[" + n + "]" : "");
720      }
721    };
722
723    Dropzone.prototype.getFallbackForm = function() {
724      var existingFallback, fields, fieldsString, form;
725      if (existingFallback = this.getExistingFallback()) {
726        return existingFallback;
727      }
728      fieldsString = "<div class=\"dz-fallback\">";
729      if (this.options.dictFallbackText) {
730        fieldsString += "<p>" + this.options.dictFallbackText + "</p>";
731      }
732      fieldsString += "<input type=\"file\" name=\"" + (this._getParamName(0)) + "\" " + (this.options.uploadMultiple ? 'multiple="multiple"' : void 0) + " /><input type=\"submit\" value=\"Upload!\"></div>";
733      fields = Dropzone.createElement(fieldsString);
734      if (this.element.tagName !== "FORM") {
735        form = Dropzone.createElement("<form action=\"" + this.options.url + "\" enctype=\"multipart/form-data\" method=\"" + this.options.method + "\"></form>");
736        form.appendChild(fields);
737      } else {
738        this.element.setAttribute("enctype", "multipart/form-data");
739        this.element.setAttribute("method", this.options.method);
740      }
741      return form != null ? form : fields;
742    };
743
744    Dropzone.prototype.getExistingFallback = function() {
745      var fallback, getFallback, tagName, _i, _len, _ref;
746      getFallback = function(elements) {
747        var el, _i, _len;
748        for (_i = 0, _len = elements.length; _i < _len; _i++) {
749          el = elements[_i];
750          if (/(^| )fallback($| )/.test(el.className)) {
751            return el;
752          }
753        }
754      };
755      _ref = ["div", "form"];
756      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
757        tagName = _ref[_i];
758        if (fallback = getFallback(this.element.getElementsByTagName(tagName))) {
759          return fallback;
760        }
761      }
762    };
763
764    Dropzone.prototype.setupEventListeners = function() {
765      var elementListeners, event, listener, _i, _len, _ref, _results;
766      _ref = this.listeners;
767      _results = [];
768      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
769        elementListeners = _ref[_i];
770        _results.push((function() {
771          var _ref1, _results1;
772          _ref1 = elementListeners.events;
773          _results1 = [];
774          for (event in _ref1) {
775            listener = _ref1[event];
776            _results1.push(elementListeners.element.addEventListener(event, listener, false));
777          }
778          return _results1;
779        })());
780      }
781      return _results;
782    };
783
784    Dropzone.prototype.removeEventListeners = function() {
785      var elementListeners, event, listener, _i, _len, _ref, _results;
786      _ref = this.listeners;
787      _results = [];
788      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
789        elementListeners = _ref[_i];
790        _results.push((function() {
791          var _ref1, _results1;
792          _ref1 = elementListeners.events;
793          _results1 = [];
794          for (event in _ref1) {
795            listener = _ref1[event];
796            _results1.push(elementListeners.element.removeEventListener(event, listener, false));
797          }
798          return _results1;
799        })());
800      }
801      return _results;
802    };
803
804    Dropzone.prototype.disable = function() {
805      var file, _i, _len, _ref, _results;
806      this.clickableElements.forEach(function(element) {
807        return element.classList.remove("dz-clickable");
808      });
809      this.removeEventListeners();
810      _ref = this.files;
811      _results = [];
812      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
813        file = _ref[_i];
814        _results.push(this.cancelUpload(file));
815      }
816      return _results;
817    };
818
819    Dropzone.prototype.enable = function() {
820      this.clickableElements.forEach(function(element) {
821        return element.classList.add("dz-clickable");
822      });
823      return this.setupEventListeners();
824    };
825
826    Dropzone.prototype.filesize = function(size) {
827      var cutoff, i, selectedSize, selectedUnit, unit, units, _i, _len;
828      selectedSize = 0;
829      selectedUnit = "b";
830      if (size > 0) {
831        units = ['TB', 'GB', 'MB', 'KB', 'b'];
832        for (i = _i = 0, _len = units.length; _i < _len; i = ++_i) {
833          unit = units[i];
834          cutoff = Math.pow(this.options.filesizeBase, 4 - i) / 10;
835          if (size >= cutoff) {
836            selectedSize = size / Math.pow(this.options.filesizeBase, 4 - i);
837            selectedUnit = unit;
838            break;
839          }
840        }
841        selectedSize = Math.round(10 * selectedSize) / 10;
842      }
843      return "<strong>" + selectedSize + "</strong> " + selectedUnit;
844    };
845
846    Dropzone.prototype._updateMaxFilesReachedClass = function() {
847      if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) {
848        if (this.getAcceptedFiles().length === this.options.maxFiles) {
849          this.emit('maxfilesreached', this.files);
850        }
851        return this.element.classList.add("dz-max-files-reached");
852      } else {
853        return this.element.classList.remove("dz-max-files-reached");
854      }
855    };
856
857    Dropzone.prototype.drop = function(e) {
858      var files, items;
859      if (!e.dataTransfer) {
860        return;
861      }
862      this.emit("drop", e);
863      files = e.dataTransfer.files;
864      this.emit("addedfiles", files);
865      if (files.length) {
866        items = e.dataTransfer.items;
867        if (items && items.length && (items[0].webkitGetAsEntry != null)) {
868          this._addFilesFromItems(items);
869        } else {
870          this.handleFiles(files);
871        }
872      }
873    };
874
875    Dropzone.prototype.paste = function(e) {
876      var items, _ref;
877      if ((e != null ? (_ref = e.clipboardData) != null ? _ref.items : void 0 : void 0) == null) {
878        return;
879      }
880      this.emit("paste", e);
881      items = e.clipboardData.items;
882      if (items.length) {
883        return this._addFilesFromItems(items);
884      }
885    };
886
887    Dropzone.prototype.handleFiles = function(files) {
888      var file, _i, _len, _results;
889      _results = [];
890      for (_i = 0, _len = files.length; _i < _len; _i++) {
891        file = files[_i];
892        _results.push(this.addFile(file));
893      }
894      return _results;
895    };
896
897    Dropzone.prototype._addFilesFromItems = function(items) {
898      var entry, item, _i, _len, _results;
899      _results = [];
900      for (_i = 0, _len = items.length; _i < _len; _i++) {
901        item = items[_i];
902        if ((item.webkitGetAsEntry != null) && (entry = item.webkitGetAsEntry())) {
903          if (entry.isFile) {
904            _results.push(this.addFile(item.getAsFile()));
905          } else if (entry.isDirectory) {
906            _results.push(this._addFilesFromDirectory(entry, entry.name));
907          } else {
908            _results.push(void 0);
909          }
910        } else if (item.getAsFile != null) {
911          if ((item.kind == null) || item.kind === "file") {
912            _results.push(this.addFile(item.getAsFile()));
913          } else {
914            _results.push(void 0);
915          }
916        } else {
917          _results.push(void 0);
918        }
919      }
920      return _results;
921    };
922
923    Dropzone.prototype._addFilesFromDirectory = function(directory, path) {
924      var dirReader, entriesReader;
925      dirReader = directory.createReader();
926      entriesReader = (function(_this) {
927        return function(entries) {
928          var entry, _i, _len;
929          for (_i = 0, _len = entries.length; _i < _len; _i++) {
930            entry = entries[_i];
931            if (entry.isFile) {
932              entry.file(function(file) {
933                if (_this.options.ignoreHiddenFiles && file.name.substring(0, 1) === '.') {
934                  return;
935                }
936                file.fullPath = "" + path + "/" + file.name;
937                return _this.addFile(file);
938              });
939            } else if (entry.isDirectory) {
940              _this._addFilesFromDirectory(entry, "" + path + "/" + entry.name);
941            }
942          }
943        };
944      })(this);
945      return dirReader.readEntries(entriesReader, function(error) {
946        return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log(error) : void 0 : void 0;
947      });
948    };
949
950    Dropzone.prototype.accept = function(file, done) {
951      if (file.size > this.options.maxFilesize * 1024 * 1024) {
952        return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
953      } else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {
954        return done(this.options.dictInvalidFileType);
955      } else if ((this.options.maxFiles != null) && this.getAcceptedFiles().length >= this.options.maxFiles) {
956        done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles));
957        return this.emit("maxfilesexceeded", file);
958      } else {
959        return this.options.accept.call(this, file, done);
960      }
961    };
962
963    Dropzone.prototype.addFile = function(file) {
964      file.upload = {
965        progress: 0,
966        total: file.size,
967        bytesSent: 0
968      };
969      this.files.push(file);
970      file.status = Dropzone.ADDED;
971      this.emit("addedfile", file);
972      this._enqueueThumbnail(file);
973      return this.accept(file, (function(_this) {
974        return function(error) {
975          if (error) {
976            file.accepted = false;
977            _this._errorProcessing([file], error);
978          } else {
979            file.accepted = true;
980            if (_this.options.autoQueue) {
981              _this.enqueueFile(file);
982            }
983          }
984          return _this._updateMaxFilesReachedClass();
985        };
986      })(this));
987    };
988
989    Dropzone.prototype.enqueueFiles = function(files) {
990      var file, _i, _len;
991      for (_i = 0, _len = files.length; _i < _len; _i++) {
992        file = files[_i];
993        this.enqueueFile(file);
994      }
995      return null;
996    };
997
998    Dropzone.prototype.enqueueFile = function(file) {
999      if (file.status === Dropzone.ADDED && file.accepted === true) {
1000        file.status = Dropzone.QUEUED;
1001        if (this.options.autoProcessQueue) {
1002          return setTimeout(((function(_this) {
1003            return function() {
1004              return _this.processQueue();
1005            };
1006          })(this)), 0);
1007        }
1008      } else {
1009        throw new Error("This file can't be queued because it has already been processed or was rejected.");
1010      }
1011    };
1012
1013    Dropzone.prototype._thumbnailQueue = [];
1014
1015    Dropzone.prototype._processingThumbnail = false;
1016
1017    Dropzone.prototype._enqueueThumbnail = function(file) {
1018      if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {
1019        this._thumbnailQueue.push(file);
1020        return setTimeout(((function(_this) {
1021          return function() {
1022            return _this._processThumbnailQueue();
1023          };
1024        })(this)), 0);
1025      }
1026    };
1027
1028    Dropzone.prototype._processThumbnailQueue = function() {
1029      if (this._processingThumbnail || this._thumbnailQueue.length === 0) {
1030        return;
1031      }
1032      this._processingThumbnail = true;
1033      return this.createThumbnail(this._thumbnailQueue.shift(), (function(_this) {
1034        return function() {
1035          _this._processingThumbnail = false;
1036          return _this._processThumbnailQueue();
1037        };
1038      })(this));
1039    };
1040
1041    Dropzone.prototype.removeFile = function(file) {
1042      if (file.status === Dropzone.UPLOADING) {
1043        this.cancelUpload(file);
1044      }
1045      this.files = without(this.files, file);
1046      this.emit("removedfile", file);
1047      if (this.files.length === 0) {
1048        return this.emit("reset");
1049      }
1050    };
1051
1052    Dropzone.prototype.removeAllFiles = function(cancelIfNecessary) {
1053      var file, _i, _len, _ref;
1054      if (cancelIfNecessary == null) {
1055        cancelIfNecessary = false;
1056      }
1057      _ref = this.files.slice();
1058      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1059        file = _ref[_i];
1060        if (file.status !== Dropzone.UPLOADING || cancelIfNecessary) {
1061          this.removeFile(file);
1062        }
1063      }
1064      return null;
1065    };
1066
1067    Dropzone.prototype.createThumbnail = function(file, callback) {
1068      var fileReader;
1069      fileReader = new FileReader;
1070      fileReader.onload = (function(_this) {
1071        return function() {
1072          if (file.type === "image/svg+xml") {
1073            _this.emit("thumbnail", file, fileReader.result);
1074            if (callback != null) {
1075              callback();
1076            }
1077            return;
1078          }
1079          return _this.createThumbnailFromUrl(file, fileReader.result, callback);
1080        };
1081      })(this);
1082      return fileReader.readAsDataURL(file);
1083    };
1084
1085    Dropzone.prototype.createThumbnailFromUrl = function(file, imageUrl, callback, crossOrigin) {
1086      var img;
1087      img = document.createElement("img");
1088      if (crossOrigin) {
1089        img.crossOrigin = crossOrigin;
1090      }
1091      img.onload = (function(_this) {
1092        return function() {
1093          var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3;
1094          file.width = img.width;
1095          file.height = img.height;
1096          resizeInfo = _this.options.resize.call(_this, file);
1097          if (resizeInfo.trgWidth == null) {
1098            resizeInfo.trgWidth = resizeInfo.optWidth;
1099          }
1100          if (resizeInfo.trgHeight == null) {
1101            resizeInfo.trgHeight = resizeInfo.optHeight;
1102          }
1103          canvas = document.createElement("canvas");
1104          ctx = canvas.getContext("2d");
1105          canvas.width = resizeInfo.trgWidth;
1106          canvas.height = resizeInfo.trgHeight;
1107          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);
1108          thumbnail = canvas.toDataURL("image/png");
1109          _this.emit("thumbnail", file, thumbnail);
1110          if (callback != null) {
1111            return callback();
1112          }
1113        };
1114      })(this);
1115      if (callback != null) {
1116        img.onerror = callback;
1117      }
1118      return img.src = imageUrl;
1119    };
1120
1121    Dropzone.prototype.processQueue = function() {
1122      var i, parallelUploads, processingLength, queuedFiles;
1123      parallelUploads = this.options.parallelUploads;
1124      processingLength = this.getUploadingFiles().length;
1125      i = processingLength;
1126      if (processingLength >= parallelUploads) {
1127        return;
1128      }
1129      queuedFiles = this.getQueuedFiles();
1130      if (!(queuedFiles.length > 0)) {
1131        return;
1132      }
1133      if (this.options.uploadMultiple) {
1134        return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));
1135      } else {
1136        while (i < parallelUploads) {
1137          if (!queuedFiles.length) {
1138            return;
1139          }
1140          this.processFile(queuedFiles.shift());
1141          i++;
1142        }
1143      }
1144    };
1145
1146    Dropzone.prototype.processFile = function(file) {
1147      return this.processFiles([file]);
1148    };
1149
1150    Dropzone.prototype.processFiles = function(files) {
1151      var file, _i, _len;
1152      for (_i = 0, _len = files.length; _i < _len; _i++) {
1153        file = files[_i];
1154        file.processing = true;
1155        file.status = Dropzone.UPLOADING;
1156        this.emit("processing", file);
1157      }
1158      if (this.options.uploadMultiple) {
1159        this.emit("processingmultiple", files);
1160      }
1161      return this.uploadFiles(files);
1162    };
1163
1164    Dropzone.prototype._getFilesWithXhr = function(xhr) {
1165      var file, files;
1166      return files = (function() {
1167        var _i, _len, _ref, _results;
1168        _ref = this.files;
1169        _results = [];
1170        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1171          file = _ref[_i];
1172          if (file.xhr === xhr) {
1173            _results.push(file);
1174          }
1175        }
1176        return _results;
1177      }).call(this);
1178    };
1179
1180    Dropzone.prototype.cancelUpload = function(file) {
1181      var groupedFile, groupedFiles, _i, _j, _len, _len1, _ref;
1182      if (file.status === Dropzone.UPLOADING) {
1183        groupedFiles = this._getFilesWithXhr(file.xhr);
1184        for (_i = 0, _len = groupedFiles.length; _i < _len; _i++) {
1185          groupedFile = groupedFiles[_i];
1186          groupedFile.status = Dropzone.CANCELED;
1187        }
1188        file.xhr.abort();
1189        for (_j = 0, _len1 = groupedFiles.length; _j < _len1; _j++) {
1190          groupedFile = groupedFiles[_j];
1191          this.emit("canceled", groupedFile);
1192        }
1193        if (this.options.uploadMultiple) {
1194          this.emit("canceledmultiple", groupedFiles);
1195        }
1196      } else if ((_ref = file.status) === Dropzone.ADDED || _ref === Dropzone.QUEUED) {
1197        file.status = Dropzone.CANCELED;
1198        this.emit("canceled", file);
1199        if (this.options.uploadMultiple) {
1200          this.emit("canceledmultiple", [file]);
1201        }
1202      }
1203      if (this.options.autoProcessQueue) {
1204        return this.processQueue();
1205      }
1206    };
1207
1208    resolveOption = function() {
1209      var args, option;
1210      option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
1211      if (typeof option === 'function') {
1212        return option.apply(this, args);
1213      }
1214      return option;
1215    };
1216
1217    Dropzone.prototype.uploadFile = function(file) {
1218      return this.uploadFiles([file]);
1219    };
1220
1221    Dropzone.prototype.uploadFiles = function(files) {
1222      var file, formData, handleError, headerName, headerValue, headers, i, input, inputName, inputType, key, method, option, progressObj, response, updateProgress, url, value, xhr, _i, _j, _k, _l, _len, _len1, _len2, _len3, _m, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
1223      xhr = new XMLHttpRequest();
1224      for (_i = 0, _len = files.length; _i < _len; _i++) {
1225        file = files[_i];
1226        file.xhr = xhr;
1227      }
1228      method = resolveOption(this.options.method, files);
1229      url = resolveOption(this.options.url, files);
1230      xhr.open(method, url, true);
1231      xhr.withCredentials = !!this.options.withCredentials;
1232      response = null;
1233      handleError = (function(_this) {
1234        return function() {
1235          var _j, _len1, _results;
1236          _results = [];
1237          for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
1238            file = files[_j];
1239            _results.push(_this._errorProcessing(files, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr));
1240          }
1241          return _results;
1242        };
1243      })(this);
1244      updateProgress = (function(_this) {
1245        return function(e) {
1246          var allFilesFinished, progress, _j, _k, _l, _len1, _len2, _len3, _results;
1247          if (e != null) {
1248            progress = 100 * e.loaded / e.total;
1249            for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
1250              file = files[_j];
1251              file.upload = {
1252                progress: progress,
1253                total: e.total,
1254                bytesSent: e.loaded
1255              };
1256            }
1257          } else {
1258            allFilesFinished = true;
1259            progress = 100;
1260            for (_k = 0, _len2 = files.length; _k < _len2; _k++) {
1261              file = files[_k];
1262              if (!(file.upload.progress === 100 && file.upload.b
1262ytesSent === file.upload.total)) {
1263                allFilesFinished = false;
1264              }
1265              file.upload.progress = progress;
1266              file.upload.bytesSent = file.upload.total;
1267            }
1268            if (allFilesFinished) {
1269              return;
1270            }
1271          }
1272          _results = [];
1273          for (_l = 0, _len3 = files.length; _l < _len3; _l++) {
1274            file = files[_l];
1275            _results.push(_this.emit("uploadprogress", file, progress, file.upload.bytesSent));
1276          }
1277          return _results;
1278        };
1279      })(this);
1280      xhr.onload = (function(_this) {
1281        return function(e) {
1282          var _ref;
1283          if (files[0].status === Dropzone.CANCELED) {
1284            return;
1285          }
1286          if (xhr.readyState !== 4) {
1287            return;
1288          }
1289          response = xhr.responseText;
1290          if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) {
1291            try {
1292              response = JSON.parse(response);
1293            } catch (_error) {
1294              e = _error;
1295              response = "Invalid JSON response from server.";
1296            }
1297          }
1298          updateProgress();
1299          if (!((200 <= (_ref = xhr.status) && _ref < 300))) {
1300            return handleError();
1301          } else {
1302            return _this._finished(files, response, e);
1303          }
1304        };
1305      })(this);
1306      xhr.onerror = (function(_this) {
1307        return function() {
1308          if (files[0].status === Dropzone.CANCELED) {
1309            return;
1310          }
1311          return handleError();
1312        };
1313      })(this);
1314      progressObj = (_ref = xhr.upload) != null ? _ref : xhr;
1315      progressObj.onprogress = updateProgress;
1316      headers = {
1317        "Accept": "application/json",
1318        "Cache-Control": "no-cache",
1319        "X-Requested-With": "XMLHttpRequest"
1320      };
1321      if (this.options.headers) {
1322        extend(headers, this.options.headers);
1323      }
1324      for (headerName in headers) {
1325        headerValue = headers[headerName];
1326        if (headerValue) {
1327          xhr.setRequestHeader(headerName, headerValue);
1328        }
1329      }
1330      formData = new FormData();
1331      if (this.options.params) {
1332        _ref1 = this.options.params;
1333        for (key in _ref1) {
1334          value = _ref1[key];
1335          formData.append(key, value);
1336        }
1337      }
1338      for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
1339        file = files[_j];
1340        this.emit("sending", file, xhr, formData);
1341      }
1342      if (this.options.uploadMultiple) {
1343        this.emit("sendingmultiple", files, xhr, formData);
1344      }
1345      if (this.element.tagName === "FORM") {
1346        _ref2 = this.element.querySelectorAll("input, textarea, select, button");
1347        for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
1348          input = _ref2[_k];
1349          inputName = input.getAttribute("name");
1350          inputType = input.getAttribute("type");
1351          if (input.tagName === "SELECT" && input.hasAttribute("multiple")) {
1352            _ref3 = input.options;
1353            for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
1354              option = _ref3[_l];
1355              if (option.selected) {
1356                formData.append(inputName, option.value);
1357              }
1358            }
1359          } else if (!inputType || ((_ref4 = inputType.toLowerCase()) !== "checkbox" && _ref4 !== "radio") || input.checked) {
1360            formData.append(inputName, input.value);
1361          }
1362        }
1363      }
1364      for (i = _m = 0, _ref5 = files.length - 1; 0 <= _ref5 ? _m <= _ref5 : _m >= _ref5; i = 0 <= _ref5 ? ++_m : --_m) {
1365        formData.append(this._getParamName(i), files[i], files[i].name);
1366      }
1367      return this.submitRequest(xhr, formData, files);
1368    };
1369
1370    Dropzone.prototype.submitRequest = function(xhr, formData, files) {
1371      return xhr.send(formData);
1372    };
1373
1374    Dropzone.prototype._finished = function(files, responseText, e) {
1375      var file, _i, _len;
1376      for (_i = 0, _len = files.length; _i < _len; _i++) {
1377        file = files[_i];
1378        file.status = Dropzone.SUCCESS;
1379        this.emit("success", file, responseText, e);
1380        this.emit("complete", file);
1381      }
1382      if (this.options.uploadMultiple) {
1383        this.emit("successmultiple", files, responseText, e);
1384        this.emit("completemultiple", files);
1385      }
1386      if (this.options.autoProcessQueue) {
1387        return this.processQueue();
1388      }
1389    };
1390
1391    Dropzone.prototype._errorProcessing = function(files, message, xhr) {
1392      var file, _i, _len;
1393      for (_i = 0, _len = files.length; _i < _len; _i++) {
1394        file = files[_i];
1395        file.status = Dropzone.ERROR;
1396        this.emit("error", file, message, xhr);
1397        this.emit("complete", file);
1398      }
1399      if (this.options.uploadMultiple) {
1400        this.emit("errormultiple", files, message, xhr);
1401        this.emit("completemultiple", files);
1402      }
1403      if (this.options.autoProcessQueue) {
1404        return this.processQueue();
1405      }
1406    };
1407
1408    return Dropzone;
1409
1410  })(Emitter);
1411
1412  Dropzone.version = "4.2.0";
1413
1414  Dropzone.options = {};
1415
1416  Dropzone.optionsForElement = function(element) {
1417    if (element.getAttribute("id")) {
1418      return Dropzone.options[camelize(element.getAttribute("id"))];
1419    } else {
1420      return void 0;
1421    }
1422  };
1423
1424  Dropzone.instances = [];
1425
1426  Dropzone.forElement = function(element) {
1427    if (typeof element === "string") {
1428      element = document.querySelector(element);
1429    }
1430    if ((element != null ? element.dropzone : void 0) == null) {
1431      throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");
1432    }
1433    return element.dropzone;
1434  };
1435
1436  Dropzone.autoDiscover = true;
1437
1438  Dropzone.discover = function() {
1439    var checkElements, dropzone, dropzones, _i, _len, _results;
1440    if (document.querySelectorAll) {
1441      dropzones = document.querySelectorAll(".dropzone");
1442    } else {
1443      dropzones = [];
1444      checkElements = function(elements) {
1445        var el, _i, _len, _results;
1446        _results = [];
1447        for (_i = 0, _len = elements.length; _i < _len; _i++) {
1448          el = elements[_i];
1449          if (/(^| )dropzone($| )/.test(el.className)) {
1450            _results.push(dropzones.push(el));
1451          } else {
1452            _results.push(void 0);
1453          }
1454        }
1455        return _results;
1456      };
1457      checkElements(document.getElementsByTagName("div"));
1458      checkElements(document.getElementsByTagName("form"));
1459    }
1460    _results = [];
1461    for (_i = 0, _len = dropzones.length; _i < _len; _i++) {
1462      dropzone = dropzones[_i];
1463      if (Dropzone.optionsForElement(dropzone) !== false) {
1464        _results.push(new Dropzone(dropzone));
1465      } else {
1466        _results.push(void 0);
1467      }
1468    }
1469    return _results;
1470  };
1471
1472  Dropzone.blacklistedBrowsers = [/opera.*Macintosh.*version\/12/i];
1473
1474  Dropzone.isBrowserSupported = function() {
1475    var capableBrowser, regex, _i, _len, _ref;
1476    capableBrowser = true;
1477    if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
1478      if (!("classList" in document.createElement("a"))) {
1479        capableBrowser = false;
1480      } else {
1481        _ref = Dropzone.blacklistedBrowsers;
1482        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1483          regex = _ref[_i];
1484          if (regex.test(navigator.userAgent)) {
1485            capableBrowser = false;
1486            continue;
1487          }
1488        }
1489      }
1490    } else {
1491      capableBrowser = false;
1492    }
1493    return capableBrowser;
1494  };
1495
1496  without = function(list, rejectedItem) {
1497    var item, _i, _len, _results;
1498    _results = [];
1499    for (_i = 0, _len = list.length; _i < _len; _i++) {
1500      item = list[_i];
1501      if (item !== rejectedItem) {
1502        _results.push(item);
1503      }
1504    }
1505    return _results;
1506  };
1507
1508  camelize = function(str) {
1509    return str.replace(/[\-_](\w)/g, function(match) {
1510      return match.charAt(1).toUpperCase();
1511    });
1512  };
1513
1514  Dropzone.createElement = function(string) {
1515    var div;
1516    div = document.createElement("div");
1517    div.innerHTML = string;
1518    return div.childNodes[0];
1519  };
1520
1521  Dropzone.elementInside = function(element, container) {
1522    if (element === container) {
1523      return true;
1524    }
1525    while (element = element.parentNode) {
1526      if (element === container) {
1527        return true;
1528      }
1529    }
1530    return false;
1531  };
1532
1533  Dropzone.getElement = function(el, name) {
1534    var element;
1535    if (typeof el === "string") {
1536      element = document.querySelector(el);
1537    } else if (el.nodeType != null) {
1538      element = el;
1539    }
1540    if (element == null) {
1541      throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector or a plain HTML element.");
1542    }
1543    return element;
1544  };
1545
1546  Dropzone.getElements = function(els, name) {
1547    var e, el, elements, _i, _j, _len, _len1, _ref;
1548    if (els instanceof Array) {
1549      elements = [];
1550      try {
1551        for (_i = 0, _len = els.length; _i < _len; _i++) {
1552          el = els[_i];
1553          elements.push(this.getElement(el, name));
1554        }
1555      } catch (_error) {
1556        e = _error;
1557        elements = null;
1558      }
1559    } else if (typeof els === "string") {
1560      elements = [];
1561      _ref = document.querySelectorAll(els);
1562      for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
1563        el = _ref[_j];
1564        elements.push(el);
1565      }
1566    } else if (els.nodeType != null) {
1567      elements = [els];
1568    }
1569    if (!((elements != null) && elements.length)) {
1570      throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");
1571    }
1572    return elements;
1573  };
1574
1575  Dropzone.confirm = function(question, accepted, rejected) {
1576    if (window.confirm(question)) {
1577      return accepted();
1578    } else if (rejected != null) {
1579      return rejected();
1580    }
1581  };
1582
1583  Dropzone.isValidFile = function(file, acceptedFiles) {
1584    var baseMimeType, mimeType, validType, _i, _len;
1585    if (!acceptedFiles) {
1586      return true;
1587    }
1588    acceptedFiles = acceptedFiles.split(",");
1589    mimeType = file.type;
1590    baseMimeType = mimeType.replace(/\/.*$/, "");
1591    for (_i = 0, _len = acceptedFiles.length; _i < _len; _i++) {
1592      validType = acceptedFiles[_i];
1593      validType = validType.trim();
1594      if (validType.charAt(0) === ".") {
1595        if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {
1596          return true;
1597        }
1598      } else if (/\/\*$/.test(validType)) {
1599        if (baseMimeType === validType.replace(/\/.*$/, "")) {
1600          return true;
1601        }
1602      } else {
1603        if (mimeType === validType) {
1604          return true;
1605        }
1606      }
1607    }
1608    return false;
1609  };
1610
1611  if (typeof jQuery !== "undefined" && jQuery !== null) {
1612    jQuery.fn.dropzone = function(options) {
1613      return this.each(function() {
1614        return new Dropzone(this, options);
1615      });
1616    };
1617  }
1618
1619  if (typeof module !== "undefined" && module !== null) {
1620    module.exports = Dropzone;
1621  } else {
1622    window.Dropzone = Dropzone;
1623  }
1624
1625  Dropzone.ADDED = "added";
1626
1627  Dropzone.QUEUED = "queued";
1628
1629  Dropzone.ACCEPTED = Dropzone.QUEUED;
1630
1631  Dropzone.UPLOADING = "uploading";
1632
1633  Dropzone.PROCESSING = Dropzone.UPLOADING;
1634
1635  Dropzone.CANCELED = "canceled";
1636
1637  Dropzone.ERROR = "error";
1638
1639  Dropzone.SUCCESS = "success";
1640
1641
1642  /*
1643  
1644  Bugfix for iOS 6 and 7
1645  Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios
1646  based on the work of https://github.com/stomita/ios-imagefile-megapixel
1647   */
1648
1649  detectVerticalSquash = function(img) {
1650    var alpha, canvas, ctx, data, ey, ih, iw, py, ratio, sy;
1651    iw = img.naturalWidth;
1652    ih = img.naturalHeight;
1653    canvas = document.createElement("canvas");
1654    canvas.width = 1;
1655    canvas.height = ih;
1656    ctx = canvas.getContext("2d");
1657    ctx.drawImage(img, 0, 0);
1658    data = ctx.getImageData(0, 0, 1, ih).data;
1659    sy = 0;
1660    ey = ih;
1661    py = ih;
1662    while (py > sy) {
1663      alpha = data[(py - 1) * 4 + 3];
1664      if (alpha === 0) {
1665        ey = py;
1666      } else {
1667        sy = py;
1668      }
1669      py = (ey + sy) >> 1;
1670    }
1671    ratio = py / ih;
1672    if (ratio === 0) {
1673      return 1;
1674    } else {
1675      return ratio;
1676    }
1677  };
1678
1679  drawImageIOSFix = function(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) {
1680    var vertSquashRatio;
1681    vertSquashRatio = detectVerticalSquash(img);
1682    return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);
1683  };
1684
1685
1686  /*
1687   * contentloaded.js
1688   *
1689   * Author: Diego Perini (diego.perini at gmail.com)
1690   * Summary: cross-browser wrapper for DOMContentLoaded
1691   * Updated: 20101020
1692   * License: MIT
1693   * Version: 1.2
1694   *
1695   * URL:
1696   * http://javascript.nwbox.com/ContentLoaded/
1697   * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
1698   */
1699
1700  contentLoaded = function(win, fn) {
1701    var add, doc, done, init, poll, pre, rem, root, top;
1702    done = false;
1703    top = true;
1704    doc = win.document;
1705    root = doc.documentElement;
1706    add = (doc.addEventListener ? "addEventListener" : "attachEvent");
1707    rem = (doc.addEventListener ? "removeEventListener" : "detachEvent");
1708    pre = (doc.addEventListener ? "" : "on");
1709    init = function(e) {
1710      if (e.type === "readystatechange" && doc.readyState !== "complete") {
1711        return;
1712      }
1713      (e.type === "load" ? win : doc)[rem](pre + e.type, init, false);
1714      if (!done && (done = true)) {
1715        return fn.call(win, e.type || e);
1716      }
1717    };
1718    poll = function() {
1719      var e;
1720      try {
1721        root.doScroll("left");
1722      } catch (_error) {
1723        e = _error;
1724        setTimeout(poll, 50);
1725        return;
1726      }
1727      return init("poll");
1728    };
1729    if (doc.readyState !== "complete") {
1730      if (doc.createEventObject && root.doScroll) {
1731        try {
1732          top = !win.frameElement;
1733        } catch (_error) {}
1734        if (top) {
1735          poll();
1736        }
1737      }
1738      doc[add](pre + "DOMContentLoaded", init, false);
1739      doc[add](pre + "readystatechange", init, false);
1740      return win[add](pre + "load", init, false);
1741    }
1742  };
1743
1744  Dropzone._autoDiscoverFunction = function() {
1745    if (Dropzone.autoDiscover) {
1746      return Dropzone.discover();
1747    }
1748  };
1749
1750  contentLoaded(window, Dropzone._autoDiscoverFunction);
1751
1752}).call(this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.