Skip to content
This repository has been archived by the owner on May 22, 2021. It is now read-only.

Commit

Permalink
add file size limit message
Browse files Browse the repository at this point in the history
  • Loading branch information
dnarcese committed Jul 19, 2017
1 parent 262322b commit eaf28ab
Show file tree
Hide file tree
Showing 7 changed files with 2,433 additions and 389 deletions.
13 changes: 6 additions & 7 deletions frontend/src/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ require('jquery-circle-progress');

const Raven = window.Raven;
$(document).ready(function() {
$('#download-progress').hide();
//link back to homepage
$('.send-new').attr('href', window.location.origin);

Expand All @@ -23,8 +22,8 @@ $(document).ready(function() {
const fileReceiver = new FileReceiver();

fileReceiver.on('progress', progress => {
$('#download-page-one').hide();
$('#download-progress').show();
$('#download-page-one').attr('hidden', true);
$('#download-progress').removeAttr('hidden');
const percent = progress[0] / progress[1];
// update progress bar
$('#dl-progress').circleProgress('value', percent);
Expand All @@ -50,7 +49,7 @@ $(document).ready(function() {
.then(translated => {
notify(translated[0]);
$('.title').html(translated[1]);
})
});
}
});

Expand Down Expand Up @@ -78,9 +77,9 @@ $(document).ready(function() {
document.l10n.formatValue('expiredPageHeader')
.then(translated => {
$('.title').text(translated);
})
$('#download-btn').hide();
$('#expired-img').show();
});
$('#download-btn').attr('hidden', true);
$('#expired-img').removeAttr('hidden');
console.log('The file has expired, or has already been deleted.');
return;
})
Expand Down
43 changes: 18 additions & 25 deletions frontend/src/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const Raven = window.Raven;

$(document).ready(function() {
gcmCompliant().catch(err => {
$('#page-one').hide();
$('#unsupported-browser').show();
$('#page-one').attr('hidden', true);
$('#unsupported-browser').removeAttr('hidden');
});

$('#file-upload').change(onUpload);
Expand All @@ -19,12 +19,6 @@ $(document).ready(function() {
$('#link').attr('disabled', false);
$copyBtn.attr('data-l10n-id', 'copyUrlFormButton');

$('#upload-progress').hide();
$('#share-link').hide();
$('#upload-error').hide();
$('#unsupported-browser').hide();
$('#compliance-error').hide();
$('#page-one').show();

if (localStorage.length === 0) {
toggleHeader();
Expand Down Expand Up @@ -88,16 +82,15 @@ $(document).ready(function() {
fileSender.cancel();
location.reload();
document.l10n.formatValue('uploadCancelNotification')
.then(str => {
console.log('here')
notify(str);
})
.then(str => {
notify(str);
});
});

fileSender.on('progress', progress => {
$('#page-one').hide();
$('#upload-error').hide();
$('#upload-progress').show();
$('#page-one').attr('hidden', true);
$('#upload-error').attr('hidden', true);
$('#upload-progress').removeAttr('hidden');
//don't allow drag and drop when not on page-one
$('body').off('drop', onUpload);
const percent = progress[0] / progress[1];
Expand Down Expand Up @@ -163,10 +156,10 @@ $(document).ready(function() {
localStorage.setItem(info.fileId, JSON.stringify(fileData));
$('#upload-filename').attr('data-l10n-id', 'uploadSuccessConfirmHeader');
t = window.setTimeout(() => {
$('#page-one').hide();
$('#upload-progress').hide();
$('#upload-error').hide();
$('#share-link').show();
$('#page-one').attr('hidden', true);
$('#upload-progress').attr('hidden', true);
$('#upload-error').attr('hidden', true);
$('#share-link').removeAttr('hidden');
}, 2000);

populateFileList(JSON.stringify(fileData));
Expand All @@ -177,9 +170,9 @@ $(document).ready(function() {
.catch(err => {
Raven.captureException(err);
console.log(err);
$('#page-one').hide();
$('#upload-progress').hide();
$('#upload-error').show();
$('#page-one').attr('hidden', true);
$('#upload-progress').attr('hidden', true);
$('#upload-error').removeAttr('hidden');
window.clearTimeout(t);
});
}
Expand Down Expand Up @@ -264,7 +257,7 @@ $(document).ready(function() {
document.l10n.formatValue('copiedUrl')
.then(translated => {
link.innerHTML = translated;
})
});
window.setTimeout(() => {
const linkImg = document.createElement('img');
$(linkImg).addClass('icon-copy');
Expand Down Expand Up @@ -381,9 +374,9 @@ $(document).ready(function() {
function toggleHeader() {
//hide table header if empty list
if (document.querySelector('tbody').childNodes.length === 1) {
$('#file-list').hide();
$('#file-list').attr('hidden', true);
} else {
$('#file-list').show();
$('#file-list').removeAttr('hidden');
}
}
});
Loading

0 comments on commit eaf28ab

Please sign in to comment.