This commit is contained in:
Daniela Arcese 2017-06-08 16:11:28 -04:00
parent 796577ee2b
commit 90809bf05d

View file

@ -36,8 +36,8 @@ $(document).ready(function() {
// on file upload by browse or drag & drop // on file upload by browse or drag & drop
window.onUpload = event => { window.onUpload = event => {
event.preventDefault(); event.preventDefault();
let file = ""; let file = '';
if (event.type == "drop"){ if (event.type == 'drop') {
file = event.dataTransfer.files[0]; file = event.dataTransfer.files[0];
} else { } else {
file = event.target.files[0]; file = event.target.files[0];
@ -50,7 +50,7 @@ $(document).ready(function() {
let del = document.createElement('td'); let del = document.createElement('td');
let btn = document.createElement('button'); let btn = document.createElement('button');
let popupDiv = document.createElement('div'); let popupDiv = document.createElement('div');
let $popupText = $('<span>', {'class': 'popuptext'}); let $popupText = $('<span>', { 'class': 'popuptext' });
let cellText = document.createTextNode(file.name); let cellText = document.createTextNode(file.name);
let progress = document.createElement('p'); let progress = document.createElement('p');
@ -62,7 +62,9 @@ $(document).ready(function() {
// create popup // create popup
popupDiv.classList.add('popup'); popupDiv.classList.add('popup');
$popupText.html("<span class='del-file'>Delete</span><span class='nvm'> Nevermind</span>"); $popupText.html(
"<span class='del-file'>Delete</span><span class='nvm'> Nevermind</span>"
);
// add data cells to table row // add data cells to table row
row.appendChild(name); row.appendChild(name);
@ -90,7 +92,7 @@ $(document).ready(function() {
// delete file // delete file
console.log($popupText.first()); console.log($popupText.first());
$popupText.find(".del-file").click(e => { $popupText.find('.del-file').click(e => {
FileSender.delete( FileSender.delete(
info.fileId, info.fileId,
localStorage.getItem(info.fileId) localStorage.getItem(info.fileId)
@ -105,7 +107,7 @@ $(document).ready(function() {
$popupText.toggleClass('show'); $popupText.toggleClass('show');
}); });
// hide popup // hide popup
$popupText.find(".nvm").click( e => { $popupText.find('.nvm').click(e => {
$popupText.toggleClass('show'); $popupText.toggleClass('show');
}); });
$('#upload-progress').hide(); $('#upload-progress').hide();
@ -115,6 +117,5 @@ $(document).ready(function() {
window.allowDrop = function(ev) { window.allowDrop = function(ev) {
ev.preventDefault(); ev.preventDefault();
} };
}); });