making changes

This commit is contained in:
Daniela Arcese 2017-06-09 09:45:06 -04:00
parent 42be528c90
commit dea589df14
5 changed files with 60 additions and 68 deletions

View File

@ -11,7 +11,7 @@ class FileSender extends EventEmitter {
static delete(fileId, token) { static delete(fileId, token) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!fileId || !token) { if (!fileId || !token) {
return resolve(); return reject();
} }
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.open('post', '/delete/' + fileId, true); xhr.open('post', '/delete/' + fileId, true);

View File

@ -42,7 +42,7 @@ $(document).ready(function() {
} else { } else {
file = event.target.files[0]; file = event.target.files[0];
} }
let fileList = $('#uploaded-files'); let $fileList = $('#uploaded-files');
let row = document.createElement('tr'); let row = document.createElement('tr');
let name = document.createElement('td'); let name = document.createElement('td');
let link = document.createElement('td'); let link = document.createElement('td');
@ -74,7 +74,7 @@ $(document).ready(function() {
$(popupDiv).append($popupText); $(popupDiv).append($popupText);
del.appendChild(popupDiv); del.appendChild(popupDiv);
row.appendChild(del); row.appendChild(del);
fileList.append(row); //add row to table $fileList.append(row); //add row to table
const fileSender = new FileSender(file); const fileSender = new FileSender(file);
fileSender.on('progress', percentComplete => { fileSender.on('progress', percentComplete => {
@ -91,28 +91,32 @@ $(document).ready(function() {
localStorage.setItem(info.fileId, info.deleteToken); localStorage.setItem(info.fileId, info.deleteToken);
// delete file // delete file
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)
).then(() => { ).then(() => {
e.target.parentNode.parentNode.parentNode.parentNode.remove(); //
$(e.target).parents('tr').remove();
localStorage.removeItem(info.fileId); localStorage.removeItem(info.fileId);
}); });
}); });
// show popup // show popup
btn.addEventListener('click', e => { btn.addEventListener('click', e => {
$popupText.toggleClass('show'); toggleShow();
}); });
// hide popup // hide popup
$popupText.find('.nvm').click(e => { $popupText.find('.nvm').click(e => {
$popupText.toggleClass('show'); toggleShow();
}); });
$('#upload-progress').hide(); $('#upload-progress').hide();
$('#share-link').show(); $('#share-link').show();
}); });
function toggleShow(){
$popupText.toggleClass('show');
}
}; };
window.allowDrop = function(ev) { window.allowDrop = function(ev) {

View File

@ -143,17 +143,9 @@ td {
border-color: #555 transparent transparent transparent; border-color: #555 transparent transparent transparent;
} }
/* Toggle this class when clicking on the popup container (hide and show the popup) */
.popup .show { .popup .show {
visibility: visible; visibility: visible;
-webkit-animation: fadeIn 1s; animation: fadeIn 1s;
animation: fadeIn 1s
}
/* Add animation (fade in the popup) */
@-webkit-keyframes fadeIn {
from {opacity: 0;}
to {opacity: 1;}
} }
@keyframes fadeIn { @keyframes fadeIn {

View File

@ -13,11 +13,10 @@
<div id="download"> <div id="download">
{{#if filename}} {{#if filename}}
<div class="title"> <div class="title">
Your friend is sending you a file: Your friend is sending you a file: <br>
{{{filename}}} ({{{filesize}}})
</div> </div>
<span> {{{filename}}} ({{{filesize}}})
<div class="share-window"> <div class="share-window">
<button id="download-btn" onclick="download()">Download File</button> <button id="download-btn" onclick="download()">Download File</button>
<img id="expired-img" src="/resources/link_expired.png"/> <img id="expired-img" src="/resources/link_expired.png"/>

View File

@ -41,9 +41,6 @@
<th width=18%>Expires in</th> <th width=18%>Expires in</th>
<th width=7%>Delete</th> <th width=7%>Delete</th>
</tr> </tr>
<!-- <div class="popup">
<span class="popuptext" id="myPopup">Popup text...</span>
</div> -->
</table> </table>
</div> </div>