Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / phpmyadmin / js / jqplot / plugins / | server ip : 104.21.89.46 your ip : 172.70.100.188 H O M E |
Filename | /usr/share/phpmyadmin/js/jqplot/plugins/jqplot.byteFormatter.js |
Size | 1.21 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 10:12 |
Last modified | 05-Dec-2013 01:44 |
Last accessed | 07-Jul-2025 18:01 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* jqplot formatter for byte values
*
* @package phpMyAdmin
*/
(function($) {
"use strict";
var formatByte = function (val, index) {
var units = [
PMA_messages.strB,
PMA_messages.strKiB,
PMA_messages.strMiB,
PMA_messages.strGiB,
PMA_messages.strTiB,
PMA_messages.strPiB,
PMA_messages.strEiB
];
while (val >= 1024 && index <= 6) {
val /= 1024;
index++;
}
var format = '%.1f';
if (Math.floor(val) === val) {
format = '%.0f';
}
return $.jqplot.sprintf(
format + ' ' + units[index], val
);
};
/**
* The index indicates what unit the incoming data will be in.
* 0 for bytes, 1 for kilobytes and so on...
*/
$.jqplot.byteFormatter = function (index) {
index = index || 0;
return function (format, val) {
if (typeof val === 'number') {
val = parseFloat(val) || 0;
return formatByte(val, index);
} else {
return String(val);
}
};
};
})(jQuery);
/**
* jqplot formatter for byte values
*
* @package phpMyAdmin
*/
(function($) {
"use strict";
var formatByte = function (val, index) {
var units = [
PMA_messages.strB,
PMA_messages.strKiB,
PMA_messages.strMiB,
PMA_messages.strGiB,
PMA_messages.strTiB,
PMA_messages.strPiB,
PMA_messages.strEiB
];
while (val >= 1024 && index <= 6) {
val /= 1024;
index++;
}
var format = '%.1f';
if (Math.floor(val) === val) {
format = '%.0f';
}
return $.jqplot.sprintf(
format + ' ' + units[index], val
);
};
/**
* The index indicates what unit the incoming data will be in.
* 0 for bytes, 1 for kilobytes and so on...
*/
$.jqplot.byteFormatter = function (index) {
index = index || 0;
return function (format, val) {
if (typeof val === 'number') {
val = parseFloat(val) || 0;
return formatByte(val, index);
} else {
return String(val);
}
};
};
})(jQuery);