jquery-tablesorter 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +1 -1
- data/lib/jquery-tablesorter/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +12 -8
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +108 -92
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.min.js +2 -2
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +28 -29
- data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.min.js +8 -8
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.black-ice.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.blue.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.dark.css +2 -2
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.default.css +1 -1
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.dropbox.css +1 -1
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.green.css +1 -1
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.grey.css +1 -1
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.ice.css +1 -1
- data/vendor/assets/stylesheets/jquery-tablesorter/theme.jui.css +1 -1
- metadata +10 -10
data/README.markdown
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.
|
7
|
+
Current tablesorter version: 2.7.3 (1/10/2013), [documentation]
|
8
8
|
|
9
9
|
Any issue associate with the js/css files, please report to [Mottie's fork].
|
10
10
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
* tablesorter pager plugin
|
3
|
-
* updated
|
3
|
+
* updated 1/4/2013
|
4
4
|
*/
|
5
5
|
/*jshint browser:true, jquery:true, unused:false */
|
6
6
|
;(function($) {
|
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
updatePageDisplay = function(table, c) {
|
96
96
|
var i, p, s, t, out, f = $(table).hasClass('hasFilters') && !c.ajaxUrl;
|
97
|
-
c.filteredRows = (f) ?
|
97
|
+
c.filteredRows = (f) ? table.config.$tbodies.children('tr:not(.filtered,.remove-me)').length : c.totalRows;
|
98
98
|
c.filteredPages = (f) ? Math.ceil( c.filteredRows / c.size ) : c.totalPages;
|
99
99
|
if ( Math.min( c.totalPages, c.filteredPages ) > 0 ) {
|
100
100
|
t = (c.size * c.page > c.filteredRows);
|
@@ -138,7 +138,7 @@
|
|
138
138
|
if (h) {
|
139
139
|
d = h - $b.height();
|
140
140
|
if ( d > 5 && $.data(table, 'pagerLastSize') === c.size && $b.children('tr:visible').length < c.size ) {
|
141
|
-
$b.append('<tr class="pagerSavedHeightSpacer
|
141
|
+
$b.append('<tr class="pagerSavedHeightSpacer ' + table.config.selectorRemove.replace('.','') + '" style="height:' + d + 'px;"></tr>');
|
142
142
|
}
|
143
143
|
}
|
144
144
|
}
|
@@ -188,9 +188,9 @@
|
|
188
188
|
var i, j, hsh, $f, $sh,
|
189
189
|
$t = $(table),
|
190
190
|
tc = table.config,
|
191
|
-
$b =
|
191
|
+
$b = c.$tbodies,
|
192
192
|
hl = $t.find('thead th').length, tds = '',
|
193
|
-
err = '<tr class="' + c.cssErrorRow + ' ' + tc.selectorRemove + '"><td style="text-align: center;" colspan="' + hl + '">' +
|
193
|
+
err = '<tr class="' + c.cssErrorRow + ' ' + tc.selectorRemove.replace('.','') + '"><td style="text-align: center;" colspan="' + hl + '">' +
|
194
194
|
(exception ? exception.message + ' (' + exception.name + ')' : 'No rows found') + '</td></tr>',
|
195
195
|
result = c.ajaxProcessing(data) || [ 0, [] ],
|
196
196
|
d = result[1] || [],
|
@@ -302,6 +302,7 @@
|
|
302
302
|
},
|
303
303
|
|
304
304
|
renderTable = function(table, rows, c) {
|
305
|
+
c.isDisabled = false; // needed because sorting will change the page and re-enable the pager
|
305
306
|
var i, j, o,
|
306
307
|
f = document.createDocumentFragment(),
|
307
308
|
l = rows.length,
|
@@ -454,19 +455,20 @@
|
|
454
455
|
$t
|
455
456
|
.unbind('filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager')
|
456
457
|
.bind('filterStart.pager', function(e, filters) {
|
458
|
+
$.data(table, 'pagerUpdateTriggered', false);
|
457
459
|
c.currentFilters = filters;
|
458
460
|
})
|
459
461
|
// update pager after filter widget completes
|
460
|
-
.bind('filterEnd.pager sortEnd.pager', function() {
|
462
|
+
.bind('filterEnd.pager sortEnd.pager', function(e) {
|
461
463
|
//Prevent infinite event loops from occuring by setting this in all moveToPage calls and catching it here.
|
462
464
|
if ($.data(table, 'pagerUpdateTriggered')) {
|
463
465
|
$.data(table, 'pagerUpdateTriggered', false);
|
464
466
|
return;
|
465
467
|
}
|
466
|
-
c.page = 0;
|
468
|
+
if (e.type === 'filterEnd') { c.page = 0; }
|
467
469
|
updatePageDisplay(table, c);
|
468
470
|
moveToPage(table, c);
|
469
|
-
|
471
|
+
fixHeight(table, c);
|
470
472
|
})
|
471
473
|
.bind('disable.pager', function(){
|
472
474
|
showAllRows(table, c);
|
@@ -544,6 +546,8 @@
|
|
544
546
|
hideRowsSetup(table, c);
|
545
547
|
}
|
546
548
|
|
549
|
+
changeHeight(table, c);
|
550
|
+
|
547
551
|
// pager initialized
|
548
552
|
if (!c.ajax) {
|
549
553
|
c.initialized = true;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* TableSorter 2.
|
2
|
+
* TableSorter 2.7.3 - Client-side table sorting with ease!
|
3
3
|
* @requires jQuery v1.2.6+
|
4
4
|
*
|
5
5
|
* Copyright (c) 2007 Christian Bach
|
@@ -24,18 +24,22 @@
|
|
24
24
|
|
25
25
|
var ts = this;
|
26
26
|
|
27
|
-
ts.version = "2.
|
27
|
+
ts.version = "2.7.3";
|
28
28
|
|
29
29
|
ts.parsers = [];
|
30
30
|
ts.widgets = [];
|
31
31
|
ts.defaults = {
|
32
32
|
|
33
|
-
// appearance
|
33
|
+
// *** appearance
|
34
34
|
theme : 'default', // adds tablesorter-{theme} to the table for styling
|
35
35
|
widthFixed : false, // adds colgroup to fix widths of columns
|
36
36
|
showProcessing : false, // show an indeterminate timer icon in the header when the table is sorted or filtered.
|
37
37
|
|
38
|
-
|
38
|
+
headerTemplate : '{content}',// header layout template (HTML ok); {content} = innerHTML, {icon} = <i/> (class from cssIcon)
|
39
|
+
onRenderTemplate : null, // function(index, template){ return template; }, (template is a string)
|
40
|
+
onRenderHeader : null, // function(index){}, (nothing to return)
|
41
|
+
|
42
|
+
// *** functionality
|
39
43
|
cancelSelection : true, // prevent text selection in the header
|
40
44
|
dateFormat : 'mmddyyyy', // other options: "ddmmyyy" or "yyyymmdd"
|
41
45
|
sortMultiSortKey : 'shiftKey', // key used to select additional columns
|
@@ -44,7 +48,7 @@
|
|
44
48
|
delayInit : false, // if false, the parsed table contents will not update until the first sort
|
45
49
|
serverSideSorting: false, // if true, server-side sorting should be performed because client-side sorting will be disabled, but the ui and events will still be used.
|
46
50
|
|
47
|
-
// sort options
|
51
|
+
// *** sort options
|
48
52
|
headers : {}, // set sorter, string, empty, locked order, sortInitialOrder, filter, etc.
|
49
53
|
ignoreCase : true, // ignore case while sorting
|
50
54
|
sortForce : null, // column(s) first sorted; always applied
|
@@ -61,18 +65,17 @@
|
|
61
65
|
textExtraction : 'simple', // text extraction method/function - function(node, table, cellIndex){}
|
62
66
|
textSorter : null, // use custom text sorter - function(a,b){ return a.sort(b); } // basic sort
|
63
67
|
|
64
|
-
// widget options
|
68
|
+
// *** widget options
|
65
69
|
widgets: [], // method to add widgets, e.g. widgets: ['zebra']
|
66
70
|
widgetOptions : {
|
67
71
|
zebra : [ 'even', 'odd' ] // zebra widget alternating row class names
|
68
72
|
},
|
69
73
|
initWidgets : true, // apply widgets on tablesorter initialization
|
70
74
|
|
71
|
-
// callbacks
|
75
|
+
// *** callbacks
|
72
76
|
initialized : null, // function(table){},
|
73
|
-
onRenderHeader : null, // function(index){},
|
74
77
|
|
75
|
-
// css class names
|
78
|
+
// *** css class names
|
76
79
|
tableClass : 'tablesorter',
|
77
80
|
cssAsc : 'tablesorter-headerAsc',
|
78
81
|
cssChildRow : 'tablesorter-childRow', // previously "expand-child"
|
@@ -83,15 +86,15 @@
|
|
83
86
|
cssInfoBlock : 'tablesorter-infoOnly', // don't sort tbody with this class name
|
84
87
|
cssProcessing : 'tablesorter-processing', // processing icon applied to header during sort/filter
|
85
88
|
|
86
|
-
// selectors
|
89
|
+
// *** selectors
|
87
90
|
selectorHeaders : '> thead th, > thead td',
|
88
91
|
selectorSort : 'th, td', // jQuery selector of content within selectorHeaders that is clickable to trigger a sort
|
89
92
|
selectorRemove : '.remove-me',
|
90
93
|
|
91
|
-
// advanced
|
94
|
+
// *** advanced
|
92
95
|
debug : false,
|
93
96
|
|
94
|
-
// Internal variables
|
97
|
+
// *** Internal variables
|
95
98
|
headerList: [],
|
96
99
|
empties: {},
|
97
100
|
strings: {},
|
@@ -167,7 +170,7 @@
|
|
167
170
|
|
168
171
|
function buildParserCache(table) {
|
169
172
|
var c = table.config,
|
170
|
-
tb =
|
173
|
+
tb = c.$tbodies,
|
171
174
|
rows, list, l, i, h, ch, p, parsersDebug = "";
|
172
175
|
if ( tb.length === 0) {
|
173
176
|
return c.debug ? log('*Empty table!* Not building a parser cache') : '';
|
@@ -273,6 +276,7 @@
|
|
273
276
|
c2 = c.cache,
|
274
277
|
r, n, totalRows, checkCell, $bk, $tb,
|
275
278
|
i, j, k, l, pos, appendTime;
|
279
|
+
if (!c2[0]) { return; } // empty table - fixes #206
|
276
280
|
if (c.debug) {
|
277
281
|
appendTime = new Date();
|
278
282
|
}
|
@@ -362,17 +366,26 @@
|
|
362
366
|
|
363
367
|
function buildHeaders(table) {
|
364
368
|
var header_index = computeThIndexes(table), ch, $t,
|
365
|
-
t, lock, time, $tableHeaders, c = table.config;
|
366
|
-
c.headerList = [];
|
369
|
+
h, i, t, lock, time, $tableHeaders, c = table.config;
|
370
|
+
c.headerList = [], c.headerContent = [];
|
367
371
|
if (c.debug) {
|
368
372
|
time = new Date();
|
369
373
|
}
|
374
|
+
i = c.cssIcon ? '<i class="' + c.cssIcon + '"></i>' : ''; // add icon if cssIcon option exists
|
370
375
|
$tableHeaders = $(table).find(c.selectorHeaders).each(function(index) {
|
371
376
|
$t = $(this);
|
372
377
|
ch = c.headers[index];
|
373
|
-
|
374
|
-
|
378
|
+
c.headerContent[index] = this.innerHTML; // save original header content
|
379
|
+
// set up header template
|
380
|
+
t = c.headerTemplate.replace(/\{content\}/g, this.innerHTML).replace(/\{icon\}/g, i);
|
381
|
+
if (c.onRenderTemplate) {
|
382
|
+
h = c.onRenderTemplate.apply($t, [index, t]);
|
383
|
+
if (h && typeof h === 'string') { t = h; } // only change t if something is returned
|
384
|
+
}
|
385
|
+
this.innerHTML = '<div class="tablesorter-header-inner">' + t + '</div>'; // faster than wrapInner
|
386
|
+
|
375
387
|
if (c.onRenderHeader) { c.onRenderHeader.apply($t, [index]); }
|
388
|
+
|
376
389
|
this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
|
377
390
|
this.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
|
378
391
|
this.count = -1; // set to -1 because clicking on the header automatically adds one
|
@@ -442,8 +455,7 @@
|
|
442
455
|
}
|
443
456
|
|
444
457
|
function updateHeaderSortCount(table, list) {
|
445
|
-
var s, o, c = table.config,
|
446
|
-
l = c.headerList.length,
|
458
|
+
var s, t, o, c = table.config,
|
447
459
|
sl = list || c.sortList;
|
448
460
|
c.sortList = [];
|
449
461
|
$.each(sl, function(i,v){
|
@@ -453,7 +465,8 @@
|
|
453
465
|
o = c.headerList[s[0]];
|
454
466
|
if (o) { // prevents error if sorton array is wrong
|
455
467
|
c.sortList.push(s);
|
456
|
-
|
468
|
+
t = $.inArray(s[1], o.order); // fixes issue #167
|
469
|
+
o.count = t >= 0 ? t : s[1] % (c.sortReset ? 3 : 2);
|
457
470
|
}
|
458
471
|
});
|
459
472
|
}
|
@@ -467,7 +480,7 @@
|
|
467
480
|
var dynamicExp, sortWrapper, col, mx = 0, dir = 0, tc = table.config,
|
468
481
|
sortList = tc.sortList, l = sortList.length, bl = table.tBodies.length,
|
469
482
|
sortTime, i, j, k, c, colMax, cache, lc, s, e, order, orgOrderCol;
|
470
|
-
if (tc.serverSideSorting) {
|
483
|
+
if (tc.serverSideSorting || !tc.cache[0]) { // empty table - fixes #206
|
471
484
|
return;
|
472
485
|
}
|
473
486
|
if (tc.debug) { sortTime = new Date(); }
|
@@ -526,18 +539,18 @@
|
|
526
539
|
return (this.config.debug) ? log('stopping initialization! No thead, tbody or tablesorter has already been initialized') : '';
|
527
540
|
}
|
528
541
|
// declare
|
529
|
-
var $cell, $this = $(this),
|
542
|
+
var $cell, $this = $(this), $t0 = this,
|
530
543
|
c, i, j, k = '', a, s, o, downTime,
|
531
544
|
m = $.metadata;
|
532
545
|
// initialization flag
|
533
|
-
|
546
|
+
$t0.hasInitialized = false;
|
534
547
|
// new blank config object
|
535
|
-
|
548
|
+
$t0.config = {};
|
536
549
|
// merge and extend
|
537
|
-
c = $.extend(true,
|
550
|
+
c = $.extend(true, $t0.config, ts.defaults, settings);
|
538
551
|
// save the settings where they read
|
539
|
-
$.data(
|
540
|
-
if (c.debug) { $.data(
|
552
|
+
$.data($t0, "tablesorter", c);
|
553
|
+
if (c.debug) { $.data( $t0, 'startoveralltimer', new Date()); }
|
541
554
|
// constants
|
542
555
|
c.supportsTextContent = $('<span>x</span>')[0].textContent === 'x';
|
543
556
|
c.supportsDataObject = parseFloat($.fn.jquery) >= 1.4;
|
@@ -547,14 +560,15 @@
|
|
547
560
|
if (!/tablesorter\-/.test($this.attr('class'))) {
|
548
561
|
k = (c.theme !== '' ? ' tablesorter-' + c.theme : '');
|
549
562
|
}
|
550
|
-
$this.addClass(c.tableClass + k);
|
563
|
+
c.$table = $this.addClass(c.tableClass + k);
|
564
|
+
c.$tbodies = $this.children('tbody:not(.' + c.cssInfoBlock + ')');
|
551
565
|
// build headers
|
552
|
-
c.$headers = buildHeaders(
|
566
|
+
c.$headers = buildHeaders($t0);
|
553
567
|
// try to auto detect column type, and store in tables config
|
554
|
-
c.parsers = buildParserCache(
|
568
|
+
c.parsers = buildParserCache($t0);
|
555
569
|
// build the cache for the tbody cells
|
556
570
|
// delayInit will delay building the cache until the user starts a sort
|
557
|
-
if (!c.delayInit) { buildCache(
|
571
|
+
if (!c.delayInit) { buildCache($t0); }
|
558
572
|
// apply event handling to headers
|
559
573
|
// this is to big, perhaps break it out?
|
560
574
|
c.$headers
|
@@ -573,10 +587,10 @@
|
|
573
587
|
}
|
574
588
|
// ignore long clicks (prevents resizable widget from initializing a sort)
|
575
589
|
if (external !== true && (new Date().getTime() - downTime > 250)) { return false; }
|
576
|
-
if (c.delayInit && !c.cache) { buildCache($
|
590
|
+
if (c.delayInit && !c.cache) { buildCache($t0); }
|
577
591
|
if (!cell.sortDisabled) {
|
578
592
|
// Only call sortStart if sorting is enabled
|
579
|
-
$this.trigger("sortStart", $
|
593
|
+
$this.trigger("sortStart", $t0);
|
580
594
|
// store exp, for speed
|
581
595
|
// $cell = $(this);
|
582
596
|
k = !e[c.sortMultiSortKey];
|
@@ -662,13 +676,13 @@
|
|
662
676
|
}
|
663
677
|
}
|
664
678
|
// sortBegin event triggered immediately before the sort
|
665
|
-
$this.trigger("sortBegin", $
|
679
|
+
$this.trigger("sortBegin", $t0);
|
666
680
|
// setTimeout needed so the processing icon shows up
|
667
681
|
setTimeout(function(){
|
668
682
|
// set css for headers
|
669
|
-
setHeadersCss($
|
670
|
-
multisort($
|
671
|
-
appendToTable($
|
683
|
+
setHeadersCss($t0);
|
684
|
+
multisort($t0);
|
685
|
+
appendToTable($t0);
|
672
686
|
}, 1);
|
673
687
|
}
|
674
688
|
});
|
@@ -685,23 +699,23 @@
|
|
685
699
|
.unbind('sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave')
|
686
700
|
.bind("sortReset", function(){
|
687
701
|
c.sortList = [];
|
688
|
-
setHeadersCss(
|
689
|
-
multisort(
|
690
|
-
appendToTable(
|
702
|
+
setHeadersCss($t0);
|
703
|
+
multisort($t0);
|
704
|
+
appendToTable($t0);
|
691
705
|
})
|
692
706
|
.bind("update", function(e, resort, callback) {
|
693
707
|
// remove rows/elements before update
|
694
|
-
$(c.selectorRemove,
|
708
|
+
$(c.selectorRemove, $t0).remove();
|
695
709
|
// rebuild parsers
|
696
|
-
c.parsers = buildParserCache(
|
710
|
+
c.parsers = buildParserCache($t0);
|
697
711
|
// rebuild the cache map
|
698
|
-
buildCache(
|
712
|
+
buildCache($t0);
|
699
713
|
checkResort($this, resort, callback);
|
700
714
|
})
|
701
715
|
.bind("updateCell", function(e, cell, resort, callback) {
|
702
716
|
// get position from the dom
|
703
717
|
var l, row, icell,
|
704
|
-
|
718
|
+
$tb = $this.find('tbody'),
|
705
719
|
// update cache - format: function(s, table, cell, cellIndex)
|
706
720
|
// no closest in jQuery v1.2.6 - tbdy = $tb.index( $(cell).closest('tbody') ),$row = $(cell).closest('tr');
|
707
721
|
tbdy = $tb.index( $(cell).parents('tbody').filter(':last') ),
|
@@ -711,25 +725,25 @@
|
|
711
725
|
if ($tb.length && tbdy >= 0) {
|
712
726
|
row = $tb.eq(tbdy).find('tr').index( $row );
|
713
727
|
icell = cell.cellIndex;
|
714
|
-
l =
|
715
|
-
|
716
|
-
|
728
|
+
l = $t0.config.cache[tbdy].normalized[row].length - 1;
|
729
|
+
$t0.config.cache[tbdy].row[$t0.config.cache[tbdy].normalized[row][l]] = $row;
|
730
|
+
$t0.config.cache[tbdy].normalized[row][icell] = c.parsers[icell].format( getElementText($t0, cell, icell), $t0, cell, icell );
|
717
731
|
checkResort($this, resort, callback);
|
718
732
|
}
|
719
733
|
})
|
720
734
|
.bind("addRows", function(e, $row, resort, callback) {
|
721
735
|
var i, rows = $row.filter('tr').length,
|
722
|
-
dat = [], l = $row[0].cells.length,
|
723
|
-
tbdy = $
|
736
|
+
dat = [], l = $row[0].cells.length,
|
737
|
+
tbdy = $this.find('tbody').index( $row.closest('tbody') );
|
724
738
|
// fixes adding rows to an empty table - see issue #179
|
725
739
|
if (!c.parsers) {
|
726
|
-
c.parsers = buildParserCache(
|
740
|
+
c.parsers = buildParserCache($t0);
|
727
741
|
}
|
728
742
|
// add each row
|
729
743
|
for (i = 0; i < rows; i++) {
|
730
744
|
// add each cell
|
731
745
|
for (j = 0; j < l; j++) {
|
732
|
-
dat[j] = c.parsers[j].format( getElementText(
|
746
|
+
dat[j] = c.parsers[j].format( getElementText($t0, $row[i].cells[j], j), $t0, $row[i].cells[j], j );
|
733
747
|
}
|
734
748
|
// add the row index to the end
|
735
749
|
dat.push(c.cache[tbdy].row.length);
|
@@ -742,36 +756,36 @@
|
|
742
756
|
checkResort($this, resort, callback);
|
743
757
|
})
|
744
758
|
.bind("sorton", function(e, list, callback, init) {
|
745
|
-
$
|
759
|
+
$this.trigger("sortStart", this);
|
746
760
|
// update header count index
|
747
|
-
updateHeaderSortCount(
|
761
|
+
updateHeaderSortCount($t0, list);
|
748
762
|
// set css for headers
|
749
|
-
setHeadersCss(
|
763
|
+
setHeadersCss($t0);
|
750
764
|
// sort the table and append it to the dom
|
751
|
-
multisort(
|
752
|
-
appendToTable(
|
765
|
+
multisort($t0);
|
766
|
+
appendToTable($t0, init);
|
753
767
|
if (typeof callback === "function") {
|
754
|
-
callback(
|
768
|
+
callback($t0);
|
755
769
|
}
|
756
770
|
})
|
757
771
|
.bind("appendCache", function(e, callback, init) {
|
758
|
-
appendToTable(
|
772
|
+
appendToTable($t0, init);
|
759
773
|
if (typeof callback === "function") {
|
760
|
-
callback(
|
774
|
+
callback($t0);
|
761
775
|
}
|
762
776
|
})
|
763
777
|
.bind("applyWidgetId", function(e, id) {
|
764
|
-
ts.getWidgetById(id).format(
|
778
|
+
ts.getWidgetById(id).format($t0, c, c.widgetOptions);
|
765
779
|
})
|
766
780
|
.bind("applyWidgets", function(e, init) {
|
767
781
|
// apply widgets
|
768
|
-
ts.applyWidget(
|
782
|
+
ts.applyWidget($t0, init);
|
769
783
|
})
|
770
784
|
.bind("refreshWidgets", function(e, all, dontapply){
|
771
|
-
ts.refreshWidgets(
|
785
|
+
ts.refreshWidgets($t0, all, dontapply);
|
772
786
|
})
|
773
787
|
.bind("destroy", function(e, c, cb){
|
774
|
-
ts.destroy(
|
788
|
+
ts.destroy($t0, c, cb);
|
775
789
|
});
|
776
790
|
|
777
791
|
// get sort list from jQuery data or metadata
|
@@ -782,35 +796,35 @@
|
|
782
796
|
c.sortList = $this.metadata().sortlist;
|
783
797
|
}
|
784
798
|
// apply widget init code
|
785
|
-
ts.applyWidget(
|
799
|
+
ts.applyWidget($t0, true);
|
786
800
|
// if user has supplied a sort list to constructor
|
787
801
|
if (c.sortList.length > 0) {
|
788
802
|
$this.trigger("sorton", [c.sortList, {}, !c.initWidgets]);
|
789
803
|
} else if (c.initWidgets) {
|
790
804
|
// apply widget format
|
791
|
-
ts.applyWidget(
|
805
|
+
ts.applyWidget($t0);
|
792
806
|
}
|
793
807
|
|
794
808
|
// fixate columns if the users supplies the fixedWidth option
|
795
809
|
// do this after theme has been applied
|
796
|
-
fixColumnWidth(
|
810
|
+
fixColumnWidth($t0);
|
797
811
|
|
798
812
|
// show processesing icon
|
799
813
|
if (c.showProcessing) {
|
800
814
|
$this
|
801
815
|
.unbind('sortBegin sortEnd')
|
802
816
|
.bind('sortBegin sortEnd', function(e) {
|
803
|
-
ts.isProcessing($
|
817
|
+
ts.isProcessing($t0, e.type === 'sortBegin');
|
804
818
|
});
|
805
819
|
}
|
806
820
|
|
807
821
|
// initialized
|
808
|
-
|
822
|
+
$t0.hasInitialized = true;
|
809
823
|
if (c.debug) {
|
810
|
-
ts.benchmark("Overall initialization time", $.data(
|
824
|
+
ts.benchmark("Overall initialization time", $.data( $t0, 'startoveralltimer'));
|
811
825
|
}
|
812
|
-
$this.trigger('tablesorter-initialized',
|
813
|
-
if (typeof c.initialized === 'function') { c.initialized(
|
826
|
+
$this.trigger('tablesorter-initialized', $t0);
|
827
|
+
if (typeof c.initialized === 'function') { c.initialized($t0); }
|
814
828
|
});
|
815
829
|
};
|
816
830
|
|
@@ -849,34 +863,36 @@
|
|
849
863
|
};
|
850
864
|
|
851
865
|
ts.clearTableBody = function(table) {
|
852
|
-
|
866
|
+
table.config.$tbodies.empty();
|
853
867
|
};
|
854
868
|
|
855
869
|
ts.destroy = function(table, removeClasses, callback){
|
856
|
-
|
857
|
-
$h = $t.find('thead:first');
|
858
|
-
// clear flag in case the plugin is initialized again
|
859
|
-
table.hasInitialized = false;
|
860
|
-
// remove widget added rows
|
861
|
-
$h.find('tr:not(.' + c.cssHeaderRow + ')').remove();
|
862
|
-
// remove resizer widget stuff
|
863
|
-
$h.find('.tablesorter-resizer').remove();
|
870
|
+
if (!table.hasInitialized) { return; }
|
864
871
|
// remove all widgets
|
865
872
|
ts.refreshWidgets(table, true, true);
|
873
|
+
var $t = $(table), c = table.config,
|
874
|
+
$h = $t.find('thead:first'),
|
875
|
+
$r = $h.find('tr.' + c.cssHeaderRow).removeClass(c.cssHeaderRow),
|
876
|
+
$f = $t.find('tfoot:first > tr').children('th, td');
|
877
|
+
// remove widget added rows, just in case
|
878
|
+
$h.find('tr').not($r).remove();
|
866
879
|
// disable tablesorter
|
867
880
|
$t
|
868
881
|
.removeData('tablesorter')
|
869
|
-
.unbind('sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave')
|
870
|
-
|
871
|
-
.unbind('click mousedown mousemove mouseup')
|
882
|
+
.unbind('sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave');
|
883
|
+
c.$headers.add($f)
|
872
884
|
.removeClass(c.cssHeader + ' ' + c.cssAsc + ' ' + c.cssDesc)
|
873
|
-
.
|
874
|
-
|
875
|
-
|
876
|
-
|
885
|
+
.removeAttr('data-column');
|
886
|
+
$r.find(c.selectorSort).unbind('mousedown.tablesorter mouseup.tablesorter');
|
887
|
+
// restore headers
|
888
|
+
$r.children().each(function(i){
|
889
|
+
$(this).html( c.headerContent[i] );
|
890
|
+
});
|
877
891
|
if (removeClasses !== false) {
|
878
|
-
$t.removeClass(c.tableClass);
|
892
|
+
$t.removeClass(c.tableClass + ' tablesorter-' + c.theme);
|
879
893
|
}
|
894
|
+
// clear flag in case the plugin is initialized again
|
895
|
+
table.hasInitialized = false;
|
880
896
|
if (typeof callback === 'function') {
|
881
897
|
callback(table);
|
882
898
|
}
|
@@ -1320,13 +1336,13 @@
|
|
1320
1336
|
format: function(table, c, wo) {
|
1321
1337
|
var $tb, $tv, $tr, row, even, time, k, l,
|
1322
1338
|
child = new RegExp(c.cssChildRow, 'i'),
|
1323
|
-
b =
|
1339
|
+
b = c.$tbodies;
|
1324
1340
|
if (c.debug) {
|
1325
1341
|
time = new Date();
|
1326
1342
|
}
|
1327
1343
|
for (k = 0; k < b.length; k++ ) {
|
1328
1344
|
// loop through the visible rows
|
1329
|
-
$tb =
|
1345
|
+
$tb = b.eq(k);
|
1330
1346
|
l = $tb.children('tr').length;
|
1331
1347
|
if (l > 1) {
|
1332
1348
|
row = 0;
|
@@ -1348,10 +1364,10 @@
|
|
1348
1364
|
},
|
1349
1365
|
remove: function(table, c, wo){
|
1350
1366
|
var k, $tb,
|
1351
|
-
b =
|
1367
|
+
b = c.$tbodies,
|
1352
1368
|
rmv = (c.widgetOptions.zebra || [ "even", "odd" ]).join(' ');
|
1353
1369
|
for (k = 0; k < b.length; k++ ){
|
1354
|
-
$tb = $.tablesorter.processTbody(table,
|
1370
|
+
$tb = $.tablesorter.processTbody(table, b.eq(k), true); // remove tbody
|
1355
1371
|
$tb.children().removeClass(rmv);
|
1356
1372
|
$.tablesorter.processTbody(table, $tb, false); // restore tbody
|
1357
1373
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* TableSorter 2.
|
2
|
+
* TableSorter 2.7.3 min - Client-side table sorting with ease!
|
3
3
|
* Copyright (c) 2007 Christian Bach
|
4
4
|
*/
|
5
|
-
!function(g){g.extend({tablesorter:new function(){function d(c){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(c):alert(c)}function v(c,b){d(c+" ("+((new Date).getTime()-b.getTime())+"ms)")}function p(c,b,a){if(!b)return"";var f=c.config,h=f.textExtraction,e="",e="simple"===h?f.supportsTextContent?b.textContent:g(b).text():"function"===typeof h?h(b,c,a):"object"===typeof h&&h.hasOwnProperty(a)?h[a](b,c,a):f.supportsTextContent?b.textContent:g(b).text();return g.trim(e)} function j(c){var b=c.config,a=g(c.tBodies).filter(":not(."+b.cssInfoBlock+")"),f,h,s,k,m,l,n="";if(0===a.length)return b.debug?d("*Empty table!* Not building a parser cache"):"";a=a[0].rows;if(a[0]){f=[];h=a[0].cells.length;for(s=0;s<h;s++){k=b.$headers.filter(":not([colspan])");k=k.add(b.$headers.filter('[colspan="1"]')).filter('[data-column="'+s+'"]:last');m=b.headers[s];l=e.getParserById(e.getData(k,m,"sorter"));b.empties[s]=e.getData(k,m,"empty")||b.emptyTo||(b.emptyToBottom?"bottom":"top"); b.strings[s]=e.getData(k,m,"string")||b.stringTo||"max";if(!l)a:{k=c;m=a;l=-1;for(var v=s,r=void 0,t=e.parsers.length,y=!1,q="",r=!0;""===q&&r;)l++,m[l]?(y=m[l].cells[v],q=p(k,y,v),k.config.debug&&d("Checking if value was empty on row "+l+", column: "+v+": "+q)):r=!1;for(r=1;r<t;r++)if(e.parsers[r].is(q,k,y)){l=e.parsers[r];break a}l=e.parsers[0]}b.debug&&(n+="column:"+s+"; parser:"+l.id+"; string:"+b.strings[s]+"; empty: "+b.empties[s]+"\n");f.push(l)}}b.debug&&d(n);return f}function q(c){var b= c.tBodies,a=c.config,f,h,s=a.parsers,k,m,l,n,j,r,q,y=[];a.cache={};if(!s)return a.debug?d("*Empty table!* Not building a cache"):"";a.debug&&(q=new Date);a.showProcessing&&e.isProcessing(c,!0);for(n=0;n<b.length;n++)if(a.cache[n]={row:[],normalized:[]},!g(b[n]).hasClass(a.cssInfoBlock)){f=b[n]&&b[n].rows.length||0;h=b[n].rows[0]&&b[n].rows[0].cells.length||0;for(m=0;m<f;++m)if(j=g(b[n].rows[m]),r=[],j.hasClass(a.cssChildRow))a.cache[n].row[a.cache[n].row.length-1]=a.cache[n].row[a.cache[n].row.length- 1].add(j);else{a.cache[n].row.push(j);for(l=0;l<h;++l)if(k=p(c,j[0].cells[l],l),k=s[l].format(k,c,j[0].cells[l],l),r.push(k),"numeric"===(s[l].type||"").toLowerCase())y[l]=Math.max(Math.abs(k),y[l]||0);r.push(a.cache[n].normalized.length);a.cache[n].normalized.push(r)}a.cache[n].colMax=y}a.showProcessing&&e.isProcessing(c);a.debug&&v("Building cache for "+f+" rows",q)}function t(c,b){var a=c.config,f=c.tBodies,h=[],d=a.cache,k,m,l,n,j,r,p,q,t,u,w;a.debug&&(w=new Date);for(q=0;q<f.length;q++)if(k= g(f[q]),!k.hasClass(a.cssInfoBlock)){j=e.processTbody(c,k,!0);k=d[q].row;m=d[q].normalized;n=(l=m.length)?m[0].length-1:0;for(r=0;r<l;r++)if(u=m[r][n],h.push(k[u]),!a.appender||!a.removeRows){t=k[u].length;for(p=0;p<t;p++)j.append(k[u][p])}e.processTbody(c,j,!1)}a.appender&&a.appender(c,h);a.debug&&v("Rebuilt table",w);b||e.applyWidget(c);g(c).trigger("sortEnd",c)}function C(c){var b,a,f,h=c.config,e=h.sortList,d=[h.cssAsc,h.cssDesc],m=g(c).find("tfoot tr").children().removeClass(d.join(" "));h.$headers.removeClass(d.join(" ")); f=e.length;for(b=0;b<f;b++)if(2!==e[b][1]&&(c=h.$headers.not(".sorter-false").filter('[data-column="'+e[b][0]+'"]'+(1===f?":last":"")),c.length))for(a=0;a<c.length;a++)c[a].sortDisabled||(c.eq(a).addClass(d[e[b][1]]),m.length&&m.filter('[data-column="'+e[b][0]+'"]').eq(a).addClass(d[e[b][1]]))}function E(c){var b=0,a=c.config,f=a.sortList,h=f.length,e=c.tBodies.length,d,m,l,n,j,r,p,q,t;if(!a.serverSideSorting){a.debug&&(d=new Date);for(l=0;l<e;l++)j=a.cache[l].colMax,t=(r=a.cache[l].normalized)&& r[0]?r[0].length-1:0,r.sort(function(e,d){for(m=0;m<h;m++){n=f[m][0];q=f[m][1];p=/n/i.test(a.parsers&&a.parsers[n]?a.parsers[n].type||"":"")?"Numeric":"Text";p+=0===q?"":"Desc";/Numeric/.test(p)&&a.strings[n]&&(b="boolean"===typeof a.string[a.strings[n]]?(0===q?1:-1)*(a.string[a.strings[n]]?-1:1):a.strings[n]?a.string[a.strings[n]]||0:0);var k=g.tablesorter["sort"+p](c,e[n],d[n],n,j[n],b);if(k)return k}return e[t]-d[t]});a.debug&&v("Sorting on "+f.toString()+" and dir "+q+" time",d)}}function D(c, b){c.trigger("updateComplete");"function"===typeof b&&b(c[0])}function F(c,b,a){!1!==b?c.trigger("sorton",[c[0].config.sortList,function(){D(c,a)}]):D(c,a)}var e=this;e.version="2.6.2";e.parsers=[];e.widgets=[];e.defaults={theme:"default",widthFixed:!1,showProcessing:!1,cancelSelection:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,headers:{},ignoreCase:!0,sortForce:null,sortList:[],sortAppend:null,sortInitialOrder:"asc", sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",textExtraction:"simple",textSorter:null,widgets:[],widgetOptions:{zebra:["even","odd"]},initWidgets:!0,initialized:null,onRenderHeader:null,tableClass:"tablesorter",cssAsc:"tablesorter-headerAsc",cssChildRow:"tablesorter-childRow",cssDesc:"tablesorter-headerDesc",cssHeader:"tablesorter-header",cssHeaderRow:"tablesorter-headerRow",cssIcon:"tablesorter-icon",cssInfoBlock:"tablesorter-infoOnly",cssProcessing:"tablesorter-processing", selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};e.benchmark=v;e.construct=function(c){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config.debug?d("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var b=g(this),a,f,h,s="",k,m,l,n,D=g.metadata;this.hasInitialized=!1;this.config={};a=g.extend(!0,this.config, e.defaults,c);g.data(this,"tablesorter",a);a.debug&&g.data(this,"startoveralltimer",new Date);a.supportsTextContent="x"===g("<span>x</span>")[0].textContent;a.supportsDataObject=1.4<=parseFloat(g.fn.jquery);a.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(b.attr("class"))||(s=""!==a.theme?" tablesorter-"+a.theme:"");b.addClass(a.tableClass+s);var r=[],N={},y=g(this).find("thead:eq(0), tfoot").children("tr"),I,J,w,z,M,B,K,O,P,G;for(I=0;I<y.length;I++){M= y[I].cells;for(J=0;J<M.length;J++){z=M[J];B=z.parentNode.rowIndex;K=B+"-"+z.cellIndex;O=z.rowSpan||1;P=z.colSpan||1;"undefined"===typeof r[B]&&(r[B]=[]);for(w=0;w<r[B].length+1;w++)if("undefined"===typeof r[B][w]){G=w;break}N[K]=G;g(z).attr({"data-column":G});for(w=B;w<B+O;w++){"undefined"===typeof r[w]&&(r[w]=[]);K=r[w];for(z=G;z<G+P;z++)K[z]="x"}}}var L,A,Q,H,R,x=this.config;x.headerList=[];x.debug&&(R=new Date);r=g(this).find(x.selectorHeaders).each(function(a){A=g(this);L=x.headers[a];Q=x.cssIcon? '<i class="'+x.cssIcon+'"></i>':"";this.innerHTML='<div class="tablesorter-header-inner">'+this.innerHTML+Q+"</div>";x.onRenderHeader&&x.onRenderHeader.apply(A,[a]);this.column=N[this.parentNode.rowIndex+"-"+this.cellIndex];var b=e.getData(A,L,"sortInitialOrder")||x.sortInitialOrder;this.order=/^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;"false"===e.getData(A,L,"sorter")?(this.sortDisabled=!0,A.addClass("sorter-false")):A.removeClass("sorter-false");this.lockedOrder=!1;H=e.getData(A,L,"lockedOrder")|| !1;"undefined"!==typeof H&&!1!==H&&(this.order=this.lockedOrder=/^d/i.test(H)||1===H?[1,1,1]:[0,0,0]);A.addClass((this.sortDisabled?"sorter-false ":" ")+x.cssHeader);x.headerList[a]=this;A.parent().addClass(x.cssHeaderRow)});this.config.debug&&(v("Built headers:",R),d(r));a.$headers=r;a.parsers=j(this);a.delayInit||q(this);a.$headers.find("*").andSelf().filter(a.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter",function(c,d){var j=(this.tagName.match("TH|TD")? g(this):g(this).parents("th, td").filter(":last"))[0];if(1!==(c.which||c.button))return!1;if("mousedown"===c.type)return n=(new Date).getTime(),"INPUT"===c.target.tagName?"":!a.cancelSelection;if(!0!==d&&250<(new Date).getTime()-n)return!1;a.delayInit&&!a.cache&&q(b[0]);if(!j.sortDisabled){b.trigger("sortStart",b[0]);s=!c[a.sortMultiSortKey];j.count=c[a.sortResetKey]?2:(j.count+1)%(a.sortReset?3:2);a.sortRestart&&(f=j,a.$headers.each(function(){if(this!==f&&(s||!g(this).is("."+a.cssDesc+",."+a.cssAsc)))this.count= -1}));f=j.column;if(s){a.sortList=[];if(null!==a.sortForce){k=a.sortForce;for(h=0;h<k.length;h++)k[h][0]!==f&&a.sortList.push(k[h])}l=j.order[j.count];if(2>l&&(a.sortList.push([f,l]),1<j.colSpan))for(h=1;h<j.colSpan;h++)a.sortList.push([f+h,l])}else if(a.sortAppend&&1<a.sortList.length&&e.isValueInArray(a.sortAppend[0][0],a.sortList)&&a.sortList.pop(),e.isValueInArray(f,a.sortList))for(h=0;h<a.sortList.length;h++)m=a.sortList[h],l=a.headerList[m[0]],m[0]===f&&(m[1]=l.order[l.count],2===m[1]&&(a.sortList.splice(h, 1),l.count=-1));else if(l=j.order[j.count],2>l&&(a.sortList.push([f,l]),1<j.colSpan))for(h=1;h<j.colSpan;h++)a.sortList.push([f+h,l]);if(null!==a.sortAppend){k=a.sortAppend;for(h=0;h<k.length;h++)k[h][0]!==f&&a.sortList.push(k[h])}b.trigger("sortBegin",b[0]);setTimeout(function(){C(b[0]);E(b[0]);t(b[0])},1)}});a.cancelSelection&&a.$headers.each(function(){this.onselectstart=function(){return!1}});b.unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave").bind("sortReset", function(){a.sortList=[];C(this);E(this);t(this)}).bind("update",function(c,f,h){g(a.selectorRemove,this).remove();a.parsers=j(this);q(this);F(b,f,h)}).bind("updateCell",function(c,f,h,e){var d,k,s;d=g(this).find("tbody");c=d.index(g(f).parents("tbody").filter(":last"));var j=g(f).parents("tr").filter(":last");f=g(f)[0];d.length&&0<=c&&(k=d.eq(c).find("tr").index(j),s=f.cellIndex,d=this.config.cache[c].normalized[k].length-1,this.config.cache[c].row[this.config.cache[c].normalized[k][d]]=j,this.config.cache[c].normalized[k][s]= a.parsers[s].format(p(this,f,s),this,f,s),F(b,h,e))}).bind("addRows",function(c,f,e,d){var k=f.filter("tr").length,s=[],l=f[0].cells.length,m=g(this).find("tbody").index(f.closest("tbody"));a.parsers||(a.parsers=j(this));for(c=0;c<k;c++){for(h=0;h<l;h++)s[h]=a.parsers[h].format(p(this,f[c].cells[h],h),this,f[c].cells[h],h);s.push(a.cache[m].row.length);a.cache[m].row.push([f[c]]);a.cache[m].normalized.push(s);s=[]}F(b,e,d)}).bind("sorton",function(a,b,c,f){g(this).trigger("sortStart",this);var h, e,d=this.config;a=b||d.sortList;d.sortList=[];g.each(a,function(a,b){h=[parseInt(b[0],10),parseInt(b[1],10)];if(e=d.headerList[h[0]])d.sortList.push(h),e.count=h[1]%(d.sortReset?3:2)});C(this);E(this);t(this,f);"function"===typeof c&&c(this)}).bind("appendCache",function(a,b,c){t(this,c);"function"===typeof b&&b(this)}).bind("applyWidgetId",function(b,c){e.getWidgetById(c).format(this,a,a.widgetOptions)}).bind("applyWidgets",function(a,b){e.applyWidget(this,b)}).bind("refreshWidgets",function(a,b, c){e.refreshWidgets(this,b,c)}).bind("destroy",function(a,b,c){e.destroy(this,b,c)});a.supportsDataObject&&"undefined"!==typeof b.data().sortlist?a.sortList=b.data().sortlist:D&&(b.metadata()&&b.metadata().sortlist)&&(a.sortList=b.metadata().sortlist);e.applyWidget(this,!0);0<a.sortList.length?b.trigger("sorton",[a.sortList,{},!a.initWidgets]):a.initWidgets&&e.applyWidget(this);if(this.config.widthFixed&&0===g(this).find("colgroup").length){var S=g("<colgroup>"),T=g(this).width();g("tr:first td", this.tBodies[0]).each(function(){S.append(g("<col>").css("width",parseInt(1E3*(g(this).width()/T),10)/10+"%"))});g(this).prepend(S)}a.showProcessing&&b.unbind("sortBegin sortEnd").bind("sortBegin sortEnd",function(a){e.isProcessing(b[0],"sortBegin"===a.type)});this.hasInitialized=!0;a.debug&&e.benchmark("Overall initialization time",g.data(this,"startoveralltimer"));b.trigger("tablesorter-initialized",this);"function"===typeof a.initialized&&a.initialized(this)})};e.isProcessing=function(c,b,a){var f= c.config;c=a||g(c).find("."+f.cssHeader);b?(0<f.sortList.length&&(c=c.filter(function(){return this.sortDisabled?!1:e.isValueInArray(parseFloat(g(this).attr("data-column")),f.sortList)})),c.addClass(f.cssProcessing)):c.removeClass(f.cssProcessing)};e.processTbody=function(c,b,a){if(a)return b.before('<span class="tablesorter-savemyplace"/>'),c=g.fn.detach?b.detach():b.remove();c=g(c).find("span.tablesorter-savemyplace");b.insertAfter(c);c.remove()};e.clearTableBody=function(c){g(c.tBodies).filter(":not(."+ c.config.cssInfoBlock+")").empty()};e.destroy=function(c,b,a){var f=g(c),h=c.config,d=f.find("thead:first");c.hasInitialized=!1;d.find("tr:not(."+h.cssHeaderRow+")").remove();d.find(".tablesorter-resizer").remove();e.refreshWidgets(c,!0,!0);f.removeData("tablesorter").unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave").find("."+h.cssHeader).unbind("click mousedown mousemove mouseup").removeClass(h.cssHeader+" "+h.cssAsc+ " "+h.cssDesc).find(".tablesorter-header-inner").each(function(){""!==h.cssIcon&&g(this).find("."+h.cssIcon).remove();g(this).replaceWith(g(this).contents())});!1!==b&&f.removeClass(h.tableClass);"function"===typeof a&&a(c)};e.regex=[/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,/^0x[0-9a-f]+$/i];e.sortText=function(c,b,a,f){if(b===a)return 0;var h=c.config,d=h.string[h.empties[f]|| h.emptyTo],k=e.regex;if(""===b&&0!==d)return"boolean"===typeof d?d?-1:1:-d||-1;if(""===a&&0!==d)return"boolean"===typeof d?d?1:-1:d||1;if("function"===typeof h.textSorter)return h.textSorter(b,a,c,f);c=b.replace(k[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");f=a.replace(k[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=parseInt(b.match(k[2]),16)||1!==c.length&&b.match(k[1])&&Date.parse(b);if(a=parseInt(a.match(k[2]),16)||b&&a.match(k[1])&&Date.parse(a)||null){if(b< a)return-1;if(b>a)return 1}h=Math.max(c.length,f.length);for(b=0;b<h;b++){a=isNaN(c[b])?c[b]||0:parseFloat(c[b])||0;k=isNaN(f[b])?f[b]||0:parseFloat(f[b])||0;if(isNaN(a)!==isNaN(k))return isNaN(a)?1:-1;typeof a!==typeof k&&(a+="",k+="");if(a<k)return-1;if(a>k)return 1}return 0};e.sortTextDesc=function(c,b,a,f){if(b===a)return 0;var d=c.config,g=d.string[d.empties[f]||d.emptyTo];return""===b&&0!==g?"boolean"===typeof g?g?-1:1:g||1:""===a&&0!==g?"boolean"===typeof g?g?1:-1:-g||-1:"function"===typeof d.textSorter? d.textSorter(a,b,c,f):e.sortText(c,a,b)};e.getTextValue=function(c,b,a){if(b){var f=c.length,d=b+a;for(b=0;b<f;b++)d+=c.charCodeAt(b);return a*d}return 0};e.sortNumeric=function(c,b,a,f,d,g){if(b===a)return 0;c=c.config;f=c.string[c.empties[f]||c.emptyTo];if(""===b&&0!==f)return"boolean"===typeof f?f?-1:1:-f||-1;if(""===a&&0!==f)return"boolean"===typeof f?f?1:-1:f||1;isNaN(b)&&(b=e.getTextValue(b,d,g));isNaN(a)&&(a=e.getTextValue(a,d,g));return b-a};e.sortNumericDesc=function(c,b,a,f,d,g){if(b=== a)return 0;c=c.config;f=c.string[c.empties[f]||c.emptyTo];if(""===b&&0!==f)return"boolean"===typeof f?f?-1:1:f||1;if(""===a&&0!==f)return"boolean"===typeof f?f?1:-1:-f||-1;isNaN(b)&&(b=e.getTextValue(b,d,g));isNaN(a)&&(a=e.getTextValue(a,d,g));return a-b};e.characterEquivalents={a:"\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5",A:"\u00c1\u00c0\u00c2\u00c3\u00c4\u0104\u00c5",c:"\u00e7\u0107\u010d",C:"\u00c7\u0106\u010c",e:"\u00e9\u00e8\u00ea\u00eb\u011b\u0119",E:"\u00c9\u00c8\u00ca\u00cb\u011a\u0118", i:"\u00ed\u00ec\u0130\u00ee\u00ef\u0131",I:"\u00cd\u00cc\u0130\u00ce\u00cf",o:"\u00f3\u00f2\u00f4\u00f5\u00f6",O:"\u00d3\u00d2\u00d4\u00d5\u00d6",ss:"\u00df",SS:"\u1e9e",u:"\u00fa\u00f9\u00fb\u00fc\u016f",U:"\u00da\u00d9\u00db\u00dc\u016e"};e.replaceAccents=function(c){var b,a="[",d=e.characterEquivalents;if(!e.characterRegex){e.characterRegexArray={};for(b in d)"string"===typeof b&&(a+=d[b],e.characterRegexArray[b]=RegExp("["+d[b]+"]","g"));e.characterRegex=RegExp(a+"]")}if(e.characterRegex.test(c))for(b in d)"string"=== typeof b&&(c=c.replace(e.characterRegexArray[b],b));return c};e.isValueInArray=function(c,b){var a,d=b.length;for(a=0;a<d;a++)if(b[a][0]===c)return!0;return!1};e.addParser=function(c){var b,a=e.parsers.length,d=!0;for(b=0;b<a;b++)e.parsers[b].id.toLowerCase()===c.id.toLowerCase()&&(d=!1);d&&e.parsers.push(c)};e.getParserById=function(c){var b,a=e.parsers.length;for(b=0;b<a;b++)if(e.parsers[b].id.toLowerCase()===c.toString().toLowerCase())return e.parsers[b];return!1};e.addWidget=function(c){e.widgets.push(c)}; e.getWidgetById=function(c){var b,a,d=e.widgets.length;for(b=0;b<d;b++)if((a=e.widgets[b])&&a.hasOwnProperty("id")&&a.id.toLowerCase()===c.toLowerCase())return a};e.applyWidget=function(c,b){var a=c.config,d=a.widgetOptions,h=a.widgets.sort().reverse(),j,k,m,l=h.length;k=g.inArray("zebra",a.widgets);0<=k&&(a.widgets.splice(k,1),a.widgets.push("zebra"));a.debug&&(j=new Date);for(k=0;k<l;k++)(m=e.getWidgetById(h[k]))&&(!0===b&&m.hasOwnProperty("init")?m.init(c,m,a,d):!b&&m.hasOwnProperty("format")&& m.format(c,a,d));a.debug&&v("Completed "+(!0===b?"initializing":"applying")+" widgets",j)};e.refreshWidgets=function(c,b,a){var f,h=c.config,j=h.widgets,k=e.widgets,m=k.length;for(f=0;f<m;f++)if(k[f]&&k[f].id&&(b||0>g.inArray(k[f].id,j)))h.debug&&d("Refeshing widgets: Removing "+k[f].id),k[f].hasOwnProperty("remove")&&k[f].remove(c,h,h.widgetOptions);!0!==a&&e.applyWidget(c,b)};e.getData=function(c,b,a){var d="";c=g(c);var e,j;if(!c.length)return"";e=g.metadata?c.metadata():!1;j=" "+(c.attr("class")|| "");"undefined"!==typeof c.data(a)||"undefined"!==typeof c.data(a.toLowerCase())?d+=c.data(a)||c.data(a.toLowerCase()):e&&"undefined"!==typeof e[a]?d+=e[a]:b&&"undefined"!==typeof b[a]?d+=b[a]:" "!==j&&j.match(" "+a+"-")&&(d=j.match(RegExp(" "+a+"-(\\w+)"))[1]||"");return g.trim(d)};e.formatFloat=function(c,b){if("string"!==typeof c||""===c)return c;var a;c=(b&&b.config?!1!==b.config.usNumberFormat:"undefined"!==typeof b?b:1)?c.replace(/,/g,""):c.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(c)&& (c=c.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(c);return isNaN(a)?g.trim(c):a};e.isDigit=function(c){return isNaN(c)?/^[\-+(]?\d+[)]?$/.test(c.toString().replace(/[,.'"\s]/g,"")):!0}}});var j=g.tablesorter;g.fn.extend({tablesorter:j.construct});j.addParser({id:"text",is:function(){return!0},format:function(d,v){var p=v.config;d=g.trim(p.ignoreCase?d.toLocaleLowerCase():d);return p.sortLocaleCompare?j.replaceAccents(d):d},type:"text"});j.addParser({id:"currency",is:function(d){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test(d)}, format:function(d,g){return j.formatFloat(d.replace(/[^\w,. \-()]/g,""),g)},type:"numeric"});j.addParser({id:"ipAddress",is:function(d){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(d)},format:function(d,g){var p,u=d.split("."),q="",t=u.length;for(p=0;p<t;p++)q+=("00"+u[p]).slice(-3);return j.formatFloat(q,g)},type:"numeric"});j.addParser({id:"url",is:function(d){return/^(https?|ftp|file):\/\//.test(d)},format:function(d){return g.trim(d.replace(/(https?|ftp|file):\/\//,""))},type:"text"}); j.addParser({id:"isoDate",is:function(d){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(d)},format:function(d,g){return j.formatFloat(""!==d?(new Date(d.replace(/-/g,"/"))).getTime()||"":"",g)},type:"numeric"});j.addParser({id:"percent",is:function(d){return/(\d\s?%|%\s?\d)/.test(d)},format:function(d,g){return j.formatFloat(d.replace(/%/g,""),g)},type:"numeric"});j.addParser({id:"usLongDate",is:function(d){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(d)}, format:function(d,g){return j.formatFloat((new Date(d.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",g)},type:"numeric"});j.addParser({id:"shortDate",is:function(d){return/^(\d{1,2}|\d{4})[\/\-\,\.\s+]\d{1,2}[\/\-\.\,\s+](\d{1,2}|\d{4})$/.test(d)},format:function(d,g,p,u){p=g.config;var q=p.headerList[u],t=q.shortDateFormat;"undefined"===typeof t&&(t=q.shortDateFormat=j.getData(q,p.headers[u],"dateFormat")||p.dateFormat);d=d.replace(/\s+/g," ").replace(/[\-|\.|\,]/g,"/");"mmddyyyy"===t?d=d.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/, "$3/$1/$2"):"ddmmyyyy"===t?d=d.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===t&&(d=d.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"));return j.formatFloat((new Date(d)).getTime()||"",g)},type:"numeric"});j.addParser({id:"time",is:function(d){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(d)},format:function(d,g){return j.formatFloat((new Date("2000/01/01 "+d.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",g)},type:"numeric"});j.addParser({id:"digit", is:function(d){return j.isDigit(d)},format:function(d,g){return j.formatFloat(d.replace(/[^\w,. \-()]/g,""),g)},type:"numeric"});j.addParser({id:"metadata",is:function(){return!1},format:function(d,j,p){d=j.config;d=!d.parserMetadataName?"sortValue":d.parserMetadataName;return g(p).metadata()[d]},type:"numeric"});j.addWidget({id:"zebra",format:function(d,v,p){var u,q,t,C,E,D,F=RegExp(v.cssChildRow,"i"),e=g(d).children("tbody:not(."+v.cssInfoBlock+")");v.debug&&(E=new Date);for(d=0;d<e.length;d++)u= g(e[d]),D=u.children("tr").length,1<D&&(t=0,u=u.children("tr:visible"),u.each(function(){q=g(this);F.test(this.className)||t++;C=0===t%2;q.removeClass(p.zebra[C?1:0]).addClass(p.zebra[C?0:1])}));v.debug&&j.benchmark("Applying Zebra widget",E)},remove:function(d,j){var p,u,q=g(d).children("tbody:not(."+j.cssInfoBlock+")"),t=(j.widgetOptions.zebra||["even","odd"]).join(" ");for(p=0;p<q.length;p++)u=g.tablesorter.processTbody(d,g(q[p]),!0),u.children().removeClass(t),g.tablesorter.processTbody(d,u,!1)}})}(jQuery);
|
5
|
+
!function(j){j.extend({tablesorter:new function(){function e(c){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(c):alert(c)}function u(c,d){e(c+" ("+((new Date).getTime()-d.getTime())+"ms)")}function p(c,d,a){if(!d)return"";var b=c.config,g=b.textExtraction,f="",f="simple"===g?b.supportsTextContent?d.textContent:j(d).text():"function"===typeof g?g(d,c,a):"object"===typeof g&&g.hasOwnProperty(a)?g[a](d,c,a):b.supportsTextContent?d.textContent:j(d).text();return j.trim(f)} function h(c){var d=c.config,a=d.$tbodies,b,q,f,l,j,n,k="";if(0===a.length)return d.debug?e("*Empty table!* Not building a parser cache"):"";a=a[0].rows;if(a[0]){b=[];q=a[0].cells.length;for(f=0;f<q;f++){l=d.$headers.filter(":not([colspan])");l=l.add(d.$headers.filter('[colspan="1"]')).filter('[data-column="'+f+'"]:last');j=d.headers[f];n=g.getParserById(g.getData(l,j,"sorter"));d.empties[f]=g.getData(l,j,"empty")||d.emptyTo||(d.emptyToBottom?"bottom":"top");d.strings[f]=g.getData(l,j,"string")|| d.stringTo||"max";if(!n)a:{l=c;j=a;n=-1;for(var u=f,x=void 0,t=g.parsers.length,y=!1,m="",x=!0;""===m&&x;)n++,j[n]?(y=j[n].cells[u],m=p(l,y,u),l.config.debug&&e("Checking if value was empty on row "+n+", column: "+u+": "+m)):x=!1;for(x=1;x<t;x++)if(g.parsers[x].is(m,l,y)){n=g.parsers[x];break a}n=g.parsers[0]}d.debug&&(k+="column:"+f+"; parser:"+n.id+"; string:"+d.strings[f]+"; empty: "+d.empties[f]+"\n");b.push(n)}}d.debug&&e(k);return b}function s(c){var d=c.tBodies,a=c.config,b,q,f=a.parsers,l, v,n,k,h,x,t,m=[];a.cache={};if(!f)return a.debug?e("*Empty table!* Not building a cache"):"";a.debug&&(t=new Date);a.showProcessing&&g.isProcessing(c,!0);for(k=0;k<d.length;k++)if(a.cache[k]={row:[],normalized:[]},!j(d[k]).hasClass(a.cssInfoBlock)){b=d[k]&&d[k].rows.length||0;q=d[k].rows[0]&&d[k].rows[0].cells.length||0;for(v=0;v<b;++v)if(h=j(d[k].rows[v]),x=[],h.hasClass(a.cssChildRow))a.cache[k].row[a.cache[k].row.length-1]=a.cache[k].row[a.cache[k].row.length-1].add(h);else{a.cache[k].row.push(h); for(n=0;n<q;++n)if(l=p(c,h[0].cells[n],n),l=f[n].format(l,c,h[0].cells[n],n),x.push(l),"numeric"===(f[n].type||"").toLowerCase())m[n]=Math.max(Math.abs(l),m[n]||0);x.push(a.cache[k].normalized.length);a.cache[k].normalized.push(x)}a.cache[k].colMax=m}a.showProcessing&&g.isProcessing(c);a.debug&&u("Building cache for "+b+" rows",t)}function m(c,d){var a=c.config,b=c.tBodies,q=[],f=a.cache,e,v,n,k,h,p,m,y,s,r,E;if(f[0]){a.debug&&(E=new Date);for(y=0;y<b.length;y++)if(e=j(b[y]),!e.hasClass(a.cssInfoBlock)){h= g.processTbody(c,e,!0);e=f[y].row;v=f[y].normalized;k=(n=v.length)?v[0].length-1:0;for(p=0;p<n;p++)if(r=v[p][k],q.push(e[r]),!a.appender||!a.removeRows){s=e[r].length;for(m=0;m<s;m++)h.append(e[r][m])}g.processTbody(c,h,!1)}a.appender&&a.appender(c,q);a.debug&&u("Rebuilt table",E);d||g.applyWidget(c);j(c).trigger("sortEnd",c)}}function F(c){var d,a,b,g=c.config,f=g.sortList,e=[g.cssAsc,g.cssDesc],h=j(c).find("tfoot tr").children().removeClass(e.join(" "));g.$headers.removeClass(e.join(" "));b=f.length; for(d=0;d<b;d++)if(2!==f[d][1]&&(c=g.$headers.not(".sorter-false").filter('[data-column="'+f[d][0]+'"]'+(1===b?":last":"")),c.length))for(a=0;a<c.length;a++)c[a].sortDisabled||(c.eq(a).addClass(e[f[d][1]]),h.length&&h.filter('[data-column="'+f[d][0]+'"]').eq(a).addClass(e[f[d][1]]))}function G(c){var d=0,a=c.config,b=a.sortList,g=b.length,f=c.tBodies.length,e,h,n,k,p,m,t,r,s;if(!a.serverSideSorting&&a.cache[0]){a.debug&&(e=new Date);for(n=0;n<f;n++)p=a.cache[n].colMax,s=(m=a.cache[n].normalized)&& m[0]?m[0].length-1:0,m.sort(function(f,e){for(h=0;h<g;h++){k=b[h][0];r=b[h][1];t=/n/i.test(a.parsers&&a.parsers[k]?a.parsers[k].type||"":"")?"Numeric":"Text";t+=0===r?"":"Desc";/Numeric/.test(t)&&a.strings[k]&&(d="boolean"===typeof a.string[a.strings[k]]?(0===r?1:-1)*(a.string[a.strings[k]]?-1:1):a.strings[k]?a.string[a.strings[k]]||0:0);var l=j.tablesorter["sort"+t](c,f[k],e[k],k,p[k],d);if(l)return l}return f[s]-e[s]});a.debug&&u("Sorting on "+b.toString()+" and dir "+r+" time",e)}}function C(c, d){c.trigger("updateComplete");"function"===typeof d&&d(c[0])}function H(c,d,a){!1!==d?c.trigger("sorton",[c[0].config.sortList,function(){C(c,a)}]):C(c,a)}var g=this;g.version="2.7.3";g.parsers=[];g.widgets=[];g.defaults={theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null,onRenderHeader:null,cancelSelection:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,headers:{},ignoreCase:!0, sortForce:null,sortList:[],sortAppend:null,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",textExtraction:"simple",textSorter:null,widgets:[],widgetOptions:{zebra:["even","odd"]},initWidgets:!0,initialized:null,tableClass:"tablesorter",cssAsc:"tablesorter-headerAsc",cssChildRow:"tablesorter-childRow",cssDesc:"tablesorter-headerDesc",cssHeader:"tablesorter-header",cssHeaderRow:"tablesorter-headerRow",cssIcon:"tablesorter-icon",cssInfoBlock:"tablesorter-infoOnly", cssProcessing:"tablesorter-processing",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};g.benchmark=u;g.construct=function(c){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config.debug?e("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var d=j(this),a=this,b,q,f,l="",v,n,k,C,x=j.metadata;a.hasInitialized= !1;a.config={};b=j.extend(!0,a.config,g.defaults,c);j.data(a,"tablesorter",b);b.debug&&j.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===j("<span>x</span>")[0].textContent;b.supportsDataObject=1.4<=parseFloat(j.fn.jquery);b.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(d.attr("class"))||(l=""!==b.theme?" tablesorter-"+b.theme:"");b.$table=d.addClass(b.tableClass+l);b.$tbodies=d.children("tbody:not(."+b.cssInfoBlock+")");var t= [],y={},Q=j(a).find("thead:eq(0), tfoot").children("tr"),K,E,z,A,O,D,L,R,S,I;for(K=0;K<Q.length;K++){O=Q[K].cells;for(E=0;E<O.length;E++){A=O[E];D=A.parentNode.rowIndex;L=D+"-"+A.cellIndex;R=A.rowSpan||1;S=A.colSpan||1;"undefined"===typeof t[D]&&(t[D]=[]);for(z=0;z<t[D].length+1;z++)if("undefined"===typeof t[D][z]){I=z;break}y[L]=I;j(A).attr({"data-column":I});for(z=D;z<D+R;z++){"undefined"===typeof t[z]&&(t[z]=[]);L=t[z];for(A=I;A<I+S;A++)L[A]="x"}}}var M,B,P,T,N,J,U,w=a.config;w.headerList=[];w.headerContent= [];w.debug&&(U=new Date);T=w.cssIcon?'<i class="'+w.cssIcon+'"></i>':"";t=j(a).find(w.selectorHeaders).each(function(a){B=j(this);M=w.headers[a];w.headerContent[a]=this.innerHTML;N=w.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,T);w.onRenderTemplate&&(P=w.onRenderTemplate.apply(B,[a,N]))&&"string"===typeof P&&(N=P);this.innerHTML='<div class="tablesorter-header-inner">'+N+"</div>";w.onRenderHeader&&w.onRenderHeader.apply(B,[a]);this.column=y[this.parentNode.rowIndex+"-"+ this.cellIndex];var b=g.getData(B,M,"sortInitialOrder")||w.sortInitialOrder;this.order=/^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;"false"===g.getData(B,M,"sorter")?(this.sortDisabled=!0,B.addClass("sorter-false")):B.removeClass("sorter-false");this.lockedOrder=!1;J=g.getData(B,M,"lockedOrder")||!1;"undefined"!==typeof J&&!1!==J&&(this.order=this.lockedOrder=/^d/i.test(J)||1===J?[1,1,1]:[0,0,0]);B.addClass((this.sortDisabled?"sorter-false ":" ")+w.cssHeader);w.headerList[a]=this;B.parent().addClass(w.cssHeaderRow)}); a.config.debug&&(u("Built headers:",U),e(t));b.$headers=t;b.parsers=h(a);b.delayInit||s(a);b.$headers.find("*").andSelf().filter(b.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter",function(c,e){var h=(this.tagName.match("TH|TD")?j(this):j(this).parents("th, td").filter(":last"))[0];if(1!==(c.which||c.button))return!1;if("mousedown"===c.type)return C=(new Date).getTime(),"INPUT"===c.target.tagName?"":!b.cancelSelection;if(!0!==e&&250< (new Date).getTime()-C)return!1;b.delayInit&&!b.cache&&s(a);if(!h.sortDisabled){d.trigger("sortStart",a);l=!c[b.sortMultiSortKey];h.count=c[b.sortResetKey]?2:(h.count+1)%(b.sortReset?3:2);b.sortRestart&&(q=h,b.$headers.each(function(){if(this!==q&&(l||!j(this).is("."+b.cssDesc+",."+b.cssAsc)))this.count=-1}));q=h.column;if(l){b.sortList=[];if(null!==b.sortForce){v=b.sortForce;for(f=0;f<v.length;f++)v[f][0]!==q&&b.sortList.push(v[f])}k=h.order[h.count];if(2>k&&(b.sortList.push([q,k]),1<h.colSpan))for(f= 1;f<h.colSpan;f++)b.sortList.push([q+f,k])}else if(b.sortAppend&&1<b.sortList.length&&g.isValueInArray(b.sortAppend[0][0],b.sortList)&&b.sortList.pop(),g.isValueInArray(q,b.sortList))for(f=0;f<b.sortList.length;f++)n=b.sortList[f],k=b.headerList[n[0]],n[0]===q&&(n[1]=k.order[k.count],2===n[1]&&(b.sortList.splice(f,1),k.count=-1));else if(k=h.order[h.count],2>k&&(b.sortList.push([q,k]),1<h.colSpan))for(f=1;f<h.colSpan;f++)b.sortList.push([q+f,k]);if(null!==b.sortAppend){v=b.sortAppend;for(f=0;f<v.length;f++)v[f][0]!== q&&b.sortList.push(v[f])}d.trigger("sortBegin",a);setTimeout(function(){F(a);G(a);m(a)},1)}});b.cancelSelection&&b.$headers.each(function(){this.onselectstart=function(){return!1}});d.unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave").bind("sortReset",function(){b.sortList=[];F(a);G(a);m(a)}).bind("update",function(c,f,g){j(b.selectorRemove,a).remove();b.parsers=h(a);s(a);H(d,f,g)}).bind("updateCell",function(c,f,g, e){var q,h,l;q=d.find("tbody");c=q.index(j(f).parents("tbody").filter(":last"));var k=j(f).parents("tr").filter(":last");f=j(f)[0];q.length&&0<=c&&(h=q.eq(c).find("tr").index(k),l=f.cellIndex,q=a.config.cache[c].normalized[h].length-1,a.config.cache[c].row[a.config.cache[c].normalized[h][q]]=k,a.config.cache[c].normalized[h][l]=b.parsers[l].format(p(a,f,l),a,f,l),H(d,g,e))}).bind("addRows",function(c,g,e,q){var j=g.filter("tr").length,l=[],k=g[0].cells.length,n=d.find("tbody").index(g.closest("tbody")); b.parsers||(b.parsers=h(a));for(c=0;c<j;c++){for(f=0;f<k;f++)l[f]=b.parsers[f].format(p(a,g[c].cells[f],f),a,g[c].cells[f],f);l.push(b.cache[n].row.length);b.cache[n].row.push([g[c]]);b.cache[n].normalized.push(l);l=[]}H(d,e,q)}).bind("sorton",function(b,c,f,g){d.trigger("sortStart",this);var e,q,l,h=a.config;b=c||h.sortList;h.sortList=[];j.each(b,function(a,b){e=[parseInt(b[0],10),parseInt(b[1],10)];if(l=h.headerList[e[0]])h.sortList.push(e),q=j.inArray(e[1],l.order),l.count=0<=q?q:e[1]%(h.sortReset? 3:2)});F(a);G(a);m(a,g);"function"===typeof f&&f(a)}).bind("appendCache",function(b,c,d){m(a,d);"function"===typeof c&&c(a)}).bind("applyWidgetId",function(c,d){g.getWidgetById(d).format(a,b,b.widgetOptions)}).bind("applyWidgets",function(b,c){g.applyWidget(a,c)}).bind("refreshWidgets",function(b,c,d){g.refreshWidgets(a,c,d)}).bind("destroy",function(b,c,d){g.destroy(a,c,d)});b.supportsDataObject&&"undefined"!==typeof d.data().sortlist?b.sortList=d.data().sortlist:x&&(d.metadata()&&d.metadata().sortlist)&& (b.sortList=d.metadata().sortlist);g.applyWidget(a,!0);0<b.sortList.length?d.trigger("sorton",[b.sortList,{},!b.initWidgets]):b.initWidgets&&g.applyWidget(a);if(a.config.widthFixed&&0===j(a).find("colgroup").length){var V=j("<colgroup>"),W=j(a).width();j("tr:first td",a.tBodies[0]).each(function(){V.append(j("<col>").css("width",parseInt(1E3*(j(this).width()/W),10)/10+"%"))});j(a).prepend(V)}b.showProcessing&&d.unbind("sortBegin sortEnd").bind("sortBegin sortEnd",function(b){g.isProcessing(a,"sortBegin"=== b.type)});a.hasInitialized=!0;b.debug&&g.benchmark("Overall initialization time",j.data(a,"startoveralltimer"));d.trigger("tablesorter-initialized",a);"function"===typeof b.initialized&&b.initialized(a)})};g.isProcessing=function(c,d,a){var b=c.config;c=a||j(c).find("."+b.cssHeader);d?(0<b.sortList.length&&(c=c.filter(function(){return this.sortDisabled?!1:g.isValueInArray(parseFloat(j(this).attr("data-column")),b.sortList)})),c.addClass(b.cssProcessing)):c.removeClass(b.cssProcessing)};g.processTbody= function(c,d,a){if(a)return d.before('<span class="tablesorter-savemyplace"/>'),c=j.fn.detach?d.detach():d.remove();c=j(c).find("span.tablesorter-savemyplace");d.insertAfter(c);c.remove()};g.clearTableBody=function(c){c.config.$tbodies.empty()};g.destroy=function(c,d,a){if(c.hasInitialized){g.refreshWidgets(c,!0,!0);var b=j(c),e=c.config,f=b.find("thead:first"),h=f.find("tr."+e.cssHeaderRow).removeClass(e.cssHeaderRow),u=b.find("tfoot:first > tr").children("th, td");f.find("tr").not(h).remove();b.removeData("tablesorter").unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave"); e.$headers.add(u).removeClass(e.cssHeader+" "+e.cssAsc+" "+e.cssDesc).removeAttr("data-column");h.find(e.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter");h.children().each(function(a){j(this).html(e.headerContent[a])});!1!==d&&b.removeClass(e.tableClass+" tablesorter-"+e.theme);c.hasInitialized=!1;"function"===typeof a&&a(c)}};g.regex=[/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, /^0x[0-9a-f]+$/i];g.sortText=function(c,d,a,b){if(d===a)return 0;var e=c.config,f=e.string[e.empties[b]||e.emptyTo],h=g.regex;if(""===d&&0!==f)return"boolean"===typeof f?f?-1:1:-f||-1;if(""===a&&0!==f)return"boolean"===typeof f?f?1:-1:f||1;if("function"===typeof e.textSorter)return e.textSorter(d,a,c,b);c=d.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=a.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");d=parseInt(d.match(h[2]),16)||1!==c.length&& d.match(h[1])&&Date.parse(d);if(a=parseInt(a.match(h[2]),16)||d&&a.match(h[1])&&Date.parse(a)||null){if(d<a)return-1;if(d>a)return 1}e=Math.max(c.length,b.length);for(d=0;d<e;d++){a=isNaN(c[d])?c[d]||0:parseFloat(c[d])||0;h=isNaN(b[d])?b[d]||0:parseFloat(b[d])||0;if(isNaN(a)!==isNaN(h))return isNaN(a)?1:-1;typeof a!==typeof h&&(a+="",h+="");if(a<h)return-1;if(a>h)return 1}return 0};g.sortTextDesc=function(c,d,a,b){if(d===a)return 0;var e=c.config,f=e.string[e.empties[b]||e.emptyTo];return""===d&& 0!==f?"boolean"===typeof f?f?-1:1:f||1:""===a&&0!==f?"boolean"===typeof f?f?1:-1:-f||-1:"function"===typeof e.textSorter?e.textSorter(a,d,c,b):g.sortText(c,a,d)};g.getTextValue=function(c,d,a){if(d){var b=c.length,e=d+a;for(d=0;d<b;d++)e+=c.charCodeAt(d);return a*e}return 0};g.sortNumeric=function(c,d,a,b,e,f){if(d===a)return 0;c=c.config;b=c.string[c.empties[b]||c.emptyTo];if(""===d&&0!==b)return"boolean"===typeof b?b?-1:1:-b||-1;if(""===a&&0!==b)return"boolean"===typeof b?b?1:-1:b||1;isNaN(d)&& (d=g.getTextValue(d,e,f));isNaN(a)&&(a=g.getTextValue(a,e,f));return d-a};g.sortNumericDesc=function(c,d,a,b,e,f){if(d===a)return 0;c=c.config;b=c.string[c.empties[b]||c.emptyTo];if(""===d&&0!==b)return"boolean"===typeof b?b?-1:1:b||1;if(""===a&&0!==b)return"boolean"===typeof b?b?1:-1:-b||-1;isNaN(d)&&(d=g.getTextValue(d,e,f));isNaN(a)&&(a=g.getTextValue(a,e,f));return a-d};g.characterEquivalents={a:"\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5",A:"\u00c1\u00c0\u00c2\u00c3\u00c4\u0104\u00c5",c:"\u00e7\u0107\u010d", C:"\u00c7\u0106\u010c",e:"\u00e9\u00e8\u00ea\u00eb\u011b\u0119",E:"\u00c9\u00c8\u00ca\u00cb\u011a\u0118",i:"\u00ed\u00ec\u0130\u00ee\u00ef\u0131",I:"\u00cd\u00cc\u0130\u00ce\u00cf",o:"\u00f3\u00f2\u00f4\u00f5\u00f6",O:"\u00d3\u00d2\u00d4\u00d5\u00d6",ss:"\u00df",SS:"\u1e9e",u:"\u00fa\u00f9\u00fb\u00fc\u016f",U:"\u00da\u00d9\u00db\u00dc\u016e"};g.replaceAccents=function(c){var d,a="[",b=g.characterEquivalents;if(!g.characterRegex){g.characterRegexArray={};for(d in b)"string"===typeof d&&(a+=b[d],g.characterRegexArray[d]= RegExp("["+b[d]+"]","g"));g.characterRegex=RegExp(a+"]")}if(g.characterRegex.test(c))for(d in b)"string"===typeof d&&(c=c.replace(g.characterRegexArray[d],d));return c};g.isValueInArray=function(c,d){var a,b=d.length;for(a=0;a<b;a++)if(d[a][0]===c)return!0;return!1};g.addParser=function(c){var d,a=g.parsers.length,b=!0;for(d=0;d<a;d++)g.parsers[d].id.toLowerCase()===c.id.toLowerCase()&&(b=!1);b&&g.parsers.push(c)};g.getParserById=function(c){var d,a=g.parsers.length;for(d=0;d<a;d++)if(g.parsers[d].id.toLowerCase()=== c.toString().toLowerCase())return g.parsers[d];return!1};g.addWidget=function(c){g.widgets.push(c)};g.getWidgetById=function(c){var d,a,b=g.widgets.length;for(d=0;d<b;d++)if((a=g.widgets[d])&&a.hasOwnProperty("id")&&a.id.toLowerCase()===c.toLowerCase())return a};g.applyWidget=function(c,d){var a=c.config,b=a.widgetOptions,e=a.widgets.sort().reverse(),f,h,m,n=e.length;h=j.inArray("zebra",a.widgets);0<=h&&(a.widgets.splice(h,1),a.widgets.push("zebra"));a.debug&&(f=new Date);for(h=0;h<n;h++)(m=g.getWidgetById(e[h]))&& (!0===d&&m.hasOwnProperty("init")?m.init(c,m,a,b):!d&&m.hasOwnProperty("format")&&m.format(c,a,b));a.debug&&u("Completed "+(!0===d?"initializing":"applying")+" widgets",f)};g.refreshWidgets=function(c,d,a){var b,h=c.config,f=h.widgets,l=g.widgets,m=l.length;for(b=0;b<m;b++)if(l[b]&&l[b].id&&(d||0>j.inArray(l[b].id,f)))h.debug&&e("Refeshing widgets: Removing "+l[b].id),l[b].hasOwnProperty("remove")&&l[b].remove(c,h,h.widgetOptions);!0!==a&&g.applyWidget(c,d)};g.getData=function(c,d,a){var b="";c=j(c); var e,f;if(!c.length)return"";e=j.metadata?c.metadata():!1;f=" "+(c.attr("class")||"");"undefined"!==typeof c.data(a)||"undefined"!==typeof c.data(a.toLowerCase())?b+=c.data(a)||c.data(a.toLowerCase()):e&&"undefined"!==typeof e[a]?b+=e[a]:d&&"undefined"!==typeof d[a]?b+=d[a]:" "!==f&&f.match(" "+a+"-")&&(b=f.match(RegExp(" "+a+"-(\\w+)"))[1]||"");return j.trim(b)};g.formatFloat=function(c,d){if("string"!==typeof c||""===c)return c;var a;c=(d&&d.config?!1!==d.config.usNumberFormat:"undefined"!==typeof d? d:1)?c.replace(/,/g,""):c.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(c)&&(c=c.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(c);return isNaN(a)?j.trim(c):a};g.isDigit=function(c){return isNaN(c)?/^[\-+(]?\d+[)]?$/.test(c.toString().replace(/[,.'"\s]/g,"")):!0}}});var h=j.tablesorter;j.fn.extend({tablesorter:h.construct});h.addParser({id:"text",is:function(){return!0},format:function(e,u){var p=u.config;e=j.trim(p.ignoreCase?e.toLocaleLowerCase():e);return p.sortLocaleCompare? h.replaceAccents(e):e},type:"text"});h.addParser({id:"currency",is:function(e){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test(e)},format:function(e,j){return h.formatFloat(e.replace(/[^\w,. \-()]/g,""),j)},type:"numeric"});h.addParser({id:"ipAddress",is:function(e){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(e)},format:function(e,j){var p,r=e.split("."),s="",m=r.length;for(p=0;p<m;p++)s+=("00"+r[p]).slice(-3);return h.formatFloat(s,j)}, type:"numeric"});h.addParser({id:"url",is:function(e){return/^(https?|ftp|file):\/\//.test(e)},format:function(e){return j.trim(e.replace(/(https?|ftp|file):\/\//,""))},type:"text"});h.addParser({id:"isoDate",is:function(e){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(e)},format:function(e,j){return h.formatFloat(""!==e?(new Date(e.replace(/-/g,"/"))).getTime()||"":"",j)},type:"numeric"});h.addParser({id:"percent",is:function(e){return/(\d\s?%|%\s?\d)/.test(e)},format:function(e,j){return h.formatFloat(e.replace(/%/g, ""),j)},type:"numeric"});h.addParser({id:"usLongDate",is:function(e){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(e)},format:function(e,j){return h.formatFloat((new Date(e.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",j)},type:"numeric"});h.addParser({id:"shortDate",is:function(e){return/^(\d{1,2}|\d{4})[\/\-\,\.\s+]\d{1,2}[\/\-\.\,\s+](\d{1,2}|\d{4})$/.test(e)},format:function(e,j,p,r){p=j.config;var s=p.headerList[r],m=s.shortDateFormat;"undefined"=== typeof m&&(m=s.shortDateFormat=h.getData(s,p.headers[r],"dateFormat")||p.dateFormat);e=e.replace(/\s+/g," ").replace(/[\-|\.|\,]/g,"/");"mmddyyyy"===m?e=e.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===m?e=e.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===m&&(e=e.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"));return h.formatFloat((new Date(e)).getTime()||"",j)},type:"numeric"});h.addParser({id:"time",is:function(e){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(e)}, format:function(e,j){return h.formatFloat((new Date("2000/01/01 "+e.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",j)},type:"numeric"});h.addParser({id:"digit",is:function(e){return h.isDigit(e)},format:function(e,j){return h.formatFloat(e.replace(/[^\w,. \-()]/g,""),j)},type:"numeric"});h.addParser({id:"metadata",is:function(){return!1},format:function(e,h,p){e=h.config;e=!e.parserMetadataName?"sortValue":e.parserMetadataName;return j(p).metadata()[e]},type:"numeric"});h.addWidget({id:"zebra", format:function(e,u,p){var r,s,m,F,G,C,H=RegExp(u.cssChildRow,"i"),g=u.$tbodies;u.debug&&(G=new Date);for(e=0;e<g.length;e++)r=g.eq(e),C=r.children("tr").length,1<C&&(m=0,r=r.children("tr:visible"),r.each(function(){s=j(this);H.test(this.className)||m++;F=0===m%2;s.removeClass(p.zebra[F?1:0]).addClass(p.zebra[F?0:1])}));u.debug&&h.benchmark("Applying Zebra widget",G)},remove:function(e,h){var p,r,s=h.$tbodies,m=(h.widgetOptions.zebra||["even","odd"]).join(" ");for(p=0;p<s.length;p++)r=j.tablesorter.processTbody(e, s.eq(p),!0),r.children().removeClass(m),j.tablesorter.processTbody(e,r,!1)}})}(jQuery);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! tableSorter 2.4+ widgets - updated
|
1
|
+
/*! tableSorter 2.4+ widgets - updated 1/10/2013
|
2
2
|
*
|
3
3
|
* Column Styles
|
4
4
|
* Column Filters
|
@@ -81,18 +81,13 @@ $.tablesorter.storage = function(table, key, val){
|
|
81
81
|
v = (d !== 0) ? $.parseJSON(k[d]) || {} : {};
|
82
82
|
}
|
83
83
|
}
|
84
|
-
|
84
|
+
// allow val to be an empty string to
|
85
|
+
if ((val || val === '') && window.JSON && JSON.hasOwnProperty('stringify')){
|
85
86
|
// add unique identifiers = url pathname > table ID/index on page > data
|
86
|
-
if (v[url]
|
87
|
-
v[url]
|
88
|
-
} else {
|
89
|
-
if (v[url]){
|
90
|
-
v[url][id] = val;
|
91
|
-
} else {
|
92
|
-
v[url] = {};
|
93
|
-
v[url][id] = val;
|
94
|
-
}
|
87
|
+
if (!v[url]) {
|
88
|
+
v[url] = {};
|
95
89
|
}
|
90
|
+
v[url][id] = val;
|
96
91
|
// *** set val ***
|
97
92
|
if (ls){
|
98
93
|
localStorage[key] = JSON.stringify(v);
|
@@ -102,7 +97,7 @@ $.tablesorter.storage = function(table, key, val){
|
|
102
97
|
document.cookie = key + '=' + (JSON.stringify(v)).replace(/\"/g,'\"') + '; expires=' + d.toGMTString() + '; path=/';
|
103
98
|
}
|
104
99
|
} else {
|
105
|
-
return
|
100
|
+
return v && v[url] ? v[url][id] : {};
|
106
101
|
}
|
107
102
|
};
|
108
103
|
|
@@ -112,13 +107,13 @@ $.tablesorter.storage = function(table, key, val){
|
|
112
107
|
$.tablesorter.addWidget({
|
113
108
|
id: "uitheme",
|
114
109
|
format: function(table){
|
115
|
-
var time, klass, $el, $tar,
|
110
|
+
var time, klass, $el, $tar,
|
111
|
+
t = $.tablesorter.themes,
|
116
112
|
$t = $(table),
|
117
113
|
c = table.config,
|
118
114
|
wo = c.widgetOptions,
|
119
|
-
theme =
|
120
|
-
|
121
|
-
o = (typeof wo.uitheme === 'object' && !Object.prototype.toString.call(wo.uitheme).test('Array')) ? wo.uitheme : $.tablesorter.themes[ $.tablesorter.themes.hasOwnProperty(theme) ? theme : 'jui'],
|
115
|
+
theme = c.theme !== 'default' ? c.theme : wo.uitheme || 'jui', // default uitheme is 'jui'
|
116
|
+
o = t[ t[theme] ? theme : t[wo.uitheme] ? wo.uitheme : 'jui'],
|
122
117
|
$h = $(c.headerList),
|
123
118
|
sh = 'tr.' + (wo.stickyHeaders || 'tablesorter-stickyHeader'),
|
124
119
|
rmv = o.sortNone + ' ' + o.sortDesc + ' ' + o.sortAsc;
|
@@ -138,7 +133,6 @@ $.tablesorter.addWidget({
|
|
138
133
|
.find('tr').addClass(o.footerRow)
|
139
134
|
.children('th, td').addClass(o.footerCells);
|
140
135
|
}
|
141
|
-
c.theme = ''; // clear out theme option so it doesn't interfere
|
142
136
|
// update header classes
|
143
137
|
$h
|
144
138
|
.addClass(o.header)
|
@@ -206,7 +200,7 @@ $.tablesorter.addWidget({
|
|
206
200
|
$tbl = $(table),
|
207
201
|
c = table.config,
|
208
202
|
wo = c.widgetOptions,
|
209
|
-
b =
|
203
|
+
b = c.$tbodies,
|
210
204
|
list = c.sortList,
|
211
205
|
len = list.length,
|
212
206
|
css = [ "primary", "secondary", "tertiary" ]; // default options
|
@@ -220,7 +214,7 @@ $.tablesorter.addWidget({
|
|
220
214
|
}
|
221
215
|
// check if there is a sort (on initialization there may not be one)
|
222
216
|
for (k = 0; k < b.length; k++ ){
|
223
|
-
$tb = $.tablesorter.processTbody(table,
|
217
|
+
$tb = $.tablesorter.processTbody(table, b.eq(k), true); // detach tbody
|
224
218
|
$tr = $tb.children('tr');
|
225
219
|
l = $tr.length;
|
226
220
|
// loop through the visible rows
|
@@ -268,10 +262,12 @@ $.tablesorter.addWidget({
|
|
268
262
|
},
|
269
263
|
remove: function(table, c, wo){
|
270
264
|
var k, $tb,
|
271
|
-
b =
|
265
|
+
b = c.$tbodies,
|
272
266
|
rmv = (c.widgetOptions.columns || [ "primary", "secondary", "tertiary" ]).join(' ');
|
267
|
+
c.$headers.removeClass(rmv);
|
268
|
+
$(table).children('tfoot').children('tr').children('th, td').removeClass(rmv);
|
273
269
|
for (k = 0; k < b.length; k++ ){
|
274
|
-
$tb = $.tablesorter.processTbody(table,
|
270
|
+
$tb = $.tablesorter.processTbody(table, b.eq(k), true); // remove tbody
|
275
271
|
$tb.children('tr').each(function(){
|
276
272
|
$(this).children().removeClass(rmv);
|
277
273
|
});
|
@@ -307,7 +303,7 @@ $.tablesorter.addWidget({
|
|
307
303
|
wo = c.widgetOptions,
|
308
304
|
css = wo.filter_cssFilter || 'tablesorter-filter',
|
309
305
|
$t = $(table).addClass('hasFilters'),
|
310
|
-
b =
|
306
|
+
b = c.$tbodies,
|
311
307
|
cols = c.parsers.length,
|
312
308
|
reg = [ // regex used in filter "check" functions
|
313
309
|
/^\/((?:\\\/|[^\/])+)\/([mig]{0,3})?$/, // 0 = regex to test for regex
|
@@ -361,7 +357,7 @@ $.tablesorter.addWidget({
|
|
361
357
|
if (c.debug) { time = new Date(); }
|
362
358
|
|
363
359
|
for (k = 0; k < b.length; k++ ){
|
364
|
-
$tb = $.tablesorter.processTbody(table,
|
360
|
+
$tb = $.tablesorter.processTbody(table, b.eq(k), true);
|
365
361
|
$tr = $tb.children('tr');
|
366
362
|
l = $tr.length;
|
367
363
|
if (cv === '' || wo.filter_serversideFiltering){
|
@@ -492,8 +488,8 @@ $.tablesorter.addWidget({
|
|
492
488
|
// build default select dropdown
|
493
489
|
for (i = 0; i < cols; i++){
|
494
490
|
t = $ths.filter('[data-column="' + i + '"]:last');
|
495
|
-
// look for the filter-select class
|
496
|
-
if (t.hasClass('filter-select')
|
491
|
+
// look for the filter-select class; build/update it if found
|
492
|
+
if ((t.hasClass('filter-select') || wo.filter_functions && wo.filter_functions[i] === true) && !t.hasClass('filter-false')){
|
497
493
|
if (!wo.filter_functions) { wo.filter_functions = {}; }
|
498
494
|
wo.filter_functions[i] = true; // make sure this select gets processed by filter_functions
|
499
495
|
buildSelect(i, updating);
|
@@ -586,7 +582,9 @@ $.tablesorter.addWidget({
|
|
586
582
|
}
|
587
583
|
}
|
588
584
|
}
|
589
|
-
|
585
|
+
// not really updating, but if the column has both the "filter-select" class & filter_functions set to true,
|
586
|
+
// it would append the same options twice.
|
587
|
+
buildDefault(true);
|
590
588
|
|
591
589
|
$t.find('select.' + css).bind('change search', function(){
|
592
590
|
checkFilters();
|
@@ -652,14 +650,14 @@ $.tablesorter.addWidget({
|
|
652
650
|
remove: function(table, c, wo){
|
653
651
|
var k, $tb,
|
654
652
|
$t = $(table),
|
655
|
-
b =
|
653
|
+
b = c.$tbodies;
|
656
654
|
$t
|
657
655
|
.removeClass('hasFilters')
|
658
656
|
// add .tsfilter namespace to all BUT search
|
659
657
|
.unbind('addRows updateCell update appendCache search'.split(' ').join('.tsfilter'))
|
660
658
|
.find('.tablesorter-filter-row').remove();
|
661
659
|
for (k = 0; k < b.length; k++ ){
|
662
|
-
$tb = $.tablesorter.processTbody(table,
|
660
|
+
$tb = $.tablesorter.processTbody(table, b.eq(k), true); // remove tbody
|
663
661
|
$tb.children().removeClass('filtered').show();
|
664
662
|
$.tablesorter.processTbody(table, $tb, false); // restore tbody
|
665
663
|
}
|
@@ -686,7 +684,7 @@ $.tablesorter.addWidget({
|
|
686
684
|
innr = '.tablesorter-header-inner',
|
687
685
|
firstRow = hdrCells.eq(0).parent(),
|
688
686
|
tfoot = $table.find('tfoot'),
|
689
|
-
t2 = $table.clone(), // clone table, but don't remove id... the table might be styled by css
|
687
|
+
t2 = wo.$sticky = $table.clone(), // clone table, but don't remove id... the table might be styled by css
|
690
688
|
// clone the entire thead - seems to work in IE8+
|
691
689
|
stkyHdr = t2.children('thead:first')
|
692
690
|
.addClass(css)
|
@@ -798,6 +796,7 @@ $.tablesorter.addWidget({
|
|
798
796
|
.removeClass('hasStickyHeaders')
|
799
797
|
.unbind('sortEnd.tsSticky pagerComplete.tsSticky')
|
800
798
|
.find('.' + css).remove();
|
799
|
+
if (wo.$sticky) { wo.$sticky.remove(); } // remove cloned thead
|
801
800
|
$(window).unbind('scroll.tsSticky resize.tsSticky');
|
802
801
|
}
|
803
802
|
});
|
@@ -1,12 +1,12 @@
|
|
1
|
-
/*! tableSorter 2.4+ widgets - updated
|
1
|
+
/*! tableSorter 2.4+ widgets - updated 1/10/2013 */
|
2
2
|
;(function(b){
|
3
3
|
b.tablesorter=b.tablesorter||{};
|
4
4
|
b.tablesorter.themes={bootstrap:{table:"table table-bordered table-striped",header:"bootstrap-header",footerRow:"",footerCells:"",icons:"",sortNone:"bootstrap-icon-unsorted",sortAsc:"icon-chevron-up",sortDesc:"icon-chevron-down",active:"",hover:"",filterRow:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",header:"ui-widget-header ui-corner-all ui-state-default",footerRow:"",footerCells:"",icons:"ui-icon",sortNone:"ui-icon-carat-2-n-s", sortAsc:"ui-icon-carat-1-n",sortDesc:"ui-icon-carat-1-s",active:"ui-state-active",hover:"ui-state-hover",filterRow:"",even:"ui-widget-content",odd:"ui-state-default"}};
|
5
|
-
b.tablesorter.storage=function(
|
6
|
-
b.tablesorter.addWidget({id:"uitheme",format:function(
|
7
|
-
b.tablesorter.addWidget({id:"columns",format:function(
|
8
|
-
b.tablesorter.addWidget({id:"filter",format:function(
|
9
|
-
b.tablesorter.addWidget({id:"stickyHeaders",format:function(
|
10
|
-
b.tablesorter.addWidget({id:"resizable",format:function(
|
11
|
-
b.tablesorter.addWidget({id:"saveSort",init:function(b,
|
5
|
+
b.tablesorter.storage=function(d,a,e){var c,j=!1;c={};var f=d.id||b(".tablesorter").index(b(d)),h=window.location.pathname;try{j=!!localStorage.getItem}catch(n){}b.parseJSON&&(j?c=b.parseJSON(localStorage[a])||{}:(c=document.cookie.split(/[;\s|=]/),d=b.inArray(a,c)+1,c=0!==d?b.parseJSON(c[d])||{}:{}));if((e||""===e)&&window.JSON&&JSON.hasOwnProperty("stringify"))c[h]|| (c[h]={}),c[h][f]=e,j?localStorage[a]=JSON.stringify(c):(d=new Date,d.setTime(d.getTime()+31536E6),document.cookie=a+"="+JSON.stringify(c).replace(/\"/g,'"')+"; expires="+d.toGMTString()+"; path=/");else return c&&c[h]?c[h][f]:{}};
|
6
|
+
b.tablesorter.addWidget({id:"uitheme",format:function(d){var a,e,c,j,f=b.tablesorter.themes,h=b(d),n=d.config,p=n.widgetOptions,q="default"!==n.theme?n.theme:p.uitheme||"jui",g=f[f[q]?q:f[p.uitheme]?p.uitheme:"jui"],m=b(n.headerList),r="tr."+(p.stickyHeaders||"tablesorter-stickyHeader"), s=g.sortNone+" "+g.sortDesc+" "+g.sortAsc;n.debug&&(a=new Date);if(!h.hasClass("tablesorter-"+q)||n.theme===q||!d.hasInitialized)""!==g.even&&(p.zebra[0]+=" "+g.even),""!==g.odd&&(p.zebra[1]+=" "+g.odd),f=h.removeClass(""===n.theme?"":"tablesorter-"+n.theme).addClass("tablesorter-"+q+" "+g.table).find("tfoot"),f.length&&f.find("tr").addClass(g.footerRow).children("th, td").addClass(g.footerCells),m.addClass(g.header).filter(":not(.sorter-false)").hover(function(){b(this).addClass(g.hover)},function(){b(this).removeClass(g.hover)}), m.find(".tablesorter-wrapper").length||m.wrapInner('<div class="tablesorter-wrapper" style="position:relative;height:100%;width:100%"></div>'),n.cssIcon&&m.find("."+n.cssIcon).addClass(g.icons),h.hasClass("hasFilters")&&m.find(".tablesorter-filter-row").addClass(g.filterRow);b.each(m,function(a){c=b(this);j=n.cssIcon?c.find("."+n.cssIcon):c;this.sortDisabled?(c.removeClass(s),j.removeClass(s+" tablesorter-icon "+g.icons)):(f=h.hasClass("hasStickyHeaders")?h.find(r).find("th").eq(a).add(c):c,e=c.hasClass(n.cssAsc)? g.sortAsc:c.hasClass(n.cssDesc)?g.sortDesc:c.hasClass(n.cssHeader)?g.sortNone:"",c[e===g.sortNone?"removeClass":"addClass"](g.active),j.removeClass(s).addClass(e))});n.debug&&b.tablesorter.benchmark("Applying "+q+" theme",a)},remove:function(d,a,e){d=b(d);var c="object"===typeof e.uitheme?"jui":e.uitheme||"jui";e="object"===typeof e.uitheme?e.uitheme:b.tablesorter.themes[b.tablesorter.themes.hasOwnProperty(c)?c:"jui"];var j=d.children("thead").children(),f=e.sortNone+" "+e.sortDesc+" "+e.sortAsc; d.removeClass("tablesorter-"+c+" "+e.table).find(a.cssHeader).removeClass(e.header);j.unbind("mouseenter mouseleave").removeClass(e.hover+" "+f+" "+e.active).find(".tablesorter-filter-row").removeClass(e.filterRow);j.find(".tablesorter-icon").removeClass(e.icons)}});
|
7
|
+
b.tablesorter.addWidget({id:"columns",format:function(d){var a,e,c,j,f,h,n,p,q,g=b(d),m=d.config,r=m.widgetOptions,s=m.$tbodies,u=m.sortList,w=u.length,l=["primary","secondary","tertiary"],l=m.widgetColumns&&m.widgetColumns.hasOwnProperty("css")? m.widgetColumns.css||l:r&&r.hasOwnProperty("columns")?r.columns||l:l;h=l.length-1;n=l.join(" ");m.debug&&(f=new Date);for(q=0;q<s.length;q++)a=b.tablesorter.processTbody(d,s.eq(q),!0),e=a.children("tr"),e.each(function(){j=b(this);if("none"!==this.style.display&&(c=j.children().removeClass(n),u&&u[0]&&(c.eq(u[0][0]).addClass(l[0]),1<w)))for(p=1;p<w;p++)c.eq(u[p][0]).addClass(l[p]||l[h])}),b.tablesorter.processTbody(d,a,!1);e=!1!==r.columns_thead?"thead tr":"";!1!==r.columns_tfoot&&(e+=(""===e?"": ",")+"tfoot tr");if(e.length&&(j=g.find(e).children().removeClass(n),u&&u[0]&&(j.filter('[data-column="'+u[0][0]+'"]').addClass(l[0]),1<w)))for(p=1;p<w;p++)j.filter('[data-column="'+u[p][0]+'"]').addClass(l[p]||l[h]);m.debug&&b.tablesorter.benchmark("Applying Columns widget",f)},remove:function(d,a){var e,c,j=a.$tbodies,f=(a.widgetOptions.columns||["primary","secondary","tertiary"]).join(" ");a.$headers.removeClass(f);b(d).children("tfoot").children("tr").children("th, td").removeClass(f);for(e=0;e< j.length;e++)c=b.tablesorter.processTbody(d,j.eq(e),!0),c.children("tr").each(function(){b(this).children().removeClass(f)}),b.tablesorter.processTbody(d,c,!1)}});
|
8
|
+
b.tablesorter.addWidget({id:"filter",format:function(d){if(d.config.parsers&&!b(d).hasClass("hasFilters")){var a,e,c,j,f,h,n,p,q,g,m,r,s,u,w,l,y,G="",A=b.tablesorter,t=d.config,B=b(t.headerList),k=t.widgetOptions,z=k.filter_cssFilter||"tablesorter-filter",v=b(d).addClass("hasFilters"),E=t.$tbodies,F=t.parsers.length,C=[/^\/((?:\\\/|[^\/])+)\/([mig]{0,3})?$/, RegExp(t.cssChildRow),/undefined|number/,/(^[\"|\'|=])|([\"|\'|=]$)/,/[\"\'=]/g,/[^\w,. \-()]/g,/[<>=]/g],M=B.map(function(a){return A.getData?"parsed"===A.getData(B.filter('[data-column="'+a+'"]:last'),t.headers[a],"filter"):b(this).hasClass("filter-parsed")}).get(),H,I,D=function(a){var c=b.isArray(a),e=v.find("thead").eq(0).children("tr").find("select."+z+", input."+z),d=c?a:e.map(function(){return b(this).val()||""}).get(),f=(d||[]).join("");c&&e.each(function(c,d){b(d).val(a[c]||"")});!0===k.filter_hideFilters&& v.find(".tablesorter-filter-row").trigger(""===f?"mouseleave":"mouseenter");if(!(G===f&&!1!==a))if(v.trigger("filterStart",[d]),t.showProcessing)setTimeout(function(){J(a,d,f);return!1},30);else return J(a,d,f),!1},J=function(j,g,h){var m,q,s,r,y,x,z;t.debug&&(z=new Date);for(c=0;c<E.length;c++){j=b.tablesorter.processTbody(d,E.eq(c),!0);m=j.children("tr");y=m.length;if(""===h||k.filter_serversideFiltering)m.show().removeClass("filtered");else for(e=0;e<y;e++)if(!C[1].test(m[e].className)){r=!0;s= m.eq(e).nextUntil("tr:not(."+t.cssChildRow+")");l=s.length&&(k&&k.hasOwnProperty("filter_childRows")&&"undefined"!==typeof k.filter_childRows?k.filter_childRows:1)?s.text():"";l=k.filter_ignoreCase?l.toLocaleLowerCase():l;q=m.eq(e).children("td");for(a=0;a<F;a++)if(g[a]){n=k.filter_useParsedData||M[a]?t.cache[c].normalized[e][a]:b.trim(q.eq(a).text());p=!C[2].test(typeof n)&&k.filter_ignoreCase?n.toLocaleLowerCase():n;x=r;f=k.filter_ignoreCase?g[a].toLocaleLowerCase():g[a];if(k.filter_functions&& k.filter_functions[a])!0===k.filter_functions[a]?x=B.filter('[data-column="'+a+'"]:last').hasClass("filter-match")?0<=p.search(f):g[a]===n:"function"===typeof k.filter_functions[a]?x=k.filter_functions[a](n,t.cache[c].normalized[e][a],g[a],a):"function"===typeof k.filter_functions[a][g[a]]&&(x=k.filter_functions[a][g[a]](n,t.cache[c].normalized[e][a],g[a],a));else if(C[0].test(f)){u=C[0].exec(f);try{x=RegExp(u[1],u[2]).test(p)}catch(D){x=!1}}else C[3].test(f)&&p===f.replace(C[4],"")?x=!0:/^\!/.test(f)? (f=f.replace("!",""),w=p.search(b.trim(f)),x=""===f?!0:!(k.filter_startsWith?0===w:0<=w)):/^[<>]=?/.test(f)?(u=isNaN(p)?b.tablesorter.formatFloat(p.replace(C[5],""),d):b.tablesorter.formatFloat(p,d),w=b.tablesorter.formatFloat(f.replace(C[5],"").replace(C[6],""),d),/>/.test(f)&&(x=/>=/.test(f)?u>=w:u>w),/</.test(f)&&(x=/<=/.test(f)?u<=w:u<w)):/[\?|\*]/.test(f)?x=RegExp(f.replace(/\?/g,"\\S{1}").replace(/\*/g,"\\S*")).test(p):(n=(p+l).indexOf(f),x=!k.filter_startsWith&&0<=n||k.filter_startsWith&&0=== n);r=x?r?!0:!1:!1}m[e].style.display=r?"":"none";m.eq(e)[r?"removeClass":"addClass"]("filtered");if(s.length)s[r?"show":"hide"]()}b.tablesorter.processTbody(d,j,!1)}G=h;t.debug&&A.benchmark("Completed filter widget search",z);v.trigger("applyWidgets");v.trigger("filterEnd")},K=function(a,f){var g,h=[];a=parseInt(a,10);g='<option value="">'+(B.filter('[data-column="'+a+'"]:last').attr("data-placeholder")||"")+"</option>";for(c=0;c<E.length;c++){j=t.cache[c].row.length;for(e=0;e<j;e++)k.filter_useParsedData? h.push(""+t.cache[c].normalized[e][a]):(l=t.cache[c].row[e][0].cells[a])&&h.push(b.trim(t.supportsTextContent?l.textContent:b(l).text()))}h=b.grep(h,function(a,c){return b.inArray(a,h)===c});h=A.sortText?h.sort(function(b,c){return A.sortText(d,b,c,a)}):h.sort(!0);for(c=0;c<h.length;c++)g+='<option value="'+h[c]+'">'+h[c]+"</option>";v.find("thead").find("select."+z+'[data-column="'+a+'"]')[f?"html":"append"](g)},L=function(b){for(a=0;a<F;a++)if(l=B.filter('[data-column="'+a+'"]:last'),(l.hasClass("filter-select")|| k.filter_functions&&!0===k.filter_functions[a])&&!l.hasClass("filter-false"))k.filter_functions||(k.filter_functions={}),k.filter_functions[a]=!0,K(a,b)};t.debug&&(H=new Date);k.filter_ignoreCase=!1!==k.filter_ignoreCase;k.filter_useParsedData=!0===k.filter_useParsedData;if(!1!==k.filter_columnFilters&&B.filter(".filter-false").length!==B.length){l='<tr class="tablesorter-filter-row">';for(a=0;a<F;a++)s=!1,s=B.filter('[data-column="'+a+'"]:last'),h=k.filter_functions&&k.filter_functions[a]&&"function"!== typeof k.filter_functions[a]||s.hasClass("filter-select"),l+="<td>",l=h?l+('<select data-column="'+a+'" class="'+z):l+('<input type="search" placeholder="'+(s.attr("data-placeholder")||"")+'" data-column="'+a+'" class="'+z),s=A.getData?"false"===A.getData(s[0],t.headers[a],"filter"):t.headers[a]&&t.headers[a].hasOwnProperty("filter")&&!1===t.headers[a].filter||s.hasClass("filter-false"),l+=s?' disabled" disabled':'"',l+=(h?"></select>":">")+"</td>";v.find("thead").eq(0).append(l+="</tr>")}v.bind(["addRows", "updateCell","update","appendCache","search"].join(".tsfilter "),function(b,a){"search"!==b.type&&L(!0);D("search"===b.type?a:"");return!1}).find("input."+z).bind("keyup search",function(b,a){if(!(32>b.which&&8!==b.which||37<=b.which&&40>=b.which)){if("undefined"!==typeof a)return D(a),!1;clearTimeout(I);I=setTimeout(function(){D()},k.filter_searchDelay||300)}});k.filter_reset&&b(k.filter_reset).length&&b(k.filter_reset).bind("click",function(){v.find("."+z).val("");D();return!1});if(k.filter_functions)for(y in k.filter_functions)if(k.filter_functions.hasOwnProperty(y)&& "string"===typeof y)if(l=B.filter('[data-column="'+y+'"]:last'),h="",!0===k.filter_functions[y]&&!l.hasClass("filter-false"))K(y);else if("string"===typeof y&&!l.hasClass("filter-false")){for(g in k.filter_functions[y])"string"===typeof g&&(h+=""===h?'<option value="">'+(l.attr("data-placeholder")||"")+"</option>":"",h+='<option value="'+g+'">'+g+"</option>");v.find("thead").find("select."+z+'[data-column="'+y+'"]').append(h)}L(!0);v.find("select."+z).bind("change search",function(){D()});!0===k.filter_hideFilters&& v.find(".tablesorter-filter-row").addClass("hideme").bind("mouseenter mouseleave",function(a){var c;m=b(this);clearTimeout(q);q=setTimeout(function(){/enter|over/.test(a.type)?m.removeClass("hideme"):b(document.activeElement).closest("tr")[0]!==m[0]&&(c=v.find("."+(k.filter_cssFilter||"tablesorter-filter")).map(function(){return b(this).val()||""}).get().join(""),""===c&&m.addClass("hideme"))},200)}).find("input, select").bind("focus blur",function(a){r=b(this).closest("tr");clearTimeout(q);q=setTimeout(function(){if(""=== v.find("."+(k.filter_cssFilter||"tablesorter-filter")).map(function(){return b(this).val()||""}).get().join(""))r["focus"===a.type?"removeClass":"addClass"]("hideme")},200)});t.showProcessing&&v.bind("filterStart filterEnd",function(a,c){var d=c?v.find("."+t.cssHeader).filter("[data-column]").filter(function(){return""!==c[b(this).data("column")]}):"";A.isProcessing(v[0],"filterStart"===a.type,c?d:"")});t.debug&&A.benchmark("Applying Filter widget",H);v.trigger("filterInit")}},remove:function(d,a, e){var c,j;c=b(d);a=a.$tbodies;c.removeClass("hasFilters").unbind(["addRows","updateCell","update","appendCache","search"].join(".tsfilter")).find(".tablesorter-filter-row").remove();for(c=0;c<a.length;c++)j=b.tablesorter.processTbody(d,a.eq(c),!0),j.children().removeClass("filtered").show(),b.tablesorter.processTbody(d,j,!1);e.filterreset&&b(e.filter_reset).unbind("click")}});
|
9
|
+
b.tablesorter.addWidget({id:"stickyHeaders",format:function(d){if(!b(d).hasClass("hasStickyHeaders")){var a=b(d).addClass("hasStickyHeaders"), e=d.config,c=e.widgetOptions,j=b(window),f=b(d).children("thead:first"),h=f.children("tr:not(.sticky-false)").children();d=c.stickyHeaders||"tablesorter-stickyHeader";var n=h.eq(0).parent(),p=a.find("tfoot"),c=c.$sticky=a.clone(),q=c.children("thead:first").addClass(d).css({width:f.outerWidth(!0),position:"fixed",margin:0,top:0,visibility:"hidden",zIndex:1}),g=q.children("tr:not(.sticky-false)").children(),m="",r=0,s=function(){var c=navigator.userAgent;r=0;"collapse"!==a.css("border-collapse")&& !/(webkit|msie)/i.test(c)&&(r=2*parseInt(h.eq(0).css("border-left-width"),10));q.css({left:f.offset().left-j.scrollLeft()-r,width:f.outerWidth()});g.each(function(a){a=h.eq(a);b(this).css({width:a.width()-r,height:a.height()})}).find(".tablesorter-header-inner").each(function(a){a=h.eq(a).find(".tablesorter-header-inner").width();b(this).width(a)})};c.find("thead:gt(0),tr.sticky-false,tbody,tfoot,caption").remove();c.css({height:0,width:0,padding:0,margin:0,border:0});q.find("tr.sticky-false").remove(); g.find(".tablesorter-resizer").remove();a.bind("sortEnd.tsSticky",function(){h.each(function(a){a=g.eq(a);a.attr("class",b(this).attr("class"));e.cssIcon&&a.find("."+e.cssIcon).attr("class",b(this).find("."+e.cssIcon).attr("class"))})}).bind("pagerComplete.tsSticky",function(){s()});h.find("*").andSelf().filter(e.selectorSort).each(function(a){var c=b(this);g.eq(a).bind("mouseup",function(a){c.trigger(a,!0)}).bind("mousedown",function(){this.onselectstart=function(){return!1};return!1})});a.after(c); j.bind("scroll.tsSticky",function(){var b=n.offset(),c=j.scrollTop(),d=a.height()-(q.height()+(p.height()||0)),b=c>b.top&&c<b.top+d?"visible":"hidden";q.css({left:f.offset().left-j.scrollLeft()-r,visibility:b});b!==m&&(s(),m=b)}).bind("resize.tsSticky",function(){s()})}},remove:function(d,a,e){d=b(d);a=e.stickyHeaders||"tablesorter-stickyHeader";d.removeClass("hasStickyHeaders").unbind("sortEnd.tsSticky pagerComplete.tsSticky").find("."+a).remove();e.$sticky&&e.$sticky.remove();b(window).unbind("scroll.tsSticky resize.tsSticky")}});
|
10
|
+
b.tablesorter.addWidget({id:"resizable",format:function(d){if(!b(d).hasClass("hasResizable")){b(d).addClass("hasResizable");var a,e,c,j,f,h=b(d),n=d.config,p=n.widgetOptions,q=0,g=null,m=null,r=function(){q=0;g=m=null;b(window).trigger("resize")};if(c=b.tablesorter.storage&&!1!==p.resizable?b.tablesorter.storage(d,"tablesorter-resizable"):{})for(e in c)!isNaN(e)&&e<n.headerList.length&&b(n.headerList[e]).width(c[e]);h.children("thead:first").find("tr").each(function(){j=b(this).children();b(this).find(".tablesorter-wrapper").length|| j.wrapInner('<div class="tablesorter-wrapper" style="position:relative;height:100%;width:100%"></div>');j=j.slice(0,-1);f=f?f.add(j):j});f.each(function(){a=b(this);e=parseInt(a.css("padding-right"),10)+8;a.find(".tablesorter-wrapper").append('<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;height:100%;width:16px;right:-'+e+'px;top:0;z-index:1;"></div>')}).bind("mousemove.tsresize",function(a){if(0!==q&&g){var b=a.pageX-q;g.width(g.width()+b);m.width(m.width()-b);q=a.pageX}}).bind("mouseup.tsresize", function(){b.tablesorter.storage&&g&&(c[g.index()]=g.width(),c[m.index()]=m.width(),!1!==p.resizable&&b.tablesorter.storage(d,"tablesorter-resizable",c));r()}).find(".tablesorter-resizer").bind("mousedown",function(a){g=b(a.target).parents("th:last");m=g.next();q=a.pageX});h.find("thead:first").bind("mouseup.tsresize mouseleave.tsresize",function(){r()}).bind("contextmenu.tsresize",function(){b.tablesorter.resizableReset(d);var a=b.isEmptyObject?b.isEmptyObject(c):c==={};c={};return a})}},remove:function(d){b(d).removeClass("hasResizable").find("thead").unbind("mouseup.tsresize mouseleave.tsresize contextmenu.tsresize").find("tr").children().unbind("mousemove.tsresize mouseup.tsresize").find(".tablesorter-wrapper").each(function(){b(this).find(".tablesorter-resizer").remove(); b(this).replaceWith(b(this).contents())});b.tablesorter.resizableReset(d)}});b.tablesorter.resizableReset=function(d){b(d.config.headerList).width("auto");b.tablesorter.storage(d,"tablesorter-resizable",{})};
|
11
|
+
b.tablesorter.addWidget({id:"saveSort",init:function(b,a){a.format(b,!0)},format:function(d,a){var e,c,j=d.config;e=!1!==j.widgetOptions.saveSort;var f={sortList:j.sortList};j.debug&&(c=new Date);b(d).hasClass("hasSaveSort")?e&&(d.hasInitialized&&b.tablesorter.storage)&&(b.tablesorter.storage(d, "tablesorter-savesort",f),j.debug&&b.tablesorter.benchmark("saveSort widget: Saving last sort: "+j.sortList,c)):(b(d).addClass("hasSaveSort"),f="",b.tablesorter.storage&&(f=(e=b.tablesorter.storage(d,"tablesorter-savesort"))&&e.hasOwnProperty("sortList")&&b.isArray(e.sortList)?e.sortList:"",j.debug&&b.tablesorter.benchmark('saveSort: Last sort loaded: "'+f+'"',c)),a&&f&&0<f.length?j.sortList=f:d.hasInitialized&&(f&&0<f.length)&&b(d).trigger("sorton",[f]))},remove:function(d){b.tablesorter.storage(d, "tablesorter-savesort","")}})
|
12
12
|
})(jQuery);
|
@@ -45,7 +45,7 @@
|
|
45
45
|
background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAAP///////yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7);
|
46
46
|
}
|
47
47
|
.tablesorter-blackice thead .sorter-false {
|
48
|
-
background-image:
|
48
|
+
background-image: none;
|
49
49
|
padding: 4px;
|
50
50
|
}
|
51
51
|
|
@@ -55,7 +55,7 @@
|
|
55
55
|
.tablesorter-blackice tfoot .tablesorter-headerAsc,
|
56
56
|
.tablesorter-blackice tfoot .tablesorter-headerDesc {
|
57
57
|
/* remove sort arrows from footer */
|
58
|
-
background-image:
|
58
|
+
background-image: none;
|
59
59
|
}
|
60
60
|
|
61
61
|
/* tbody */
|
@@ -70,7 +70,7 @@
|
|
70
70
|
/* background-image: url(/assets/jquery-tablesorter/black-desc.gif); */
|
71
71
|
}
|
72
72
|
.tablesorter-blue thead .sorter-false {
|
73
|
-
background-image:
|
73
|
+
background-image: none;
|
74
74
|
padding: 4px;
|
75
75
|
}
|
76
76
|
|
@@ -80,7 +80,7 @@
|
|
80
80
|
.tablesorter-blue tfoot .tablesorter-headerAsc,
|
81
81
|
.tablesorter-blue tfoot .tablesorter-headerDesc {
|
82
82
|
/* remove sort arrows from footer */
|
83
|
-
background-image:
|
83
|
+
background-image: none;
|
84
84
|
}
|
85
85
|
|
86
86
|
/* tbody */
|
@@ -44,7 +44,7 @@
|
|
44
44
|
border-bottom: #888 1px solid;
|
45
45
|
}
|
46
46
|
.tablesorter-dark thead .sorter-false {
|
47
|
-
background-image:
|
47
|
+
background-image: none;
|
48
48
|
padding: 4px;
|
49
49
|
}
|
50
50
|
|
@@ -55,7 +55,7 @@
|
|
55
55
|
.tablesorter-dark tfoot .tablesorter-headerDesc {
|
56
56
|
border-top: #888 1px solid;
|
57
57
|
/* remove sort arrows from footer */
|
58
|
-
background-image:
|
58
|
+
background-image: none;
|
59
59
|
}
|
60
60
|
|
61
61
|
/* tbody */
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-tablesorter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.0
|
4
5
|
prerelease:
|
5
|
-
version: 1.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jun Lin
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
16
|
-
|
15
|
+
name: railties
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '3.1'
|
22
|
-
|
22
|
+
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
@@ -99,19 +99,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
100
100
|
- - ! '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
102
103
|
segments:
|
103
104
|
- 0
|
104
|
-
hash:
|
105
|
-
version: '0'
|
105
|
+
hash: -4475428360458463170
|
106
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
109
|
- - ! '>='
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
111
112
|
segments:
|
112
113
|
- 0
|
113
|
-
hash:
|
114
|
-
version: '0'
|
114
|
+
hash: -4475428360458463170
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project:
|
117
117
|
rubygems_version: 1.8.23
|