2015-10-26 15:56:01 +00:00
|
|
|
/*! Parser: jQuery Globalize - updated 10/26/2015 (v2.23.6) */
|
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-05-02 20:15:56 +00:00
|
|
|
/*jshint jquery:true */
|
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 ) {
|
|
|
|
globalize = typeof options.lang === 'object' ? options.lang : Globalize( options.lang || 'en' );
|
|
|
|
}
|
|
|
|
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 ) {
|
|
|
|
globalize = typeof options.lang === 'object' ? options.lang : Globalize( options.lang || 'en' );
|
|
|
|
}
|
|
|
|
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 );
|