From ed472d705e893a47d23453d4636186b01f5349dd Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Oct 21 2018 16:47:46 +0000 Subject: Fix #115 - Display file size when uploading --- diff --git a/CHANGELOG b/CHANGELOG index fda3386..97f17c2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ Revision history for Lufi - Option to force "Burn after reading" for each uploaded file - Use GzipStatic and StaticCache plugins for speed - Allow to block files by setting an abuse field in DB + - Display file size when uploading 0.02.2 2017-09-18 - Fix cron tasks bug diff --git a/themes/default/public/js/lufi-up.js b/themes/default/public/js/lufi-up.js index e594927..e60787c 100644 --- a/themes/default/public/js/lufi-up.js +++ b/themes/default/public/js/lufi-up.js @@ -137,6 +137,7 @@ function uploadFile(i, delay, del_at_first_view) { // Get the file and properties var file = window.fileList[i]; var name = escapeHtml(file.name); + var size = filesize(file.size); var parts = Math.ceil(file.size/window.sliceLength); if (parts === 0) { parts = 1; @@ -152,7 +153,7 @@ function uploadFile(i, delay, del_at_first_view) { '', '', '
', - '', name, '', + '', name, ' (', size,')', '

', '
', '
', @@ -266,12 +267,13 @@ function updateProgressBar(data) { $('#parts-'+window.fc).remove(); var n = $('#name-'+window.fc); + var s = $('#size-'+window.fc); var d = $('
'); var url = baseURL+'r/'+short+'#'+key; var del_url = actionURL+'d/'+short+'/'+data.token; var links = encodeURIComponent('["'+short+'"]'); var limit = (delay === 0) ? i18n.noLimit : i18n.expiration+' '+moment.unix(delay * 86400 + created_at).locale(window.navigator.language).format('LLLL'); - n.html(n.html()+'
'+limit); + n.html(n.html()+' '+s.html()+'
'+limit); d.html(['
', '
', '', @@ -293,6 +295,7 @@ function updateProgressBar(data) { '', '
', '
'].join('')); + s.remove(); var p2 = dp.parent(); var p1 = p2.parent(); diff --git a/themes/default/templates/index.html.ep b/themes/default/templates/index.html.ep index 7fcb687..4d239b2 100644 --- a/themes/default/templates/index.html.ep +++ b/themes/default/templates/index.html.ep @@ -101,5 +101,6 @@ %= javascript '/partial/index.js' %= javascript '/js/sjcl.js' %= javascript '/js/moment-with-locales.min.js' +%= javascript '/js/filesize.min.js' %= javascript '/js/lufi-up.js' % }