jquery-tablesorter 1.17.2 → 1.17.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/jquery-tablesorter/version.rb +1 -1
  4. data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +76 -71
  5. data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.dragtable.mod.js +1 -1
  6. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.combined.js +2647 -2576
  7. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +174 -119
  8. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +2487 -2471
  9. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-extract.js +15 -15
  10. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-iso8601.js +1 -1
  11. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js +4 -4
  12. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-range.js +1 -1
  13. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-two-digit-year.js +12 -12
  14. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-weekday.js +4 -4
  15. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date.js +1 -1
  16. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-duration.js +1 -1
  17. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-feet-inch-fraction.js +6 -6
  18. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-file-type.js +22 -22
  19. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-globalize.js +1 -1
  20. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-ignore-articles.js +15 -15
  21. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-image.js +3 -3
  22. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +10 -3
  23. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-metric.js +2 -2
  24. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-named-numbers.js +3 -3
  25. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-network.js +1 -1
  26. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-roman.js +4 -4
  27. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-alignChar.js +122 -121
  28. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-build-table.js +13 -13
  29. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-chart.js +2 -2
  30. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columnSelector.js +324 -324
  31. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columns.js +60 -60
  32. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +219 -219
  33. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-html5.js +360 -361
  34. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-jui.js +666 -666
  35. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-select2.js +124 -124
  36. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-type-insideRange.js +1 -1
  37. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter.js +1448 -1433
  38. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-formatter.js +1 -1
  39. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +213 -213
  40. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-headerTitles.js +3 -3
  41. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-math.js +271 -216
  42. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-output.js +339 -320
  43. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +1057 -1045
  44. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-print.js +109 -109
  45. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-reflow.js +114 -115
  46. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-resizable.js +360 -359
  47. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-saveSort.js +59 -59
  48. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-scroller.js +818 -806
  49. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-sort2Hash.js +128 -0
  50. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-sortTbodies.js +195 -195
  51. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-staticRow.js +90 -90
  52. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-stickyHeaders.js +257 -257
  53. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-storage.js +76 -76
  54. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-uitheme.js +170 -170
  55. metadata +3 -3
  56. data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.quicksearch.js +0 -195
@@ -1,89 +1,89 @@
1
1
  /*! Widget: storage - updated 3/26/2015 (v2.21.3) */
