tablesorter/dist/js/parsers/parser-globalize.min.js
2015-10-31 11:06:09 -05:00

14 lines
1.5 KiB
JavaScript

/*! Parser: jQuery Globalize - updated 10/31/2015 (v2.24.0) */
/* Extract localized data using jQuery's Globalize parsers; set
Globalize.locale( 'xx' ) in the globalize settings */
/*jshint jquery:true, newcap: false */
/*global Globalize:false */
!function(a){"use strict";/*! jQuery Globalize date parser (https://github.com/jquery/globalize#date-module) */
a.tablesorter.addParser({id:"globalize-date",is:function(){return!1},format:function(a,b,c,d){var e,f,g=b.config,
// add options to 'config.globalize' for all columns --> globalize : { skeleton: 'GyMMMd' }
// or per column by using the column index --> globalize : { 0 : { datetime: 'medium' } }
h=g.globalize&&(g.globalize[d]||g.globalize)||{};return Globalize&&(e="object"==typeof h.lang?h.lang:Globalize(h.lang||"en")),f=e&&e.dateParser?e.dateParser(h)(a):a?new Date(a):a,f instanceof Date&&isFinite(f)?f.getTime():a},type:"numeric"}),/*! jQuery Globalize number parser (https://github.com/jquery/globalize#number-module) */
a.tablesorter.addParser({id:"globalize-number",is:function(){return!1},format:function(b,c,d,e){var f,g,h=c.config,
// add options to 'config.globalize' for all columns --> globalize : { skeleton: 'GyMMMd' }
// or per column by using the column index --> globalize : { 0 : { datetime: 'medium' } }
i=h.globalize&&(h.globalize[e]||h.globalize)||{};return Globalize&&(f="object"==typeof i.lang?i.lang:Globalize(i.lang||"en")),g=f&&f.numberParser?f.numberParser(i)(b):b?a.tablesorter.formatFloat((b||"").replace(/[^\w,. \-()]/g,""),c):b,b&&"number"==typeof g?g:b},type:"numeric"})}(jQuery);