jquery-tablesorter 1.19.3 → 1.19.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +26 -22
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.combined.js +25 -16
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +24 -15
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +18 -19
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-range.js +87 -3
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js +4 -5
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +28 -30
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-image.js +1 -0
- data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +80 -17
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-type-insideRange.js +6 -4
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-math.js +50 -18
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +501 -449
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-print.js +20 -8
- data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-sortTbodies.js +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62741a2df0ebdcde5ec17b1d93db4b19e86f6264
|
4
|
+
data.tar.gz: d1c841c3f0905a99e159fb6727be8dd238617ab7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1807a2f47eb7238a2d388c3295619cc2ec975caeec0cdf9203cf520f79417916fe161e06f5acc3dfe684afa0f2071d2f577e8544c06ae2b10d83e6cf8a95dcd0
|
7
|
+
data.tar.gz: 8b5958478a5222a04a117ab2fafdb613372851d8f8e3c7ad913fe2c29f514a95218808f2ddb46bef105c175c70954b22053102c5f6ce4c183c8ae886068c1a76
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Simple integration of jquery-tablesorter into the asset pipeline.
|
6
6
|
|
7
|
-
Current tablesorter version: 2.24.
|
7
|
+
Current tablesorter version: 2.24.6 (11/22/2015), [documentation]
|
8
8
|
|
9
9
|
Any issue associated with the js/css files, please report to [Mottie's fork].
|
10
10
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
* tablesorter (FORK) pager plugin
|
3
|
-
* updated 11/
|
3
|
+
* updated 11/22/2015 (v2.24.6)
|
4
4
|
*/
|
5
5
|
/*jshint browser:true, jquery:true, unused:false */
|
6
6
|
;(function($) {
|
@@ -126,13 +126,13 @@
|
|
126
126
|
$this = this,
|
127
127
|
|
128
128
|
// hide arrows at extremes
|
129
|
-
pagerArrows = function(p, disable) {
|
129
|
+
pagerArrows = function( table, p, disable ) {
|
130
130
|
var a = 'addClass',
|
131
131
|
r = 'removeClass',
|
132
132
|
d = p.cssDisabled,
|
133
133
|
dis = !!disable,
|
134
134
|
first = ( dis || p.page === 0 ),
|
135
|
-
tp =
|
135
|
+
tp = getTotalPages( table, p ),
|
136
136
|
last = ( dis || (p.page === tp - 1) || tp === 0 );
|
137
137
|
if ( p.updateArrows ) {
|
138
138
|
p.$container.find(p.cssFirst + ',' + p.cssPrev)[ first ? a : r ](d).attr('aria-disabled', first);
|
@@ -170,11 +170,11 @@
|
|
170
170
|
if (p.countChildRows) { t.push(c.cssChildRow); }
|
171
171
|
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for "pageSize" method
|
172
172
|
c.totalRows = p.totalRows;
|
173
|
-
parsePageNumber( p );
|
173
|
+
parsePageNumber( table, p );
|
174
174
|
calcFilters(table, p);
|
175
175
|
c.filteredRows = p.filteredRows;
|
176
176
|
p.filteredPages = Math.ceil( p.filteredRows / sz ) || 0;
|
177
|
-
if (
|
177
|
+
if ( getTotalPages( table, p ) >= 0 ) {
|
178
178
|
t = (p.size * p.page > p.filteredRows) && completed;
|
179
179
|
p.page = (t) ? p.pageReset || 0 : p.page;
|
180
180
|
p.startRow = (t) ? p.size * p.page + 1 : (p.filteredRows === 0 ? 0 : p.size * p.page + 1);
|
@@ -203,7 +203,7 @@
|
|
203
203
|
});
|
204
204
|
if ( p.$goto.length ) {
|
205
205
|
t = '';
|
206
|
-
options = buildPageSelect(p);
|
206
|
+
options = buildPageSelect( table, p );
|
207
207
|
len = options.length;
|
208
208
|
for (indx = 0; indx < len; indx++) {
|
209
209
|
t += '<option value="' + options[indx] + '">' + options[indx] + '</option>';
|
@@ -221,7 +221,7 @@
|
|
221
221
|
});
|
222
222
|
}
|
223
223
|
}
|
224
|
-
pagerArrows(p);
|
224
|
+
pagerArrows( table, p );
|
225
225
|
fixHeight(table, p);
|
226
226
|
if (p.initialized && completed !== false) {
|
227
227
|
if (c.debug) {
|
@@ -238,11 +238,11 @@
|
|
238
238
|
}
|
239
239
|
},
|
240
240
|
|
241
|
-
buildPageSelect = function(p) {
|
241
|
+
buildPageSelect = function( table, p ) {
|
242
242
|
// Filter the options page number link array if it's larger than 'maxOptionSize'
|
243
243
|
// as large page set links will slow the browser on large dom inserts
|
244
244
|
var i, central_focus_size, focus_option_pages, insert_index, option_length, focus_length,
|
245
|
-
pg =
|
245
|
+
pg = getTotalPages( table, p ) || 1,
|
246
246
|
// make skip set size multiples of 5
|
247
247
|
skip_set_size = Math.ceil( ( pg / p.maxOptionSize ) / 5 ) * 5,
|
248
248
|
large_collection = pg > p.maxOptionSize,
|
@@ -373,7 +373,7 @@
|
|
373
373
|
p.size = parsePageSize( p, p.$size.val(), 'get' );
|
374
374
|
p.$size.val( parsePageSize( p, p.size, 'set' ) );
|
375
375
|
$.data(table, 'pagerLastSize', p.size);
|
376
|
-
pagerArrows(p);
|
376
|
+
pagerArrows( table, p );
|
377
377
|
if ( !p.removeRows ) {
|
378
378
|
hideRows(table, p);
|
379
379
|
$(table).bind('sortEnd filterEnd '.split(' ').join(table.config.namespace + 'pager '), function(){
|
@@ -661,7 +661,7 @@
|
|
661
661
|
showAllRows = function(table, p) {
|
662
662
|
var index, $controls, len;
|
663
663
|
if ( p.ajax ) {
|
664
|
-
pagerArrows(p, true);
|
664
|
+
pagerArrows( table, p, true );
|
665
665
|
} else {
|
666
666
|
$.data(table, 'pagerLastPage', p.page);
|
667
667
|
$.data(table, 'pagerLastSize', p.size);
|
@@ -719,8 +719,7 @@
|
|
719
719
|
}
|
720
720
|
// abort page move if the table has filters and has not been initialized
|
721
721
|
if (p.ajax && ts.hasWidget(table, 'filter') && !c.widgetOptions.filter_initialized) { return; }
|
722
|
-
|
723
|
-
parsePageNumber( p );
|
722
|
+
parsePageNumber( table, p );
|
724
723
|
calcFilters(table, p);
|
725
724
|
// fixes issue where one currentFilter is [] and the other is ['','',''],
|
726
725
|
// making the next if comparison think the filters are different (joined by commas). Fixes #202.
|
@@ -768,29 +767,33 @@
|
|
768
767
|
}
|
769
768
|
},
|
770
769
|
|
770
|
+
getTotalPages = function( table, p ) {
|
771
|
+
return ts.hasWidget( table, 'filter' ) ? Math.min( p.totalPages, p.filteredPages ) : p.totalPages;
|
772
|
+
},
|
773
|
+
|
771
774
|
// set to either set or get value
|
772
775
|
parsePageSize = function( p, size, mode ) {
|
773
776
|
var s = parseInt( size, 10 ) || p.size || p.settings.size || 10,
|
774
777
|
// if select does not contain an "all" option, use size
|
775
778
|
setAll = p.$size.find( 'option[value="all"]' ).length ? 'all' : p.totalRows;
|
776
779
|
return /all/i.test( size ) || s === p.totalRows ?
|
777
|
-
// "get" to
|
780
|
+
// "get" to get `p.size` or "set" to set `p.$size.val()`
|
778
781
|
( mode === 'get' ? p.totalRows : setAll ) :
|
779
782
|
( mode === 'get' ? s : p.size );
|
780
783
|
},
|
781
784
|
|
782
|
-
parsePageNumber = function( p ) {
|
783
|
-
var min =
|
785
|
+
parsePageNumber = function( table, p ) {
|
786
|
+
var min = getTotalPages( table, p ) - 1;
|
784
787
|
p.page = parseInt( p.page, 10 );
|
785
788
|
if ( p.page < 0 || isNaN( p.page ) ) { p.page = 0; }
|
786
|
-
if ( p.page > min &&
|
789
|
+
if ( p.page > min && min >= 0 ) { p.page = min; }
|
787
790
|
return p.page;
|
788
791
|
},
|
789
792
|
|
790
793
|
setPageSize = function(table, size, p) {
|
791
794
|
p.size = parsePageSize( p, size, 'get' );
|
792
795
|
p.$size.val( parsePageSize( p, p.size, 'set' ) );
|
793
|
-
$.data(table, 'pagerLastPage', parsePageNumber( p ) );
|
796
|
+
$.data(table, 'pagerLastPage', parsePageNumber( table, p ) );
|
794
797
|
$.data(table, 'pagerLastSize', p.size);
|
795
798
|
p.totalPages = Math.ceil( p.totalRows / p.size );
|
796
799
|
p.filteredPages = Math.ceil( p.filteredRows / p.size );
|
@@ -803,14 +806,15 @@
|
|
803
806
|
},
|
804
807
|
|
805
808
|
moveToLastPage = function(table, p) {
|
806
|
-
p.page = (
|
809
|
+
p.page = getTotalPages( table, p ) - 1;
|
807
810
|
moveToPage(table, p);
|
808
811
|
},
|
809
812
|
|
810
813
|
moveToNextPage = function(table, p) {
|
811
814
|
p.page++;
|
812
|
-
|
813
|
-
|
815
|
+
var last = getTotalPages( table, p ) - 1;
|
816
|
+
if ( p.page >= last ) {
|
817
|
+
p.page = last;
|
814
818
|
}
|
815
819
|
moveToPage(table, p);
|
816
820
|
},
|
@@ -855,7 +859,7 @@
|
|
855
859
|
size = p.$size.find('option[selected]').val();
|
856
860
|
p.size = $.data(table, 'pagerLastSize') || parsePageSize( p, p.size, 'get' );
|
857
861
|
p.$size.val( parsePageSize( p, p.size, 'set' ) ); // set page size
|
858
|
-
p.totalPages = Math.ceil(
|
862
|
+
p.totalPages = Math.ceil( getTotalPages( table, p ) / p.size );
|
859
863
|
// if table id exists, include page display with aria info
|
860
864
|
if ( table.id ) {
|
861
865
|
info = table.id + '_pager_info';
|
@@ -4,7 +4,7 @@
|
|
4
4
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
|
5
5
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
6
6
|
*/
|
7
|
-
/*! tablesorter (FORK) - updated 11-
|
7
|
+
/*! tablesorter (FORK) - updated 11-22-2015 (v2.24.6)*/
|
8
8
|
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
9
9
|
(function(factory) {
|
10
10
|
if (typeof define === 'function' && define.amd) {
|
@@ -16,7 +16,7 @@
|
|
16
16
|
}
|
17
17
|
}(function($) {
|
18
18
|
|
19
|
-
/*! TableSorter (FORK) v2.24.
|
19
|
+
/*! TableSorter (FORK) v2.24.6 *//*
|
20
20
|
* Client-side table sorting with ease!
|
21
21
|
* @requires jQuery v1.2.6+
|
22
22
|
*
|
@@ -39,7 +39,7 @@
|
|
39
39
|
'use strict';
|
40
40
|
var ts = $.tablesorter = {
|
41
41
|
|
42
|
-
version : '2.24.
|
42
|
+
version : '2.24.6',
|
43
43
|
|
44
44
|
parsers : [],
|
45
45
|
widgets : [],
|
@@ -207,6 +207,9 @@
|
|
207
207
|
bottom : false
|
208
208
|
},
|
209
209
|
|
210
|
+
// placeholder date parser data (globalize)
|
211
|
+
dates : {},
|
212
|
+
|
210
213
|
// These methods can be applied on table.config instance
|
211
214
|
instanceMethods : {},
|
212
215
|
|
@@ -330,10 +333,10 @@
|
|
330
333
|
$table
|
331
334
|
.unbind( 'sortBegin' + c.namespace + ' sortEnd' + c.namespace )
|
332
335
|
.bind( 'sortBegin' + c.namespace + ' sortEnd' + c.namespace, function( e ) {
|
333
|
-
clearTimeout( c.
|
336
|
+
clearTimeout( c.timerProcessing );
|
334
337
|
ts.isProcessing( table );
|
335
338
|
if ( e.type === 'sortBegin' ) {
|
336
|
-
c.
|
339
|
+
c.timerProcessing = setTimeout( function() {
|
337
340
|
ts.isProcessing( table, true );
|
338
341
|
}, 500 );
|
339
342
|
}
|
@@ -750,20 +753,24 @@
|
|
750
753
|
},
|
751
754
|
|
752
755
|
detectParserForColumn : function( c, rows, rowIndex, cellIndex ) {
|
753
|
-
var cur, $node,
|
756
|
+
var cur, $node, row,
|
754
757
|
indx = ts.parsers.length,
|
755
758
|
node = false,
|
756
759
|
nodeValue = '',
|
757
760
|
keepLooking = true;
|
758
761
|
while ( nodeValue === '' && keepLooking ) {
|
759
762
|
rowIndex++;
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
763
|
+
row = rows[ rowIndex ];
|
764
|
+
// stop looking after 50 empty rows
|
765
|
+
if ( row && rowIndex < 50 ) {
|
766
|
+
if ( row.className.indexOf( ts.cssIgnoreRow ) < 0 ) {
|
767
|
+
node = rows[ rowIndex ].cells[ cellIndex ];
|
768
|
+
nodeValue = ts.getElementText( c, node, cellIndex );
|
769
|
+
$node = $( node );
|
770
|
+
if ( c.debug ) {
|
771
|
+
console.log( 'Checking if value was empty on row ' + rowIndex + ', column: ' +
|
772
|
+
cellIndex + ': "' + nodeValue + '"' );
|
773
|
+
}
|
767
774
|
}
|
768
775
|
} else {
|
769
776
|
keepLooking = false;
|
@@ -1858,6 +1865,8 @@
|
|
1858
1865
|
}
|
1859
1866
|
if ( c.debug ) { time = new Date(); }
|
1860
1867
|
ts.addWidgetFromClass( table );
|
1868
|
+
// prevent "tablesorter-ready" from firing multiple times in a row
|
1869
|
+
clearTimeout( c.timerReady );
|
1861
1870
|
if ( c.widgets.length ) {
|
1862
1871
|
table.isApplyingWidgets = true;
|
1863
1872
|
// ensure unique widget ids
|
@@ -1927,11 +1936,11 @@
|
|
1927
1936
|
callback( table );
|
1928
1937
|
}
|
1929
1938
|
}
|
1930
|
-
setTimeout( function() {
|
1939
|
+
c.timerReady = setTimeout( function() {
|
1931
1940
|
table.isApplyingWidgets = false;
|
1932
1941
|
$.data( table, 'lastWidgetApplication', new Date() );
|
1933
|
-
c.$table.trigger('tablesorter-ready');
|
1934
|
-
},
|
1942
|
+
c.$table.trigger( 'tablesorter-ready' );
|
1943
|
+
}, 10 );
|
1935
1944
|
if ( c.debug ) {
|
1936
1945
|
widget = c.widgets.length;
|
1937
1946
|
console.log( 'Completed ' +
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! TableSorter (FORK) v2.24.
|
1
|
+
/*! TableSorter (FORK) v2.24.6 *//*
|
2
2
|
* Client-side table sorting with ease!
|
3
3
|
* @requires jQuery v1.2.6+
|
4
4
|
*
|
@@ -21,7 +21,7 @@
|
|
21
21
|
'use strict';
|
22
22
|
var ts = $.tablesorter = {
|
23
23
|
|
24
|
-
version : '2.24.
|
24
|
+
version : '2.24.6',
|
25
25
|
|
26
26
|
parsers : [],
|
27
27
|
widgets : [],
|
@@ -189,6 +189,9 @@
|
|
189
189
|
bottom : false
|
190
190
|
},
|
191
191
|
|
192
|
+
// placeholder date parser data (globalize)
|
193
|
+
dates : {},
|
194
|
+
|
192
195
|
// These methods can be applied on table.config instance
|
193
196
|
instanceMethods : {},
|
194
197
|
|
@@ -312,10 +315,10 @@
|
|
312
315
|
$table
|
313
316
|
.unbind( 'sortBegin' + c.namespace + ' sortEnd' + c.namespace )
|
314
317
|
.bind( 'sortBegin' + c.namespace + ' sortEnd' + c.namespace, function( e ) {
|
315
|
-
clearTimeout( c.
|
318
|
+
clearTimeout( c.timerProcessing );
|
316
319
|
ts.isProcessing( table );
|
317
320
|
if ( e.type === 'sortBegin' ) {
|
318
|
-
c.
|
321
|
+
c.timerProcessing = setTimeout( function() {
|
319
322
|
ts.isProcessing( table, true );
|
320
323
|
}, 500 );
|
321
324
|
}
|
@@ -732,20 +735,24 @@
|
|
732
735
|
},
|
733
736
|
|
734
737
|
detectParserForColumn : function( c, rows, rowIndex, cellIndex ) {
|
735
|
-
var cur, $node,
|
738
|
+
var cur, $node, row,
|
736
739
|
indx = ts.parsers.length,
|
737
740
|
node = false,
|
738
741
|
nodeValue = '',
|
739
742
|
keepLooking = true;
|
740
743
|
while ( nodeValue === '' && keepLooking ) {
|
741
744
|
rowIndex++;
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
745
|
+
row = rows[ rowIndex ];
|
746
|
+
// stop looking after 50 empty rows
|
747
|
+
if ( row && rowIndex < 50 ) {
|
748
|
+
if ( row.className.indexOf( ts.cssIgnoreRow ) < 0 ) {
|
749
|
+
node = rows[ rowIndex ].cells[ cellIndex ];
|
750
|
+
nodeValue = ts.getElementText( c, node, cellIndex );
|
751
|
+
$node = $( node );
|
752
|
+
if ( c.debug ) {
|
753
|
+
console.log( 'Checking if value was empty on row ' + rowIndex + ', column: ' +
|
754
|
+
cellIndex + ': "' + nodeValue + '"' );
|
755
|
+
}
|
749
756
|
}
|
750
757
|
} else {
|
751
758
|
keepLooking = false;
|
@@ -1840,6 +1847,8 @@
|
|
1840
1847
|
}
|
1841
1848
|
if ( c.debug ) { time = new Date(); }
|
1842
1849
|
ts.addWidgetFromClass( table );
|
1850
|
+
// prevent "tablesorter-ready" from firing multiple times in a row
|
1851
|
+
clearTimeout( c.timerReady );
|
1843
1852
|
if ( c.widgets.length ) {
|
1844
1853
|
table.isApplyingWidgets = true;
|
1845
1854
|
// ensure unique widget ids
|
@@ -1909,11 +1918,11 @@
|
|
1909
1918
|
callback( table );
|
1910
1919
|
}
|
1911
1920
|
}
|
1912
|
-
setTimeout( function() {
|
1921
|
+
c.timerReady = setTimeout( function() {
|
1913
1922
|
table.isApplyingWidgets = false;
|
1914
1923
|
$.data( table, 'lastWidgetApplication', new Date() );
|
1915
|
-
c.$table.trigger('tablesorter-ready');
|
1916
|
-
},
|
1924
|
+
c.$table.trigger( 'tablesorter-ready' );
|
1925
|
+
}, 10 );
|
1917
1926
|
if ( c.debug ) {
|
1918
1927
|
widget = c.widgets.length;
|
1919
1928
|
console.log( 'Completed ' +
|
@@ -4,7 +4,7 @@
|
|
4
4
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
|
5
5
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
6
6
|
*/
|
7
|
-
/*! tablesorter (FORK) - updated 11-
|
7
|
+
/*! tablesorter (FORK) - updated 11-22-2015 (v2.24.6)*/
|
8
8
|
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
9
9
|
(function(factory) {
|
10
10
|
if (typeof define === 'function' && define.amd) {
|
@@ -1,31 +1,30 @@
|
|
1
|
-
/*! Parser: Month - updated 11/
|
1
|
+
/*! Parser: Month - updated 11/22/2015 (v2.24.6) */
|
2
2
|
/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
|
3
3
|
/*jshint jquery:true */
|
4
4
|
;(function($){
|
5
5
|
'use strict';
|
6
6
|
|
7
7
|
var ts = $.tablesorter;
|
8
|
-
|
8
|
+
|
9
|
+
if ( !ts.dates ) { ts.dates = {}; }
|
10
|
+
if ( !ts.dates.months ) { ts.dates.months = {}; }
|
11
|
+
ts.dates.months.en = {
|
9
12
|
// See http://mottie.github.io/tablesorter/docs/example-widget-grouping.html
|
10
13
|
// for details on how to use CLDR data for a locale to add data for this parser
|
11
14
|
// CLDR returns an object { 1: "Jan", 2: "Feb", 3: "Mar", ..., 12: "Dec" }
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
12: 'Dec'
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}, ts.dates );
|
15
|
+
1 : 'Jan',
|
16
|
+
2 : 'Feb',
|
17
|
+
3 : 'Mar',
|
18
|
+
4 : 'Apr',
|
19
|
+
5 : 'May',
|
20
|
+
6 : 'Jun',
|
21
|
+
7 : 'Jul',
|
22
|
+
8 : 'Aug',
|
23
|
+
9 : 'Sep',
|
24
|
+
10: 'Oct',
|
25
|
+
11: 'Nov',
|
26
|
+
12: 'Dec'
|
27
|
+
};
|
29
28
|
|
30
29
|
ts.addParser({
|
31
30
|
id: 'month',
|
@@ -1,17 +1,25 @@
|
|
1
|
-
/*! Parser: date ranges -
|
1
|
+
/*! Parser: date ranges -updated 11/22/2015 (v2.24.6) */
|
2
2
|
/* Include the 'widget-filter-type-insideRange.js' to filter ranges */
|
3
3
|
/*jshint jquery:true */
|
4
4
|
;(function($){
|
5
5
|
'use strict';
|
6
6
|
|
7
|
-
var
|
7
|
+
var ts = $.tablesorter,
|
8
|
+
getMonthVal,
|
9
|
+
|
10
|
+
regex = {
|
8
11
|
mdy : /(\d{1,2}[-\s]\d{1,2}[-\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/gi,
|
9
12
|
|
10
13
|
dmy : /(\d{1,2}[-\s]\d{1,2}[-\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/gi,
|
11
14
|
dmyreplace : /(\d{1,2})[-\s](\d{1,2})[-\s](\d{4})/,
|
12
15
|
|
13
16
|
ymd : /(\d{4}[-\s]\d{1,2}[-\s]\d{1,2}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/gi,
|
14
|
-
ymdreplace : /(\d{4})[-\s](\d{1,2})[-\s](\d{1,2})
|
17
|
+
ymdreplace : /(\d{4})[-\s](\d{1,2})[-\s](\d{1,2})/,
|
18
|
+
|
19
|
+
// extract out date format (dd MMM yyyy hms) e.g. 13 March 2016 12:55 PM
|
20
|
+
overall_dMMMyyyy : /(\d{1,2}\s+\w+\s+\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s\w+)?)?)/g,
|
21
|
+
matches_dMMMyyyy : /(\d{1,2})\s+(\w+)\s+(\d{4})/
|
22
|
+
|
15
23
|
};
|
16
24
|
|
17
25
|
/*! date-range MMDDYYYY *//* (2/15/2000 - 5/18/2000) */
|
@@ -87,4 +95,80 @@
|
|
87
95
|
type: 'text'
|
88
96
|
});
|
89
97
|
|
98
|
+
if ( !ts.dates ) { ts.dates = {}; }
|
99
|
+
if ( !ts.dates.months ) { ts.dates.months = {}; }
|
100
|
+
ts.dates.months.en = {
|
101
|
+
// See http://mottie.github.io/tablesorter/docs/example-widget-grouping.html
|
102
|
+
// for details on how to use CLDR data for a locale to add data for this parser
|
103
|
+
// CLDR returns an object { 1: "Jan", 2: "Feb", 3: "Mar", ..., 12: "Dec" }
|
104
|
+
1 : 'Jan',
|
105
|
+
2 : 'Feb',
|
106
|
+
3 : 'Mar',
|
107
|
+
4 : 'Apr',
|
108
|
+
5 : 'May',
|
109
|
+
6 : 'Jun',
|
110
|
+
7 : 'Jul',
|
111
|
+
8 : 'Aug',
|
112
|
+
9 : 'Sep',
|
113
|
+
10: 'Oct',
|
114
|
+
11: 'Nov',
|
115
|
+
12: 'Dec'
|
116
|
+
};
|
117
|
+
|
118
|
+
getMonthVal = function( str, c, cellIndex ) {
|
119
|
+
var m, month,
|
120
|
+
// add options to 'config.globalize' for all columns --> globalize : { lang: 'en' }
|
121
|
+
// or per column by using the column index --> globalize : { 0 : { lang: 'fr' } }
|
122
|
+
options = c.globalize && ( c.globalize[ cellIndex ] || c.globalize ) || {},
|
123
|
+
months = ts.dates.months[ options.lang || 'en' ];
|
124
|
+
if ( c.ignoreCase ) {
|
125
|
+
str = str.toLowerCase();
|
126
|
+
}
|
127
|
+
for ( month in months ) {
|
128
|
+
if ( typeof month === 'string' ) {
|
129
|
+
m = months[ month ];
|
130
|
+
if ( c.ignoreCase ) {
|
131
|
+
m = m.toLowerCase();
|
132
|
+
}
|
133
|
+
if ( str.match( m ) ) {
|
134
|
+
return parseInt( month, 10 );
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
return str;
|
139
|
+
};
|
140
|
+
|
141
|
+
/*! date-range "dd MMM yyyy - dd MMM yyyy" *//* ( hms optional )*/
|
142
|
+
ts.addParser({
|
143
|
+
id: 'date-range-dMMMyyyy',
|
144
|
+
is: function () {
|
145
|
+
return false;
|
146
|
+
},
|
147
|
+
format: function( text, table, cell, cellIndex ) {
|
148
|
+
var date, month, matches, i,
|
149
|
+
parsed = [],
|
150
|
+
str = text.replace( /\s+/g, ' ' ).match( regex.overall_dMMMyyyy ),
|
151
|
+
len = str && str.length;
|
152
|
+
if ( len ) {
|
153
|
+
for ( i = 0; i < len; i++ ) {
|
154
|
+
date = '';
|
155
|
+
matches = str[ i ].match( regex.matches_dMMMyyyy );
|
156
|
+
if ( matches && matches.length >= 4 ) {
|
157
|
+
matches.shift();
|
158
|
+
month = getMonthVal( matches[1], table.config, cellIndex );
|
159
|
+
if ( !isNaN( month ) ) {
|
160
|
+
str[i] = str[i].replace( matches[1], month );
|
161
|
+
}
|
162
|
+
date = new Date( ( '' + str[ i ] ).replace( ts.regex.shortDateXXY, '$3/$2/$1' ) );
|
163
|
+
}
|
164
|
+
parsed.push( date instanceof Date && isFinite(date) ? date.getTime() : str[i] );
|
165
|
+
}
|
166
|
+
// sort from min to max
|
167
|
+
return parsed.sort().join( ' - ' );
|
168
|
+
}
|
169
|
+
return text;
|
170
|
+
},
|
171
|
+
type: 'text'
|
172
|
+
});
|
173
|
+
|
90
174
|
})(jQuery);
|