AdminerReadableTableSize show '-' for "empty" tables with less than 16KiB and use the SI annotation
This commit is contained in:
parent
99a9242da9
commit
6e089e9aa1
1 changed files with 2 additions and 2 deletions
|
|
@ -17,14 +17,14 @@ class AdminerReadableTableSize
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->prepend = <<<EOT
|
$this->prepend = <<<EOT
|
||||||
function AdminerReadableTableSizeConvert(a,b){if(0==a)return"0 Bytes";var c=1024,d=b||2,e=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],f=Math.floor(Math.log(a)/Math.log(c));return parseFloat((a/Math.pow(c,f)).toFixed(d))+" "+e[f]}
|
function AdminerReadableTableSizeConvert(a,b){if(0==a)return"0 Bytes";var c=1024,d=b||2,e=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],f=Math.floor(Math.log(a)/Math.log(c));return parseFloat((a/Math.pow(c,f)).toFixed(d))+" "+e[f]}
|
||||||
function AdminerReadableTableSize(field) {
|
function AdminerReadableTableSize(field) {
|
||||||
var rows = document.querySelectorAll('[id*="'+field+'"]');
|
var rows = document.querySelectorAll('[id*="'+field+'"]');
|
||||||
for (var i = 0; i < rows.length; i++) {
|
for (var i = 0; i < rows.length; i++) {
|
||||||
var row = rows[i];
|
var row = rows[i];
|
||||||
var bytes = row.innerText.replace(/,/g, '');
|
var bytes = row.innerText.replace(/,/g, '');
|
||||||
var sized = '-';
|
var sized = '-';
|
||||||
if (bytes > 0) {
|
if (bytes > 16384) {
|
||||||
sized = AdminerReadableTableSizeConvert(bytes, 2);
|
sized = AdminerReadableTableSizeConvert(bytes, 2);
|
||||||
}
|
}
|
||||||
row.title = row.title+' [' + row.innerText + ' Bytes]';
|
row.title = row.title+' [' + row.innerText + ' Bytes]';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue