mirror of
https://gitlab.com/timvisee/send.git
synced 2024-11-10 21:22:35 +01:00
attach delete-file handler only after upload
This commit is contained in:
parent
097ff19c5f
commit
441fe86186
@ -94,9 +94,6 @@ $(() => {
|
|||||||
$uploadWindow.removeClass('ondrag');
|
$uploadWindow.removeClass('ondrag');
|
||||||
});
|
});
|
||||||
|
|
||||||
//link back to homepage
|
|
||||||
$('.send-new').attr('href', window.location);
|
|
||||||
|
|
||||||
// on file upload by browse or drag & drop
|
// on file upload by browse or drag & drop
|
||||||
function onUpload(event) {
|
function onUpload(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -219,6 +216,30 @@ $(() => {
|
|||||||
uploadSpeed: speed
|
uploadSpeed: speed
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$('#delete-file').on('click', () => {
|
||||||
|
FileSender.delete(
|
||||||
|
fileData.fileId,
|
||||||
|
fileData.deleteToken
|
||||||
|
).then(() => {
|
||||||
|
const ttl =
|
||||||
|
ONE_DAY_IN_MS -
|
||||||
|
(Date.now() - fileData.creationDate.getTime());
|
||||||
|
metrics
|
||||||
|
.deletedUpload({
|
||||||
|
size: fileData.size,
|
||||||
|
time: fileData.totalTime,
|
||||||
|
speed: fileData.uploadSpeed,
|
||||||
|
type: fileData.typeOfUpload,
|
||||||
|
location: 'success-screen',
|
||||||
|
ttl
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
storage.remove(fileData.fileId);
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
storage.addFile(info.fileId, fileData);
|
storage.addFile(info.fileId, fileData);
|
||||||
|
|
||||||
$pageOne.attr('hidden', true);
|
$pageOne.attr('hidden', true);
|
||||||
@ -428,26 +449,6 @@ $(() => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#delete-file').on('click', () => {
|
|
||||||
FileSender.delete(file.fileId, file.deleteToken).then(() => {
|
|
||||||
const ttl =
|
|
||||||
ONE_DAY_IN_MS - (Date.now() - file.creationDate.getTime());
|
|
||||||
metrics
|
|
||||||
.deletedUpload({
|
|
||||||
size: file.size,
|
|
||||||
time: file.totalTime,
|
|
||||||
speed: file.uploadSpeed,
|
|
||||||
type: file.typeOfUpload,
|
|
||||||
location: 'success-screen',
|
|
||||||
ttl
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
storage.remove(file.fileId);
|
|
||||||
location.reload();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// show popup
|
// show popup
|
||||||
$delIcon.on('click', () => {
|
$delIcon.on('click', () => {
|
||||||
$popupText.addClass('show').focus();
|
$popupText.addClass('show').focus();
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
<button id="copy-btn" data-l10n-id="copyUrlFormButton"></button>
|
<button id="copy-btn" data-l10n-id="copyUrlFormButton"></button>
|
||||||
</div>
|
</div>
|
||||||
<button id="delete-file" data-l10n-id="deleteFileButton"></button>
|
<button id="delete-file" data-l10n-id="deleteFileButton"></button>
|
||||||
<a class="send-new" data-state="completed" data-l10n-id="sendAnotherFileLink"></a>
|
<a class="send-new" data-state="completed" data-l10n-id="sendAnotherFileLink" href="/"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user