2
2
  ;(function ($, window, document) {
3
- 'use strict';
3
+ 'use strict';
4
4
 
5
- var ts = $.tablesorter || {};
6
- // *** Store data in local storage, with a cookie fallback ***
7
- /* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
8
- if you need it, then include https://github.com/douglascrockford/JSON-js
5
+ var ts = $.tablesorter || {};
6
+ // *** Store data in local storage, with a cookie fallback ***
7
+ /* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
8
+ if you need it, then include https://github.com/douglascrockford/JSON-js
9
9
 
10
- $.parseJSON is not available is jQuery versions older than 1.4.1, using older
11
- versions will only allow storing information for one page at a time
10
+ $.parseJSON is not available is jQuery versions older than 1.4.1, using older
11
+ versions will only allow storing information for one page at a time
12
12
 
13
- // *** Save data (JSON format only) ***
14
- // val must be valid JSON... use http://jsonlint.com/ to ensure it is valid
15
- var val = { "mywidget" : "data1" }; // valid JSON uses double quotes
16
- // $.tablesorter.storage(table, key, val);
17
- $.tablesorter.storage(table, 'tablesorter-mywidget', val);
13
+ // *** Save data (JSON format only) ***
14
+ // val must be valid JSON... use http://jsonlint.com/ to ensure it is valid
15
+ var val = { "mywidget" : "data1" }; // valid JSON uses double quotes
16
+ // $.tablesorter.storage(table, key, val);
17
+ $.tablesorter.storage(table, 'tablesorter-mywidget', val);
18
18
 
19
- // *** Get data: $.tablesorter.storage(table, key); ***
20
- v = $.tablesorter.storage(table, 'tablesorter-mywidget');
21
- // val may be empty, so also check for your data
22
- val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
23
- alert(val); // "data1" if saved, or "" if not
24
- */
25
- ts.storage = function(table, key, value, options) {
26
- table = $(table)[0];
27
- var cookieIndex, cookies, date,
28
- hasStorage = false,
29
- values = {},
30
- c = table.config,
31
- wo = c && c.widgetOptions,
32
- storageType = ( options && options.useSessionStorage ) || ( wo && wo.storage_useSessionStorage ) ?
33
- 'sessionStorage' : 'localStorage',
34
- $table = $(table),
35
- // id from (1) options ID, (2) table "data-table-group" attribute, (3) widgetOptions.storage_tableId,
36
- // (4) table ID, then (5) table index
37
- id = options && options.id ||
38
- $table.attr( options && options.group || wo && wo.storage_group || 'data-table-group') ||
39
- wo && wo.storage_tableId || table.id || $('.tablesorter').index( $table ),
40
- // url from (1) options url, (2) table "data-table-page" attribute, (3) widgetOptions.storage_fixedUrl,
41
- // (4) table.config.fixedUrl (deprecated), then (5) window location path
42
- url = options && options.url ||
43
- $table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
44
- wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname;
45
- // https://gist.github.com/paulirish/5558557
46
- if (storageType in window) {
47
- try {
48
- window[storageType].setItem('_tmptest', 'temp');
49
- hasStorage = true;
50
- window[storageType].removeItem('_tmptest');
51
- } catch(error) {
52
- if (c && c.debug) {
53
- ts.log( storageType + ' is not supported in this browser' );
19
+ // *** Get data: $.tablesorter.storage(table, key); ***
20
+ v = $.tablesorter.storage(table, 'tablesorter-mywidget');
21
+ // val may be empty, so also check for your data
22
+ val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
23
+ alert(val); // 'data1' if saved, or '' if not
24
+ */
25
+ ts.storage = function(table, key, value, options) {
26
+ table = $(table)[0];
27
+ var cookieIndex, cookies, date,
28
+ hasStorage = false,
29
+ values = {},
30
+ c = table.config,
31
+ wo = c && c.widgetOptions,
32
+ storageType = ( options && options.useSessionStorage ) || ( wo && wo.storage_useSessionStorage ) ?
33
+ 'sessionStorage' : 'localStorage',
34
+ $table = $(table),
35
+ // id from (1) options ID, (2) table 'data-table-group' attribute, (3) widgetOptions.storage_tableId,
36
+ // (4) table ID, then (5) table index
37
+ id = options && options.id ||
38
+ $table.attr( options && options.group || wo && wo.storage_group || 'data-table-group') ||
39
+ wo && wo.storage_tableId || table.id || $('.tablesorter').index( $table ),
40
+ // url from (1) options url, (2) table 'data-table-page' attribute, (3) widgetOptions.storage_fixedUrl,
41
+ // (4) table.config.fixedUrl (deprecated), then (5) window location path
42
+ url = options && options.url ||
43
+ $table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
44
+ wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname;
45
+ // https://gist.github.com/paulirish/5558557
46
+ if (storageType in window) {
47
+ try {
48
+ window[storageType].setItem('_tmptest', 'temp');
49
+ hasStorage = true;
50
+ window[storageType].removeItem('_tmptest');
51
+ } catch (error) {
52
+ if (c && c.debug) {
53
+ console.warn( storageType + ' is not supported in this browser' );
54
+ }
54
55
  }
55
56
  }
56
- }
57
- // *** get value ***
58
- if ($.parseJSON) {
59
- if (hasStorage) {
60
- values = $.parseJSON( window[storageType][key] || 'null' ) || {};
61
- } else {
62
- // old browser, using cookies
63
- cookies = document.cookie.split(/[;\s|=]/);
64
- // add one to get from the key to the value
65
- cookieIndex = $.inArray(key, cookies) + 1;
66
- values = (cookieIndex !== 0) ? $.parseJSON(cookies[cookieIndex] || 'null') || {} : {};
67
- }
68
- }
69
- // allow value to be an empty string too
70
- if ((value || value === '') && window.JSON && JSON.hasOwnProperty('stringify')) {
71
- // add unique identifiers = url pathname > table ID/index on page > data
72
- if (!values[url]) {
73
- values[url] = {};
57
+ // *** get value ***
58
+ if ($.parseJSON) {
59
+ if (hasStorage) {
60
+ values = $.parseJSON( window[storageType][key] || 'null' ) || {};
61
+ } else {
62
+ // old browser, using cookies
63
+ cookies = document.cookie.split(/[;\s|=]/);
64
+ // add one to get from the key to the value
65
+ cookieIndex = $.inArray(key, cookies) + 1;
66
+ values = (cookieIndex !== 0) ? $.parseJSON(cookies[cookieIndex] || 'null') || {} : {};
67
+ }
74
68
  }
75
- values[url][id] = value;
76
- // *** set value ***
77
- if (hasStorage) {
78
- window[storageType][key] = JSON.stringify(values);
69
+ // allow value to be an empty string too
70
+ if ((value || value === '') && window.JSON && JSON.hasOwnProperty('stringify')) {
71
+ // add unique identifiers = url pathname > table ID/index on page > data
72
+ if (!values[url]) {
73
+ values[url] = {};
74
+ }
75
+ values[url][id] = value;
76
+ // *** set value ***
77
+ if (hasStorage) {
78
+ window[storageType][key] = JSON.stringify(values);
79
+ } else {
80
+ date = new Date();
81
+ date.setTime(date.getTime() + (31536e+6)); // 365 days
82
+ document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g, '\"') + '; expires=' + date.toGMTString() + '; path=/';
83
+ }
79
84
  } else {
80
- date = new Date();
81
- date.setTime(date.getTime() + (31536e+6)); // 365 days
82
- document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g,'\"') + '; expires=' + date.toGMTString() + '; path=/';
85
+ return values && values[url] ? values[url][id] : '';
83
86
  }
84
- } else {
85
- return values && values[url] ? values[url][id] : '';
86
- }
87
- };
87
+ };
88
88
 
89
89
  })(jQuery, window, document);
@@ -1,185 +1,185 @@
1
1
  /*! Widget: uitheme - updated 3/26/2015 (v2.21.3) */
2
2
  ;(function ($) {
3
- 'use strict';
4
- var ts = $.tablesorter || {};
3
+ 'use strict';
4
+ var ts = $.tablesorter || {};
5
5
 
6
- ts.themes = {
7
- 'bootstrap' : {
8
- table : 'table table-bordered table-striped',
9
- caption : 'caption',
10
- // header class names
11
- header : 'bootstrap-header', // give the header a gradient background (theme.bootstrap_2.css)
12
- sortNone : '',
13
- sortAsc : '',
14
- sortDesc : '',
15
- active : '', // applied when column is sorted
16
- hover : '', // custom css required - a defined bootstrap style may not override other classes
17
- // icon class names
18
- icons : '', // add "icon-white" to make them white; this icon class is added to the <i> in the header
19
- iconSortNone : 'bootstrap-icon-unsorted', // class name added to icon when column is not sorted
20
- iconSortAsc : 'icon-chevron-up glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort
21
- iconSortDesc : 'icon-chevron-down glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort
22
- filterRow : '', // filter row class
23
- footerRow : '',
24
- footerCells : '',
25
- even : '', // even row zebra striping
26
- odd : '' // odd row zebra striping
27
- },
28
- 'jui' : {
29
- table : 'ui-widget ui-widget-content ui-corner-all', // table classes
30
- caption : 'ui-widget-content',
31
- // header class names
32
- header : 'ui-widget-header ui-corner-all ui-state-default', // header classes
33
- sortNone : '',
34
- sortAsc : '',
35
- sortDesc : '',
36
- active : 'ui-state-active', // applied when column is sorted
37
- hover : 'ui-state-hover', // hover class
38
- // icon class names
39
- icons : 'ui-icon', // icon class added to the <i> in the header
40
- iconSortNone : 'ui-icon-carat-2-n-s', // class name added to icon when column is not sorted
41
- iconSortAsc : 'ui-icon-carat-1-n', // class name added to icon when column has ascending sort
42
- iconSortDesc : 'ui-icon-carat-1-s', // class name added to icon when column has descending sort
43
- filterRow : '',
44
- footerRow : '',
45
- footerCells : '',
46
- even : 'ui-widget-content', // even row zebra striping
47
- odd : 'ui-state-default' // odd row zebra striping
48
- }
49
- };
50
-
51
- $.extend(ts.css, {
52
- wrapper : 'tablesorter-wrapper' // ui theme & resizable
53
- });
6
+ ts.themes = {
7
+ 'bootstrap' : {
8
+ table : 'table table-bordered table-striped',
9
+ caption : 'caption',
10
+ // header class names
11
+ header : 'bootstrap-header', // give the header a gradient background (theme.bootstrap_2.css)
12
+ sortNone : '',
13
+ sortAsc : '',
14
+ sortDesc : '',
15
+ active : '', // applied when column is sorted
16
+ hover : '', // custom css required - a defined bootstrap style may not override other classes
17
+ // icon class names
18
+ icons : '', // add 'icon-white' to make them white; this icon class is added to the <i> in the header
19
+ iconSortNone : 'bootstrap-icon-unsorted', // class name added to icon when column is not sorted
20
+ iconSortAsc : 'icon-chevron-up glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort
21
+ iconSortDesc : 'icon-chevron-down glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort
22
+ filterRow : '', // filter row class
23
+ footerRow : '',
24
+ footerCells : '',
25
+ even : '', // even row zebra striping
26
+ odd : '' // odd row zebra striping
27
+ },
28
+ 'jui' : {
29
+ table : 'ui-widget ui-widget-content ui-corner-all', // table classes
30
+ caption : 'ui-widget-content',
31
+ // header class names
32
+ header : 'ui-widget-header ui-corner-all ui-state-default', // header classes
33
+ sortNone : '',
34
+ sortAsc : '',
35
+ sortDesc : '',
36
+ active : 'ui-state-active', // applied when column is sorted
37
+ hover : 'ui-state-hover', // hover class
38
+ // icon class names
39
+ icons : 'ui-icon', // icon class added to the <i> in the header
40
+ iconSortNone : 'ui-icon-carat-2-n-s', // class name added to icon when column is not sorted
41
+ iconSortAsc : 'ui-icon-carat-1-n', // class name added to icon when column has ascending sort
42
+ iconSortDesc : 'ui-icon-carat-1-s', // class name added to icon when column has descending sort
43
+ filterRow : '',
44
+ footerRow : '',
45
+ footerCells : '',
46
+ even : 'ui-widget-content', // even row zebra striping
47
+ odd : 'ui-state-default' // odd row zebra striping
48
+ }
49
+ };
54
50
 
55
- ts.addWidget({
56
- id: "uitheme",
57
- priority: 10,
58
- format: function(table, c, wo) {
59
- var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
60
- themesAll = ts.themes,
61
- $table = c.$table.add( $( c.namespace + '_extra_table' ) ),
62
- $headers = c.$headers.add( $( c.namespace + '_extra_headers' ) ),
63
- theme = c.theme || 'jui',
64
- themes = themesAll[theme] || {},
65
- remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
66
- iconRmv = $.trim( [ themes.iconSortNone, themes.iconSortDesc, themes.iconSortAsc ].join( ' ' ) );
67
- if (c.debug) { time = new Date(); }
68
- // initialization code - run once
69
- if (!$table.hasClass('tablesorter-' + theme) || c.theme !== c.appliedTheme || !wo.uitheme_applied) {
70
- wo.uitheme_applied = true;
71
- oldtheme = themesAll[c.appliedTheme] || {};
72
- hasOldTheme = !$.isEmptyObject(oldtheme);
73
- oldremove = hasOldTheme ? [ oldtheme.sortNone, oldtheme.sortDesc, oldtheme.sortAsc, oldtheme.active ].join( ' ' ) : '';
74
- oldIconRmv = hasOldTheme ? [ oldtheme.iconSortNone, oldtheme.iconSortDesc, oldtheme.iconSortAsc ].join( ' ' ) : '';
75
- if (hasOldTheme) {
76
- wo.zebra[0] = $.trim( ' ' + wo.zebra[0].replace(' ' + oldtheme.even, '') );
77
- wo.zebra[1] = $.trim( ' ' + wo.zebra[1].replace(' ' + oldtheme.odd, '') );
78
- c.$tbodies.children().removeClass( [oldtheme.even, oldtheme.odd].join(' ') );
79
- }
80
- // update zebra stripes
81
- if (themes.even) { wo.zebra[0] += ' ' + themes.even; }
82
- if (themes.odd) { wo.zebra[1] += ' ' + themes.odd; }
83
- // add caption style
84
- $table.children('caption')
85
- .removeClass(oldtheme.caption || '')
86
- .addClass(themes.caption);
87
- // add table/footer class names
88
- $tfoot = $table
89
- // remove other selected themes
90
- .removeClass( (c.appliedTheme ? 'tablesorter-' + (c.appliedTheme || '') : '') + ' ' + (oldtheme.table || '') )
91
- .addClass('tablesorter-' + theme + ' ' + (themes.table || '')) // add theme widget class name
92
- .children('tfoot');
93
- c.appliedTheme = c.theme;
51
+ $.extend(ts.css, {
52
+ wrapper : 'tablesorter-wrapper' // ui theme & resizable
53
+ });
94
54
 
95
- if ($tfoot.length) {
96
- $tfoot
97
- // if oldtheme.footerRow or oldtheme.footerCells are undefined, all class names are removed
98
- .children('tr').removeClass(oldtheme.footerRow || '').addClass(themes.footerRow)
99
- .children('th, td').removeClass(oldtheme.footerCells || '').addClass(themes.footerCells);
100
- }
101
- // update header classes
102
- $headers
103
- .removeClass( (hasOldTheme ? [oldtheme.header, oldtheme.hover, oldremove].join(' ') : '') || '' )
104
- .addClass(themes.header)
105
- .not('.sorter-false')
106
- .unbind('mouseenter.tsuitheme mouseleave.tsuitheme')
107
- .bind('mouseenter.tsuitheme mouseleave.tsuitheme', function(event) {
108
- // toggleClass with switch added in jQuery 1.3
109
- $(this)[ event.type === 'mouseenter' ? 'addClass' : 'removeClass' ](themes.hover || '');
110
- });
55
+ ts.addWidget({
56
+ id: 'uitheme',
57
+ priority: 10,
58
+ format: function(table, c, wo) {
59
+ var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
60
+ themesAll = ts.themes,
61
+ $table = c.$table.add( $( c.namespace + '_extra_table' ) ),
62
+ $headers = c.$headers.add( $( c.namespace + '_extra_headers' ) ),
63
+ theme = c.theme || 'jui',
64
+ themes = themesAll[theme] || {},
65
+ remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
66
+ iconRmv = $.trim( [ themes.iconSortNone, themes.iconSortDesc, themes.iconSortAsc ].join( ' ' ) );
67
+ if (c.debug) { time = new Date(); }
68
+ // initialization code - run once
69
+ if (!$table.hasClass('tablesorter-' + theme) || c.theme !== c.appliedTheme || !wo.uitheme_applied) {
70
+ wo.uitheme_applied = true;
71
+ oldtheme = themesAll[c.appliedTheme] || {};
72
+ hasOldTheme = !$.isEmptyObject(oldtheme);
73
+ oldremove = hasOldTheme ? [ oldtheme.sortNone, oldtheme.sortDesc, oldtheme.sortAsc, oldtheme.active ].join( ' ' ) : '';
74
+ oldIconRmv = hasOldTheme ? [ oldtheme.iconSortNone, oldtheme.iconSortDesc, oldtheme.iconSortAsc ].join( ' ' ) : '';
75
+ if (hasOldTheme) {
76
+ wo.zebra[0] = $.trim( ' ' + wo.zebra[0].replace(' ' + oldtheme.even, '') );
77
+ wo.zebra[1] = $.trim( ' ' + wo.zebra[1].replace(' ' + oldtheme.odd, '') );
78
+ c.$tbodies.children().removeClass( [ oldtheme.even, oldtheme.odd ].join(' ') );
79
+ }
80
+ // update zebra stripes
81
+ if (themes.even) { wo.zebra[0] += ' ' + themes.even; }
82
+ if (themes.odd) { wo.zebra[1] += ' ' + themes.odd; }
83
+ // add caption style
84
+ $table.children('caption')
85
+ .removeClass(oldtheme.caption || '')
86
+ .addClass(themes.caption);
87
+ // add table/footer class names
88
+ $tfoot = $table
89
+ // remove other selected themes
90
+ .removeClass( (c.appliedTheme ? 'tablesorter-' + (c.appliedTheme || '') : '') + ' ' + (oldtheme.table || '') )
91
+ .addClass('tablesorter-' + theme + ' ' + (themes.table || '')) // add theme widget class name
92
+ .children('tfoot');
93
+ c.appliedTheme = c.theme;
111
94
 
112
- $headers.each(function(){
113
- var $this = $(this);
114
- if (!$this.find('.' + ts.css.wrapper).length) {
115
- // Firefox needs this inner div to position the icon & resizer correctly
116
- $this.wrapInner('<div class="' + ts.css.wrapper + '" style="position:relative;height:100%;width:100%"></div>');
95
+ if ($tfoot.length) {
96
+ $tfoot
97
+ // if oldtheme.footerRow or oldtheme.footerCells are undefined, all class names are removed
98
+ .children('tr').removeClass(oldtheme.footerRow || '').addClass(themes.footerRow)
99
+ .children('th, td').removeClass(oldtheme.footerCells || '').addClass(themes.footerCells);
117
100
  }
118
- });
119
- if (c.cssIcon) {
120
- // if c.cssIcon is '', then no <i> is added to the header
101
+ // update header classes
121
102
  $headers
122
- .find('.' + ts.css.icon)
123
- .removeClass(hasOldTheme ? [oldtheme.icons, oldIconRmv].join(' ') : '')
124
- .addClass(themes.icons || '');
125
- }
126
- if ($table.hasClass('hasFilters')) {
127
- $table.children('thead').children('.' + ts.css.filterRow)
128
- .removeClass(hasOldTheme ? oldtheme.filterRow || '' : '')
129
- .addClass(themes.filterRow || '');
103
+ .removeClass( (hasOldTheme ? [ oldtheme.header, oldtheme.hover, oldremove ].join(' ') : '') || '' )
104
+ .addClass(themes.header)
105
+ .not('.sorter-false')
106
+ .unbind('mouseenter.tsuitheme mouseleave.tsuitheme')
107
+ .bind('mouseenter.tsuitheme mouseleave.tsuitheme', function(event) {
108
+ // toggleClass with switch added in jQuery 1.3
109
+ $(this)[ event.type === 'mouseenter' ? 'addClass' : 'removeClass' ](themes.hover || '');
110
+ });
111
+
112
+ $headers.each(function(){
113
+ var $this = $(this);
114
+ if (!$this.find('.' + ts.css.wrapper).length) {
115
+ // Firefox needs this inner div to position the icon & resizer correctly
116
+ $this.wrapInner('<div class="' + ts.css.wrapper + '" style="position:relative;height:100%;width:100%"></div>');
117
+ }
118
+ });
119
+ if (c.cssIcon) {
120
+ // if c.cssIcon is '', then no <i> is added to the header
121
+ $headers
122
+ .find('.' + ts.css.icon)
123
+ .removeClass(hasOldTheme ? [ oldtheme.icons, oldIconRmv ].join(' ') : '')
124
+ .addClass(themes.icons || '');
125
+ }
126
+ if ($table.hasClass('hasFilters')) {
127
+ $table.children('thead').children('.' + ts.css.filterRow)
128
+ .removeClass(hasOldTheme ? oldtheme.filterRow || '' : '')
129
+ .addClass(themes.filterRow || '');
130
+ }
130
131
  }
131
- }
132
- for (i = 0; i < c.columns; i++) {
133
- $header = c.$headers
134
- .add($(c.namespace + '_extra_headers'))
135
- .not('.sorter-false')
136
- .filter('[data-column="' + i + '"]');
137
- $icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $();
138
- $h = $headers.not('.sorter-false').filter('[data-column="' + i + '"]:last');
139
- if ($h.length) {
140
- $header.removeClass(remove);
141
- $icon.removeClass(iconRmv);
142
- if ($h[0].sortDisabled) {
143
- // no sort arrows for disabled columns!
144
- $icon.removeClass(themes.icons || '');
145
- } else {
146
- hdr = themes.sortNone;
147
- icon = themes.iconSortNone;
148
- if ($h.hasClass(ts.css.sortAsc)) {
149
- hdr = [themes.sortAsc, themes.active].join(' ');
150
- icon = themes.iconSortAsc;
151
- } else if ($h.hasClass(ts.css.sortDesc)) {
152
- hdr = [themes.sortDesc, themes.active].join(' ');
153
- icon = themes.iconSortDesc;
132
+ for (i = 0; i < c.columns; i++) {
133
+ $header = c.$headers
134
+ .add($(c.namespace + '_extra_headers'))
135
+ .not('.sorter-false')
136
+ .filter('[data-column="' + i + '"]');
137
+ $icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $();
138
+ $h = $headers.not('.sorter-false').filter('[data-column="' + i + '"]:last');
139
+ if ($h.length) {
140
+ $header.removeClass(remove);
141
+ $icon.removeClass(iconRmv);
142
+ if ($h[0].sortDisabled) {
143
+ // no sort arrows for disabled columns!
144
+ $icon.removeClass(themes.icons || '');
145
+ } else {
146
+ hdr = themes.sortNone;
147
+ icon = themes.iconSortNone;
148
+ if ($h.hasClass(ts.css.sortAsc)) {
149
+ hdr = [ themes.sortAsc, themes.active ].join(' ');
150
+ icon = themes.iconSortAsc;
151
+ } else if ($h.hasClass(ts.css.sortDesc)) {
152
+ hdr = [ themes.sortDesc, themes.active ].join(' ');
153
+ icon = themes.iconSortDesc;
154
+ }
155
+ $header.addClass(hdr);
156
+ $icon.addClass(icon || '');
154
157
  }
155
- $header.addClass(hdr);
156
- $icon.addClass(icon || '');
157
158
  }
158
159
  }
160
+ if (c.debug) {
161
+ console.log('Applying ' + theme + ' theme' + ts.benchmark(time));
162
+ }
163
+ },
164
+ remove: function(table, c, wo, refreshing) {
165
+ if (!wo.uitheme_applied) { return; }
166
+ var $table = c.$table,
167
+ theme = c.appliedTheme || 'jui',
168
+ themes = ts.themes[ theme ] || ts.themes.jui,
169
+ $headers = $table.children('thead').children(),
170
+ remove = themes.sortNone + ' ' + themes.sortDesc + ' ' + themes.sortAsc,
171
+ iconRmv = themes.iconSortNone + ' ' + themes.iconSortDesc + ' ' + themes.iconSortAsc;
172
+ $table.removeClass('tablesorter-' + theme + ' ' + themes.table);
173
+ wo.uitheme_applied = false;
174
+ if (refreshing) { return; }
175
+ $table.find(ts.css.header).removeClass(themes.header);
176
+ $headers
177
+ .unbind('mouseenter.tsuitheme mouseleave.tsuitheme') // remove hover
178
+ .removeClass(themes.hover + ' ' + remove + ' ' + themes.active)
179
+ .filter('.' + ts.css.filterRow)
180
+ .removeClass(themes.filterRow);
181
+ $headers.find('.' + ts.css.icon).removeClass(themes.icons + ' ' + iconRmv);
159
182
  }
160
- if (c.debug) {
161
- ts.benchmark("Applying " + theme + " theme", time);
162
- }
163
- },
164
- remove: function(table, c, wo, refreshing) {
165
- if (!wo.uitheme_applied) { return; }
166
- var $table = c.$table,
167
- theme = c.appliedTheme || 'jui',
168
- themes = ts.themes[ theme ] || ts.themes.jui,
169
- $headers = $table.children('thead').children(),
170
- remove = themes.sortNone + ' ' + themes.sortDesc + ' ' + themes.sortAsc,
171
- iconRmv = themes.iconSortNone + ' ' + themes.iconSortDesc + ' ' + themes.iconSortAsc;
172
- $table.removeClass('tablesorter-' + theme + ' ' + themes.table);
173
- wo.uitheme_applied = false;
174
- if (refreshing) { return; }
175
- $table.find(ts.css.header).removeClass(themes.header);
176
- $headers
177
- .unbind('mouseenter.tsuitheme mouseleave.tsuitheme') // remove hover
178
- .removeClass(themes.hover + ' ' + remove + ' ' + themes.active)
179
- .filter('.' + ts.css.filterRow)
180
- .removeClass(themes.filterRow);
181
- $headers.find('.' + ts.css.icon).removeClass(themes.icons + ' ' + iconRmv);
182
- }
183
- });
183
+ });
184
184
 
185
185
  })(jQuery);