Sha256: 3fc7a3d2f9a19419a86f6c9eebae9595bab61d4e7a29130566732ca5fbf3fd2c

Contents?: true

Size: 1.87 KB

Versions: 3

Compression:

Stored size: 1.87 KB

Contents

/*! Parser: jQuery Globalize - updated 5/17/2015 (v2.22.0) */
/* Extract localized data using jQuery's Globalize parsers; set
 Globalize.locale( 'xx' ) prior to initializing tablesorter! */
/*jshint jquery:true */
;( function( $ ) {
'use strict';

	/*! jQuery Globalize date parser (https://github.com/jquery/globalize#date-module) */
	/* demo: http://jsfiddle.net/Mottie/0j18Lw8r/ */
	$.tablesorter.addParser({
		id: 'globalize-date',
		is: function () {
			return false;
		},
		format: function ( str, table, cell, cellIndex ) {
			var 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 ) || {},
			date = Globalize && Globalize.dateParser ? Globalize.dateParser( options )( str ) :
				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) */
	/* demo: http://jsfiddle.net/Mottie/0j18Lw8r/ */
	$.tablesorter.addParser({
		id: 'globalize-number',
		is: function () {
			return false;
		},
		format: function ( str, table, cell, cellIndex ) {
			var 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 ) || {},
			num = Globalize && Globalize.numberParser ? Globalize.numberParser( options )( str ) :
				str ? $.tablesorter.formatFloat( ( str || '' ).replace( /[^\w,. \-()]/g, '' ), table ) : str;
			return str && typeof num === 'number' ? num : str;
		},
		type: 'numeric'
	});

})( jQuery );

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jquery-tablesorter-1.17.2 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-globalize.js
jquery-tablesorter-1.17.1 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-globalize.js
jquery-tablesorter-1.17.0 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-globalize.js