Open MrCaspan opened 7 years ago
Anyone?? Is this project even active anymore?
I took matters into my own hands and created the code myself
for anyone looking to add this to their min project please add this function to the beginning of the min file after the comment but before the !function(e,t){...
function fB(b,d){if(b==0)return 0;var k=1000,dm=d+1||3,s=['Bytes','KB','MB','GB','TB','PB','EB','ZB','YB'],i=Math.floor(Math.log(b)/Math.log(k));return parseFloat((b/Math.pow(k,i)).toFixed(dm))+' '+[i];}
then search for
p=Math.round(p/1024)
and replace it with
p=fB(p,1)
and then find
i=Math.round(e[o].size/1024)
an replace it with
i=fB(e[o].size,1)
this will then give you a proper readout for your Bytes, KB, MB, GB etc..
var
lang: 'en',
----------------------------------------------------------------------------------------
ss.formatBytes = function(bytes,lang) {
if(lang==='ar')
var sizes = ["بايت", "كيلو", "ميقا","جيقا","تيرا"];
else
var sizes = ["Bytes", "KB", "MB","GB","TB"];
var k = 1024;
var i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i+1];
};
----------------------------------------------------------------------------------------
if ( size && !self._sizeFlags[key] ) {
if ( sizeBox ) {
sizeBox.innerHTML = ss.formatBytes(size,this._opts.lang);
}
----------------------------------------------------------------------------------------
// Inject file size into size box
if ( sizeBox ) {
sizeBox.innerHTML = ss.formatBytes(fileObj.size,this._opts.lang);
}
Is there any way that you can add a function that will give the proper reduces file size? 109834K is confusing for an end user instead of 109 MB