2015-11-02 05:44:14 +00:00
|
|
|
/*! Parser: jQuery Globalize - updated 11/2/2015 (v2.24.1) */
|
2015-05-02 20:15:56 +00:00
|
|
|
/* Extract localized data using jQuery's Globalize parsers; set
|
2015-10-26 15:56:01 +00:00
|
|
|
Globalize.locale( 'xx' ) in the globalize settings */
|
2015-10-30 20:30:23 +00:00
|
|
|
/*jshint jquery:true, newcap: false */
|
2015-07-28 20:57:01 +00:00
|
|
|
/*global Globalize:false */
|
2015-05-02 20:15:56 +00:00
|
|
|
;( function( $ ) {
|
2015-07-23 04:29:51 +00:00
|
|
|
'use strict';
|
2015-05-02 20:15:56 +00:00
|
|
|
|
|
|
|
/*! jQuery Globalize date parser (https://github.com/jquery/globalize#date-module) */
|
|
|
|
$.tablesorter.addParser({
|
|
|
|
id: 'globalize-date',
|
|
|
|
is: function () {
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
format: function ( str, table, cell, cellIndex ) {
|
2015-10-26 15:56:01 +00:00
|
|
|
var globalize, date,
|
|
|
|
c = table.config,
|
|
|
|
// add options to 'config.globalize' for all columns --> globalize : { skeleton: 'GyMMMd' }
|
|
|
|
// or per column by using the column index --> globalize : { 0 : { datetime: 'medium' } }
|
|
|
|
options = c.globalize && ( c.globalize[ cellIndex ] || c.globalize ) || {};
|
|
|
|
if ( Globalize ) {
|
2015-11-02 05:44:14 +00:00
|
|
|
globalize = typeof options.Globalize === 'object' ?
|
|
|
|
// initialized Globalize object
|
|
|
|
options.Globalize :
|
|
|
|
// Globalize initialized from "lang" option
|
|
|
|
Globalize( options.lang || 'en' );
|
|
|
|
if ( !options.Globalize ) {
|
|
|
|
// cache the object
|
|
|
|
options.Globalize = globalize;
|
|
|
|
}
|
2015-10-26 15:56:01 +00:00
|
|
|
}
|
|
|
|
date = globalize && globalize.dateParser ? globalize.dateParser( options )( str ) :
|
2015-05-02 20:15:56 +00:00
|
|
|
str ? new Date( str ) : str;
|
|
|
|
return date instanceof Date && isFinite( date ) ? date.getTime() : str;
|
|
|
|
},
|
|
|
|
type: 'numeric'
|
|
|
|
});
|
|
|
|
|
|
|
|
/*! jQuery Globalize number parser (https://github.com/jquery/globalize#number-module) */
|
|
|
|
$.tablesorter.addParser({
|
|
|
|
id: 'globalize-number',
|
|
|
|
is: function () {
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
format: function ( str, table, cell, cellIndex ) {
|
2015-10-26 15:56:01 +00:00
|
|
|
var globalize, num,
|
|
|
|
c = table.config,
|
|
|
|
// add options to 'config.globalize' for all columns --> globalize : { skeleton: 'GyMMMd' }
|
|
|
|
// or per column by using the column index --> globalize : { 0 : { datetime: 'medium' } }
|
|
|
|
options = c.globalize && ( c.globalize[ cellIndex ] || c.globalize ) || {};
|
|
|
|
if ( Globalize ) {
|
2015-11-02 05:44:14 +00:00
|
|
|
globalize = typeof options.Globalize === 'object' ?
|
|
|
|
// initialized Globalize object
|
|
|
|
options.Globalize :
|
|
|
|
// Globalize initialized from "lang" option
|
|
|
|
Globalize( options.lang || 'en' );
|
|
|
|
if ( !options.Globalize ) {
|
|
|
|
// cache the object
|
|
|
|
options.Globalize = globalize;
|
|
|
|
}
|
2015-10-26 15:56:01 +00:00
|
|
|
}
|
|
|
|
num = globalize && globalize.numberParser ? globalize.numberParser( options )( str ) :
|
2015-05-02 20:15:56 +00:00
|
|
|
str ? $.tablesorter.formatFloat( ( str || '' ).replace( /[^\w,. \-()]/g, '' ), table ) : str;
|
|
|
|
return str && typeof num === 'number' ? num : str;
|
|
|
|
},
|
|
|
|
type: 'numeric'
|
|
|
|
});
|
|
|
|
|
|
|
|
})( jQuery );
|