Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
this.on('sending', function (file, xhr, formData) {
xhr.ontimeout = () => {
_self.options.onError('Server Timeout')
console.error('Server Timeout')
}
})
}
}
Dropzone.autoDiscover = this.options.autoDiscover
try {
/* eslint-disable no-new */
new Dropzone(this.options.selector, Dropzone.options.uploadDropzoneDocument)
let $dropzone = $(this.options.selector)
$dropzone.append(`<div class="dz-default dz-message"><span>${this.options.dictDefaultMessage}</span></div>`)
let $dzMessage = $dropzone.find('.dz-message')
$dzMessage.append(`
<div class="circles-icons">
<div class="circle circle-1"></div>
<div class="circle circle-2"></div>
<div class="circle circle-3"></div>
<div class="circle circle-4"></div>
<div class="circle circle-5"></div>
<i class="uk-icon-rz-file"></i>
</div>`)
this.attached = true
} catch (e) {
console.error(e)
import Dropzone from "dropzone";
Dropzone.autoDiscover = false;
export default class DropzoneUpload {
constructor(element) {
this.element = element;
this.render();
}
render() {
const dz = new Dropzone(this.element); // eslint-disable-line new-cap
dz.on("complete", () => window.location.reload());
}
}
Dropzone.options.uploadUser = {
acceptedFiles: ".csv"
};
init () {
const _self = this
// Get folder id
let form = $('#upload-dropzone-document')
if (form.attr('data-folder-id') && form.attr('data-folder-id') > 0) {
this.options.headers.folderId = parseInt(form.attr('data-folder-id'))
this.options.url = window.Rozier.routes.documentsUploadPage + '/' + parseInt(form.attr('data-folder-id'))
}
Dropzone.options.uploadDropzoneDocument = {
url: this.options.url,
method: 'post',
headers: this.options.headers,
paramName: this.options.paramName,
uploadMultiple: this.options.uploadMultiple,
timeout: this.options.timeout,
maxFilesize: this.options.maxFilesize,
dictDefaultMessage: this.options.dictDefaultMessage,
dictFallbackMessage: this.options.dictFallbackMessage,
dictFallbackText: this.options.dictFallbackText,
dictFileTooBig: this.options.dictFileTooBig,
dictInvalidFileType: this.options.dictInvalidFileType,
dictResponseError: this.options.dictResponseError,
dictCancelUpload: this.options.dictCancelUpload,
dictCancelUploadConfirmation: this.options.dictCancelUploadConfirmation,
dictRemoveFile: this.options.dictRemoveFile,
$("#add-molecule").click(function() {
onAddMolecule();
});
$("#del-molecule").click(function() {
onDeleteMolecule();
});
$("#n-molecules").data("n_mols", 1);
});
// http://stackoverflow.com/questions/22063612
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
const token = Utl.EDD.findCSRFToken();
jqXHR.setRequestHeader("X-CSRFToken", token);
});
Dropzone.options.gcmsDropzone = {
"uploadMultiple": false,
"previewsContainer": "#file-preview",
"init": function() {
this.element
.querySelector("button[type=submit]")
.addEventListener("click", (e) => {
// Make sure that the form isn't actually being sent.
e.preventDefault();
e.stopPropagation();
if (this.files.length === 0) {
alert("No input file specified!");
return false;
}
// reset the upload queue
for (const file of this.files) {
file.status = Dropzone.QUEUED;
var Dropzone = require("dropzone"),
Opentip = require("opentip"),
o = require("jquery");
Dropzone.options.demoUpload = {
addRemoveLinks: true,
fallback: function() {
Dropzone.prototype.defaultOptions.fallback.call(this);
o(this.element).append("<p>This is what the file uploads with Dropzone look like in modern browsers:<br><img alt="\"preview\"" src="\"/images/preview.png\""></p>");
}
};