On my rutorrent installation a modified version of the plugin "diskspace" run, so that not the diskspace is shown in the bottom bar but the quota each user have. The quotas are softcoded, so that more space can be used.
All in all, the values for free space get negative and the common.js function "theConverter" converts only positive values.
here the actual code:
Code:
bytes: function(bt, p)
{
p = (p == null) ? 1 : p;
var a = new Array(theUILang.bytes, theUILang.KB, theUILang.MB, theUILang.GB, theUILang.TB, theUILang.PB);
var ndx = 0;
if(bt == 0)
ndx = 1;
else
{
if(bt < 1024)
{
bt /= 1024;
ndx = 1;
}
else
while(bt >= 1024)
{
bt /= 1024;
ndx++;
}
}
}
return(this.round(bt, p) + " " + a[ndx]);
},
and the modified version:
Code:
bytes: function(bt, p)
{
p = (p == null) ? 1 : p;
var a = new Array(theUILang.bytes, theUILang.KB, theUILang.MB, theUILang.GB, theUILang.TB, theUILang.PB);
var ndx = 0;
while(Math.abs(bt) >= 1024)
{
bt /= 1024;
ndx++;
}
}
}
return(this.round(bt, p) + " " + a[ndx]);
},
So my question is, affects these changes some other code?
Furthermore, in my opinion the two if statements are redundant, because the value is smaller than 1024, so nothing should be changed. But with the ordinary code all values are converter at least to KiB.
Thanks in advance.
All in all, the values for free space get negative and the common.js function "theConverter" converts only positive values.
here the actual code:
Code:
bytes: function(bt, p)
{
p = (p == null) ? 1 : p;
var a = new Array(theUILang.bytes, theUILang.KB, theUILang.MB, theUILang.GB, theUILang.TB, theUILang.PB);
var ndx = 0;
if(bt == 0)
ndx = 1;
else
{
if(bt < 1024)
{
bt /= 1024;
ndx = 1;
}
else
while(bt >= 1024)
{
bt /= 1024;
ndx++;
}
}
}
return(this.round(bt, p) + " " + a[ndx]);
},
and the modified version:
Code:
bytes: function(bt, p)
{
p = (p == null) ? 1 : p;
var a = new Array(theUILang.bytes, theUILang.KB, theUILang.MB, theUILang.GB, theUILang.TB, theUILang.PB);
var ndx = 0;
while(Math.abs(bt) >= 1024)
{
bt /= 1024;
ndx++;
}
}
}
return(this.round(bt, p) + " " + a[ndx]);
},
So my question is, affects these changes some other code?
Furthermore, in my opinion the two if statements are redundant, because the value is smaller than 1024, so nothing should be changed. But with the ordinary code all values are converter at least to KiB.
Thanks in advance.