|
|
|
/*! © SpryMedia Ltd - datatables.net/license */
|
|
|
|
|
|
|
|
(function( factory ){
|
|
|
|
if ( typeof define === 'function' && define.amd ) {
|
|
|
|
// AMD
|
|
|
|
define( ['jquery', 'datatables.net'], function ( $ ) {
|
|
|
|
return factory( $, window, document );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
else if ( typeof exports === 'object' ) {
|
|
|
|
// CommonJS
|
|
|
|
module.exports = function (root, $) {
|
|
|
|
if ( ! root ) {
|
|
|
|
// CommonJS environments without a window global must pass a
|
|
|
|
// root. This will give an error otherwise
|
|
|
|
root = window;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! $ ) {
|
|
|
|
$ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window
|
|
|
|
require('jquery') :
|
|
|
|
require('jquery')( root );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! $.fn.dataTable ) {
|
|
|
|
require('datatables.net')(root, $);
|
|
|
|
}
|
|
|
|
|
|
|
|
return factory( $, root, root.document );
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// Browser
|
|
|
|
factory( jQuery, window, document );
|
|
|
|
}
|
|
|
|
}(function( $, window, document, undefined ) {
|
|
|
|
'use strict';
|
|
|
|
var DataTable = $.fn.dataTable;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When dealing with computer file sizes, it is common to append a post fix
|
|
|
|
* such as B, KB, MB or GB to a string in order to easily denote the order of
|
|
|
|
* magnitude of the file size. This plug-in allows sorting to take these
|
|
|
|
* indicates of size into account.
|
|
|
|
*
|
|
|
|
* A counterpart type detection plug-in is also available.
|
|
|
|
*
|
|
|
|
* @name File size
|
|
|
|
* @summary Sort abbreviated file sizes correctly (8MB, 4KB, etc)
|
|
|
|
* @author Allan Jardine - datatables.net
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* $('#example').DataTable( {
|
|
|
|
* columnDefs: [
|
|
|
|
* { type: 'file-size', targets: 0 }
|
|
|
|
* ]
|
|
|
|
* } );
|
|
|
|
*/
|
|
|
|
DataTable.ext.type.order['file-size-pre'] = function (data) {
|
|
|
|
if (data === null || data === '') {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
var matches = data.match(/^(\d+(?:\.\d+)?)\s*([a-z]+)/i);
|
|
|
|
var multipliers = {
|
|
|
|
b: 1,
|
|
|
|
bytes: 1,
|
|
|
|
kb: 1000,
|
|
|
|
kib: 1024,
|
|
|
|
mb: 1000000,
|
|
|
|
mib: 1048576,
|
|
|
|
gb: 1000000000,
|
|
|
|
gib: 1073741824,
|
|
|
|
tb: 1000000000000,
|
|
|
|
tib: 1099511627776,
|
|
|
|
pb: 1000000000000000,
|
|
|
|
pib: 1125899906842624,
|
|
|
|
};
|
|
|
|
if (matches) {
|
|
|
|
var multiplier = multipliers[matches[2].toLowerCase()];
|
|
|
|
return parseFloat(matches[1]) * multiplier;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return DataTable;
|
|
|
|
}));
|