2017-10-11 21:15:38 +02:00
|
|
|
function showInstructions () {
|
2017-10-25 20:22:15 +02:00
|
|
|
document.getElementById('preview-dropzone-instructions').setAttribute('class', 'flex-container flex-container--column flex-container--justify-center position-absolute');
|
|
|
|
document.getElementById('asset-preview').style.opacity = 0.2;
|
2017-10-11 21:15:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function hideInstructions () {
|
2017-10-24 00:10:49 +02:00
|
|
|
document.getElementById('preview-dropzone-instructions').setAttribute('class', 'hidden');
|
2017-10-11 21:15:38 +02:00
|
|
|
document.getElementById('asset-preview').style.opacity = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
function triggerFileChooser(fileInputId, event) {
|
|
|
|
document.getElementById(fileInputId).click();
|
|
|
|
}
|
|
|
|
|
|
|
|
function drop_handler(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
// if dropped items aren't files, reject them
|
|
|
|
var dt = event.dataTransfer;
|
|
|
|
if (dt.items) {
|
|
|
|
if (dt.items[0].kind == 'file') {
|
|
|
|
var droppedFile = dt.items[0].getAsFile();
|
|
|
|
previewAndStageFile(droppedFile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function dragover_handler(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
|
|
|
|
function dragend_handler(event) {
|
|
|
|
var dt = event.dataTransfer;
|
|
|
|
if (dt.items) {
|
|
|
|
for (var i = 0; i < dt.items.length; i++) {
|
|
|
|
dt.items.remove(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
event.dataTransfer.clearData();
|
|
|
|
}
|
2017-10-11 22:33:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function dragenter_handler(event) {
|
2017-10-25 20:22:15 +02:00
|
|
|
var thisDropzone = document.getElementById(event.target.id);
|
|
|
|
thisDropzone.setAttribute('class', 'dropzone dropzone--drag-over row row--margined row--padded row--tall flex-container flex-container--column flex-container--justify-center');
|
|
|
|
thisDropzone.firstElementChild.setAttribute('class', 'hidden');
|
|
|
|
thisDropzone.lastElementChild.setAttribute('class', '');
|
2017-10-24 07:29:20 +02:00
|
|
|
|
2017-10-11 22:33:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function dragexit_handler(event) {
|
2017-10-25 20:22:15 +02:00
|
|
|
var thisDropzone = document.getElementById(event.target.id);
|
|
|
|
thisDropzone.setAttribute('class', 'dropzone row row--tall row--margined row--padded flex-container flex-container--column flex-container--justify-center');
|
|
|
|
thisDropzone.firstElementChild.setAttribute('class', '');
|
|
|
|
thisDropzone.lastElementChild.setAttribute('class', 'hidden');
|
2017-10-11 21:15:38 +02:00
|
|
|
}
|