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

Commit

Permalink
fixing things
Browse files Browse the repository at this point in the history
  • Loading branch information
dnarcese committed Jul 17, 2017
1 parent fcdb905 commit 20afd7a
Show file tree
Hide file tree
Showing 13 changed files with 2,467 additions and 842 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,20 @@ Pull requests are always welcome! Feel free to check out the list of ["good firs
## License

[Mozilla Public License Version 2.0](LICENSE)

**Entypo**

Copyright (C) 2012 by Daniel Bruce

Author: Daniel Bruce
License: SIL (http://scripts.sil.org/OFL)
Homepage: http://www.entypo.com


**Font Awesome**

Copyright (C) 2016 by Dave Gandy

Author: Dave Gandy
License: SIL ()
Homepage: http://fortawesome.github.com/Font-Awesome/
20 changes: 15 additions & 5 deletions frontend/src/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ const $ = require('jquery');
require('jquery-circle-progress');

const Raven = window.Raven;

$(document).ready(function() {
$('#download-progress').hide();
$('.send-new').click(() => {
window.location.replace(`${window.location.origin}`);
});
const filename = $('#dl-filename').html();

//initiate progress bar
$('#dl-progress').circleProgress({
value: 0.0,
Expand All @@ -29,10 +30,19 @@ $(document).ready(function() {
// update progress bar
$('#dl-progress').circleProgress('value', percent);
$('.percent-number').html(`${Math.floor(percent * 100)}`);
$('.progress-text').append(
` (${(progress[0] / 1000000).toFixed(2)}MB of ${(progress[1] /
1000000).toFixed(2)}MB)`
);
if (progress[1] < 1000000) {
$('.progress-text').html(
`${filename} (${(progress[0] / 1000).toFixed(1)}KB of ${(progress[1] / 1000).toFixed(1)}KB)`
);
} else if (progress[1] < 1000000000) {
$('.progress-text').html(
`${filename} (${(progress[0] / 1000000).toFixed(1)}MB of ${(progress[1] / 1000000).toFixed(1)}MB)`
);
} else {
$('.progress-text').html(
`${filename} (${(progress[0] / 1000000).toFixed(1)}MB of ${(progress[1] / 1000000000).toFixed(1)}GB)`
);
}
//on complete
if (percent === 1) {
fileReceiver.removeAllListeners('progress');
Expand Down
45 changes: 25 additions & 20 deletions frontend/src/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ $(document).ready(function() {
$('#link').attr('disabled', false);
$copyBtn.html('Copy to Clipboard');

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

if (localStorage.length === 0) {
toggleHeader();
Expand All @@ -47,7 +47,7 @@ $(document).ready(function() {
//disable button for 3s
$copyBtn.attr('disabled', true);
$('#link').attr('disabled', true);
$copyBtn.html('<span class=\'icon-check\'></span>');
$copyBtn.html('<span class="icon-check"></span>');
window.setTimeout(() => {
$copyBtn.attr('disabled', false);
$('#link').attr('disabled', false);
Expand All @@ -70,13 +70,14 @@ $(document).ready(function() {
});
// link back to home page
$('.send-new').click(() => {
$('#page-one').show();
$('#upload-progress').hide();
$('#share-link').hide();
$('#upload-error').hide();
$copyBtn.attr('disabled', false);
$('#link').attr('disabled', false);
$copyBtn.html('Copy to Clipboard');
$('.upload-window').removeClass('ondrag');
$('#page-one').show();
});
//cancel the upload
$('#cancel-upload').click(() => {});
Expand All @@ -94,23 +95,25 @@ $(document).ready(function() {
const fileSender = new FileSender(file);
fileSender.on('progress', progress => {
$('#page-one').hide();
$('#upload-progress').show();
$('#upload-error').hide();
$('#upload-progress').show();
const percent = progress[0] / progress[1];
// update progress bar
$('#ul-progress').circleProgress('value', percent);
$('.percent-number').html(`${Math.floor(percent * 100)}`);
if (progress[1] < 1000000000) {
$('#ul-progress').circleProgress().on('circle-animation-end', function() {
$('.percent-number').html(`${Math.floor(percent * 100)}`);
});
if (progress[1] < 1000000) {
$('.progress-text').html(
`${file.name} (${(progress[0] / 1000).toFixed(1)}KB of ${(progress[1] / 1000).toFixed(1)}KB)`
);
} else if (progress[1] < 1000000000) {
$('.progress-text').html(
`${file.name} (${(progress[0] / 1000000).toFixed(
1
)}MB of ${(progress[1] / 1000000).toFixed(1)}MB)`
`${file.name} (${(progress[0] / 1000000).toFixed(1)}MB of ${(progress[1] / 1000000).toFixed(1)}MB)`
);
} else {
$('.progress-text').html(
`${file.name} (${(progress[0] / 1000000).toFixed(
1
)}MB of ${(progress[1] / 1000000000).toFixed(1)}GB)`
`${file.name} (${(progress[0] / 1000000).toFixed(1)}MB of ${(progress[1] / 1000000000).toFixed(1)}GB)`
);
}
});
Expand Down Expand Up @@ -159,8 +162,8 @@ $(document).ready(function() {
t = window.setTimeout(() => {
$('#page-one').hide();
$('#upload-progress').hide();
$('#share-link').show();
$('#upload-error').hide();
$('#share-link').show();
}, 2000);

populateFileList(JSON.stringify(fileData));
Expand Down Expand Up @@ -224,10 +227,10 @@ $(document).ready(function() {
name.appendChild(cellText);

// create delete button
del.innerHTML =
'<span class=\'icon-cancel-1\' title=\'Delete\' style=\'margin-left: -7px\'></span>';
del.innerHTML = '<span class="icon-cancel-1" title="Delete"></span>';

link.innerHTML = '<span class=\'icon-docs\' title=\'Copy URL\'></span>';
link.innerHTML = '<span class="icon-docs" title="Copy URL"></span>';
link.style.color = '#0A8DFF';
//copy link to clipboard when icon clicked
$(link).click(function() {
const aux = document.createElement('input');
Expand All @@ -236,7 +239,10 @@ $(document).ready(function() {
aux.select();
document.execCommand('copy');
document.body.removeChild(aux);
notify('The link has been copied to your clipboard.');
link.innerHTML = 'Copied!';
window.setTimeout(() => {
link.innerHTML = '<span class="icon-docs" title="Copy URL"></span>';
}, 500);
});

file.creationDate = new Date(file.creationDate);
Expand Down Expand Up @@ -282,7 +288,7 @@ $(document).ready(function() {
// create popup
popupDiv.classList.add('popup');
$popupText.html(
'<span class=\'del-file\'>Delete</span><span class=\'nvm\' > Nevermind</span>'
'<span class="del-file">Delete</span><span class="nvm" > Nevermind</span>'
);

// delete file
Expand All @@ -296,8 +302,7 @@ $(document).ready(function() {
document.getElementById('delete-file').onclick = () => {
FileSender.delete(file.fileId, file.deleteToken).then(() => {
localStorage.removeItem(file.fileId);
toggleHeader();
$('.send-new').click();
location.reload();
});
};

Expand Down
Loading

0 comments on commit 20afd7a

Please sign in to comment.