Add the filesize in QR thumnbails' title.

This commit is contained in:
Nicolas Stepien 2012-06-13 23:55:00 +02:00
parent 414846c1df
commit 431bcf6ee1
2 changed files with 4 additions and 4 deletions

View File

@ -477,7 +477,7 @@
size /= 1024;
unit++;
}
size = unit > 1 ? Math.round(a * 100) / 100 : Math.round(size);
size = unit > 1 ? Math.round(size * 100) / 100 : Math.round(size);
return "" + size + " " + ['B', 'KB', 'MB', 'GB'][unit];
}
});
@ -1692,7 +1692,7 @@
var fileUrl, img, url,
_this = this;
this.file = file;
this.el.title = file.name;
this.el.title = "" + file.name + " (" + ($.bytesToString(file.size)) + ")";
if (QR.spoiler) {
$('label', this.el).hidden = false;
}

View File

@ -366,7 +366,7 @@ $.extend $,
if unit > 1
# Keep the size as a float if the size is greater than 2^20 B.
# Round to hundredth.
Math.round(a * 100) / 100
Math.round(size * 100) / 100
else
# Round to an integer otherwise.
Math.round size
@ -1261,7 +1261,7 @@ QR =
QR.replies.push @
setFile: (@file) ->
@el.title = file.name
@el.title = "#{file.name} (#{$.bytesToString file.size})"
$('label', @el).hidden = false if QR.spoiler
if file.type is 'application/pdf'
@el.style.backgroundImage = null