dropzone.js 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398
  1. ;(function(){
  2. /**
  3. * Require the given path.
  4. *
  5. * @param {String} path
  6. * @return {Object} exports
  7. * @api public
  8. */
  9. function require(path, parent, orig) {
  10. var resolved = require.resolve(path);
  11. // lookup failed
  12. if (null == resolved) {
  13. orig = orig || path;
  14. parent = parent || 'root';
  15. var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
  16. err.path = orig;
  17. err.parent = parent;
  18. err.require = true;
  19. throw err;
  20. }
  21. var module = require.modules[resolved];
  22. // perform real require()
  23. // by invoking the module's
  24. // registered function
  25. if (!module.exports) {
  26. module.exports = {};
  27. module.client = module.component = true;
  28. module.call(this, module.exports, require.relative(resolved), module);
  29. }
  30. return module.exports;
  31. }
  32. /**
  33. * Registered modules.
  34. */
  35. require.modules = {};
  36. /**
  37. * Registered aliases.
  38. */
  39. require.aliases = {};
  40. /**
  41. * Resolve `path`.
  42. *
  43. * Lookup:
  44. *
  45. * - PATH/index.js
  46. * - PATH.js
  47. * - PATH
  48. *
  49. * @param {String} path
  50. * @return {String} path or null
  51. * @api private
  52. */
  53. require.resolve = function(path) {
  54. if (path.charAt(0) === '/') path = path.slice(1);
  55. var index = path + '/index.js';
  56. var paths = [
  57. path,
  58. path + '.js',
  59. path + '.json',
  60. path + '/index.js',
  61. path + '/index.json'
  62. ];
  63. for (var i = 0; i < paths.length; i++) {
  64. var path = paths[i];
  65. if (require.modules.hasOwnProperty(path)) return path;
  66. }
  67. if (require.aliases.hasOwnProperty(index)) {
  68. return require.aliases[index];
  69. }
  70. };
  71. /**
  72. * Normalize `path` relative to the current path.
  73. *
  74. * @param {String} curr
  75. * @param {String} path
  76. * @return {String}
  77. * @api private
  78. */
  79. require.normalize = function(curr, path) {
  80. var segs = [];
  81. if ('.' != path.charAt(0)) return path;
  82. curr = curr.split('/');
  83. path = path.split('/');
  84. for (var i = 0; i < path.length; ++i) {
  85. if ('..' == path[i]) {
  86. curr.pop();
  87. } else if ('.' != path[i] && '' != path[i]) {
  88. segs.push(path[i]);
  89. }
  90. }
  91. return curr.concat(segs).join('/');
  92. };
  93. /**
  94. * Register module at `path` with callback `definition`.
  95. *
  96. * @param {String} path
  97. * @param {Function} definition
  98. * @api private
  99. */
  100. require.register = function(path, definition) {
  101. require.modules[path] = definition;
  102. };
  103. /**
  104. * Alias a module definition.
  105. *
  106. * @param {String} from
  107. * @param {String} to
  108. * @api private
  109. */
  110. require.alias = function(from, to) {
  111. if (!require.modules.hasOwnProperty(from)) {
  112. throw new Error('Failed to alias "' + from + '", it does not exist');
  113. }
  114. require.aliases[to] = from;
  115. };
  116. /**
  117. * Return a require function relative to the `parent` path.
  118. *
  119. * @param {String} parent
  120. * @return {Function}
  121. * @api private
  122. */
  123. require.relative = function(parent) {
  124. var p = require.normalize(parent, '..');
  125. /**
  126. * lastIndexOf helper.
  127. */
  128. function lastIndexOf(arr, obj) {
  129. var i = arr.length;
  130. while (i--) {
  131. if (arr[i] === obj) return i;
  132. }
  133. return -1;
  134. }
  135. /**
  136. * The relative require() itself.
  137. */
  138. function localRequire(path) {
  139. var resolved = localRequire.resolve(path);
  140. return require(resolved, parent, path);
  141. }
  142. /**
  143. * Resolve relative to the parent.
  144. */
  145. localRequire.resolve = function(path) {
  146. var c = path.charAt(0);
  147. if ('/' == c) return path.slice(1);
  148. if ('.' == c) return require.normalize(p, path);
  149. // resolve deps by returning
  150. // the dep in the nearest "deps"
  151. // directory
  152. var segs = parent.split('/');
  153. var i = lastIndexOf(segs, 'deps') + 1;
  154. if (!i) i = 0;
  155. path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
  156. return path;
  157. };
  158. /**
  159. * Check if module is defined at `path`.
  160. */
  161. localRequire.exists = function(path) {
  162. return require.modules.hasOwnProperty(localRequire.resolve(path));
  163. };
  164. return localRequire;
  165. };
  166. require.register("component-emitter/index.js", function(exports, require, module){
  167. /**
  168. * Expose `Emitter`.
  169. */
  170. module.exports = Emitter;
  171. /**
  172. * Initialize a new `Emitter`.
  173. *
  174. * @api public
  175. */
  176. function Emitter(obj) {
  177. if (obj) return mixin(obj);
  178. };
  179. /**
  180. * Mixin the emitter properties.
  181. *
  182. * @param {Object} obj
  183. * @return {Object}
  184. * @api private
  185. */
  186. function mixin(obj) {
  187. for (var key in Emitter.prototype) {
  188. obj[key] = Emitter.prototype[key];
  189. }
  190. return obj;
  191. }
  192. /**
  193. * Listen on the given `event` with `fn`.
  194. *
  195. * @param {String} event
  196. * @param {Function} fn
  197. * @return {Emitter}
  198. * @api public
  199. */
  200. Emitter.prototype.on = function(event, fn){
  201. this._callbacks = this._callbacks || {};
  202. (this._callbacks[event] = this._callbacks[event] || [])
  203. .push(fn);
  204. return this;
  205. };
  206. /**
  207. * Adds an `event` listener that will be invoked a single
  208. * time then automatically removed.
  209. *
  210. * @param {String} event
  211. * @param {Function} fn
  212. * @return {Emitter}
  213. * @api public
  214. */
  215. Emitter.prototype.once = function(event, fn){
  216. var self = this;
  217. this._callbacks = this._callbacks || {};
  218. function on() {
  219. self.off(event, on);
  220. fn.apply(this, arguments);
  221. }
  222. fn._off = on;
  223. this.on(event, on);
  224. return this;
  225. };
  226. /**
  227. * Remove the given callback for `event` or all
  228. * registered callbacks.
  229. *
  230. * @param {String} event
  231. * @param {Function} fn
  232. * @return {Emitter}
  233. * @api public
  234. */
  235. Emitter.prototype.off =
  236. Emitter.prototype.removeListener =
  237. Emitter.prototype.removeAllListeners = function(event, fn){
  238. this._callbacks = this._callbacks || {};
  239. var callbacks = this._callbacks[event];
  240. if (!callbacks) return this;
  241. // remove all handlers
  242. if (1 == arguments.length) {
  243. delete this._callbacks[event];
  244. return this;
  245. }
  246. // remove specific handler
  247. var i = callbacks.indexOf(fn._off || fn);
  248. if (~i) callbacks.splice(i, 1);
  249. return this;
  250. };
  251. /**
  252. * Emit `event` with the given args.
  253. *
  254. * @param {String} event
  255. * @param {Mixed} ...
  256. * @return {Emitter}
  257. */
  258. Emitter.prototype.emit = function(event){
  259. this._callbacks = this._callbacks || {};
  260. var args = [].slice.call(arguments, 1)
  261. , callbacks = this._callbacks[event];
  262. if (callbacks) {
  263. callbacks = callbacks.slice(0);
  264. for (var i = 0, len = callbacks.length; i < len; ++i) {
  265. callbacks[i].apply(this, args);
  266. }
  267. }
  268. return this;
  269. };
  270. /**
  271. * Return array of callbacks for `event`.
  272. *
  273. * @param {String} event
  274. * @return {Array}
  275. * @api public
  276. */
  277. Emitter.prototype.listeners = function(event){
  278. this._callbacks = this._callbacks || {};
  279. return this._callbacks[event] || [];
  280. };
  281. /**
  282. * Check if this emitter has `event` handlers.
  283. *
  284. * @param {String} event
  285. * @return {Boolean}
  286. * @api public
  287. */
  288. Emitter.prototype.hasListeners = function(event){
  289. return !! this.listeners(event).length;
  290. };
  291. });
  292. require.register("dropzone/index.js", function(exports, require, module){
  293. /**
  294. * Exposing dropzone
  295. */
  296. module.exports = require("./lib/dropzone.js");
  297. });
  298. require.register("dropzone/lib/dropzone.js", function(exports, require, module){
  299. /*
  300. #
  301. # More info at [www.dropzonejs.com](http://www.dropzonejs.com)
  302. #
  303. # Copyright (c) 2012, Matias Meno
  304. #
  305. # Permission is hereby granted, free of charge, to any person obtaining a copy
  306. # of this software and associated documentation files (the "Software"), to deal
  307. # in the Software without restriction, including without limitation the rights
  308. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  309. # copies of the Software, and to permit persons to whom the Software is
  310. # furnished to do so, subject to the following conditions:
  311. #
  312. # The above copyright notice and this permission notice shall be included in
  313. # all copies or substantial portions of the Software.
  314. #
  315. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  316. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  317. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  318. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  319. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  320. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  321. # THE SOFTWARE.
  322. #
  323. */
  324. (function() {
  325. var Dropzone, Em, camelize, contentLoaded, noop, without,
  326. __hasProp = {}.hasOwnProperty,
  327. __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; },
  328. __slice = [].slice,
  329. __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
  330. Em = typeof Emitter !== "undefined" && Emitter !== null ? Emitter : require("emitter");
  331. noop = function() {};
  332. Dropzone = (function(_super) {
  333. __extends(Dropzone, _super);
  334. /*
  335. This is a list of all available events you can register on a dropzone object.
  336. You can register an event handler like this:
  337. dropzone.on("dragEnter", function() { });
  338. */
  339. Dropzone.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "selectedfiles", "addedfile", "removedfile", "thumbnail", "error", "processingfile", "uploadprogress", "totaluploadprogress", "sending", "success", "complete", "reset"];
  340. Dropzone.prototype.defaultOptions = {
  341. url: null,
  342. method: "post",
  343. parallelUploads: 2,
  344. maxFilesize: 256,
  345. paramName: "file",
  346. createImageThumbnails: true,
  347. maxThumbnailFilesize: 10,
  348. thumbnailWidth: 100,
  349. thumbnailHeight: 100,
  350. params: {},
  351. clickable: true,
  352. acceptedMimeTypes: null,
  353. acceptParameter: null,
  354. enqueueForUpload: true,
  355. previewsContainer: null,
  356. dictDefaultMessage: "Drop files here to upload",
  357. dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
  358. dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
  359. dictFileTooBig: "File is too big ({{filesize}}MB). Max filesize: {{maxFilesize}}MB.",
  360. dictInvalidFileType: "You can't upload files of this type.",
  361. dictResponseError: "Server responded with {{statusCode}} code.",
  362. accept: function(file, done) {
  363. return done();
  364. },
  365. init: function() {
  366. return noop;
  367. },
  368. forceFallback: false,
  369. fallback: function() {
  370. var child, messageElement, span, _i, _len, _ref;
  371. this.element.className = "" + this.element.className + " dz-browser-not-supported";
  372. _ref = this.element.getElementsByTagName("div");
  373. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  374. child = _ref[_i];
  375. if (/(^| )message($| )/.test(child.className)) {
  376. messageElement = child;
  377. child.className = "dz-message";
  378. continue;
  379. }
  380. }
  381. if (!messageElement) {
  382. messageElement = Dropzone.createElement("<div class=\"dz-message\"><span></span></div>");
  383. this.element.appendChild(messageElement);
  384. }
  385. span = messageElement.getElementsByTagName("span")[0];
  386. if (span) {
  387. span.textContent = this.options.dictFallbackMessage;
  388. }
  389. return this.element.appendChild(this.getFallbackForm());
  390. },
  391. resize: function(file) {
  392. var info, srcRatio, trgRatio;
  393. info = {
  394. srcX: 0,
  395. srcY: 0,
  396. srcWidth: file.width,
  397. srcHeight: file.height
  398. };
  399. srcRatio = file.width / file.height;
  400. trgRatio = this.options.thumbnailWidth / this.options.thumbnailHeight;
  401. if (file.height < this.options.thumbnailHeight || file.width < this.options.thumbnailWidth) {
  402. info.trgHeight = info.srcHeight;
  403. info.trgWidth = info.srcWidth;
  404. } else {
  405. if (srcRatio > trgRatio) {
  406. info.srcHeight = file.height;
  407. info.srcWidth = info.srcHeight * trgRatio;
  408. } else {
  409. info.srcWidth = file.width;
  410. info.srcHeight = info.srcWidth / trgRatio;
  411. }
  412. }
  413. info.srcX = (file.width - info.srcWidth) / 2;
  414. info.srcY = (file.height - info.srcHeight) / 2;
  415. return info;
  416. },
  417. /*
  418. Those functions register themselves to the events on init and handle all
  419. the user interface specific stuff. Overwriting them won't break the upload
  420. but can break the way it's displayed.
  421. You can overwrite them if you don't like the default behavior. If you just
  422. want to add an additional event handler, register it on the dropzone object
  423. and don't overwrite those options.
  424. */
  425. drop: function(e) {
  426. return this.element.classList.remove("dz-drag-hover");
  427. },
  428. dragstart: noop,
  429. dragend: function(e) {
  430. return this.element.classList.remove("dz-drag-hover");
  431. },
  432. dragenter: function(e) {
  433. return this.element.classList.add("dz-drag-hover");
  434. },
  435. dragover: function(e) {
  436. return this.element.classList.add("dz-drag-hover");
  437. },
  438. dragleave: function(e) {
  439. return this.element.classList.remove("dz-drag-hover");
  440. },
  441. selectedfiles: function(files) {
  442. if (this.element === this.previewsContainer) {
  443. return this.element.classList.add("dz-started");
  444. }
  445. },
  446. reset: function() {
  447. return this.element.classList.remove("dz-started");
  448. },
  449. addedfile: function(file) {
  450. file.previewElement = Dropzone.createElement(this.options.previewTemplate);
  451. file.previewTemplate = file.previewElement;
  452. this.previewsContainer.appendChild(file.previewElement);
  453. file.previewElement.querySelector("[data-dz-name]").textContent = file.name;
  454. return file.previewElement.querySelector("[data-dz-size]").innerHTML = this.filesize(file.size);
  455. },
  456. removedfile: function(file) {
  457. return file.previewElement.parentNode.removeChild(file.previewElement);
  458. },
  459. thumbnail: function(file, dataUrl) {
  460. var thumbnailElement;
  461. file.previewElement.classList.remove("dz-file-preview");
  462. file.previewElement.classList.add("dz-image-preview");
  463. thumbnailElement = file.previewElement.querySelector("[data-dz-thumbnail]");
  464. thumbnailElement.alt = file.name;
  465. return thumbnailElement.src = dataUrl;
  466. },
  467. error: function(file, message) {
  468. file.previewElement.classList.add("dz-error");
  469. return file.previewElement.querySelector("[data-dz-errormessage]").textContent = message;
  470. },
  471. processingfile: function(file) {
  472. return file.previewElement.classList.add("dz-processing");
  473. },
  474. uploadprogress: function(file, progress, bytesSent) {
  475. return file.previewElement.querySelector("[data-dz-uploadprogress]").style.width = "" + progress + "%";
  476. },
  477. totaluploadprogress: noop,
  478. sending: noop,
  479. success: function(file) {
  480. return file.previewElement.classList.add("dz-success");
  481. },
  482. complete: noop,
  483. previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-details\">\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n <div class=\"dz-size\" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n <div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div>\n <div class=\"dz-success-mark\"><span>✔</span></div>\n <div class=\"dz-error-mark\"><span>✘</span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>"
  484. };
  485. function Dropzone(element, options) {
  486. var elementOptions, extend, fallback, _ref;
  487. this.element = element;
  488. this.version = Dropzone.version;
  489. this.defaultOptions.previewTemplate = this.defaultOptions.previewTemplate.replace(/\n*/g, "");
  490. if (typeof this.element === "string") {
  491. this.element = document.querySelector(this.element);
  492. }
  493. if (!(this.element && (this.element.nodeType != null))) {
  494. throw new Error("Invalid dropzone element.");
  495. }
  496. if (this.element.dropzone) {
  497. throw new Error("Dropzone already attached.");
  498. }
  499. Dropzone.instances.push(this);
  500. element.dropzone = this;
  501. elementOptions = (_ref = Dropzone.optionsForElement(this.element)) != null ? _ref : {};
  502. extend = function() {
  503. var key, object, objects, target, val, _i, _len;
  504. target = arguments[0], objects = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  505. for (_i = 0, _len = objects.length; _i < _len; _i++) {
  506. object = objects[_i];
  507. for (key in object) {
  508. val = object[key];
  509. target[key] = val;
  510. }
  511. }
  512. return target;
  513. };
  514. this.options = extend({}, this.defaultOptions, elementOptions, options != null ? options : {});
  515. if (this.options.url == null) {
  516. this.options.url = this.element.action;
  517. }
  518. if (!this.options.url) {
  519. throw new Error("No URL provided.");
  520. }
  521. if (this.options.acceptParameter && this.options.acceptedMimeTypes) {
  522. throw new Error("You can't provide both 'acceptParameter' and 'acceptedMimeTypes'. 'acceptParameter' is deprecated.");
  523. }
  524. this.options.method = this.options.method.toUpperCase();
  525. if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
  526. return this.options.fallback.call(this);
  527. }
  528. if ((fallback = this.getExistingFallback()) && fallback.parentNode) {
  529. fallback.parentNode.removeChild(fallback);
  530. }
  531. if (this.options.previewsContainer) {
  532. this.previewsContainer = Dropzone.getElement(this.options.previewsContainer, "previewsContainer");
  533. } else {
  534. this.previewsContainer = this.element;
  535. }
  536. if (this.options.clickable) {
  537. if (this.options.clickable === true) {
  538. this.clickableElements = [this.element];
  539. } else {
  540. this.clickableElements = Dropzone.getElements(this.options.clickable, "clickable");
  541. }
  542. } else {
  543. this.clickableElements = [];
  544. }
  545. this.init();
  546. }
  547. Dropzone.prototype.init = function() {
  548. var eventName, noPropagation, setupHiddenFileInput, _i, _len, _ref, _ref1,
  549. _this = this;
  550. if (this.element.tagName === "form") {
  551. this.element.setAttribute("enctype", "multipart/form-data");
  552. }
  553. if (this.element.classList.contains("dropzone") && !this.element.querySelector("[data-dz-message]")) {
  554. this.element.appendChild(Dropzone.createElement("<div class=\"dz-default dz-message\" data-dz-message><span>" + this.options.dictDefaultMessage + "</span></div>"));
  555. }
  556. if (this.clickableElements.length) {
  557. setupHiddenFileInput = function() {
  558. if (_this.hiddenFileInput) {
  559. document.body.removeChild(_this.hiddenFileInput);
  560. }
  561. _this.hiddenFileInput = document.createElement("input");
  562. _this.hiddenFileInput.setAttribute("type", "file");
  563. _this.hiddenFileInput.setAttribute("multiple", "multiple");
  564. if (_this.options.acceptedMimeTypes != null) {
  565. _this.hiddenFileInput.setAttribute("accept", _this.options.acceptedMimeTypes);
  566. }
  567. if (_this.options.acceptParameter != null) {
  568. _this.hiddenFileInput.setAttribute("accept", _this.options.acceptParameter);
  569. }
  570. _this.hiddenFileInput.style.visibility = "hidden";
  571. _this.hiddenFileInput.style.position = "absolute";
  572. _this.hiddenFileInput.style.top = "0";
  573. _this.hiddenFileInput.style.left = "0";
  574. _this.hiddenFileInput.style.height = "0";
  575. _this.hiddenFileInput.style.width = "0";
  576. document.body.appendChild(_this.hiddenFileInput);
  577. return _this.hiddenFileInput.addEventListener("change", function() {
  578. var files;
  579. files = _this.hiddenFileInput.files;
  580. if (files.length) {
  581. _this.emit("selectedfiles", files);
  582. _this.handleFiles(files);
  583. }
  584. return setupHiddenFileInput();
  585. });
  586. };
  587. setupHiddenFileInput();
  588. }
  589. this.files = [];
  590. this.acceptedFiles = [];
  591. this.filesQueue = [];
  592. this.filesProcessing = [];
  593. this.URL = (_ref = window.URL) != null ? _ref : window.webkitURL;
  594. _ref1 = this.events;
  595. for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
  596. eventName = _ref1[_i];
  597. this.on(eventName, this.options[eventName]);
  598. }
  599. this.on("uploadprogress", function(file) {
  600. var totalBytes, totalBytesSent, totalUploadProgress, _j, _len1, _ref2;
  601. totalBytesSent = 0;
  602. totalBytes = 0;
  603. _ref2 = _this.acceptedFiles;
  604. for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
  605. file = _ref2[_j];
  606. totalBytesSent += file.upload.bytesSent;
  607. totalBytes += file.upload.total;
  608. }
  609. totalUploadProgress = 100 * totalBytesSent / totalBytes;
  610. return _this.emit("totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent);
  611. });
  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(e) {
  625. return _this.emit("dragstart", e);
  626. },
  627. "dragenter": function(e) {
  628. noPropagation(e);
  629. return _this.emit("dragenter", e);
  630. },
  631. "dragover": function(e) {
  632. noPropagation(e);
  633. return _this.emit("dragover", e);
  634. },
  635. "dragleave": function(e) {
  636. return _this.emit("dragleave", e);
  637. },
  638. "drop": function(e) {
  639. noPropagation(e);
  640. _this.drop(e);
  641. return _this.emit("drop", e);
  642. },
  643. "dragend": function(e) {
  644. return _this.emit("dragend", e);
  645. }
  646. }
  647. }
  648. ];
  649. this.clickableElements.forEach(function(clickableElement) {
  650. return _this.listeners.push({
  651. element: clickableElement,
  652. events: {
  653. "click": function(evt) {
  654. if ((clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".dz-message")))) {
  655. return _this.hiddenFileInput.click();
  656. }
  657. }
  658. }
  659. });
  660. });
  661. this.enable();
  662. return this.options.init.call(this);
  663. };
  664. Dropzone.prototype.getFallbackForm = function() {
  665. var existingFallback, fields, fieldsString, form;
  666. if (existingFallback = this.getExistingFallback()) {
  667. return existingFallback;
  668. }
  669. fieldsString = "<div class=\"dz-fallback\">";
  670. if (this.options.dictFallbackText) {
  671. fieldsString += "<p>" + this.options.dictFallbackText + "</p>";
  672. }
  673. fieldsString += "<input type=\"file\" name=\"" + this.options.paramName + "[]\" multiple=\"multiple\" /><button type=\"submit\">Upload!</button></div>";
  674. fields = Dropzone.createElement(fieldsString);
  675. if (this.element.tagName !== "FORM") {
  676. form = Dropzone.createElement("<form action=\"" + this.options.url + "\" enctype=\"multipart/form-data\" method=\"" + this.options.method + "\"></form>");
  677. form.appendChild(fields);
  678. } else {
  679. this.element.setAttribute("enctype", "multipart/form-data");
  680. this.element.setAttribute("method", this.options.method);
  681. }
  682. return form != null ? form : fields;
  683. };
  684. Dropzone.prototype.getExistingFallback = function() {
  685. var fallback, getFallback, tagName, _i, _len, _ref;
  686. getFallback = function(elements) {
  687. var el, _i, _len;
  688. for (_i = 0, _len = elements.length; _i < _len; _i++) {
  689. el = elements[_i];
  690. if (/(^| )fallback($| )/.test(el.className)) {
  691. return el;
  692. }
  693. }
  694. };
  695. _ref = ["div", "form"];
  696. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  697. tagName = _ref[_i];
  698. if (fallback = getFallback(this.element.getElementsByTagName(tagName))) {
  699. return fallback;
  700. }
  701. }
  702. };
  703. Dropzone.prototype.setupEventListeners = function() {
  704. var elementListeners, event, listener, _i, _len, _ref, _results;
  705. _ref = this.listeners;
  706. _results = [];
  707. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  708. elementListeners = _ref[_i];
  709. _results.push((function() {
  710. var _ref1, _results1;
  711. _ref1 = elementListeners.events;
  712. _results1 = [];
  713. for (event in _ref1) {
  714. listener = _ref1[event];
  715. _results1.push(elementListeners.element.addEventListener(event, listener, false));
  716. }
  717. return _results1;
  718. })());
  719. }
  720. return _results;
  721. };
  722. Dropzone.prototype.removeEventListeners = function() {
  723. var elementListeners, event, listener, _i, _len, _ref, _results;
  724. _ref = this.listeners;
  725. _results = [];
  726. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  727. elementListeners = _ref[_i];
  728. _results.push((function() {
  729. var _ref1, _results1;
  730. _ref1 = elementListeners.events;
  731. _results1 = [];
  732. for (event in _ref1) {
  733. listener = _ref1[event];
  734. _results1.push(elementListeners.element.removeEventListener(event, listener, false));
  735. }
  736. return _results1;
  737. })());
  738. }
  739. return _results;
  740. };
  741. Dropzone.prototype.disable = function() {
  742. this.clickableElements.forEach(function(element) {
  743. return element.classList.remove("dz-clickable");
  744. });
  745. this.removeEventListeners();
  746. this.filesProcessing = [];
  747. return this.filesQueue = [];
  748. };
  749. Dropzone.prototype.enable = function() {
  750. this.clickableElements.forEach(function(element) {
  751. return element.classList.add("dz-clickable");
  752. });
  753. return this.setupEventListeners();
  754. };
  755. Dropzone.prototype.filesize = function(size) {
  756. var string;
  757. if (size >= 100000000000) {
  758. size = size / 100000000000;
  759. string = "TB";
  760. } else if (size >= 100000000) {
  761. size = size / 100000000;
  762. string = "GB";
  763. } else if (size >= 100000) {
  764. size = size / 100000;
  765. string = "MB";
  766. } else if (size >= 100) {
  767. size = size / 100;
  768. string = "KB";
  769. } else {
  770. size = size * 10;
  771. string = "b";
  772. }
  773. return "<strong>" + (Math.round(size) / 10) + "</strong> " + string;
  774. };
  775. Dropzone.prototype.drop = function(e) {
  776. var files;
  777. if (!e.dataTransfer) {
  778. return;
  779. }
  780. files = e.dataTransfer.files;
  781. this.emit("selectedfiles", files);
  782. if (files.length) {
  783. return this.handleFiles(files);
  784. }
  785. };
  786. Dropzone.prototype.handleFiles = function(files) {
  787. var file, _i, _len, _results;
  788. _results = [];
  789. for (_i = 0, _len = files.length; _i < _len; _i++) {
  790. file = files[_i];
  791. _results.push(this.addFile(file));
  792. }
  793. return _results;
  794. };
  795. Dropzone.prototype.accept = function(file, done) {
  796. if (file.size > this.options.maxFilesize * 1024 * 1024) {
  797. return done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
  798. } else if (!Dropzone.isValidMimeType(file.type, this.options.acceptedMimeTypes)) {
  799. return done(this.options.dictInvalidFileType);
  800. } else {
  801. return this.options.accept.call(this, file, done);
  802. }
  803. };
  804. Dropzone.prototype.addFile = function(file) {
  805. var _this = this;
  806. file.upload = {
  807. progress: 0,
  808. total: file.size,
  809. bytesSent: 0
  810. };
  811. this.files.push(file);
  812. this.emit("addedfile", file);
  813. if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {
  814. this.createThumbnail(file);
  815. }
  816. return this.accept(file, function(error) {
  817. if (error) {
  818. file.accepted = false;
  819. return _this.errorProcessing(file, error);
  820. } else {
  821. file.accepted = true;
  822. _this.acceptedFiles.push(file);
  823. if (_this.options.enqueueForUpload) {
  824. _this.filesQueue.push(file);
  825. return _this.processQueue();
  826. }
  827. }
  828. });
  829. };
  830. Dropzone.prototype.removeFile = function(file) {
  831. if (file.processing) {
  832. throw new Error("Can't remove file currently processing");
  833. }
  834. this.files = without(this.files, file);
  835. this.filesQueue = without(this.filesQueue, file);
  836. this.emit("removedfile", file);
  837. if (this.files.length === 0) {
  838. return this.emit("reset");
  839. }
  840. };
  841. Dropzone.prototype.removeAllFiles = function() {
  842. var file, _i, _len, _ref;
  843. _ref = this.files.slice();
  844. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  845. file = _ref[_i];
  846. if (__indexOf.call(this.filesProcessing, file) < 0) {
  847. this.removeFile(file);
  848. }
  849. }
  850. return null;
  851. };
  852. Dropzone.prototype.createThumbnail = function(file) {
  853. var fileReader,
  854. _this = this;
  855. fileReader = new FileReader;
  856. fileReader.onload = function() {
  857. var img;
  858. img = new Image;
  859. img.onload = function() {
  860. var canvas, ctx, resizeInfo, thumbnail, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
  861. file.width = img.width;
  862. file.height = img.height;
  863. resizeInfo = _this.options.resize.call(_this, file);
  864. if ((_ref = resizeInfo.trgWidth) == null) {
  865. resizeInfo.trgWidth = _this.options.thumbnailWidth;
  866. }
  867. if ((_ref1 = resizeInfo.trgHeight) == null) {
  868. resizeInfo.trgHeight = _this.options.thumbnailHeight;
  869. }
  870. canvas = document.createElement("canvas");
  871. ctx = canvas.getContext("2d");
  872. canvas.width = resizeInfo.trgWidth;
  873. canvas.height = resizeInfo.trgHeight;
  874. ctx.drawImage(img, (_ref2 = resizeInfo.srcX) != null ? _ref2 : 0, (_ref3 = resizeInfo.srcY) != null ? _ref3 : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, (_ref4 = resizeInfo.trgX) != null ? _ref4 : 0, (_ref5 = resizeInfo.trgY) != null ? _ref5 : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);
  875. thumbnail = canvas.toDataURL("image/png");
  876. return _this.emit("thumbnail", file, thumbnail);
  877. };
  878. return img.src = fileReader.result;
  879. };
  880. return fileReader.readAsDataURL(file);
  881. };
  882. Dropzone.prototype.processQueue = function() {
  883. var i, parallelUploads, processingLength;
  884. parallelUploads = this.options.parallelUploads;
  885. processingLength = this.filesProcessing.length;
  886. i = processingLength;
  887. while (i < parallelUploads) {
  888. if (!this.filesQueue.length) {
  889. return;
  890. }
  891. this.processFile(this.filesQueue.shift());
  892. i++;
  893. }
  894. };
  895. Dropzone.prototype.processFile = function(file) {
  896. this.filesProcessing.push(file);
  897. file.processing = true;
  898. this.emit("processingfile", file);
  899. return this.uploadFile(file);
  900. };
  901. Dropzone.prototype.uploadFile = function(file) {
  902. var formData, handleError, input, inputName, inputType, key, progressObj, response, value, xhr, _i, _len, _ref, _ref1, _ref2,
  903. _this = this;
  904. xhr = new XMLHttpRequest();
  905. xhr.open(this.options.method, this.options.url, true);
  906. response = null;
  907. handleError = function() {
  908. return _this.errorProcessing(file, response || _this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr);
  909. };
  910. xhr.onload = function(e) {
  911. var _ref;
  912. response = xhr.responseText;
  913. if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) {
  914. try {
  915. response = JSON.parse(response);
  916. } catch (_error) {
  917. e = _error;
  918. response = "Invalid JSON response from server.";
  919. }
  920. }
  921. if (!((200 <= (_ref = xhr.status) && _ref < 300))) {
  922. return handleError();
  923. } else {
  924. return _this.finished(file, response, e);
  925. }
  926. };
  927. xhr.onerror = function() {
  928. return handleError();
  929. };
  930. progressObj = (_ref = xhr.upload) != null ? _ref : xhr;
  931. progressObj.onprogress = function(e) {
  932. var progress;
  933. file.upload = {
  934. progress: progress,
  935. total: e.total,
  936. bytesSent: e.loaded
  937. };
  938. progress = 100 * e.loaded / e.total;
  939. return _this.emit("uploadprogress", file, progress, e.loaded);
  940. };
  941. xhr.setRequestHeader("Accept", "application/json");
  942. xhr.setRequestHeader("Cache-Control", "no-cache");
  943. xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  944. xhr.setRequestHeader("X-File-Name", file.name);
  945. formData = new FormData();
  946. if (this.options.params) {
  947. _ref1 = this.options.params;
  948. for (key in _ref1) {
  949. value = _ref1[key];
  950. formData.append(key, value);
  951. }
  952. }
  953. if (this.element.tagName === "FORM") {
  954. _ref2 = this.element.querySelectorAll("input, textarea, select, button");
  955. for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
  956. input = _ref2[_i];
  957. inputName = input.getAttribute("name");
  958. inputType = input.getAttribute("type");
  959. if (!inputType || inputType.toLowerCase() !== "checkbox" || input.checked) {
  960. formData.append(inputName, input.value);
  961. }
  962. }
  963. }
  964. this.emit("sending", file, xhr, formData);
  965. formData.append(this.options.paramName, file);
  966. return xhr.send(formData);
  967. };
  968. Dropzone.prototype.finished = function(file, responseText, e) {
  969. this.filesProcessing = without(this.filesProcessing, file);
  970. file.processing = false;
  971. this.processQueue();
  972. this.emit("success", file, responseText, e);
  973. this.emit("finished", file, responseText, e);
  974. return this.emit("complete", file);
  975. };
  976. Dropzone.prototype.errorProcessing = function(file, message, xhr) {
  977. this.filesProcessing = without(this.filesProcessing, file);
  978. file.processing = false;
  979. this.processQueue();
  980. this.emit("error", file, message, xhr);
  981. return this.emit("complete", file);
  982. };
  983. return Dropzone;
  984. })(Em);
  985. Dropzone.version = "3.2.0";
  986. Dropzone.options = {};
  987. Dropzone.optionsForElement = function(element) {
  988. if (element.id) {
  989. return Dropzone.options[camelize(element.id)];
  990. } else {
  991. return void 0;
  992. }
  993. };
  994. Dropzone.instances = [];
  995. Dropzone.forElement = function(element) {
  996. var _ref;
  997. if (typeof element === "string") {
  998. element = document.querySelector(element);
  999. }
  1000. return (_ref = element.dropzone) != null ? _ref : null;
  1001. };
  1002. Dropzone.autoDiscover = true;
  1003. Dropzone.discover = function() {
  1004. var checkElements, dropzone, dropzones, _i, _len, _results;
  1005. if (!Dropzone.autoDiscover) {
  1006. return;
  1007. }
  1008. if (document.querySelectorAll) {
  1009. dropzones = document.querySelectorAll(".dropzone");
  1010. } else {
  1011. dropzones = [];
  1012. checkElements = function(elements) {
  1013. var el, _i, _len, _results;
  1014. _results = [];
  1015. for (_i = 0, _len = elements.length; _i < _len; _i++) {
  1016. el = elements[_i];
  1017. if (/(^| )dropzone($| )/.test(el.className)) {
  1018. _results.push(dropzones.push(el));
  1019. } else {
  1020. _results.push(void 0);
  1021. }
  1022. }
  1023. return _results;
  1024. };
  1025. checkElements(document.getElementsByTagName("div"));
  1026. checkElements(document.getElementsByTagName("form"));
  1027. }
  1028. _results = [];
  1029. for (_i = 0, _len = dropzones.length; _i < _len; _i++) {
  1030. dropzone = dropzones[_i];
  1031. if (Dropzone.optionsForElement(dropzone) !== false) {
  1032. _results.push(new Dropzone(dropzone));
  1033. } else {
  1034. _results.push(void 0);
  1035. }
  1036. }
  1037. return _results;
  1038. };
  1039. Dropzone.blacklistedBrowsers = [/opera.*Macintosh.*version\/12/i];
  1040. Dropzone.isBrowserSupported = function() {
  1041. var capableBrowser, regex, _i, _len, _ref;
  1042. capableBrowser = true;
  1043. if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
  1044. if (!("classList" in document.createElement("a"))) {
  1045. capableBrowser = false;
  1046. } else {
  1047. _ref = Dropzone.blacklistedBrowsers;
  1048. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  1049. regex = _ref[_i];
  1050. if (regex.test(navigator.userAgent)) {
  1051. capableBrowser = false;
  1052. continue;
  1053. }
  1054. }
  1055. }
  1056. } else {
  1057. capableBrowser = false;
  1058. }
  1059. return capableBrowser;
  1060. };
  1061. without = function(list, rejectedItem) {
  1062. var item, _i, _len, _results;
  1063. _results = [];
  1064. for (_i = 0, _len = list.length; _i < _len; _i++) {
  1065. item = list[_i];
  1066. if (item !== rejectedItem) {
  1067. _results.push(item);
  1068. }
  1069. }
  1070. return _results;
  1071. };
  1072. camelize = function(str) {
  1073. return str.replace(/[\-_](\w)/g, function(match) {
  1074. return match[1].toUpperCase();
  1075. });
  1076. };
  1077. Dropzone.createElement = function(string) {
  1078. var div;
  1079. div = document.createElement("div");
  1080. div.innerHTML = string;
  1081. return div.childNodes[0];
  1082. };
  1083. Dropzone.elementInside = function(element, container) {
  1084. if (element === container) {
  1085. return true;
  1086. }
  1087. while (element = element.parentNode) {
  1088. if (element === container) {
  1089. return true;
  1090. }
  1091. }
  1092. return false;
  1093. };
  1094. Dropzone.getElement = function(el, name) {
  1095. var element;
  1096. if (typeof el === "string") {
  1097. element = document.querySelector(el);
  1098. } else if (el.nodeType != null) {
  1099. element = el;
  1100. }
  1101. if (element == null) {
  1102. throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector or a plain HTML element.");
  1103. }
  1104. return element;
  1105. };
  1106. Dropzone.getElements = function(els, name) {
  1107. var e, el, elements, _i, _j, _len, _len1, _ref;
  1108. if (els instanceof Array) {
  1109. elements = [];
  1110. try {
  1111. for (_i = 0, _len = els.length; _i < _len; _i++) {
  1112. el = els[_i];
  1113. elements.push(this.getElement(el, name));
  1114. }
  1115. } catch (_error) {
  1116. e = _error;
  1117. elements = null;
  1118. }
  1119. } else if (typeof els === "string") {
  1120. elements = [];
  1121. _ref = document.querySelectorAll(els);
  1122. for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
  1123. el = _ref[_j];
  1124. elements.push(el);
  1125. }
  1126. } else if (els.nodeType != null) {
  1127. elements = [els];
  1128. }
  1129. if (!((elements != null) && elements.length)) {
  1130. throw new Error("Invalid `" + name + "` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");
  1131. }
  1132. return elements;
  1133. };
  1134. Dropzone.isValidMimeType = function(mimeType, acceptedMimeTypes) {
  1135. var baseMimeType, validMimeType, _i, _len;
  1136. if (!acceptedMimeTypes) {
  1137. return true;
  1138. }
  1139. acceptedMimeTypes = acceptedMimeTypes.split(",");
  1140. baseMimeType = mimeType.replace(/\/.*$/, "");
  1141. for (_i = 0, _len = acceptedMimeTypes.length; _i < _len; _i++) {
  1142. validMimeType = acceptedMimeTypes[_i];
  1143. validMimeType = validMimeType.trim();
  1144. if (/\/\*$/.test(validMimeType)) {
  1145. if (baseMimeType === validMimeType.replace(/\/.*$/, "")) {
  1146. return true;
  1147. }
  1148. } else {
  1149. if (mimeType === validMimeType) {
  1150. return true;
  1151. }
  1152. }
  1153. }
  1154. return false;
  1155. };
  1156. if (typeof jQuery !== "undefined" && jQuery !== null) {
  1157. jQuery.fn.dropzone = function(options) {
  1158. return this.each(function() {
  1159. return new Dropzone(this, options);
  1160. });
  1161. };
  1162. }
  1163. if (typeof module !== "undefined" && module !== null) {
  1164. module.exports = Dropzone;
  1165. } else {
  1166. window.Dropzone = Dropzone;
  1167. }
  1168. /*
  1169. # contentloaded.js
  1170. #
  1171. # Author: Diego Perini (diego.perini at gmail.com)
  1172. # Summary: cross-browser wrapper for DOMContentLoaded
  1173. # Updated: 20101020
  1174. # License: MIT
  1175. # Version: 1.2
  1176. #
  1177. # URL:
  1178. # http://javascript.nwbox.com/ContentLoaded/
  1179. # http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
  1180. */
  1181. contentLoaded = function(win, fn) {
  1182. var add, doc, done, init, poll, pre, rem, root, top;
  1183. done = false;
  1184. top = true;
  1185. doc = win.document;
  1186. root = doc.documentElement;
  1187. add = (doc.addEventListener ? "addEventListener" : "attachEvent");
  1188. rem = (doc.addEventListener ? "removeEventListener" : "detachEvent");
  1189. pre = (doc.addEventListener ? "" : "on");
  1190. init = function(e) {
  1191. if (e.type === "readystatechange" && doc.readyState !== "complete") {
  1192. return;
  1193. }
  1194. (e.type === "load" ? win : doc)[rem](pre + e.type, init, false);
  1195. if (!done && (done = true)) {
  1196. return fn.call(win, e.type || e);
  1197. }
  1198. };
  1199. poll = function() {
  1200. var e;
  1201. try {
  1202. root.doScroll("left");
  1203. } catch (_error) {
  1204. e = _error;
  1205. setTimeout(poll, 50);
  1206. return;
  1207. }
  1208. return init("poll");
  1209. };
  1210. if (doc.readyState !== "complete") {
  1211. if (doc.createEventObject && root.doScroll) {
  1212. try {
  1213. top = !win.frameElement;
  1214. } catch (_error) {}
  1215. if (top) {
  1216. poll();
  1217. }
  1218. }
  1219. doc[add](pre + "DOMContentLoaded", init, false);
  1220. doc[add](pre + "readystatechange", init, false);
  1221. return win[add](pre + "load", init, false);
  1222. }
  1223. };
  1224. contentLoaded(window, Dropzone.discover);
  1225. }).call(this);
  1226. });
  1227. require.alias("component-emitter/index.js", "dropzone/deps/emitter/index.js");
  1228. require.alias("component-emitter/index.js", "emitter/index.js");
  1229. if (typeof exports == "object") {
  1230. module.exports = require("dropzone");
  1231. } else if (typeof define == "function" && define.amd) {
  1232. define(function(){ return require("dropzone"); });
  1233. } else {
  1234. this["Dropzone"] = require("dropzone");
  1235. }})();