Merge pull request #259 from mozilla/ui
add alert when uploading multiple files
This commit is contained in:
commit
f816c0bc12
2 changed files with 18 additions and 10 deletions
|
@ -19,7 +19,6 @@ $(document).ready(function() {
|
||||||
$('#link').attr('disabled', false);
|
$('#link').attr('disabled', false);
|
||||||
$copyBtn.attr('data-l10n-id', 'copyUrlFormButton');
|
$copyBtn.attr('data-l10n-id', 'copyUrlFormButton');
|
||||||
|
|
||||||
|
|
||||||
if (localStorage.length === 0) {
|
if (localStorage.length === 0) {
|
||||||
toggleHeader();
|
toggleHeader();
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,18 +69,26 @@ $(document).ready(function() {
|
||||||
// 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();
|
||||||
|
let file = '';
|
||||||
|
if (event.type === 'drop') {
|
||||||
|
if (event.originalEvent.dataTransfer.files.length > 1 || event.originalEvent.dataTransfer.files[0].size === 0){
|
||||||
|
$('.upload-window').removeClass('ondrag');
|
||||||
|
document.l10n.formatValue('uploadPageMultipleFilesAlert')
|
||||||
|
.then(str => {
|
||||||
|
alert(str);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
file = event.originalEvent.dataTransfer.files[0];
|
||||||
|
} else {
|
||||||
|
file = event.target.files[0];
|
||||||
|
}
|
||||||
|
|
||||||
$('#page-one').attr('hidden', true);
|
$('#page-one').attr('hidden', true);
|
||||||
$('#upload-error').attr('hidden', true);
|
$('#upload-error').attr('hidden', true);
|
||||||
$('#upload-progress').removeAttr('hidden');
|
$('#upload-progress').removeAttr('hidden');
|
||||||
//don't allow drag and drop when not on page-one
|
//don't allow drag and drop when not on page-one
|
||||||
$('body').off('drop', onUpload);
|
$('body').off('drop', onUpload);
|
||||||
|
|
||||||
let file = '';
|
|
||||||
if (event.type === 'drop') {
|
|
||||||
file = event.originalEvent.dataTransfer.files[0];
|
|
||||||
} else {
|
|
||||||
file = event.target.files[0];
|
|
||||||
}
|
|
||||||
const expiration = 24 * 60 * 60 * 1000; //will eventually come from a field
|
const expiration = 24 * 60 * 60 * 1000; //will eventually come from a field
|
||||||
|
|
||||||
const fileSender = new FileSender(file);
|
const fileSender = new FileSender(file);
|
||||||
|
@ -162,7 +169,7 @@ $(document).ready(function() {
|
||||||
$('#upload-progress').attr('hidden', true);
|
$('#upload-progress').attr('hidden', true);
|
||||||
$('#upload-error').attr('hidden', true);
|
$('#upload-error').attr('hidden', true);
|
||||||
$('#share-link').removeAttr('hidden');
|
$('#share-link').removeAttr('hidden');
|
||||||
}, 2000);
|
}, 1000);
|
||||||
|
|
||||||
populateFileList(JSON.stringify(fileData));
|
populateFileList(JSON.stringify(fileData));
|
||||||
document.l10n.formatValue('notifyUploadDone')
|
document.l10n.formatValue('notifyUploadDone')
|
||||||
|
|
|
@ -4,10 +4,11 @@ uploadPageHeader = Private, Encrypted File Sharing
|
||||||
uploadPageExplainer = Send files through a safe, private, and encrypted link that automatically expires to ensure your stuff does not remain online forever.
|
uploadPageExplainer = Send files through a safe, private, and encrypted link that automatically expires to ensure your stuff does not remain online forever.
|
||||||
|
|
||||||
uploadPageLearnMore = Learn more
|
uploadPageLearnMore = Learn more
|
||||||
uploadPageDropMessage = Drop your files here to start uploading
|
uploadPageDropMessage = Drop your file here to start uploading
|
||||||
uploadPageSizeMessage = For the most reliable operation, it’s best to keep your file under 1GB
|
uploadPageSizeMessage = For the most reliable operation, it’s best to keep your file under 1GB
|
||||||
uploadPageBrowseButton = Select a file on your computer
|
uploadPageBrowseButton = Select a file on your computer
|
||||||
.title = {uploadPageBrowseButtonTitle}
|
.title = {uploadPageBrowseButtonTitle}
|
||||||
|
uploadPageMultipleFilesAlert = Uploading multiple files or a folder is currently not supported.
|
||||||
|
|
||||||
uploadPageBrowseButtonTitle = Upload file
|
uploadPageBrowseButtonTitle = Upload file
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue