diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..85e2c8746 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +_test*.js +*.min.js +*mod.js +*.metadata.js +semver.js diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 000000000..4c9173156 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,31 @@ +{ + "env": { + "browser": true, + "jquery": true + }, + "rules": { + "curly": 1, + "dot-location": [2, "property"], + "eqeqeq": 1, + "linebreak-style": [2, "unix"], + "no-else-return": 0, + "no-eval": 2, + "no-octal": 2, + "no-with": 2, + "radix": 2, + "brace-style": 0, + "camelcase": 0, + "indent": 0, + "no-array-constructor": 2, + "quotes": [2, "single", { + "allowTemplateLiterals": true, + "avoidEscape": true + }], + "spaced-comment": 0, + "space-before-blocks": 1, + "keyword-spacing": 1, + "arrow-spacing": 2, + "no-var": 0, + "no-unused-vars": 1 + } +} diff --git a/Gruntfile.js b/Gruntfile.js index 93d2ad0a8..e085b3c0e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,8 +4,6 @@ module.exports = function( grunt ) { var pkg = grunt.file.readJSON( 'package.json' ), tasks, - widgetFilePrefix, - widgetFileSuffix, defaults = { dependencies : { @@ -428,7 +426,7 @@ module.exports = function( grunt ) { }); function escapeRegExp(str) { - return str.replace(/[$()*+\-.\/?[\\\]^{|}]/g, "\\$&"); + return str.replace(/[$()*+\-.\/?[\\\]^{|}]/g, '\\$&'); } // update tablesorter.jquery.json file version numbers to match the package.json version diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 16a614d42..42161cbc1 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -27,7 +27,7 @@ customAjaxUrl: function(table, url) { return url; }, // ajax error callback from $.tablesorter.showError function - // ajaxError: function( config, xhr, settings, exception ){ return exception; }; + // ajaxError: function( config, xhr, settings, exception ) { return exception; }; // returning false will abort the error message ajaxError: null, @@ -52,7 +52,7 @@ // ], // [ "header1", "header2", ... "headerN" ] // optional // ] - ajaxProcessing: function(ajax){ return [ 0, [], null ]; }, + ajaxProcessing: function( /* ajax */ ) { return [ 0, [], null ]; }, // output default: '{page}/{totalPages}' // possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, @@ -139,12 +139,12 @@ if ( p.updateArrows ) { tmp = p.$container.find(p.cssFirst + ',' + p.cssPrev); tmp[ first ? a : r ](d); // toggle disabled class - tmp.each(function(){ + tmp.each(function() { this.ariaDisabled = first; }); tmp = p.$container.find(p.cssNext + ',' + p.cssLast); tmp[ last ? a : r ](d); - tmp.each(function(){ + tmp.each(function() { this.ariaDisabled = last; }); } @@ -203,11 +203,11 @@ // form the output string (can now get a new output string from the server) s = ( p.ajaxData && p.ajaxData.output ? p.ajaxData.output || output : output ) // {page} = one-based index; {page+#} = zero based index +/- value - .replace(/\{page([\-+]\d+)?\}/gi, function(m, n){ + .replace(/\{page([\-+]\d+)?\}/gi, function(m, n) { return p.totalPages ? p.page + (n ? parseInt(n, 10) : 1) : 0; }) // {totalPages}, {extra}, {extra:0} (array) or {extra : key} (object) - .replace(/\{\w+(\s*:\s*\w+)?\}/gi, function(m){ + .replace(/\{\w+(\s*:\s*\w+)?\}/gi, function(m) { var len, indx, str = m.replace(/[{}\s]/g, ''), extra = str.split(':'), @@ -236,7 +236,7 @@ if ($out.length) { $out[ ($out[0].nodeName === 'INPUT') ? 'val' : 'html' ](s); // rebind startRow/page inputs - $out.find('.ts-startRow, .ts-page').unbind('change' + namespace).bind('change' + namespace, function(){ + $out.find('.ts-startRow, .ts-page').unbind('change' + namespace).bind('change' + namespace, function() { var v = $(this).val(), pg = $(this).hasClass('ts-startRow') ? Math.floor( v / sz ) + 1 : v; c.$table.triggerHandler('pageSet' + namespace, [ pg ]); @@ -357,7 +357,7 @@ $.data(table, 'pagerLastSize', p.size); }, - hideRows = function(table, p){ + hideRows = function(table, p) { if (!p.ajaxUrl) { var i, lastIndex = 0, @@ -370,7 +370,7 @@ last = 0, // for cache indexing j = 0; // size counter p.cacheIndex = []; - for ( i = 0; i < l; i++ ){ + for ( i = 0; i < l; i++ ) { if ( !p.regexFiltered.test(rows[i].className) ) { if (j === s && rows[i].className.match(c.cssChildRow)) { // hide child rows @ start of pager (if already visible) @@ -398,19 +398,19 @@ } }, - hideRowsSetup = function(table, p){ + hideRowsSetup = function(table, p) { p.size = parsePageSize( p, p.$container.find(p.cssPageSize).val(), 'get' ); setPageSize( table, p.size, p ); pagerArrows( table, p ); if ( !p.removeRows ) { hideRows(table, p); - $(table).bind('sortEnd filterEnd '.split(' ').join(table.config.namespace + 'pager '), function(){ + $(table).bind('sortEnd filterEnd '.split(' ').join(table.config.namespace + 'pager '), function() { hideRows(table, p); }); } }, - renderAjax = function(data, table, p, xhr, settings, exception){ + renderAjax = function(data, table, p, xhr, settings, exception) { // process data if ( typeof p.ajaxProcessing === 'function' ) { @@ -424,9 +424,7 @@ c = table.config, $table = c.$table, tds = '', - result = p.ajaxProcessing(data, table, xhr) || [ 0, [] ], - hl = $table.find('thead th').length; - + result = p.ajaxProcessing(data, table, xhr) || [ 0, [] ]; // Clean up any previous error. ts.showError( table ); @@ -524,11 +522,11 @@ p.last.sortList = (c.sortList || []).join(','); updatePageDisplay(table, p, false); // tablesorter core updateCache (not pager) - ts.updateCache( c, function(){ + ts.updateCache( c, function() { if (p.initialized) { // apply widgets after table has rendered & after a delay to prevent // multiple applyWidget blocking code from blocking this trigger - setTimeout(function(){ + setTimeout(function() { if (c.debug) { console.log('Pager: Triggering pagerChange'); } @@ -566,7 +564,7 @@ p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl p.ajaxObject.success = function(data, status, jqxhr) { // Refuse to process old ajax commands that were overwritten by new ones - see #443 - if (counter < p.ajaxCounter){ + if (counter < p.ajaxCounter) { return; } renderAjax(data, table, p, jqxhr); @@ -587,7 +585,7 @@ c = table.config, url = (p.ajaxUrl) ? p.ajaxUrl // allow using "{page+1}" in the url string to switch to a non-zero based index - .replace(/\{page([\-+]\d+)?\}/, function(s, n){ return p.page + (n ? parseInt(n, 10) : 0); }) + .replace(/\{page([\-+]\d+)?\}/, function(s, n) { return p.page + (n ? parseInt(n, 10) : 0); }) // this will pass "all" to server when size is set to "all" .replace(/\{size\}/g, p.size) : '', sortList = c.sortList, @@ -664,7 +662,7 @@ count = f ? 0 : s; added = 0; while (added < e && index < rows.length) { - if (!f || !p.regexFiltered.test(rows[index][0].className)){ + if (!f || !p.regexFiltered.test(rows[index][0].className)) { count++; if (count > s && added <= e) { added++; @@ -720,7 +718,7 @@ var c = table.config, p = c.pager; // tablesorter core updateCache (not pager) - ts.updateCache( c, function(){ + ts.updateCache( c, function() { var i, rows = [], n = table.config.cache[0].normalized; @@ -908,7 +906,7 @@ p.$container.find(p.cssGoto + ',' + p.cssPageSize + ',.ts-startRow, .ts-page') .removeClass(p.cssDisabled) .removeAttr('disabled') - .each(function(){ + .each(function() { this.ariaDisabled = false; }); p.isDisabled = false; @@ -943,7 +941,7 @@ }, init = function(table, settings) { - var t, ctrls, fxn, size, $el, + var t, ctrls, fxn, $el, c = table.config, wo = c.widgetOptions, p = c.pager = $.extend( true, {}, $.tablesorterPager.defaults, settings ), @@ -1003,23 +1001,23 @@ ts.applyWidget( table ); } }) - .bind('disablePager' + namespace, function(e){ + .bind('disablePager' + namespace, function(e) { e.stopPropagation(); showAllRows(table, p); }) - .bind('enablePager' + namespace, function(e){ + .bind('enablePager' + namespace, function(e) { e.stopPropagation(); enablePager(table, p, true); }) - .bind('destroyPager' + namespace, function(e){ + .bind('destroyPager' + namespace, function(e) { e.stopPropagation(); destroyPager(table, p); }) - .bind('resetToLoadState' + namespace, function(e){ + .bind('resetToLoadState' + namespace, function(e) { e.stopPropagation(); resetState(table, p); }) - .bind('updateComplete' + namespace, function(e, table, triggered){ + .bind('updateComplete' + namespace, function(e, table, triggered) { e.stopPropagation(); // table can be unintentionally undefined in tablesorter v2.17.7 and earlier // don't recalculate total rows/pages if using ajax @@ -1038,14 +1036,14 @@ changeHeight(table, p); updatePageDisplay(table, p, true); }) - .bind('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e, size){ + .bind('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e, size) { e.stopPropagation(); setPageSize(table, parsePageSize( p, size, 'get' ), p); moveToPage(table, p); hideRows(table, p); updatePageDisplay(table, p, false); }) - .bind('pageSet pagerUpdate '.split(' ').join(namespace + ' '), function(e, num){ + .bind('pageSet pagerUpdate '.split(' ').join(namespace + ' '), function(e, num) { e.stopPropagation(); // force pager refresh if (e.type === 'pagerUpdate') { @@ -1056,7 +1054,7 @@ moveToPage(table, p, true); updatePageDisplay(table, p, false); }) - .bind('pageAndSize' + namespace, function(e, page, size){ + .bind('pageAndSize' + namespace, function(e, page, size) { e.stopPropagation(); p.page = (parseInt(page, 10) || 1) - 1; setPageSize(table, parsePageSize( p, size, 'get' ), p); @@ -1074,7 +1072,7 @@ pager.find(ctrls.join(',')) .attr('tabindex', 0) .unbind('click' + namespace) - .bind('click' + namespace, function(e){ + .bind('click' + namespace, function(e) { e.stopPropagation(); var i, $t = $(this), l = ctrls.length; if ( !$t.hasClass(p.cssDisabled) ) { @@ -1092,7 +1090,7 @@ if ( $el.length ) { $el .unbind('change' + namespace) - .bind('change' + namespace, function(){ + .bind('change' + namespace, function() { p.page = $(this).val() - 1; moveToPage(table, p, true); updatePageDisplay(table, p, false); @@ -1187,8 +1185,7 @@ // see #486 ts.showError = function( table, xhr, settings, exception ) { - var $row, - $table = $( table ), + var $table = $( table ), c = $table[0].config, wo = c && c.widgetOptions, errorRow = c.pager && c.pager.cssErrorRow || @@ -1197,7 +1194,7 @@ typ = typeof xhr, valid = true, message = '', - removeRow = function(){ + removeRow = function() { c.$table.find( 'thead' ).find( c.selectorRemove ).remove(); }; @@ -1243,7 +1240,7 @@ } // allow message to include entire row HTML! - $row = ( /tr\>/.test(message) ? $(message) : $('' + message + '') ) + $( /tr\>/.test(message) ? message : '' + message + '' ) .click( function() { $( this ).remove(); }) diff --git a/beta-testing/widget-reorder.js b/beta-testing/widget-reorder.js index 5d09f83a4..09b6bab4e 100644 --- a/beta-testing/widget-reorder.js +++ b/beta-testing/widget-reorder.js @@ -4,8 +4,8 @@ */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery: false */ -;(function($){ - "use strict"; +;(function($) { + 'use strict'; $.tablesorter.addWidget({ id: 'reorder', @@ -22,14 +22,13 @@ $.tablesorter.addWidget({ init: function(table, thisWidget, c, wo) { var i, timer, $helper, $bar, clickOffset, lastIndx = -1, - ts = $.tablesorter, endIndex = -1, startIndex = -1, t = wo.reorder_blocked.split(' '), noReorderLeft = t[0] || 'reorder-block-left', noReorderLast = t[1] || 'reorder-block-end', lastOffset = c.$headers.not('.' + noReorderLeft).first(), - offsets = c.$headers.map(function(i){ + offsets = c.$headers.map(function() { var s, $t = $(this); if ($t.hasClass(noReorderLeft)) { s = lastOffset; @@ -40,7 +39,7 @@ $.tablesorter.addWidget({ return $t.offset().left; }).get(), len = offsets.length, - startReorder = function(e, $th){ + startReorder = function(e, $th) { var p = $th.position(), r = $th.parent().position(), i = startIndex = $th.index(); @@ -68,7 +67,7 @@ $.tablesorter.addWidget({ positionBar(e); lastIndx = endIndex; }, - positionBar = function(e){ + positionBar = function(e) { for (i = 0; i <= len; i++) { if ( i > 0 && e.pageX < offsets[i-1] + (offsets[i] - offsets[i-1])/2 && !c.$headers.eq(i).hasClass(noReorderLeft) ) { endIndex = i - 1; @@ -87,7 +86,7 @@ $.tablesorter.addWidget({ $bar.css('left', offsets[len]); } }, - finishReorder = function(){ + finishReorder = function() { $helper.remove(); $bar.remove(); // finish reorder @@ -95,7 +94,7 @@ $.tablesorter.addWidget({ rows = c.$table.find('tr'), cols; startIndex = -1; // stop mousemove updates - if ( s > -1 && endIndex > -1 && s != endIndex && s + 1 !== endIndex ) { + if ( s > -1 && endIndex > -1 && s !== endIndex && s + 1 !== endIndex ) { adj = endIndex !== 0; if (c.debug) { console.log( 'Inserting column ' + s + (adj ? ' after' : ' before') + ' column ' + (endIndex - adj ? 1 : 0) ); @@ -123,10 +122,10 @@ $.tablesorter.addWidget({ } endIndex = -1; }, - mdown = function(e, el){ + mdown = function(e, el) { var $t = $(el), evt = e; if ($t.hasClass(wo.reorder_noReorder)) { return; } - timer = setTimeout(function(){ + timer = setTimeout(function() { $t.addClass('tablesorter-reorder'); startReorder(evt, $t); }, wo.reorder_delay); @@ -140,13 +139,13 @@ $.tablesorter.addWidget({ offsets.push( c.$table.offset().left + c.$table.outerWidth() ); } - c.$headers.not('.' + wo.reorder_noReorder).bind('mousedown.reorder', function(e){ + c.$headers.not('.' + wo.reorder_noReorder).bind('mousedown.reorder', function(e) { mdown(e, this); }); $(document) - .bind('mousemove.reorder', function(e){ - if (startIndex !== -1){ + .bind('mousemove.reorder', function(e) { + if (startIndex !== -1) { var c = { left : e.pageX - clickOffset[0] }; endIndex = -1; if (/y/.test(wo.reorder_axis)) { @@ -157,9 +156,9 @@ $.tablesorter.addWidget({ } }) .add( c.$headers ) - .bind('mouseup.reorder', function(){ + .bind('mouseup.reorder', function() { clearTimeout(timer); - if (startIndex !== -1 && endIndex !== -1){ + if (startIndex !== -1 && endIndex !== -1) { finishReorder(); } else { startIndex = -1; @@ -167,8 +166,8 @@ $.tablesorter.addWidget({ }); // has sticky headers? - c.$table.bind('stickyHeadersInit', function(){ - wo.$sticky.find('thead').children().not('.' + wo.reorder_noReorder).bind('mousedown.reorder', function(e){ + c.$table.bind('stickyHeadersInit', function() { + wo.$sticky.find('thead').children().not('.' + wo.reorder_noReorder).bind('mousedown.reorder', function(e) { mdown(e, this); }); }); @@ -177,6 +176,6 @@ $.tablesorter.addWidget({ }); // add mouse coordinates -$x = $('#main h1:last'); $(document).mousemove(function(e){ $x.html( e.pageX ); }); +$x = $('#main h1:last'); $(document).mousemove(function(e) { $x.html( e.pageX ); }); })(jQuery); diff --git a/docs/example-add-rows.html b/docs/example-add-rows.html index c100de011..8170a979b 100644 --- a/docs/example-add-rows.html +++ b/docs/example-add-rows.html @@ -28,7 +28,7 @@ // Add two new rows using the "addRows" method // the "update" method doesn't work here because not all // rows are present in the table when the pager is applied - $('button').click(function(){ + $('button').click(function() { // add two rows var row = 'FrankSmith53$39.9522%Mar 22, 2011 9:33 AM' + 'InigoMontoya34$19.9915%Sep 25, 1987 12:00PM', diff --git a/docs/example-apply-widget.html b/docs/example-apply-widget.html index 017cf8975..4d088f611 100644 --- a/docs/example-apply-widget.html +++ b/docs/example-apply-widget.html @@ -23,7 +23,7 @@ // call the tablesorter plugin $('table').tablesorter({ theme : 'blue' }); - $('button.applyid').click(function(){ + $('button.applyid').click(function() { // This method adds the 'columns' widget & sorts the table to make it visible $('table') .trigger('applyWidgetId', 'columns') @@ -31,7 +31,7 @@ return false; }); - $('button.apply').click(function(){ + $('button.apply').click(function() { // This method reapplies the widgets listed in table.config.widgets // it won't appear to do anything unless we add 'zebra' to the widgets option $('table').data('tablesorter').widgets = ['zebra']; @@ -39,7 +39,7 @@ return false; }); - $('button.remove').click(function(){ + $('button.remove').click(function() { // This method removes both the zebra & columns widget entirely $('table').trigger('removeWidget', 'zebra columns'); return false; diff --git a/docs/example-child-rows-filtered.html b/docs/example-child-rows-filtered.html index 7c880b710..28215f7c3 100644 --- a/docs/example-child-rows-filtered.html +++ b/docs/example-child-rows-filtered.html @@ -151,7 +151,7 @@ }); // Toggle filter_childByColumn option - $( 'button.toggle-byColumn' ).click(function(){ + $( 'button.toggle-byColumn' ).click(function() { var wo = $table2[0].config.widgetOptions, o = !wo.filter_childByColumn; wo.filter_childByColumn = o; diff --git a/docs/example-child-rows.html b/docs/example-child-rows.html index e42b5efca..a7f382f38 100644 --- a/docs/example-child-rows.html +++ b/docs/example-child-rows.html @@ -36,7 +36,7 @@ positionFixed: false }); /* no longer needed! - .bind('pagerChange', function(){ + .bind('pagerChange', function() { // hide child rows after pager update $('.tablesorter-childRow td').hide(); }); @@ -45,7 +45,7 @@ // Toggle child row content (td), not hiding the row since we are using rowspan // Using delegate because the pager plugin rebuilds the table after each page change // "delegate" works in jQuery 1.4.2+; use "live" back to v1.3; for older jQuery - SOL - $('.tablesorter').delegate('.toggle', 'click' ,function(){ + $('.tablesorter').delegate('.toggle', 'click' ,function() { // use "nextUntil" to toggle multiple child rows // toggle table cells instead of the row diff --git a/docs/example-colspan.html b/docs/example-colspan.html index 9dc30c6fb..ea1e28ebf 100644 --- a/docs/example-colspan.html +++ b/docs/example-colspan.html @@ -21,7 +21,7 @@ - - - - - - - - - diff --git a/docs/example-parsers-date-range.html b/docs/example-parsers-date-range.html index f7c68f187..626b45b16 100644 --- a/docs/example-parsers-date-range.html +++ b/docs/example-parsers-date-range.html @@ -35,7 +35,7 @@ }); // filter buttons - $('button').on('click', function(){ + $('button').on('click', function() { var $this = $(this), filter = [], column = $this.attr('data-column'); diff --git a/docs/example-parsers-dates.html b/docs/example-parsers-dates.html index 5371c1774..a028fbf5c 100644 --- a/docs/example-parsers-dates.html +++ b/docs/example-parsers-dates.html @@ -196,7 +196,7 @@

HTML

.params { font-size: 0.8em; } diff --git a/docs/example-parsers-file-type.html b/docs/example-parsers-file-type.html index 502ae6bb1..5e346045d 100644 --- a/docs/example-parsers-file-type.html +++ b/docs/example-parsers-file-type.html @@ -170,8 +170,8 @@

HTML

- diff --git a/docs/example-parsers-named-numbers.html b/docs/example-parsers-named-numbers.html index 883dc5a5f..6742bff86 100644 --- a/docs/example-parsers-named-numbers.html +++ b/docs/example-parsers-named-numbers.html @@ -167,7 +167,7 @@

HTML

- diff --git a/docs/example-widget-column-selector.html b/docs/example-widget-column-selector.html index 4f41ca122..94033d85e 100644 --- a/docs/example-widget-column-selector.html +++ b/docs/example-widget-column-selector.html @@ -108,7 +108,7 @@ // container layout columnSelector_layout : '', // layout customizer callback called for each column - // function($cell, name, column){ return name || $cell.html(); } + // function($cell, name, column) { return name || $cell.html(); } columnSelector_layoutCustomizer : null, // data attribute containing column name to use in the selector container columnSelector_name : 'data-selector-name', @@ -552,7 +552,7 @@

Column selector widget default options (added inside of tablesorter wi

Bind to this event if you to need to perform an action after the columnSelector has finished hiding or showing columns.

- Use it as follows
$('table').on('columnUpdate', function(){
+							Use it as follows
$('table').on('columnUpdate', function() {
   // set ascending sort on first column
   $(this).trigger('sorton', [ [[0,0]] ]);
 });
diff --git a/docs/example-widget-columns.html b/docs/example-widget-columns.html index 2a273fb69..d1bfcc5e5 100644 --- a/docs/example-widget-columns.html +++ b/docs/example-widget-columns.html @@ -62,7 +62,7 @@ } $('select') .html(o) - .change(function(){ + .change(function() { var theme = $(this).val().toLowerCase(); $('table') .removeClass('tablesorter-' + t.join(' tablesorter-')) diff --git a/docs/example-widget-css-sticky-header.html b/docs/example-widget-css-sticky-header.html index 631d7eb1f..84d56f766 100644 --- a/docs/example-widget-css-sticky-header.html +++ b/docs/example-widget-css-sticky-header.html @@ -56,7 +56,7 @@ - @@ -70,7 +70,7 @@ // External search // buttons set up like this: // - $('button').click(function(){ + $('button').click(function() { var $t = $(this), col = $t.data('filter-column'), // zero-based index filter = []; @@ -211,7 +211,7 @@

How to remove filter types

  • If one of the built-in search types is interfering or bothersome to your users, then you can remove it using the following command (using fuzzy search as an example): -
    $(function(){
    +			
    $(function() {
     
     	// Remove fuzzy search
     	delete $.tablesorter.filter.types.fuzzy;
    diff --git a/docs/example-widget-filter-custom-search2.html b/docs/example-widget-filter-custom-search2.html
    index e5a219025..c9972997c 100644
    --- a/docs/example-widget-filter-custom-search2.html
    +++ b/docs/example-widget-filter-custom-search2.html
    @@ -44,8 +44,8 @@
     });
     
     
     
     	
     	
     	
     	
     
    -
     
     
     
    -	
     	
     
    -	
     	
     
    -	
     
    -	
     	
     	
     	
    -	
     	
     
    -	
     
     	
     
     
    diff --git a/docs/example-widgets.html b/docs/example-widgets.html
    index a50e85ad0..b4c161258 100644
    --- a/docs/example-widgets.html
    +++ b/docs/example-widgets.html
    @@ -65,7 +65,7 @@
     		},
     		// this remove function is called when using the refreshWidgets method or when destroying the tablesorter plugin
     		// this function only applies to tablesorter v2.4+
    -		remove: function(table, c){
    +		remove: function(table, c) {
     			c.$tbodies.children("tr.repeated-header").remove();
     		}
     
    @@ -175,7 +175,7 @@ 

    addWidget Template

    }, // The init function (added v2.0.28) is called only after tablesorter has // initialized, but before initial sort & before any of the widgets are applied. - init: function(table, thisWidget, config, widgetOptions){ + init: function(table, thisWidget, config, widgetOptions) { // widget initialization code - this is only *RUN ONCE* // but in this example, only the format function is called to from here // to keep the widget backwards compatible with the original tablesorter @@ -187,7 +187,7 @@

    addWidget Template

    // function above otherwise initFlag is undefined // * see the saveSort widget for a full example * }, - remove: function(table, config, widgetOptions, refreshing){ + remove: function(table, config, widgetOptions, refreshing) { // do what ever needs to be done to remove stuff added by your widget // unbind events, restore hidden content, etc. // refreshing flag is true when the refreshWidgets method is triggered, meaning diff --git a/docs/index.html b/docs/index.html index a695daf1c..2bc951b63 100644 --- a/docs/index.html +++ b/docs/index.html @@ -282,7 +282,7 @@

    Getting started

    Start by telling tablesorter to sort your table when the document is loaded:

    -
    $(function(){
    +	
    $(function() {
       $("#myTable").tablesorter();
     });
    @@ -292,7 +292,7 @@

    Getting started

    tablesorter to sort on the first and second column in ascending order.

    -
    $(function(){
    +	
    $(function() {
       $("#myTable").tablesorter({ sortList: [[0,0], [1,0]] });
     });
    @@ -899,7 +899,7 @@

    Configuration


    The sorter should be set to "shortDate" and the date format can be set in the "dateFormat" option or set for a specific columns within the "headers" option. See the demo page to see it working. -
    $(function(){
    +						
    $(function() {
       $("table").tablesorter({
     
         dateFormat : "mmddyyyy", // default date format
    @@ -988,7 +988,7 @@ 

    Configuration


    The plugin attempts to detect the type of data that is contained in a column, but if it can't figure it out then it defaults to alphanumeric. You can easily override this by setting the header argument (or column parser). See the full list of default parsers here or write your own. -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         headers: {
     
    @@ -1094,7 +1094,7 @@ 

    Configuration

    null This callback fires when tablesorter has completed initialization. (v2.2).
    -
    $(function(){
    +						
    $(function() {
     
       // bind to tablesorter-initialized event BEFORE initializing tablesorter*
       $("table")
    @@ -1105,7 +1105,7 @@ 

    Configuration

    // initialize the tablesorter plugin $("table").tablesorter({ // this is equivalent to the above bind method - initialized : function(table){ + initialized : function(table) { // do something after tablesorter has initialized } }); @@ -1163,10 +1163,10 @@

    Configuration

  • config - The current table.config.
  • $table - This value is the current table jQuery object. If this function is being applied to cloned headers, as is does in the stickyHeaders widget, then this value will contain the sticky header clone added after the current table, and not the main table (v2.18.0).
-
$(function(){
+					
$(function() {
   $("table").tablesorter({
     headerTemplate: '{content}',
-    onRenderHeader: function (index, config, $table){
+    onRenderHeader: function (index, config, $table) {
       $(this).find('div').addClass('roundedCorners');
     }
   });
@@ -1196,10 +1196,10 @@ 

Configuration

  • index - zero-based index of the current table header cell; this value is not indicative of the column index, as it is simply a count of header cells. So it will be effected by rowspan, colspan and multiple rows in the header.
  • template - A rendered headerTemplate HTML string.
  • -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         headerTemplate: '{icon}{content}',
    -    onRenderTemplate: function (index, template){
    +    onRenderTemplate: function (index, template) {
           return '<em>' + (index + 1) + ':</em> ' + template;
         }
       });
    @@ -1304,7 +1304,7 @@ 

    Configuration

  • SortAppend is the default sort that is added to the end of the users sort selection (null by default; v2.24.0).
  • The value of these sort options is an array of arrays and can include one or more columns. The format is an array of instructions for per-column sorting and direction in the format: [[columnIndex, sortDirection], ... ] where columnIndex is a zero-based index for your columns left-to-right and sortDirection is 0 for Ascending and 1 for Descending. A valid argument that sorts ascending first by column 1 and then column 2 looks like: [[0,0],[1,0]]. -
    $(function(){
    +				
    $(function() {
       $("table").tablesorter({
         sortForce  : [[0,0]],        // Always sort first column first
         sortList   : [[1,0], [2,0]], // initial sort columns (2nd and 3rd)
    @@ -1325,7 +1325,7 @@ 

    Configuration

    NOTE Only when the user interacts with the table will the sortForce and sortAppend settings be applied. During initialization, and while setting the sortList through the API, both the sortForce and sortAppend settings are ignored. This will allow you to have explicit control over the sorting.

    The value contains an array of instructions for per-column sorting and direction in the format: [[columnIndex, sortDirection], ... ] where columnIndex is a zero-based index for your columns left-to-right and sortDirection is 0 for Ascending and 1 for Descending. A valid argument that sorts ascending first by column 1 and then column 2 looks like: [[0,0],[1,0]]. Please see sortForce for more details on other sort order options.
    -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         sortList : [[1,0], [2,0]] // initial sort columns (2nd and 3rd)
       });
    @@ -1355,7 +1355,7 @@ 

    Configuration

    NOTE Only when the user interacts with the table will the sortForce and sortAppend settings be applied. During initialization, and while setting the sortList through the API, both the sortForce and sortAppend settings are ignored. This will allow you to have explicit control over the sorting.

    For example, can be used to sort people alphabetically after some other user-selected sort that results in rows with the same value like dates or money due. It can help prevent data from appearing as though it has a random secondary sort.
    -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         sortAppend : [[1,0], [2,0]] // always append sorting of 2nd and 3rd column
       });
    @@ -1363,7 +1363,7 @@ 

    Configuration

    The value contains an array of instructions for per-column sorting and direction in the format: [[columnIndex, sortDirection], ... ] where columnIndex is a zero-based index for your columns left-to-right and sortDirection is 0 for Ascending and 1 for Descending. A valid argument that sorts ascending first by column 1 and then column 2 looks like: [[0,0],[1,0]]. Please see sortForce for more details on other sort order options.

    In v2.24.0, the sortAppend option now accepts an object containing column indexes.

    Also, the sort direction can be set using "a" (ascending), "d" (descending), "n" (next), "s" (same) & "o" (opposite):

    -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         sortAppend: {
           0 : [[ 1,'a' ]], // always apply ascending sort
    @@ -1615,7 +1615,7 @@ 

    Custom theme

    odd : 'odd' // odd row zebra striping }
    Then use it by adding the name of your theme to the theme option: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         // set the new theme name from $.tablesorter.themes here
         theme   : 'custom',
    @@ -1677,18 +1677,18 @@ 

    Custom theme

  • Also, this option can now be set using a data-attribute named "data-text-extraction" on the table.
  • You can customize the text extraction by writing your own text extraction function "myTextExtraction" which you define like: -
    var myTextExtraction = function(node, table, cellIndex){
    +					
    var myTextExtraction = function(node, table, cellIndex) {
       // extract data from markup and return it
       // originally: return node.childNodes[0].childNodes[0].innerHTML;
       return $(node).find('selector').text();
     }
    -$(function(){
    +$(function() {
       $("#myTable").tablesorter( { textExtraction: myTextExtraction } );
     });
    tablesorter will pass the current table cell object for you to parse and return. Thanks to Josh Nathanson for the examples; updated to a jQuery example by Rob G (Mottie).

    Now if the text you are finding in the script above is say a number, then just include the headers sorter option to specify how to sort it. Also in this example, we will specify that the special textExtraction code is only needed for the second column (1 because we are using a zero-based index). All other columns will ignore this textExtraction function.

    Added table and cellIndex variables to the textExtraction function in version 2.1.2 (this is not part of the original plugin).

    -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         textExtraction: {
           1: function(node, table, cellIndex) {
    @@ -1720,7 +1720,7 @@ 

    Custom theme

  • If defined, any "non-word" characters (anything not "a-z", "0-9" or "_") within the namespace will be removed.
  • Added or not, the namespace will be saved with a leading period (e.g. ".myuniquetableid")
  • -
    $(function(){
    +					
    $(function() {
       $("#mytable").tablesorter({
         // if table id = "mytable", this namespace is saved as ".mytable"
         namespace : $('#mytable')[0].id;
    @@ -1740,9 +1740,9 @@ 

    Custom theme


    Here is an example: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
    -    numberSorter : function(a, b, direction, maxColumnValue){
    +    numberSorter : function(a, b, direction, maxColumnValue) {
           // direction; true = ascending; false = descending
           // maxColumnValue = the maximum value of that column (ignoring its sign)
           return a - b;
    @@ -1800,16 +1800,16 @@ 

    Custom theme


    Include a script like naturalSort.js as follows: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         textSorter : naturalSort
       });
     });
    or use the localeCompare sort -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         // replace the OVERALL text sorter function
    -    textSorter: function(a, b, direction, columnIndex, table){
    +    textSorter: function(a, b, direction, columnIndex, table) {
           // direction: true = ascending; false = descending
           // columnIndex: zero-based index of the current table column being sorted
           // table: table DOM element (access options by using table.config)
    @@ -1817,11 +1817,11 @@ 

    Custom theme

    } }); });
    In v2.27.6, the textSorter option will allow setting a sorter per column index or class name (column indexes were added in v2.12): -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         textSorter : {
           // replace INDIVIDUAL COLUMN text sorter functions
    -      0 : function(a, b, direction, columnIndex, table){
    +      0 : function(a, b, direction, columnIndex, table) {
             // same as $.tablesorter.sortText (basic alphabetical sort)
             // direction: true = ascending; false = descending
             // columnIndex: zero-based index of the current table column being sorted
    @@ -1905,7 +1905,7 @@ 

    Custom theme

    Previously documented widget options widgetZebra, widgetColumns and widgetUitheme will be retained for backwards compatibility.

    Use the widgetOptions option as follows, please note that each option is followed by a comma (except the last one): -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
     
         // initialize a bunch of widgets (the order doesn't matter)
    @@ -2232,7 +2232,7 @@ 

    Custom theme

    This option is meant to be used with the jQuery Globalize library along with CLDR data.

    See the Globalization section in the group widget demo for details on how to set it up.

    Currently, the globalize (parser-globalize.js), month (parser-date-month.js) & weekday (parser-date-weekday.js) parsers utilize this option.

    -
    $(function(){
    +						
    $(function() {
       $('table').tablesorter({
         // globalize : { lang: 'en' } // for ALL columns
         // or, per column by using the column index
    @@ -2255,7 +2255,7 @@ 

    Custom theme

    Used by the input-select parser indicate if changes to child row content is to be ignored (v2.28.10)

    Change this setting to ignore input, textarea and select changes inside of child rows: -
    $(function(){
    +						
    $(function() {
       $('table').tablesorter({
         ignoreChildRow : true
       });
    @@ -2274,7 +2274,7 @@ 

    Custom theme

    Used by the image parser to grab the image attribute content (v2.17.5; moved to tablesorter core in v2.18.0; see config.parsers).

    Change this setting to grab a different image attribute to be used for sorting: -
    $(function(){
    +						
    $(function() {
       $('table').tablesorter({
         // parse image title (value to be used while sorting & filtering)
         imgAttr : 'title',
    @@ -2345,7 +2345,7 @@ 

    Custom theme

    When the column styling widget is initialized, it automatically applied the default class names of "primary" for the primary sort, "secondary" for the next sort, "tertiary" for the next sort, and so on (add more as needed)... (v2.0.17). Use the widgetColumns option to change the css class name as follows: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         widgets: ["columns"], // initialize column styling of the table
         widgetColumns: { css: ["primary", "secondary", "tertiary" ] }
    @@ -2370,7 +2370,7 @@ 

    Custom theme

    Find more jQuery UI class names by hovering over the Framework icons on this page: http://jqueryui.com/themeroller/

    Use the widgetUitheme option to change the css class name as follows: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         widgets: ["uitheme"], // initialize ui theme styling widget of the table
         widgetUitheme: {
    @@ -2399,7 +2399,7 @@ 

    Custom theme

    When the zebra striping widget is initialized, it automatically applied the default class names of "even" and "odd". Use the widgetZebra option to change the css class name as follows: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         widgets: ["zebra"], // initialize zebra striping of the table
         widgetZebra: { css: [ "normal-row", "alt-row" ] }
    @@ -2477,7 +2477,7 @@ 

    Widget & Pager Options


    Use the "columns" option to change the css class name as follows: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         widgets: ["columns"], // initialize column styling of the table
         widgetOptions : {
    @@ -2498,7 +2498,7 @@ 

    Widget & Pager Options


    Use the "columns_thead" option to add the column class names to the thead as follows: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         widgets: ["columns"], // initialize column styling of the table
         widgetOptions : {
    @@ -2519,7 +2519,7 @@ 

    Widget & Pager Options


    Use the "columns_tfoot" option to add the column class names to the tfoot as follows: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         widgets: ["columns"], // initialize column styling of the table
         widgetOptions : {
    @@ -2541,7 +2541,7 @@ 

    Widget & Pager Options

    *NOTE* When using this option, please be aware that all child row content will be obtained from each table cell using textContent, so none of the markup will be preserved. Also, carriage returns (<br>) will not be included. To account for the loss of white space, especially after carriage returns, please add an extra space to the end of the line. Using innerText, could have been an option for preserving the white space, but it is not standardized across all browsers (ref).

    Use the filter_childRows option to include child row text as follows: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         widgets: ["filter"],
         widgetOptions : {
    @@ -2564,7 +2564,7 @@ 

    Widget & Pager Options

    If false, and the filter_childRows option is true, then queries in any column will search all child content, as before this option was added.

    Use the filter_childByColumn option as follows: -
    $(function(){
    +						
    $(function() {
       $("table").tablesorter({
         widgets: ["filter"],
         widgetOptions : {
    @@ -2588,7 +2588,7 @@ 

    Widget & Pager Options

    Both filter_childRows & filter_childByColumn options must be set to true for this option to work.

    If false, this option will only show the child row that matches the filter; and its parent row.

    Use the filter_childWithSibs option as follows: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         widgets: [ "filter" ],
         widgetOptions : {
    @@ -2631,7 +2631,7 @@ 

    Widget & Pager Options


    Use the filter_columnFilters option as follows: -
    $(function(){
    +					
    $(function() {
       $("table").tablesorter({
         widgets: ["filter"],
         widgetOptions : {
    @@ -2662,7 +2662,7 @@ 

    Widget & Pager Options

    Use the filter_cellFilter option to add an extra css class name as follows:

    -
    $(function(){
    +						
    $(function() {
       $("table").tablesorter({
         widgets: ["filter"],
         widgetOptions : {
    @@ -2687,7 +2687,7 @@ 

    Widget & Pager Options


    Changed default to an empty string in v2.11, as the "tablesorter-filter" class will always be added to the filter; this option now contains any additional class names to add.

    Use the filter_cssFilter option to add an extra css class name as follows:

    -
    $(function(){
    +						
    $(function() {
       $("table").tablesorter({
         widgets: ["filter"],
         widgetOptions : {
    @@ -2713,7 +2713,7 @@ 

    Widget & Pager Options

    Warning If a column has a default filter set, the user will not be able to use other filters.

    Use the filter_defaultFilter option as follows: -
    $(function(){
    +						
    $(function() {
       $("table").tablesorter({
         widgets: ["filter"],
         widgetOptions : {
    @@ -2760,7 +2760,7 @@ 

    Widget & Pager Options


    Use the filter_excludeFilter option as follows: -
    $(function(){
    +						
    $(function() {
       $("table").tablesorter({
         widgets: ["filter"],
         widgetOptions : {
    @@ -2804,7 +2804,7 @@ 

    Widget & Pager Options

    Set this option to be a jQuery selector string, or jQuery object, pointing to any external inputs that are to be used for searching the table.

    Use the filter_external option as follows: -
    $(function(){
    +						
    $(function() {
       $("table").tablesorter({
         widgets: ["filter"],
         widgetOptions : {
    @@ -2878,7 +2878,7 @@ 

    Widget & Pager Options


    In v2.17.0, the filter_formatter column can also be referenced by using a jQuery selector (e.g. class name or ID) that points to a table header cell.
    filter_formatter : {
    -    ".col-value" : function($cell, indx){
    +    ".col-value" : function($cell, indx) {
           return $.tablesorter.filterFormatter.uiSpinner( $cell, indx, {
             ...
           });
    @@ -2896,13 +2896,13 @@ 

    Widget & Pager Options

    • To add the jQuery UI slider, follow this example: -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["filter"],
           widgetOptions : {
             filter_formatter : {
               // column index `0` or use a jQuery selector `"th:contains('Discount')"`
      -        0 : function($cell, indx){
      +        0 : function($cell, indx) {
                 return $.tablesorter.filterFormatter.uiSpinner( $cell, indx, {
                   value : 0,  // starting value
                   min   : 0,  // minimum value
      @@ -2962,7 +2962,7 @@ 

      Widget & Pager Options

      • Make a sorted select dropdown list of all column contents. Repeated content will be combined. -
        $(function(){
        +							
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions: {
        @@ -2980,7 +2980,7 @@ 

        Widget & Pager Options

        Make a select dropdown list with custom option settings. Each option must have a corresponding function which returns a boolean value; return true if there is a match, or false with no match.

        Regex example

        -
        $(function(){
        +							
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions: {
        @@ -3008,7 +3008,7 @@ 

        Regex example

        }); });

        Comparison example

        -
        $(function(){
        +							
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions: {
        @@ -3037,7 +3037,7 @@ 

        Comparison example

      • Make a custom filter for the column. -
        $(function(){
        +							
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions: {
        @@ -3075,7 +3075,7 @@ 

        Comparison example


        Use the filter_hideEmpty option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions : {
        @@ -3096,7 +3096,7 @@ 

        Comparison example


        Use the filter_hideFilters option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions : {
        @@ -3110,7 +3110,7 @@ 

        Comparison example

      • If this function does not return a boolean value, the value of the filters are checked and if no search queries are found, the filter row will be hidden.
      Example of function setting: -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["filter"],
           widgetOptions : {
      @@ -3140,7 +3140,7 @@ 

      Comparison example


      Use the filter_ignoreCase option as follows: -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["filter"],
           widgetOptions : {
      @@ -3164,7 +3164,7 @@ 

      Comparison example


      If this option is set to a number, e.g. 4, a search of the column content will not initiate until this minimum number of characters are entered into the input.

      In v2.27.3, this option can be set as an object containing specific column zero-based indexes, or class names. For undefined columns, include a "fallback" value otherwise undefined columns will be set as false.

      -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["filter"],
           widgetOptions : {
      @@ -3265,7 +3265,7 @@ 

      Comparison example

      For example, add this button (<button class="reset">Reset</button>) to the table header, or anywhere else on the page. That element will be used as a reset for all column and quick search filters (clears all fields):

      Use the filter_reset option as follows: -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["filter"],
           widgetOptions : {
      @@ -3321,7 +3321,7 @@ 

      Comparison example


      Use the filter_searchDelay option as follows: -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["filter"],
           widgetOptions : {
      @@ -3373,7 +3373,7 @@ 

      Comparison example

      If the debug option is set to true, then a message will appear while filtering stating the specific number of rows, or "all" rows, that are being searched.

      Use the filter_searchFiltered option as follows: -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["filter"],
           widgetOptions : {
      @@ -3437,11 +3437,11 @@ 

      Comparison example

      • null - this value will set the default behavior and return all table cell values from the current column.
      • An overall function - when this option is a function, it will be used for all filter selects in the table. -
        $(function(){
        +							
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions : {
        -      filter_selectSource : function(table, column, onlyAvail){
        +      filter_selectSource : function(table, column, onlyAvail) {
                 // get an array of all table cell contents for a table column
                 var array = $.tablesorter.filter.getOptions(table, column, onlyAvail);
                 // manipulate the array as desired, then return it
        @@ -3453,12 +3453,12 @@ 

        Comparison example

      • An object containing column keys set with a function - when the option is set in this manner, a function can be applied to a specific column.

        This example was updated in v2.23.4 to use the buildSelect function directly (ref)

        -
        $(function(){
        +							
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions : {
               filter_selectSource : {
        -        0 : function(table, column, onlyAvail){
        +        0 : function(table, column, onlyAvail) {
                   // call ajax after tablesorter has initialized; this prevents
                   // multiple ajax calls during initialization
                   if (table.hasInitialized) {
        @@ -3502,7 +3502,7 @@ 

        Comparison example


        Use the filter_selectSourceSeparator option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions : {
        @@ -3520,7 +3520,7 @@ 

        Comparison example

        <option value="fr">French</option> <option value="de">German</option> </select>
        This also works for the filter_functions -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions: {
        @@ -3558,7 +3558,7 @@ 

        Comparison example


        Use the filter_serversideFiltering option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions : {
        @@ -3579,7 +3579,7 @@ 

        Comparison example


        Use the filter_startsWith option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions : {
        @@ -3600,7 +3600,7 @@ 

        Comparison example


        Use the filter_useParsedData option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions : {
        @@ -3633,7 +3633,7 @@ 

        Comparison example


        Use the filter_defaultAttrib option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["filter"],
             widgetOptions : {
        @@ -3654,7 +3654,7 @@ 

        Comparison example

        Changed to empty string in v2.11, as the "tablesorter-stickyHeader" class will always be added to the sticky header row; this option now contains any additional class names to add.

        Previously, this option contained the class name to be applied to the sticky header row (tr) (v2.1).

        Use the "stickyHeaders" option to add an extra css class name as follows: -
        $(function(){
        +						
        $(function() {
           $("table").tablesorter({
             widgets: ["stickyHeaders"],
             widgetOptions : {
        @@ -3678,7 +3678,7 @@ 

        Comparison example

        So if your table ID is "gummy", then the cloned sticky table id becomes "gummy-sticky"

        Use the "stickyHeaders_cloneId" option to change the cloned table id as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["stickyHeaders"],
             widgetOptions : {
        @@ -3700,7 +3700,7 @@ 

        Comparison example


        Use the stickyHeaders_includeCaption option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["stickyHeaders"],
             widgetOptions : {
        @@ -3724,7 +3724,7 @@ 

        Comparison example

        Note Appending the sticky headers to an element that does not have the same dimensions (width) as the table wrapper will produce a sticky header that does not match the table size!

        Use the stickyHeaders_appendTo option as follows:
        -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["stickyHeaders"],
             widgetOptions : {
        @@ -3746,7 +3746,7 @@ 

        Comparison example


        Use the stickyHeaders_attachTo option as follows:
        -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["stickyHeaders"],
             widgetOptions : {
        @@ -3770,7 +3770,7 @@ 

        Comparison example

        If undefined (or null), the window element will be monitored.

        Use the stickyHeaders_xScroll option as follows:
        -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["stickyHeaders"],
             widgetOptions : {
        @@ -3794,7 +3794,7 @@ 

        Comparison example

        If undefined (or null), the window element will be monitored.

        Use the stickyHeaders_yScroll option as follows:
        -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["stickyHeaders"],
             widgetOptions : {
        @@ -3816,7 +3816,7 @@ 

        Comparison example


        If the page includes a fixed navigation bar at the top, like Bootstrap, set "stickyHeaders_offset" option to offset the sticky table header to be below the fixed navigation by setting this option using any of the following examples:
        -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["stickyHeaders"],
             widgetOptions : {
        @@ -3859,7 +3859,7 @@ 

        Comparison example

        When this option is false, sticky table headers are unable to detect and match the width of the original table headers when content is added or removed.

        Use the "stickyHeaders_addResizeEvent" option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["resizable"],
             widgetOptions : {
        @@ -3882,7 +3882,7 @@ 

        Comparison example


        Use the stickyHeaders_zIndex option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["stickyHeaders"],
             widgetOptions : {
        @@ -3904,7 +3904,7 @@ 

        Comparison example


        Use the "resizable" option to not save the resized widths: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["resizable"],
             widgetOptions : {
        @@ -3928,7 +3928,7 @@ 

        Comparison example

        If an anchor was included and the table is full width, the column would resize in the opposite direction which my not be intuitive to the user. So set this option as desired, but please be mindful of the user experience.

        Use the "resizable_addLastColumn" option to include the last column resizer as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["resizable"],
             widgetOptions : {
        @@ -3963,7 +3963,7 @@ 

        Comparison example


        Use the "resizable_widths" option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["resizable"],
             widgetOptions : {
        @@ -3990,7 +3990,7 @@ 

        Comparison example

        Set this option to either true for a default 5 millisecond delay, or set it to any number less than 10 to adjust the throttling delay that is applied to the mousemove/resizing event.

        Use the "resizable_throttle" option as follows: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["resizable"],
             widgetOptions : {
        @@ -4028,7 +4028,7 @@ 

        Comparison example


        Use the "saveSort" option to not save the current sort: -
        $(function(){
        +					
        $(function() {
           $("table").tablesorter({
             widgets: ["saveSort"],
             widgetOptions : {
        @@ -4055,7 +4055,7 @@ 

        Comparison example

      • Any other setting will switch to using the default localStorage type.
      Use the "storage_storageType" option as follows: -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["saveSort"],
           widgetOptions : {
      @@ -4079,7 +4079,7 @@ 

      Comparison example

      If this option is set to false, all saved variables for the table will be within local storage (v2.21.3).

      If true, all saved variables for the table will be within the session storage. This means once the user closes the browser, all saved variables are lost.

      Use the "storage_useSessionStorage" option to switch to session storage as follows: -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["saveSort"],
           widgetOptions : {
      @@ -4161,7 +4161,7 @@ 

      Comparison example


      Use the "zebra" option to change the theme as follows: -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["zebra"], // initialize zebra striping of the table
           widgetOptions: {
      @@ -4208,7 +4208,7 @@ 

      Comparison example

      <select class="gotoPage" title="Select page number"></select> </form> </div>
      Caution If you use buttons in your pager container, make sure the buttons include a button type (<button type="button">Next</button>) to prevent form submission and page reloading every time the button is clicked.
      -
      Use this option as follows:
      $(function(){
      +						
      Use this option as follows:
      $(function() {
         $("table")
           .tablesorter()
           .tablesorterPager({
      @@ -4234,12 +4234,12 @@ 

      Comparison example

      If you need to send your server a page offset (actual starting record number), then you'll need to use the customAjaxUrl option.

      Here is an example of how to include the option, it should always be paired with an ajaxProcessing function: -
      $(function(){
      +					
      $(function() {
         $("table")
           .tablesorter()
           .tablesorterPager({
             ajaxUrl: "http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}",
      -      ajaxProcessing: function(data, table, xhr){
      +      ajaxProcessing: function(data, table, xhr) {
               // do something with the ajax data
               return [ formatted_data, total_rows ];
             }
      @@ -4283,12 +4283,12 @@ 

      Comparison example

      Note The pager widget equivalent option is within the widgetOptions and accessed via widgetOptions.pager_customAjaxUrl

      The customAjaxUrl function has two parameters, the table DOM element and the processed url string (all tags within the ajaxUrl have been replaced with their appropriate values). -
      $(function(){
      +					
      $(function() {
         $("table")
           .tablesorter()
           .tablesorterPager({
             ajaxUrl: "http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}",
      -      ajaxProcessing: function(data, table, xhr){
      +      ajaxProcessing: function(data, table, xhr) {
               // do something with the ajax data
               return [ formatted_data, total_rows ];
             },
      @@ -4302,7 +4302,7 @@ 

      Comparison example

      }); });
      In the following example, lets say your server needs a starting and ending record number instead of a page & size parameter. Use this option as follows: -
      $(function(){
      +					
      $(function() {
         $("table")
           .tablesorter()
           .tablesorterPager({
      @@ -4313,7 +4313,7 @@ 

      Comparison example

      end = start + pager.size; return url += '&start=' + start + '&end=' + end; }, - ajaxProcessing: function(data, table, xhr){ + ajaxProcessing: function(data, table, xhr) { // do something with the ajax data return [ total_rows, data ]; } @@ -4339,7 +4339,7 @@

      Comparison example

      Your server does not need to return a JSON format, if you want to return pure HTML, set the dataType to "html" and modify the ajaxProcessing function to instead work with HTML; then return a jQuery object or apply the HTML to the table yourself.

      See all possible settings in the jQuery.ajax documentation -
      $(function(){
      +					
      $(function() {
         $("table")
           .tablesorter()
           .tablesorterPager({
      @@ -4350,7 +4350,7 @@ 

      Comparison example

      dataType: 'json', type: 'GET' }, - ajaxProcessing: function(data, table, xhr){ + ajaxProcessing: function(data, table, xhr) { // do something with the ajax data; return [ total_rows ]; } @@ -4378,7 +4378,7 @@

      Comparison example

      When there is an ajax error, the $.tablesorter.showError function is called. In v2.23.0, that function now checks this callback to allow adding a custom error message.

      Use it as follows: -
      $(function(){
      +					
      $(function() {
         $("table")
           .tablesorter()
           .tablesorterPager({
      @@ -4410,7 +4410,7 @@ 

      Comparison example


      Note The pager widget equivalent option is within the widgetOptions and accessed via widgetOptions.pager_initialRows

      Use this option as follows:

      -
      $(function(){
      +						
      $(function() {
         $("table")
           .tablesorter()
           .tablesorterPager({
      @@ -4478,7 +4478,7 @@ 

      Object

      "tasty" : "It's delicious!" }
      This ajaxProcessing function must return an object with "total", "headers" and "rows" properties! As before, "total" is the only required property; if the headers don't need to be changed, don't return a headers array, and if you append the rows to the table yourself within the ajaxProcessing function, you don't need to return a "rows" property. -
      ajaxProcessing: function(result, table, xhr){
      +							
      ajaxProcessing: function(result, table, xhr) {
           if (result && result.hasOwnProperty('data')) {
       
               // "total" is a required property!
      @@ -4505,7 +4505,7 @@ 

      Object

      Array (total only)

      After tablesorter v2.10, just build the table yourself and return the total number of rows: -
      ajaxProcessing: function(data, table, xhr){
      +							
      ajaxProcessing: function(data, table, xhr) {
         if (data && data.hasOwnProperty('rows')) {
           var r, row, c, d = data.rows,
           // total number of rows (required)
      @@ -4537,7 +4537,7 @@ 

      Array (total only)

      Array (rows as jQuery object)

      After tablesorter v2.10, return a jQuery object -
      ajaxProcessing: function(data, table, xhr){
      +							
      ajaxProcessing: function(data, table, xhr) {
         if (data && data.hasOwnProperty('rows')) {
           var r, row, c, d = data.rows,
           // total number of rows (required)
      @@ -4566,7 +4566,7 @@ 

      Array (rows as jQuery object)

      } }
      Or, if your JSON contains all the rows within a string this method will work: -
      ajaxProcessing: function(data, table, xhr){
      +							
      ajaxProcessing: function(data, table, xhr) {
         if (data && data.hasOwnProperty('rows')) {
           // data.rows would look something like this
           // '<tr><td>r0c0</td><td>r0c1</td></tr><tr><td>r1c0</td><td>r1c1</td></tr>'
      @@ -4613,12 +4613,12 @@ 

      Array (rows as an array of arrays)

      }] }
      The above JSON is processed by the following code (this returns an array of array of table rows): -
      $(function(){
      +							
      $(function() {
         $("table")
           .tablesorter()
           .tablesorterPager({
             ajaxUrl: "http://mydatabase.com?page={page}&size={size}",
      -      ajaxProcessing: function(data, table, xhr){
      +      ajaxProcessing: function(data, table, xhr) {
               if (data && data.hasOwnProperty('rows')) {
                 var r, row, c, d = data.rows,
                 // total number of rows (required)
      @@ -4674,7 +4674,7 @@ 

      Array (rows as an array of arrays)

      This option replaced the original separator option, which only separated the page number from the total number of pages. The formatted output from this option is placed inside the information block targeted by the cssPageDisplay option.

      Use it as follows: -
      $(function(){
      +					
      $(function() {
         $("table")
           .tablesorter()
           .tablesorterPager({
      @@ -5001,7 +5001,7 @@ 

      Array (rows as an array of arrays)

      It is best if this filter_anyMatch option is used with a single search input as follows:
      <input class="search" type="search">
       <button type="button" class="reset">Reset Search</button>
      -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           widgets: ["filter"],
           widgetOptions : {
      @@ -5069,7 +5069,7 @@ 

      Array (rows as an array of arrays)

      As before the jQuery UI theme applies the default class names of "ui-icon-arrowthick-2-n-s" for the unsorted column, "ui-icon-arrowthick-1-s" for the descending sort and "ui-icon-arrowthick-1-n" for the ascending sort. (Modified v2.1; Updated in v2.4). Find more jQuery UI class names by hovering over the Framework icons on this page: http://jqueryui.com/themeroller/

      Use the "uitheme" option to change the css class name as follows: -
      $(function(){
      +					
      $(function() {
         $("table").tablesorter({
           theme     : 'jui',       // set theme name from $.tablesorter.themes here
           widgets   : ["uitheme"], // initialize ui theme styling widget of the table
      @@ -5188,7 +5188,7 @@ 

      Triggered event method:

      // As of v2.19.0, the resort variable can contain a new sortList to be applied // A callback method was added in 2.3.9. resort = true, // or [ [0,0], [1,0] ] etc - callback = function( table ){ + callback = function( table ) { alert( 'rows have been added!' ); }; $( 'table' ) @@ -5257,7 +5257,7 @@

      Direct method:

      Triggered event method:

      // Choose a new sort order
       var sort = [ [0,0], [2,0] ],
      -    callback = function( table ){
      +    callback = function( table ) {
               alert( 'new sort applied to ' + table.id );
           };
       // Note that the sort value below is inside of another array (inside another set of square brackets)
      @@ -5325,7 +5325,7 @@ 

      Triggered event method:

      // if set to false, no new sort will be applied; or set it to any sortList value (e.g. [[0,0]]; new v2.19.0) // A callback method was added in 2.3.9. var resort = true, - callback = function( table ){ + callback = function( table ) { alert( 'new sort applied' ); }; $( 'table' ).trigger( 'update', [ resort, callback ] ); @@ -5368,7 +5368,7 @@

      Triggered event method:

      // remember, "eq()" is zero based & "nth-child()" is 1 based $("table thead th:eq(2)").html("Number"); // add some random numbers to the table cell -$("table tbody").find('td:nth-child(3)').html(function(i,h){ +$("table tbody").find('td:nth-child(3)').html(function(i,h) { return Math.floor(Math.random()*10) + 1; // random number from 0 to 10 }); @@ -5379,7 +5379,7 @@

      Triggered event method:

      // or the sort is reset if resort = [] var resort = true, // add a callback, as desired - callback = function(table){ + callback = function(table) { alert('table updated!'); }; @@ -5407,7 +5407,7 @@

      Triggered event method:

      *NOTE* In v2.22.2, a new parameter was added to allow passing a jQuery object containing tbodies to be added to the table (for the tbody sorting widget).

      This method is used by the pager (addon & widget) to update the data stored within the cache after the content has been updated using ajax.

      // optional callback function
      -var callback = function( table ){ /* do something */ },
      +var callback = function( table ) { /* do something */ },
       	// optional in v2.22.2; defaults to table.config.$tbodies if undefined
       	$tbodies = $( 'table' ).children( 'tbody' );
       $("table").trigger("updateCache", [ callback, $tbodies ] );
      @@ -5550,12 +5550,12 @@

      Triggered event method:

      Direct method:

      $.tablesorter.applyWidgetId( $('table'), 'zebra' );

      Triggered event method:

      -
      $(function(){
      +						
      $(function() {
         // initialize tablesorter without the widget
         $('table').tablesorter();
       
         // click a button to apply the zebra striping
      -  $('button').click(function(){
      +  $('button').click(function() {
           $('table').trigger('applyWidgetId', 'zebra');
           return false;
         });
      @@ -5661,13 +5661,13 @@ 

      Triggered event method:

      filter: Trigger the filter widget to update the search from current inputs and/or selections (v2.4; v2.15).
      - This first method sends an array with the search strings to the filter widget.
      $(function(){
      +					This first method sends an array with the search strings to the filter widget.
      $(function() {
         // apply "2?%" filter to the fifth column (zero-based index)
         var columns = [];
         columns[4] = '2?%'; // or define the array this way [ '', '', '', '', '2?%' ]
         $('table').trigger('search', [columns]);
       });
      -or, directly add the search string to the filter input as follows:
      $(function(){
      +or, directly add the search string to the filter input as follows:
      $(function() {
         // apply "2?%" filter to the fifth column (zero-based index)
         $('table').find('input.tablesorter-filter').eq(4).val('2?%');
         $('table').trigger('search', false); // add a false flag to skip the search delay
      @@ -5684,9 +5684,9 @@ 

      Triggered event method:

      filter: Trigger the filter widget to reset the search criteria (v2.7.7).

      If you are using the filter_formatter option to add custom input elements, this function may not work on those columns. Please refer to the filter_formatter section for more details. -
      $(function(){
      +						
      $(function() {
         // this is the same code that the "filter_reset" element runs to clear out the filters.
      -  $('button').click(function(){
      +  $('button').click(function() {
           $('table').trigger('filterReset');
           return false;
       });
      @@ -5705,7 +5705,7 @@

      Triggered event method:

      This method does not include a callback parameter similiar to the sortReset method.
      $(function() {
      -  $('button').click(function(){
      +  $('button').click(function() {
           $('table').trigger('filterAndSortReset');
           return false;
       });
      @@ -5719,9 +5719,9 @@

      Triggered event method:

      filter: Make the filter widget reset any saved searches (v2.25.6).

      Use this as follows: -
      $(function(){
      +						
      $(function() {
         // this is the same code that the "filter_reset" element runs to clear out the filters.
      -  $('button').click(function(){
      +  $('button').click(function() {
           $('#myTable').trigger('filterResetSaved');
           return false;
       });
      @@ -5737,8 +5737,8 @@

      Triggered event method:

      Trigger the saveSort widget to clear any saved sorts for that specific table (v2.7.11).
      -
      $(function(){
      -  $('button').click(function(){
      +						
      $(function() {
      +  $('button').click(function() {
           $('table').trigger('saveSortReset');
           return false;
         });
      @@ -5758,7 +5758,7 @@ 

      Triggered event method:

      Trigger the pager to change the page size (v2.7.4; v2.24.0).
      -
      $(function(){
      +						
      $(function() {
         $('table').trigger('pageSize', 15);
       });
      In v2.24.0, this option will now accept "all" as a setting, and in turn display all rows. @@ -5772,7 +5772,7 @@

      Triggered event method:


      If no value is passed, the pager will reset to page 1; otherwise, pass a "one-based" index of the desired page -
      $(function(){
      +						
      $(function() {
         $('table').trigger('pageSet', 3); // pass a one-based index
       });
      @@ -5784,7 +5784,7 @@

      Triggered event method:


      If no value is passed, the pager will reset to page 1 with the original pager size setting; otherwise, pass a "one-based" index of the desired page and the pager size as an array -
      $(function(){
      +						
      $(function() {
         $('table').trigger('pageAndSize', [ 2, 20 ]); // pass a one-based page index & page size
       });
      In v2.24.0, this option will now accept "all" as a page size setting, and in turn display all rows; the page number will be force to page one. @@ -5798,11 +5798,11 @@

      Triggered event method:


      If there is a need, this method will force the (ajax and non-ajax) pager to update. Use it as follows: -
      $(function(){
      +						
      $(function() {
         $('table').trigger('pagerUpdate');
       });
      Or, if you need, you can optionally pass a new page number: -
      $(function(){
      +						
      $(function() {
         $('table').trigger('pagerUpdate', 3); // update and set to page 3
       });
      @@ -5815,12 +5815,12 @@

      Triggered event method:

      Calling this method will reveal the entire table, remove the pager functionality, and hide the actual pager (v2.0.16; v2.23.0).

      In v2.23.0, this method was changed from destroy.pager to destroyPager because of issues with unique namespacing.

      -
      $(function(){
      +						
      $(function() {
         $('table').trigger('destroyPager');
       });
      The only way to restore the pager addon is to re-initialize the pager addon:
      -
      $(function(){
      +						
      $(function() {
         $('table').tablesorterPager(pagerOptions);
       });
      @@ -5834,7 +5834,7 @@

      Triggered event method:

      In v2.23.0, this method was changed from disable.pager to disablePager because of issues with unique namespacing.

      The disabled state will reveal all table rows and disable, but not hide, pager controls.
      -
      $(function(){
      +						
      $(function() {
         $('table').trigger('disablePager');
       });
      @@ -5846,7 +5846,7 @@

      Triggered event method:

      This method will re-enable the pager, but only from the disabled state (v2.0.21.2; v2.23.0).

      In v2.23.0, this method was changed from enable.pager to enablePager because of issues with unique namespacing.

      -
      $(function(){
      +						
      $(function() {
         $('table').trigger('enablePager');
       });
      @@ -5881,7 +5881,7 @@

      Events

      This event fires when tablesorter has completed initialization. (v2.2).
      -
      $(function(){
      +						
      $(function() {
       
         // bind to initialized event BEFORE initializing tablesorter*
         $("table")
      @@ -5892,7 +5892,7 @@ 

      Events

      // initialize the tablesorter plugin $("table").tablesorter({ // this is equivalent to the above bind method - initialized : function(table){ + initialized : function(table) { // do something after tablesorter has initialized } }); @@ -5906,7 +5906,7 @@

      Events

      This event fires immediately before tablesorter begins resorting the table.
      -
      $(function(){
      +						
      $(function() {
       
         // initialize the tablesorter plugin
         $("table").tablesorter();
      @@ -5924,7 +5924,7 @@ 

      Events

      This event fires immediately after the tablesorter header has been clicked, initializing a resort.
      -
      $(function(){
      +						
      $(function() {
       
         // initialize the tablesorter plugin
         $("table").tablesorter();
      @@ -5946,7 +5946,7 @@ 

      Events

      This event fires when tablesorter has completed resorting the table.
      -
      $(function(){
      +						
      $(function() {
       
         // initialize the tablesorter plugin
         $("table").tablesorter();
      @@ -5969,7 +5969,7 @@ 

      Events

      This event fires after tablesorter has completed updating (v2.3.9).
      This occurs after an "update", "updateAll", "updateCell" or "addRows" method was called, but before any callback functions are executed. -
      $(function(){
      +						
      $(function() {
       
         // initialize the tablesorter plugin
         $('table')
      @@ -5990,7 +5990,7 @@ 

      Events

      This event fires after tablesorter has complete applying all widgets and is ready for its next action (v2.24.0).
      This event occurs after an "updateComplete" and "pagerComplete" event. There may be some other table interaction if a widget includes any setTimeout functions. -
      $(function(){
      +						
      $(function() {
       
         // initialize the tablesorter plugin
         $('table')
      @@ -6012,7 +6012,7 @@ 

      Events


      Use it as follows: -
      $(function(){
      +						
      $(function() {
       
         // initialize the tablesorter plugin
         $('table')
      @@ -6041,11 +6041,11 @@ 

      Events

      Event triggered when the filter widget has finished initializing (v2.4).

      - You can use this event to modify the filter elements (row, inputs and/or selects) as desired. Use it as follows:
      $(function(){
      +						You can use this event to modify the filter elements (row, inputs and/or selects) as desired. Use it as follows:
      $(function() {
         $('table')
       
           // bind to filter initialized event BEFORE initializing tablesorter*
      -    .bind('filterInit', function(event, config){
      +    .bind('filterInit', function(event, config) {
             $(this).find('tr.tablesorter-filter-row').addClass('fred');
           })
       
      @@ -6063,7 +6063,7 @@ 

      Events

      Event triggered when the filter widget has started processing the search (v2.4).

      - You can use this event to do something like add a class to the filter row. Use it as follows:
      $(function(){
      +						You can use this event to do something like add a class to the filter row. Use it as follows:
      $(function() {
         $('table').bind('filterStart', function(event, filters) {
           // filters contains an array of the current filters
           $(this).find('tr.tablesorter-filter-row').addClass('filtering');
      @@ -6077,8 +6077,8 @@ 

      Events

      Event triggered when the filter widget has finished processing the search (v2.4).

      - You can use this event to do something like remove the class added to the filter row when the filtering started. Use it as follows:
      $(function(){
      -  $('table').bind('filterEnd', function(event, config){
      +						You can use this event to do something like remove the class added to the filter row when the filtering started. Use it as follows:
      $(function() {
      +  $('table').bind('filterEnd', function(event, config) {
           $(this).find('tr.tablesorter-filter-row').removeClass('filtering');
         });
       });
      @@ -6090,10 +6090,10 @@

      Events

      Event triggered when the stickyHeader widget has finished initializing (v2.10.4).

      - You can use this event to do something like modify content within the sticky header:
      $(function(){
      +						You can use this event to do something like modify content within the sticky header:
      $(function() {
         $('table')
           // bind to the init event BEFORE initializing tablesorter*
      -    .bind('stickyHeadersInit', function(){
      +    .bind('stickyHeadersInit', function() {
             // this.config.widgetOptions.$sticky contains the entire sticky header table
             this.config.widgetOptions.$sticky.find('tr.tablesorter-headerRow').addClass('sticky-styling');
           })
      @@ -6112,7 +6112,7 @@ 

      Events

      Event triggered after any widget has finished being removed (v2.29.0).

      - You can use this event to do something like remove the class added to the filter row when the filtering started. Use it as follows:
      $(function(){
      +						You can use this event to do something like remove the class added to the filter row when the filtering started. Use it as follows:
      $(function() {
         $('table').bind('widgetRemoveEnd', function(event, table) {
           // do something after widget was removed
         });
      @@ -6136,7 +6136,7 @@ 

      Events

      This event fires when the pager plugin begins to render the table on the currently selected page. (v2.0.7).
      -
      $(function(){
      +						
      $(function() {
       
         // initialize the sorter
         $("table")
      @@ -6148,7 +6148,7 @@ 

      Events

      }) // bind to pager events - .bind('pagerChange pagerComplete', function(event, options){ + .bind('pagerChange pagerComplete', function(event, options) { // options = table.config.pager (pager addon) // options = table.config (pager widget) - so use options.pager.page below // this.totalPages contains the total number of pages (this = table) @@ -6167,7 +6167,7 @@

      Events


      Note In v2.18.1, the "pagerComplete" event also fires off immediately after pager initialization.

      -
      $(function(){
      +						
      $(function() {
       
         // initialize the sorter
         $("table")
      @@ -6179,7 +6179,7 @@ 

      Events

      }) // bind to pager events - .bind('pagerChange pagerComplete', function(event, options){ + .bind('pagerChange pagerComplete', function(event, options) { // options = table.config.pager (pager addon) // options = table.config (pager widget) - so use options.pager.page below // c.totalPages contains the total number of pages @@ -6195,13 +6195,13 @@

      Events

      This event fires after all pager controls have been bound and set up but before the pager formats the table or loads any ajax data (v2.4.4).
      -
      $(function(){
      +						
      $(function() {
       
         $("table")
       
           // bind to pager initialized event BEFORE calling the ADDON
           // or BEFORE initializing tablesorter when using the pager WIDGET*
      -    .bind('pagerBeforeInitialized', function(event, options){
      +    .bind('pagerBeforeInitialized', function(event, options) {
             // options = table.config.pager (pager addon)
             // options = table.config (pager widget)
       
      @@ -6225,13 +6225,13 @@ 

      Events

      This event fires when the pager plugin has completed initialization (v2.4.4).
      -
      $(function(){
      +						
      $(function() {
       
         $("table")
       
           // bind to pager initialized event BEFORE calling the ADDON
           // or BEFORE initializing tablesorter when using the pager WIDGET*
      -    .bind('pagerInitialized', function(event, options){
      +    .bind('pagerInitialized', function(event, options) {
             // options = table.config.pager (pager addon)
             // options = table.config (pager widget) - so use options.pager.page below
             // c.totalPages contains the total number of pages
      @@ -6257,7 +6257,7 @@ 

      Events

      This event may fire before the pagerComplete event when ajax processing is involved, or after the pagerComplete on normal use. See issue #153. -
      $(function(){
      +						
      $(function() {
       
         // initialize the sorter
         $("table")
      @@ -6269,7 +6269,7 @@ 

      Events

      }) // bind to pager events - .bind('pageMoved', function(event, options){ + .bind('pageMoved', function(event, options) { // options = table.config.pager (pager addon) // options = table.config (pager widget) - so use options.pager.page below // c.totalPages contains the total number of pages @@ -6402,7 +6402,7 @@

      Variables

      // "Header Name" + $.tablesorter.language.sortDesc + $.tablesorter.language.sortDisabled
       "Account #: Descending sort applied, sorting is disabled"
      Use this variable to change the language as follows: -
      $(function(){
      +					
      $(function() {
       
         $.tablesorter.language = {
           sortAsc      : 'sorting from a to z, ',
      @@ -6646,7 +6646,7 @@ 

      Variables

      var $headers = $( table.config.$headerIndexed ); // make a collection of jQuery objects // then use collection manipulation functions -$headers.each(function(){ +$headers.each(function() { console.log( $(this).text() ); });
      @@ -6802,13 +6802,13 @@

      Variables


      Access this internal value after tablesorter has initialized. It is also included as a variable in the filterEnd event so you can update an external count like this: -
      $('table').bind('filterInit filterEnd', function(event, data){
      +					
      $('table').bind('filterInit filterEnd', function(event, data) {
           // use data.filteredRows or this.config.filteredRows
           $('.filter-rows').html( data.filteredRows );
           $('.total-rows').html( data.totalRows );
       });

      If using the pager plugin or widget, the value returned from the filterEnd event will not be accurate, so you'll need to bind to the pagerComplete event instead: -
      $('table').bind('filterInit filterEnd pagerComplete', function(event, data){
      +					
      $('table').bind('filterInit filterEnd pagerComplete', function(event, data) {
           // Note: data = table.config (filterEnd event); and data = table.config.pager (pagerComplete event)
           // both objects contain data.filteredRows & data.totalRows
           $('.filter-rows').html( data.filteredRows );
      @@ -6898,13 +6898,13 @@ 

      Variables

      This internal value will show an accurate number of filtered rows; which means the count won't include any rows from "information-only" tbodies.

      Access this internal value at any time after the filter widget has initialized, or as a shortcut it is included as a variable in the filterEnd event so you can update an external count like this: -
      $('table').bind('filterInit filterEnd', function(event, data){
      +					
      $('table').bind('filterInit filterEnd', function(event, data) {
           // use data.filteredRows or this.config.filteredRows
           $('.filter-rows').html( data.filteredRows );
           $('.total-rows').html( data.totalRows );
       });

      If using the pager plugin or widget, the value returned from the filterEnd event will not be accurate, so you'll need to bind to the pagerComplete event instead: -
      $('table').bind('filterInit filterEnd pagerComplete', function(event, data){
      +					
      $('table').bind('filterInit filterEnd pagerComplete', function(event, data) {
           // Note: data = table.config (filterEnd event); and data = table.config.pager (pagerComplete event)
           // both objects contain data.filteredRows & data.totalRows
           $('.filter-rows').html( data.filteredRows );
      @@ -7258,7 +7258,7 @@ 

      Functions

      All this function does is add or remove a class name of "tablesorter-processing" and the class name contained within the cssProcessing option.

      Here is a basic example of how this function is used: -
      $('table').bind('sortBegin sortEnd', function(event, table){
      +						
      $('table').bind('sortBegin sortEnd', function(event, table) {
       	// this is included with the basic functionality of tablesorter
       	$.tablesorter.isProcessing( this, event === 'sortBegin' );
       });
      @@ -7338,7 +7338,7 @@

      Functions

      When calling the function, set the removeClasses option to true to include removing of the "tablesorter" class name, tablesorter theme name (e.g. "tablesorter-blue") and the class name applied by the tableClass option. The callback function only provides a table (DOM element only) parameter.

      Here is a basic example of how this function is used: -
      $.tablesorter.destroy( table, true, function(table){
      +						
      $.tablesorter.destroy( table, true, function(table) {
       	alert('tablesorter has been removed! No sort for you!');
       });
      Please note that only header cells that still contain a div with a class name of tablesorter-header-inner will have their contents restored; it assumes that the contents have already been restored. @@ -8003,7 +8003,7 @@

      Functions

      timer : 250 // header cell size is checked every 250 milliseconds (1/4 of a second) }; $.tablesorter.addHeaderResizeEvent( table, disable, options );
      Then use it in your custom widget as follows: -
      $(table).on('resize', function(event, columns){
      +
      $(table).on('resize', function(event, columns) {
         // columns contains an array of header cells that were resized
         // this seemed like a better idea than firing off a resize event for every
         // column when the table adjusts itself to fit within its container
      diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js
      index a625c6ea3..d8271bae9 100644
      --- a/js/jquery.tablesorter.js
      +++ b/js/jquery.tablesorter.js
      @@ -34,8 +34,8 @@
       			showProcessing   : false,      // show an indeterminate timer icon in the header when the table is sorted or filtered.
       
       			headerTemplate   : '{content}',// header layout template (HTML ok); {content} = innerHTML, {icon} =  // class from cssIcon
      -			onRenderTemplate : null,       // function( index, template ){ return template; }, // template is a string
      -			onRenderHeader   : null,       // function( index ){}, // nothing to return
      +			onRenderTemplate : null,       // function( index, template ) { return template; }, // template is a string
      +			onRenderHeader   : null,       // function( index ) {}, // nothing to return
       
       			// *** functionality
       			cancelSelection  : true,       // prevent text selection in the header
      @@ -64,7 +64,7 @@
       			emptyTo          : 'bottom',   // sort empty cell to bottom, top, none, zero, emptyMax, emptyMin
       			stringTo         : 'max',      // sort strings in numerical column as max, min, top, bottom, zero
       			duplicateSpan    : true,       // colspan cells in the tbody will have duplicated content in the cache for each spanned column
      -			textExtraction   : 'basic',    // text extraction method/function - function( node, table, cellIndex ){}
      +			textExtraction   : 'basic',    // text extraction method/function - function( node, table, cellIndex ) {}
       			textAttribute    : 'data-text',// data-attribute that contains alternate cell text (used in default textExtraction function)
       			textSorter       : null,       // choose overall or specific column sorter function( a, b, direction, table, columnIndex ) [alt: ts.sortText]
       			numberSorter     : null,       // choose overall numeric sorter function( a, b, direction, maxColumnValue )
      @@ -78,7 +78,7 @@
       			},
       
       			// *** callbacks
      -			initialized      : null,       // function( table ){},
      +			initialized      : null,       // function( table ) {},
       
       			// *** extra css class names
       			tableClass       : '',
      @@ -764,7 +764,7 @@
       		},
       
       		getParserById : function( name ) {
      -			/*jshint eqeqeq:false */
      +			/*jshint eqeqeq:false */ // eslint-disable-next-line eqeqeq
       			if ( name == 'false' ) { return false; }
       			var indx,
       				len = ts.parsers.length;
      @@ -1125,8 +1125,8 @@
       				// direction = 2 means reset!
       				if ( list[ indx ][ 1 ] !== 2 ) {
       					// multicolumn sorting updating - see #1005
      -					// .not(function(){}) needs jQuery 1.4
      -					// filter(function(i, el){}) <- el is undefined in jQuery v1.2.6
      +					// .not(function() {}) needs jQuery 1.4
      +					// filter(function(i, el) {}) <- el is undefined in jQuery v1.2.6
       					$sorted = c.$headers.filter( function( i ) {
       						// only include headers that are in the sortList (this includes colspans)
       						var include = true,
      @@ -1535,7 +1535,7 @@
       		initSort : function( c, cell, event ) {
       			if ( c.table.isUpdating ) {
       				// let any updates complete before initializing a sort
      -				return setTimeout( function(){
      +				return setTimeout( function() {
       					ts.initSort( c, cell, event );
       				}, 50 );
       			}
      @@ -2697,7 +2697,7 @@
       		is : function( str ) {
       			return ts.regex.isoDate.test( str );
       		},
      -		format : function( str, table ) {
      +		format : function( str ) {
       			var date = str ? new Date( str.replace( ts.regex.dash, '/' ) ) : str;
       			return date instanceof Date && isFinite( date ) ? date.getTime() : str;
       		},
      @@ -2740,7 +2740,7 @@
       			// Jan 01, 2013 12:34:56 PM or 01 Jan 2013
       			return ts.regex.usLongDateTest1.test( str ) || ts.regex.usLongDateTest2.test( str );
       		},
      -		format : function( str, table ) {
      +		format : function( str ) {
       			var date = str ? new Date( str.replace( ts.regex.dateReplace, '$1 $2' ) ) : str;
       			return date instanceof Date && isFinite( date ) ? date.getTime() : str;
       		},
      @@ -2801,7 +2801,7 @@
       		is : function( str ) {
       			return ts.regex.timeTest.test( str );
       		},
      -		format : function( str, table ) {
      +		format : function( str ) {
       			// isolate time... ignore month, day and year
       			var temp,
       				timePart = ( str || '' ).match( ts.regex.timeMatch ),
      @@ -2868,7 +2868,7 @@
       			var tbodyIndex, $tbody,
       				$tbodies = c.$tbodies,
       				toRemove = ( wo.zebra || [ 'even', 'odd' ] ).join( ' ' );
      -			for ( tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ){
      +			for ( tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
       				$tbody = ts.processTbody( table, $tbodies.eq( tbodyIndex ), true ); // remove tbody
       				$tbody.children().removeClass( toRemove );
       				ts.processTbody( table, $tbody, false ); // restore tbody
      diff --git a/js/parsers/parser-date-extract.js b/js/parsers/parser-date-extract.js
      index 7af958513..d99300e5a 100644
      --- a/js/parsers/parser-date-extract.js
      +++ b/js/parsers/parser-date-extract.js
      @@ -1,6 +1,6 @@
       /*! Parser: Extract out date - updated 10/26/2014 (v2.18.0) */
       /*jshint jquery:true */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var regex = {
      diff --git a/js/parsers/parser-date-iso8601.js b/js/parsers/parser-date-iso8601.js
      index 5a1e3e6ee..e7c230c43 100644
      --- a/js/parsers/parser-date-iso8601.js
      +++ b/js/parsers/parser-date-iso8601.js
      @@ -5,7 +5,7 @@
        * See https://github.com/Mottie/tablesorter/issues/247
        */
       /*global jQuery: false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var iso8601date = /^([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?$/;
      diff --git a/js/parsers/parser-date-month.js b/js/parsers/parser-date-month.js
      index 9a9f6e85e..19eda84b8 100644
      --- a/js/parsers/parser-date-month.js
      +++ b/js/parsers/parser-date-month.js
      @@ -1,7 +1,7 @@
       /*! Parser: Month - updated 11/22/2015 (v2.24.6) */
       /* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
       /*jshint jquery:true */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var ts = $.tablesorter;
      diff --git a/js/parsers/parser-date-range.js b/js/parsers/parser-date-range.js
      index 9c23097cb..f33ab0e8f 100644
      --- a/js/parsers/parser-date-range.js
      +++ b/js/parsers/parser-date-range.js
      @@ -1,7 +1,7 @@
       /*! Parser: date ranges -updated 11/22/2015 (v2.24.6) */
       /* Include the 'widget-filter-type-insideRange.js' to filter ranges */
       /*jshint jquery:true */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var ts = $.tablesorter,
      diff --git a/js/parsers/parser-date-two-digit-year.js b/js/parsers/parser-date-two-digit-year.js
      index ceb822c0c..e3011709b 100644
      --- a/js/parsers/parser-date-two-digit-year.js
      +++ b/js/parsers/parser-date-two-digit-year.js
      @@ -1,7 +1,7 @@
       /*! Parser: two digit year - updated 11/26/2016 (v2.28.0) */
       /* Demo: http://mottie.github.io/tablesorter/docs/example-parsers-dates.html */
       /*jshint jquery:true */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	// Make the date be within +/- range of the 2 digit year
      @@ -20,7 +20,7 @@
       	ts.dates.regxxxxyy = /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/;
       	ts.dates.regyyxxxx = /(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/;
       
      -	ts.formatDate = function(s, regex, format, table){
      +	ts.formatDate = function(s, regex, format, table) {
       		if (s) {
       			var y, rng,
       				n = s
      diff --git a/js/parsers/parser-date-weekday.js b/js/parsers/parser-date-weekday.js
      index 734508d01..af0289138 100644
      --- a/js/parsers/parser-date-weekday.js
      +++ b/js/parsers/parser-date-weekday.js
      @@ -1,7 +1,7 @@
       /*! Parser: weekday - updated 11/22/2015 (v2.24.6) */
       /* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
       /*jshint jquery:true */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var ts = $.tablesorter;
      diff --git a/js/parsers/parser-date.js b/js/parsers/parser-date.js
      index 30072c983..313288ab9 100644
      --- a/js/parsers/parser-date.js
      +++ b/js/parsers/parser-date.js
      @@ -2,7 +2,7 @@
       /* Extract dates using popular natural language date parsers */
       /*jshint jquery:true */
       /*global Sugar*/
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	/*! Sugar (https://sugarjs.com/docs/#/DateParsing) */
      diff --git a/js/parsers/parser-duration.js b/js/parsers/parser-duration.js
      index 2ad1fd0a1..0848cf703 100644
      --- a/js/parsers/parser-duration.js
      +++ b/js/parsers/parser-duration.js
      @@ -1,6 +1,6 @@
       /*! Parser: duration & countdown - updated 2/7/2015 (v2.19.0) */
       /*jshint jquery:true, unused:false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	// If any number > 9999, then set table.config.durationLength = 5
      diff --git a/js/parsers/parser-feet-inch-fraction.js b/js/parsers/parser-feet-inch-fraction.js
      index 3db96cbe2..6abdb3c1e 100644
      --- a/js/parsers/parser-feet-inch-fraction.js
      +++ b/js/parsers/parser-feet-inch-fraction.js
      @@ -4,7 +4,7 @@
       * Demo: http://jsfiddle.net/Mottie/abkNM/154/
       */
       /*global jQuery: false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var ts = $.tablesorter;
      @@ -26,7 +26,7 @@
       				n = p + parseInt(t[0], 10) / parseInt(t[1] || 1, 10);
       				// look for fraction symbols
       			} else if (ts.symbolRegex.test(n)) {
      -				n = p + n.replace(ts.symbolRegex, function(m){
      +				n = p + n.replace(ts.symbolRegex, function(m) {
       					return {
       						'\u215b' : '.125', // 1/8
       						'\u215c' : '.375', // 3/8
      diff --git a/js/parsers/parser-file-type.js b/js/parsers/parser-file-type.js
      index a6d81957c..9e211b5e2 100644
      --- a/js/parsers/parser-file-type.js
      +++ b/js/parsers/parser-file-type.js
      @@ -3,7 +3,7 @@
        * prefixed into the parsed data, so sorting occurs in groups
        */
       /*global jQuery: false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	// basic list from http://en.wikipedia.org/wiki/List_of_file_formats
      @@ -51,7 +51,7 @@
       			if (!m) {
       				// make a string to 'quick' match the existing equivalents
       				t = [];
      -				$.each(types, function(i, v){
      +				$.each(types, function(i, v) {
       					t.push(v);
       				});
       				m = $.tablesorter.fileTypes.matching = sep + t.join(sep) + sep;
      diff --git a/js/parsers/parser-ignore-articles.js b/js/parsers/parser-ignore-articles.js
      index 4b6795a53..1de34ed4c 100644
      --- a/js/parsers/parser-ignore-articles.js
      +++ b/js/parsers/parser-ignore-articles.js
      @@ -4,7 +4,7 @@
        * Demo: http://jsfiddle.net/Mottie/abkNM/5/
        */
       /*jshint browser: true, jquery:true, unused:false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var ts = $.tablesorter;
      diff --git a/js/parsers/parser-image.js b/js/parsers/parser-image.js
      index adba3c4df..59eb02399 100644
      --- a/js/parsers/parser-image.js
      +++ b/js/parsers/parser-image.js
      @@ -2,12 +2,12 @@
       /* alt attribute parser for jQuery 1.7+ & tablesorter 2.7.11+ */
       /* NOTE! Moved to jquery.tablesorter.js (core) in v2.18.0 */
       /*jshint jquery:true, unused:false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	$.tablesorter.addParser({
       		id: 'image',
      -		is: function(){
      +		is: function() {
       			return false;
       		},
       		format: function(s, table, cell) {
      diff --git a/js/parsers/parser-input-select.js b/js/parsers/parser-input-select.js
      index 07429535d..9d45c048d 100644
      --- a/js/parsers/parser-input-select.js
      +++ b/js/parsers/parser-input-select.js
      @@ -6,7 +6,7 @@
       ;( function( $ ) {
       	'use strict';
       
      -	var updateServer = function( event, $table, $input ) {
      +	var updateServer = function( /* event, $table, $input */ ) {
       		// do something here to update your server, if needed
       		// event = change event object
       		// $table = jQuery object of the table that was just updated
      diff --git a/js/parsers/parser-leading-zeros.js b/js/parsers/parser-leading-zeros.js
      index d3ad897dc..99ba16bd6 100644
      --- a/js/parsers/parser-leading-zeros.js
      +++ b/js/parsers/parser-leading-zeros.js
      @@ -18,6 +18,7 @@
       				str = number.toString();
       			if (
       				!isNaN( number ) &&
      +				// eslint-disable-next-line eqeqeq
       				number == val && // jshint ignore:line
       				val.length !== str.length
       			) {
      diff --git a/js/parsers/parser-named-numbers.js b/js/parsers/parser-named-numbers.js
      index 28d2dc846..a39930fd1 100644
      --- a/js/parsers/parser-named-numbers.js
      +++ b/js/parsers/parser-named-numbers.js
      @@ -2,7 +2,7 @@
        * code modified from http://stackoverflow.com/a/12014376/145346
        */
       /*jshint jquery:true */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	// Change language of the named numbers as needed
      diff --git a/js/parsers/parser-network.js b/js/parsers/parser-network.js
      index 2a8b9b66e..148f53acb 100644
      --- a/js/parsers/parser-network.js
      +++ b/js/parsers/parser-network.js
      @@ -1,7 +1,7 @@
       /*! Parser: network - updated 2018-01-10 (v2.29.3) */
       /* IPv4, IPv6 and MAC Addresses */
       /*global jQuery: false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var ts = $.tablesorter,
      @@ -47,13 +47,13 @@
       			if (ts.regex.ipv4Validate.test(address)) {
       				groups = address.match(ts.regex.ipv4Extract);
       				t = '';
      -				for (i = 1; i < groups.length; i++){
      +				for (i = 1; i < groups.length; i++) {
       					t += ('00' + (parseInt(groups[i], 10).toString(16)) ).slice(-2) + ( i === 2 ? ':' : '' );
       				}
       				address = address.replace( ts.regex.ipv4Extract, t );
       			}
       
      -			if (address.indexOf('::') == -1) {
      +			if (address.indexOf('::') === -1) {
       				// All eight groups are present
       				fullAddress = address;
       			} else {
      @@ -74,7 +74,7 @@
       				// it's fastest & easiest for tablesorter to sort decimal values (vs hex)
       				groups[i] = hex ? ('0000' + groups[i]).slice(-4) :
       					('00000' + (parseInt(groups[i], 16) || 0)).slice(-5);
      -				expandedAddress += ( i != validGroupCount - 1) ? groups[i] + ':' : groups[i];
      +				expandedAddress += ( i !== validGroupCount - 1) ? groups[i] + ':' : groups[i];
       			}
       			return expandedAddress;
       		},
      diff --git a/js/parsers/parser-roman.js b/js/parsers/parser-roman.js
      index 0386bde82..62f7c8e09 100644
      --- a/js/parsers/parser-roman.js
      +++ b/js/parsers/parser-roman.js
      @@ -4,7 +4,7 @@
        * Jonathan Snook comment @ http://blog.stevenlevithan.com/archives/javascript-roman-numeral-converter#comment-16140
        */
       /*jshint jquery:true, unused:false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	// allow lower case roman numerals, since lists use i, ii, iii, etc.
      @@ -14,7 +14,7 @@
       
       	$.tablesorter.addParser({
       		id: 'roman',
      -		is: function(){
      +		is: function() {
       			return false;
       		},
       		format: function(s) {
      @@ -39,7 +39,7 @@
       
       	$.tablesorter.addParser({
       		id: 'roman-ignore',
      -		is: function(){
      +		is: function() {
       			return false;
       		},
       		format: function(s, table, cell, column) {
      @@ -80,13 +80,13 @@
       
       	$.tablesorter.addParser({
       		id: 'roman-extract',
      -		is: function(){
      +		is: function() {
       			return false;
       		},
       		format: function(s) {
       			var val,
       				// find roman numerals
      -				roman = $.grep(s.split(/\b/), function(v, i){
      +				roman = $.grep(s.split(/\b/), function(v) {
       					return validator.test(v) ? v : '';
       				}).join('').match(matcher),
       
      diff --git a/js/widgets/widget-alignChar.js b/js/widgets/widget-alignChar.js
      index 628f1d0a0..bae8ba78d 100644
      --- a/js/widgets/widget-alignChar.js
      +++ b/js/widgets/widget-alignChar.js
      @@ -4,14 +4,14 @@
        */
       /*jshint browser:true, jquery:true, unused:false */
       /*global jQuery: false */
      -;(function($){
      +;(function($) {
       	'use strict';
       	var ts = $.tablesorter;
       
       	ts.alignChar = {
       
       		init : function(table, c, wo) {
      -			c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
      +			c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function() {
       				var $this = $(this),
       				vars = {
       					column     : this.column,
      @@ -27,14 +27,14 @@
       			});
       		},
       
      -		setup: function(table, c, wo, v){
      +		setup: function(table, c, wo, v) {
       			// do nothing for empty tables
       			if ($.isEmptyObject(c.cache)) { return; }
       			var tbodyIndex, rowIndex, start, end, last, index, rows, val, count,
       				len, wLeft, wRight, alignChar, $row,
       				left = [],
       				right = [];
      -			for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++){
      +			for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++) {
       				rows = c.cache[tbodyIndex];
       				len = rows.normalized.length;
       				for (rowIndex = 0; rowIndex < len; rowIndex++) {
      @@ -70,14 +70,14 @@
       			}
       
       			// find widest segments
      -			wLeft = ($.extend([], left)).sort(function(a, b){ return b.length - a.length; })[0];
      -			wRight = ($.extend([], right)).sort(function(a, b){ return b.length - a.length; })[0];
      +			wLeft = ($.extend([], left)).sort(function(a, b) { return b.length - a.length; })[0];
      +			wRight = ($.extend([], right)).sort(function(a, b) { return b.length - a.length; })[0];
       			// calculate percentage widths
       			v.width = v.width || ( Math.floor(wLeft.length / (wLeft.length + wRight.length) * 100) + v.adjust );
       			wLeft = 'min-width:' + v.width + '%';
       			wRight = 'min-width:' + (100 - v.width)  + '%';
       
      -			for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++){
      +			for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++) {
       				rows = c.cache[tbodyIndex];
       				len = rows.normalized.length;
       				for (rowIndex = 0; rowIndex < len; rowIndex++) {
      @@ -94,10 +94,10 @@
       
       		},
       
      -		remove: function(table, c, column){
      +		remove: function(table, c, column) {
       			if ($.isEmptyObject(c.cache)) { return; }
       			var tbodyIndex, rowIndex, len, rows, $row, $cell;
      -			for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++){
      +			for (tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++) {
       				rows = c.cache[tbodyIndex];
       				len = rows.normalized.length;
       				for (rowIndex = 0; rowIndex < len; rowIndex++) {
      @@ -118,26 +118,26 @@
       			alignChar_indexAttrib  : 'data-align-index',
       			alignChar_adjustAttrib : 'data-align-adjust' // percentage width adjustments
       		},
      -		init: function(table, thisWidget, c, wo){
      +		init: function(table, thisWidget, c, wo) {
       			wo.alignChar_initialized = false;
       			wo.alignChar_savedVars = [];
       			ts.alignChar.init(table, c, wo);
      -			c.$table.on('pagerEnd refreshAlign', function(){
      -				c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
      +			c.$table.on('pagerEnd refreshAlign', function() {
      +				c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function() {
       					ts.alignChar.remove(table, c, this.column);
       				});
       				ts.alignChar.init(table, c, wo);
       			});
       		},
      -		format : function(table, c, wo){
      +		format : function(table, c, wo) {
       			// reinitialize in case table is empty when first initialized
       			if (!wo.alignChar_initialized) {
       				c.$table.triggerHandler('refreshAlign');
       			}
       		},
      -		remove : function(table, c, wo, refreshing){
      +		remove : function(table, c, wo, refreshing) {
       			if (refreshing) { return; }
      -			c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
      +			c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function() {
       				ts.alignChar.remove(table, c, this.column);
       			});
       			wo.alignChar_initialized = false;
      diff --git a/js/widgets/widget-chart.js b/js/widgets/widget-chart.js
      index a28f2cb93..08838aa7a 100644
      --- a/js/widgets/widget-chart.js
      +++ b/js/widgets/widget-chart.js
      @@ -3,7 +3,7 @@
        */
       /*jshint browser:true, jquery:true, unused:false */
       /*global jQuery: false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var ts = $.tablesorter,
      diff --git a/js/widgets/widget-cssStickyHeaders.js b/js/widgets/widget-cssStickyHeaders.js
      index 9c5a03851..02e248c5a 100644
      --- a/js/widgets/widget-cssStickyHeaders.js
      +++ b/js/widgets/widget-cssStickyHeaders.js
      @@ -2,7 +2,7 @@
       * Requires a modern browser, tablesorter v2.8+
       */
       /*jshint jquery:true, unused:false */
      -;(function($, window){
      +;(function($, window) {
       	'use strict';
       
       	var ts = $.tablesorter;
      diff --git a/js/widgets/widget-filter-formatter-html5.js b/js/widgets/widget-filter-formatter-html5.js
      index 67e67353b..771fc9c87 100644
      --- a/js/widgets/widget-filter-formatter-html5.js
      +++ b/js/widgets/widget-filter-formatter-html5.js
      @@ -7,7 +7,7 @@
        */
       /*jshint browser:true, jquery:true, unused:false */
       /*global jQuery: false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var ts = $.tablesorter || {},
      @@ -17,12 +17,12 @@
       
       	tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
       
      -		addCompare: function($cell, indx, options){
      +		addCompare: function($cell, indx, options) {
       			if (options.compare && $.isArray(options.compare) && options.compare.length > 1) {
       				var opt = '',
       					compareSelectClass = [ compareSelect.slice(1), ' ' + compareSelect.slice(1), '' ],
       					txt = options.cellText ? '' : '';
      -				$.each(options.compare, function(i, c){
      +				$.each(options.compare, function(i, c) {
       					opt += '';
       				});
       				$cell
      @@ -38,7 +38,7 @@
       				num = val.replace(/\s*?[><=]\s*?/g, ''),
       				compare = val.match(/[><=]/g) || '';
       			if (o.compare) {
      -				if ($.isArray(o.compare)){
      +				if ($.isArray(o.compare)) {
       					compare = (compare || []).join('') || o.compare[o.selected || 0];
       				}
       				$cell.find(compareSelect).val( compare );
      @@ -72,7 +72,7 @@
       			$shcell = [],
       			c = $cell.closest('table')[0].config,
       
      -			updateNumber = function(delayed, notrigger){
      +			updateNumber = function(delayed, notrigger) {
       				var chkd = o.addToggle ? $cell.find('.toggle').is(':checked') : true,
       					v = $cell.find('.number').val(),
       					compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '',
      @@ -104,13 +104,13 @@
       				// add HTML5 number (spinner)
       				$cell
       					.append(t + '')
      -					.find('.toggle, .number').bind('change', function(){
      +					.find('.toggle, .number').bind('change', function() {
       						updateNumber();
       					})
       					.closest('thead').find('th[data-column=' + indx + ']')
       					.addClass('filter-parsed') // get exact numbers from column
       					// on reset
      -					.closest('table').bind('filterReset', function(){
      +					.closest('table').bind('filterReset', function() {
       						if ($.isArray(o.compare)) {
       							$cell.add($shcell).find(compareSelect).val( o.compare[ o.selected || 0 ] );
       						}
      @@ -122,17 +122,17 @@
       							}
       						}
       						$cell.find('.number').val( o.value );
      -						setTimeout(function(){
      +						setTimeout(function() {
       							updateNumber();
       						}, 0);
       					});
      -				$input = $cell.find('input[type=hidden]').bind('change', function(){
      +				$input = $cell.find('input[type=hidden]').bind('change', function() {
       					$cell.find('.number').val( this.value );
       					updateNumber();
       				});
       
       				// update slider from hidden input, in case of saved filters
      -				c.$table.bind('filterFomatterUpdate', function(){
      +				c.$table.bind('filterFomatterUpdate', function() {
       					var val = tsff.updateCompare($cell, $input, o)[0] || o.value;
       					$cell.find('.number').val( ((val || '') + '').replace(/[><=]/g, '') );
       					updateNumber(false, true);
      @@ -142,17 +142,17 @@
       				if (o.compare) {
       					// add compare select
       					tsff.addCompare($cell, indx, o);
      -					$cell.find(compareSelect).bind('change', function(){
      +					$cell.find(compareSelect).bind('change', function() {
       						updateNumber();
       					});
       				}
       
       				// has sticky headers?
      -				c.$table.bind('stickyHeadersInit', function(){
      +				c.$table.bind('stickyHeadersInit', function() {
       					$shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx).empty();
       					$shcell
       						.append(t)
      -						.find('.toggle, .number').bind('change', function(){
      +						.find('.toggle, .number').bind('change', function() {
       							$cell.find('.number').val( $(this).val() );
       							updateNumber();
       						});
      @@ -160,7 +160,7 @@
       					if (o.compare) {
       						// add compare select
       						tsff.addCompare($shcell, indx, o);
      -						$shcell.find(compareSelect).bind('change', function(){
      +						$shcell.find(compareSelect).bind('change', function() {
       							$cell.find(compareSelect).val( $(this).val() );
       							updateNumber();
       						});
      @@ -203,15 +203,17 @@
       			$shcell = [],
       			c = $cell.closest('table')[0].config,
       
      -			updateRange = function(v, delayed, notrigger){
      +			updateRange = function(v, delayed, notrigger) {
       				/*jshint eqeqeq:false */
       				// hidden input changes may include compare symbols
       				v = ( typeof v === 'undefined' ? $input.val() : v ).toString().replace(/[<>=]/g, '') || o.value;
       				var compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '',
      +					// eslint-disable-next-line eqeqeq
       					t = ' (' + (compare ? compare + v : v == o.min ? o.allText : v) + ')',
       					searchType =  c.$table[0].hasInitialized ? (delayed ? delayed : o.delayed) || '' : true;
       				$cell.find('input[type=hidden]')
       					// add equal to the beginning, so we filter exact numbers
      +					// eslint-disable-next-line eqeqeq
       					.val( ( compare ? compare + v : ( v == o.min ? '' : ( o.exactMatch ? '=' : '' ) + v ) ) )
       					// ( val == o.min ? '' : val + (o.exactMatch ? '=' : ''))
       					.trigger( notrigger ? '' : 'search', searchType ).end()
      @@ -237,23 +239,24 @@
       					// add span to header for the current slider value
       					.find('.tablesorter-header-inner').append('');
       				// hidden filter update namespace trigger by filter widget
      -				$input = $cell.find('input[type=hidden]').bind('change' + c.namespace + 'filter', function(){
      +				$input = $cell.find('input[type=hidden]').bind('change' + c.namespace + 'filter', function() {
       					/*jshint eqeqeq:false */
       					var v = this.value,
       						compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '';
       					if (v !== this.lastValue) {
      +						// eslint-disable-next-line eqeqeq
       						this.lastValue = ( compare ? compare + v : ( v == o.min ? '' : ( o.exactMatch ? '=' : '' ) + v ) );
       						this.value = this.lastValue;
       						updateRange( v );
       					}
       				});
       
      -				$cell.find('.range').bind('change', function(){
      +				$cell.find('.range').bind('change', function() {
       					updateRange( this.value );
       				});
       
       				// update spinner from hidden input, in case of saved filters
      -				c.$table.bind('filterFomatterUpdate', function(){
      +				c.$table.bind('filterFomatterUpdate', function() {
       					var val = tsff.updateCompare($cell, $input, o)[0];
       					$cell.find('.range').val( val );
       					updateRange(val, false, true);
      @@ -263,17 +266,17 @@
       				if (o.compare) {
       					// add compare select
       					tsff.addCompare($cell, indx, o);
      -					$cell.find(compareSelect).bind('change', function(){
      +					$cell.find(compareSelect).bind('change', function() {
       						updateRange();
       					});
       				}
       
       				// has sticky headers?
      -				c.$table.bind('stickyHeadersInit', function(){
      +				c.$table.bind('stickyHeadersInit', function() {
       					$shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx).empty();
       					$shcell
       						.html('')
      -						.find('.range').bind('change', function(){
      +						.find('.range').bind('change', function() {
       							updateRange( $shcell.find('.range').val() );
       						});
       					updateRange();
      @@ -281,7 +284,7 @@
       					if (o.compare) {
       						// add compare select
       						tsff.addCompare($shcell, indx, o);
      -						$shcell.find(compareSelect).bind('change', function(){
      +						$shcell.find(compareSelect).bind('change', function() {
       							$cell.find(compareSelect).val( $(this).val() );
       							updateRange();
       						});
      @@ -290,11 +293,11 @@
       				});
       
       				// on reset
      -				$cell.closest('table').bind('filterReset', function(){
      +				$cell.closest('table').bind('filterReset', function() {
       					if ($.isArray(o.compare)) {
       						$cell.add($shcell).find(compareSelect).val( o.compare[ o.selected || 0 ] );
       					}
      -					setTimeout(function(){
      +					setTimeout(function() {
       						updateRange(o.value, false, true);
       					}, 0);
       				});
      @@ -378,23 +381,23 @@
       					$cell.closest('thead').find('th[data-column=' + indx + ']').find('.tablesorter-header-inner').append('');
       				}
       
      -				$cell.find('.toggle, .colorpicker').bind('change', function(){
      +				$cell.find('.toggle, .colorpicker').bind('change', function() {
       					updateColor( $cell.find('.colorpicker').val() );
       				});
       
       				// hidden filter update namespace trigger by filter widget
      -				$input = $cell.find('input[type=hidden]').bind('change' + c.namespace + 'filter', function(){
      +				$input = $cell.find('input[type=hidden]').bind('change' + c.namespace + 'filter', function() {
       					updateColor( this.value );
       				});
       
       				// update slider from hidden input, in case of saved filters
      -				c.$table.bind('filterFomatterUpdate', function(){
      +				c.$table.bind('filterFomatterUpdate', function() {
       					updateColor( $input.val(), true );
       					ts.filter.formatterUpdated($cell, indx);
       				});
       
       				// on reset
      -				$cell.closest('table').bind('filterReset', function(){
      +				$cell.closest('table').bind('filterReset', function() {
       					// just turn off the colorpicker
       					if (o.addToggle) {
       						$cell.find('.toggle')[0].checked = false;
      @@ -402,17 +405,17 @@
       					// delay needed because default color needs to be set in the filter
       					// there is no compare option here, so if addToggle = false,
       					// default color is #000000 (even with no value set)
      -					setTimeout(function(){
      +					setTimeout(function() {
       						updateColor();
       					}, 0);
       				});
       
       				// has sticky headers?
      -				c.$table.bind('stickyHeadersInit', function(){
      +				c.$table.bind('stickyHeadersInit', function() {
       					$shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx);
       					$shcell
       						.html(t)
      -						.find('.toggle, .colorpicker').bind('change', function(){
      +						.find('.toggle, .colorpicker').bind('change', function() {
       							updateColor( $shcell.find('.colorpicker').val() );
       						});
       					updateColor( $shcell.find('.colorpicker').val() );
      diff --git a/js/widgets/widget-filter-formatter-jui.js b/js/widgets/widget-filter-formatter-jui.js
      index 9b933f04d..6e39d63b0 100644
      --- a/js/widgets/widget-filter-formatter-jui.js
      +++ b/js/widgets/widget-filter-formatter-jui.js
      @@ -9,7 +9,7 @@
        */
       /*jshint browser:true, jquery:true, unused:false */
       /*global jQuery: false */
      -;(function($){
      +;(function($) {
       	'use strict';
       
       	var ts = $.tablesorter || {},
      @@ -19,12 +19,12 @@
       
       	tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
       
      -		addCompare: function($cell, indx, options){
      +		addCompare: function($cell, indx, options) {
       			if (options.compare && $.isArray(options.compare) && options.compare.length > 1) {
       				var opt = '',
       					compareSelectClass = [ compareSelect.slice(1), ' ' + compareSelect.slice(1), '' ],
       					txt = options.cellText ? '' : '';
      -				$.each(options.compare, function(i, c){
      +				$.each(options.compare, function(i, c) {
       					opt += '';
       				});
       				$cell
      @@ -40,7 +40,7 @@
       				num = val.replace(/\s*?[><=]\s*?/g, ''),
       				compare = val.match(/[><=]/g) || '';
       			if (o.compare) {
      -				if ($.isArray(o.compare)){
      +				if ($.isArray(o.compare)) {
       					compare = (compare || []).join('') || o.compare[o.selected || 0];
       				}
       				$cell.find(compareSelect).val( compare );
      @@ -72,7 +72,7 @@
       			$input = $('')
       				.appendTo($cell)
       				// hidden filter update namespace trigger by filter widget
      -				.bind('change' + c.namespace + 'filter', function(){
      +				.bind('change' + c.namespace + 'filter', function() {
       					updateSpinner({ value: this.value, delayed: false });
       				}),
       			$shcell = [],
      @@ -123,7 +123,7 @@
       					'
      ') .appendTo($cell) .find('.toggle') - .bind('change', function(){ + .bind('change', function() { updateSpinner(); }); } @@ -134,12 +134,12 @@ .val(o.value) .appendTo($cell) .spinner(o) - .bind('change keyup', function(){ + .bind('change keyup', function() { updateSpinner(); }); // update spinner from hidden input, in case of saved filters - c.$table.bind('filterFomatterUpdate' + c.namespace + 'filter', function(){ + c.$table.bind('filterFomatterUpdate' + c.namespace + 'filter', function() { var val = tsff.updateCompare($cell, $input, o)[0]; $cell.find('.spinner').val( val ); updateSpinner({ value: val }, true); @@ -149,20 +149,20 @@ if (o.compare) { // add compare select tsff.addCompare($cell, indx, o); - $cell.find(compareSelect).bind('change', function(){ + $cell.find(compareSelect).bind('change', function() { updateSpinner(); }); } // has sticky headers? - c.$table.bind('stickyHeadersInit' + c.namespace + 'filter', function(){ + c.$table.bind('stickyHeadersInit' + c.namespace + 'filter', function() { $shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx).empty(); if (o.addToggle) { $('
      ' + '
      ') .appendTo($shcell) .find('.toggle') - .bind('change', function(){ + .bind('change', function() { $cell.find('.toggle')[0].checked = this.checked; updateSpinner(); }); @@ -172,7 +172,7 @@ .val(o.value) .appendTo($shcell) .spinner(o) - .bind('change keyup', function(){ + .bind('change keyup', function() { $cell.find('.spinner').val( this.value ); updateSpinner(); }); @@ -180,7 +180,7 @@ if (o.compare) { // add compare select tsff.addCompare($shcell, indx, o); - $shcell.find(compareSelect).bind('change', function(){ + $shcell.find(compareSelect).bind('change', function() { $cell.find(compareSelect).val( $(this).val() ); updateSpinner(); }); @@ -189,7 +189,7 @@ }); // on reset - c.$table.bind('filterReset' + c.namespace + 'filter', function(){ + c.$table.bind('filterReset' + c.namespace + 'filter', function() { if ($.isArray(o.compare)) { $cell.add($shcell).find(compareSelect).val( o.compare[ o.selected || 0 ] ); } @@ -198,7 +198,7 @@ $cell.find('.toggle')[0].checked = false; } $cell.find('.spinner').spinner('value', o.value); - setTimeout(function(){ + setTimeout(function() { updateSpinner(); }, 0); }); @@ -232,7 +232,7 @@ $input = $('') .appendTo($cell) // hidden filter update namespace trigger by filter widget - .bind('change' + c.namespace + 'filter', function(){ + .bind('change' + c.namespace + 'filter', function() { updateSlider({ value: this.value }); }), $shcell = [], @@ -300,7 +300,7 @@ .slider(o); // update slider from hidden input, in case of saved filters - c.$table.bind('filterFomatterUpdate' + c.namespace + 'filter', function(){ + c.$table.bind('filterFomatterUpdate' + c.namespace + 'filter', function() { var val = tsff.updateCompare($cell, $input, o)[0]; $cell.find('.slider').slider('value', val ); updateSlider({ value: val }, false); @@ -310,23 +310,23 @@ if (o.compare) { // add compare select tsff.addCompare($cell, indx, o); - $cell.find(compareSelect).bind('change', function(){ + $cell.find(compareSelect).bind('change', function() { updateSlider({ value: $cell.find('.slider').slider('value') }); }); } // on reset - c.$table.bind('filterReset' + c.namespace + 'filter', function(){ + c.$table.bind('filterReset' + c.namespace + 'filter', function() { if ($.isArray(o.compare)) { $cell.add($shcell).find(compareSelect).val( o.compare[ o.selected || 0 ] ); } - setTimeout(function(){ + setTimeout(function() { updateSlider({ value: o.value }); }, 0); }); // has sticky headers? - c.$table.bind('stickyHeadersInit' + c.namespace + 'filter', function(){ + c.$table.bind('stickyHeadersInit' + c.namespace + 'filter', function() { $shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx).empty(); // add a jQuery UI slider! @@ -334,7 +334,7 @@ .val(o.value) .appendTo($shcell) .slider(o) - .bind('change keyup', function(){ + .bind('change keyup', function() { $cell.find('.slider').slider('value', this.value ); updateSlider(); }); @@ -342,7 +342,7 @@ if (o.compare) { // add compare select tsff.addCompare($shcell, indx, o); - $shcell.find(compareSelect).bind('change', function(){ + $shcell.find(compareSelect).bind('change', function() { $cell.find(compareSelect).val( $(this).val() ); updateSlider(); }); @@ -373,12 +373,12 @@ $input = $('') .appendTo($cell) // hidden filter update namespace trigger by filter widget - .bind('change' + c.namespace + 'filter', function(){ + .bind('change' + c.namespace + 'filter', function() { getRange(); }), $shcell = [], - getRange = function(){ + getRange = function() { var val = $input.val(), v = val.split(' - '); if (val === '') { v = [ o.min, o.max ]; } @@ -449,21 +449,21 @@ .slider(o); // update slider from hidden input, in case of saved filters - c.$table.bind('filterFomatterUpdate' + c.namespace + 'filter', function(){ + c.$table.bind('filterFomatterUpdate' + c.namespace + 'filter', function() { getRange(); ts.filter.formatterUpdated($cell, indx); }); // on reset - c.$table.bind('filterReset' + c.namespace + 'filter', function(){ + c.$table.bind('filterReset' + c.namespace + 'filter', function() { $cell.find('.range').slider('values', o.values); - setTimeout(function(){ + setTimeout(function() { updateUiRange(); }, 0); }); // has sticky headers? - c.$table.bind('stickyHeadersInit' + c.namespace + 'filter', function(){ + c.$table.bind('stickyHeadersInit' + c.namespace + 'filter', function() { $shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx).empty(); // add a jQuery UI slider! @@ -471,7 +471,7 @@ .val(o.value) .appendTo($shcell) .slider(o) - .bind('change keyup', function(){ + .bind('change keyup', function() { $cell.find('.range').val( this.value ); updateUiRange(); }); @@ -508,7 +508,7 @@ $input = $('') .appendTo($cell) // hidden filter update namespace trigger by filter widget - .bind('change' + c.namespace + 'filter', function(){ + .bind('change' + c.namespace + 'filter', function() { var v = this.value; if (v) { o.onClose(v); @@ -558,18 +558,18 @@ $date.datepicker(o); // on reset - c.$table.bind('filterReset' + c.namespace + 'filter', function(){ + c.$table.bind('filterReset' + c.namespace + 'filter', function() { if ($.isArray(o.compare)) { $cell.add($shcell).find(compareSelect).val( o.compare[ o.selected || 0 ] ); } $cell.add($shcell).find('.date').val(o.defaultDate).datepicker('setDate', o.defaultDate || null); - setTimeout(function(){ + setTimeout(function() { date1Compare(); }, 0); }); // update date compare from hidden input, in case of saved filters - c.$table.bind('filterFomatterUpdate' + c.namespace + 'filter', function(){ + c.$table.bind('filterFomatterUpdate' + c.namespace + 'filter', function() { var num, v = $input.val(); if (/\s+-\s+/.test(v)) { // date range found; assume an exact match on one day @@ -582,7 +582,7 @@ num = num !== '' ? /\d{5}/g.test(num) ? new Date(Number(num)) : num || '' : ''; } $cell.add($shcell).find('.date').datepicker( 'setDate', num || null ); - setTimeout(function(){ + setTimeout(function() { date1Compare(true); ts.filter.formatterUpdated($cell, indx); }, 0); @@ -591,13 +591,13 @@ if (o.compare) { // add compare select tsff.addCompare($cell, indx, o); - $cell.find(compareSelect).bind('change', function(){ + $cell.find(compareSelect).bind('change', function() { date1Compare(); }); } // has sticky headers? - c.$table.bind('stickyHeadersInit' + c.namespace + 'filter', function(){ + c.$table.bind('stickyHeadersInit' + c.namespace + 'filter', function() { $shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx).empty(); // add a jQuery datepicker! @@ -609,7 +609,7 @@ if (o.compare) { // add compare select tsff.addCompare($shcell, indx, o); - $shcell.find(compareSelect).bind('change', function(){ + $shcell.find(compareSelect).bind('change', function() { $cell.find(compareSelect).val( $(this).val() ); date1Compare(); }); @@ -639,14 +639,14 @@ }, defDate), t, closeDate, $shcell = [], c = $cell.closest('table')[0].config, - validDate = function(d){ + validDate = function(d) { return d instanceof Date && isFinite(d); }, // Add a hidden input to hold the range values $input = $('') .appendTo($cell) // hidden filter update namespace trigger by filter widget - .bind('change' + c.namespace + 'filter', function(){ + .bind('change' + c.namespace + 'filter', function() { var v = this.value; if (v.match(' - ')) { v = v.split(' - '); @@ -708,12 +708,12 @@ $cell.find('.dateTo').datepicker(o); // update date compare from hidden input, in case of saved filters - c.$table.bind('filterFomatterUpdate' + c.namespace + 'filter', function(){ + c.$table.bind('filterFomatterUpdate' + c.namespace + 'filter', function() { var val = $input.val() || '', from = '', to = ''; // date range - if (/\s+-\s+/.test(val)){ + if (/\s+-\s+/.test(val)) { val = val.split(/\s+-\s+/) || []; from = val[0] || ''; to = val[1] || ''; @@ -732,14 +732,14 @@ $cell.add($shcell).find('.dateFrom').datepicker('setDate', from || null); $cell.add($shcell).find('.dateTo').datepicker('setDate', to || null); // give datepicker time to process - setTimeout(function(){ + setTimeout(function() { closeDate(); ts.filter.formatterUpdated($cell, indx); }, 0); }); // has sticky headers? - c.$table.bind('stickyHeadersInit' + c.namespace + 'filter', function(){ + c.$table.bind('stickyHeadersInit' + c.namespace + 'filter', function() { $shcell = c.widgetOptions.$sticky.find('.tablesorter-filter-row').children().eq(indx).empty(); $shcell.append(t); @@ -753,10 +753,10 @@ }); // on reset - $cell.closest('table').bind('filterReset' + c.namespace + 'filter', function(){ + $cell.closest('table').bind('filterReset' + c.namespace + 'filter', function() { $cell.add($shcell).find('.dateFrom').val('').datepicker('setDate', o.from || null ); $cell.add($shcell).find('.dateTo').val('').datepicker('setDate', o.to || null ); - setTimeout(function(){ + setTimeout(function() { closeDate(); }, 0); }); diff --git a/js/widgets/widget-filter-formatter-select2.js b/js/widgets/widget-filter-formatter-select2.js index b43d00bfd..a91040650 100644 --- a/js/widgets/widget-filter-formatter-select2.js +++ b/js/widgets/widget-filter-formatter-select2.js @@ -4,7 +4,7 @@ */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery: false */ -;(function($){ +;(function($) { 'use strict'; var ts = $.tablesorter || {}; @@ -33,7 +33,7 @@ $input = $('') .appendTo($cell) // hidden filter update namespace trigger by filter widget - .bind('change' + c.namespace + 'filter', function(){ + .bind('change' + c.namespace + 'filter', function() { var val = convertRegex(this.value); c.$table.find('.select2col' + indx + ' .select2').select2('val', val); updateSelect2(); @@ -88,11 +88,11 @@ }, // get options from table cell content or filter_selectSource (v2.16) - updateOptions = function(){ + updateOptions = function() { data = []; arry = ts.filter.getOptionSource(c.$table[0], indx, onlyAvail) || []; // build select2 data option - $.each(arry, function(i, v){ + $.each(arry, function(i, v) { // getOptionSource returns { parsed: "value", text: "value" } in v2.24.4 data.push({ id: '' + v.parsed, text: v.text }); }); @@ -109,7 +109,7 @@ // data options are already defined if (!(o.ajax && !$.isEmptyObject(o.ajax)) && !o.data) { updateOptions(); - c.$table.bind('filterEnd', function(){ + c.$table.bind('filterEnd', function() { updateOptions(); c.$table .find('.select2col' + indx) @@ -123,7 +123,7 @@ .val(o.value) .appendTo($cell) .select2(o) - .bind('change', function(){ + .bind('change', function() { updateSelect2(); }); @@ -138,14 +138,14 @@ }); // has sticky headers? - c.$table.bind('stickyHeadersInit', function(){ + c.$table.bind('stickyHeadersInit', function() { var $shcell = c.widgetOptions.$sticky.find('.select2col' + indx).empty(); // add a select2! $('') .val(o.value) .appendTo($shcell) .select2(o) - .bind('change', function(){ + .bind('change', function() { c.$table.find('.select2col' + indx) .find('.select2') .select2('val', c.widgetOptions.$sticky.find('.select2col' + indx + ' .select2').select2('val') ); @@ -157,9 +157,9 @@ }); // on reset - c.$table.bind('filterReset', function(){ + c.$table.bind('filterReset', function() { c.$table.find('.select2col' + indx).find('.select2').select2('val', o.value || ''); - setTimeout(function(){ + setTimeout(function() { updateSelect2(); }, 0); }); diff --git a/js/widgets/widget-filter-type-insideRange.js b/js/widgets/widget-filter-type-insideRange.js index e412a4b46..f6152a511 100644 --- a/js/widgets/widget-filter-type-insideRange.js +++ b/js/widgets/widget-filter-type-insideRange.js @@ -1,5 +1,5 @@ /*! Widget: filter, insideRange filter type - updated 12/10/2015 (v2.25.0) */ -;(function($){ +;(function($) { 'use strict'; // Add insideRange filter type diff --git a/js/widgets/widget-filter.js b/js/widgets/widget-filter.js index 2b7cedc07..af7a6e250 100644 --- a/js/widgets/widget-filter.js +++ b/js/widgets/widget-filter.js @@ -280,6 +280,7 @@ if ( tsfRegex.exact.test( data.iFilter ) ) { var txt = data.iFilter.replace( tsfRegex.exact, '' ), filter = tsf.parseFilter( c, txt, data ) || ''; + // eslint-disable-next-line eqeqeq return data.anyMatch ? $.inArray( filter, data.rowArray ) >= 0 : filter == data.iExact; } return null; @@ -453,7 +454,7 @@ c.lastCombinedFilter = null; c.lastSearch = []; // update filterFormatters after update (& small delay) - Fixes #1237 - setTimeout(function(){ + setTimeout(function() { c.$table.triggerHandler( 'filterFomatterUpdate' ); }, 100); } diff --git a/js/widgets/widget-formatter.js b/js/widgets/widget-formatter.js index c3608a501..d7b224a27 100644 --- a/js/widgets/widget-formatter.js +++ b/js/widgets/widget-formatter.js @@ -4,7 +4,7 @@ */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery: false */ -;(function($){ +;(function($) { 'use strict'; var ts = $.tablesorter; @@ -33,7 +33,7 @@ formatter[ column ] = ts.getColumnData( c.table, wo.formatter_column, column ) || false; } // main loop - for ( tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++ ){ + for ( tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++ ) { $tbody = ts.processTbody( c.table, c.$tbodies.eq( tbodyIndex ), true ); // detach tbody rows = c.cache[ tbodyIndex ]; len = rows.normalized.length; diff --git a/js/widgets/widget-grouping.js b/js/widgets/widget-grouping.js index 8e18d58ad..17914194f 100644 --- a/js/widgets/widget-grouping.js +++ b/js/widgets/widget-grouping.js @@ -4,7 +4,7 @@ */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery: false */ -;(function($){ +;(function($) { 'use strict'; var ts = $.tablesorter, @@ -12,7 +12,7 @@ types : { number : function(c, $column, txt, num) { - var word, result, + var result, ascSort = $column.hasClass( ts.css.sortAsc ); if ( num > 1 && txt !== '' ) { if ( ascSort ) { @@ -43,7 +43,7 @@ letter : function(c, $column, txt, num) { return txt ? (txt + ' ').substring(0, num) : ''; }, - date : function(c, $column, txt, part, group) { + date : function(c, $column, txt, part) { var year, month, wo = c.widgetOptions, time = new Date(txt || ''); @@ -203,7 +203,7 @@ return savedGroup; }, findColumnGroups : function( c, wo, data ) { - var tbodyIndex, norm_rows, $row, rowIndex, end, undef, + var tbodyIndex, norm_rows, rowIndex, end, undef, hasPager = ts.hasWidget( c.table, 'pager' ), p = c.pager || {}; data.groupIndex = 0; @@ -251,15 +251,15 @@ } }, - bindEvents : function(table, c, wo){ + bindEvents : function(table, c, wo) { if (wo.group_collapsible) { wo.group_collapsedGroups = []; // .on() requires jQuery 1.7+ - c.$table.on('click toggleGroup keyup', 'tr.group-header', function(event){ + c.$table.on('click toggleGroup keyup', 'tr.group-header', function(event) { event.stopPropagation(); // pressing enter will toggle the group if (event.type === 'keyup' && event.which !== 13) { return; } - var isCollapsed, $groups, indx, + var isCollapsed, indx, $this = $(this), name = $this.find('.group-name').text().toLowerCase() + $this.attr('data-group-index'); // use shift-click to toggle ALL groups @@ -276,7 +276,6 @@ } // save collapsed groups if (wo.group_saveGroups && ts.storage) { - $groups = c.$table.find('.group-header'); if (!wo.group_collapsedGroups[wo.group_collapsedGroup]) { wo.group_collapsedGroups[wo.group_collapsedGroup] = []; } @@ -292,15 +291,15 @@ } }); } - $(wo.group_saveReset).on('click', function(){ + $(wo.group_saveReset).on('click', function() { tsg.clearSavedGroups(table); }); - c.$table.on('pagerChange.tsgrouping', function(){ + c.$table.on('pagerChange.tsgrouping', function() { tsg.update(table); }); }, - clearSavedGroups: function(table){ + clearSavedGroups: function(table) { if (table && ts.storage) { ts.storage(table, 'tablesorter-groups', ''); tsg.update(table); @@ -320,7 +319,7 @@ group_count : ' ({num})', // if not false, the '{num}' string is replaced with the number of rows in the group group_separator : '-', // group name separator; used when group-separator-# class is used. group_formatter : null, // function(txt, column, table, c, wo) { return txt; } - group_callback : null, // function($cell, $rows, column, table){}, callback allowing modification of the group header labels + group_callback : null, // function($cell, $rows, column, table) {}, callback allowing modification of the group header labels group_complete : 'groupingComplete', // event triggered on the table when the grouping widget has finished work // apply the grouping widget only to selected column @@ -344,13 +343,13 @@ // reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#Conversion_getter group_dateString : function(date) { return date.toLocaleString(); } }, - init: function(table, thisWidget, c, wo){ + init: function(table, thisWidget, c, wo) { tsg.bindEvents(table, c, wo); }, - format: function(table, c, wo) { + format: function(table) { tsg.update(table); }, - remove : function(table, c, wo){ + remove : function(table, c) { c.$table .off('click', 'tr.group-header') .off('pagerChange.tsgrouping') diff --git a/js/widgets/widget-headerTitles.js b/js/widgets/widget-headerTitles.js index 599086f81..fabe37085 100644 --- a/js/widgets/widget-headerTitles.js +++ b/js/widgets/widget-headerTitles.js @@ -4,7 +4,7 @@ */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery: false */ -;(function($){ +;(function($) { 'use strict'; var ts = $.tablesorter; @@ -35,14 +35,14 @@ // manipulate the title as desired headerTitle_callback : null // function($cell, txt) { return txt; } }, - init: function(table, thisWidget, c, wo){ + init: function(table, thisWidget, c, wo) { // force refresh - c.$table.on('refreshHeaderTitle', function(){ + c.$table.on('refreshHeaderTitle', function() { thisWidget.format(table, c, wo); }); // add tooltip class if ($.isArray(wo.headerTitle_tooltip)) { - c.$headers.each(function(){ + c.$headers.each(function() { $(this).addClass( wo.headerTitle_tooltip[this.column] || '' ); }); } else if (wo.headerTitle_tooltip !== '') { @@ -51,9 +51,8 @@ }, format: function (table, c, wo) { var txt; - c.$headers.each(function(){ - var t = this, - $this = $(this), + c.$headers.each(function() { + var $this = $(this), col = parseInt( $this.attr( 'data-column' ), 10 ), sortType = wo.headerTitle_type[ col ] || c.parsers[ col ].type || 'text', sortDirection = $this.hasClass(ts.css.sortAsc) ? 0 : $this.hasClass(ts.css.sortDesc) ? 1 : 2, @@ -64,7 +63,7 @@ txt = (wo.headerTitle_prefix || '') + // now deprecated ($this.hasClass('sorter-false') ? wo.headerTitle_output_nosort : ts.isValueInArray( col, c.sortList ) >= 0 ? wo.headerTitle_output_sorted : wo.headerTitle_output_unsorted); - txt = txt.replace(/\{(current|next|name)\}/gi, function(m){ + txt = txt.replace(/\{(current|next|name)\}/gi, function(m) { return { '{name}' : $this.text(), '{current}' : wo[ 'headerTitle_cur_' + sortType ][ sortDirection ] || '', @@ -80,7 +79,7 @@ c.$table.off('refreshHeaderTitle'); // remove tooltip class if ($.isArray(wo.headerTitle_tooltip)) { - c.$headers.each(function(){ + c.$headers.each(function() { $(this).removeClass( wo.headerTitle_tooltip[this.column] || '' ); }); } else if (wo.headerTitle_tooltip !== '') { diff --git a/js/widgets/widget-lazyload.js b/js/widgets/widget-lazyload.js index e9b4b6c2b..ba83d24bf 100644 --- a/js/widgets/widget-lazyload.js +++ b/js/widgets/widget-lazyload.js @@ -51,7 +51,7 @@ $(window).scroll(); }, 1); }, - remove : function( c, wo ) { + remove : function( c ) { c.$table.off( c.namespace + 'lazyload' ); } }; @@ -200,26 +200,26 @@ var settings = { threshold : 0, failure_limit : 0, - event : "scroll", - effect : "show", + event : 'scroll', + effect : 'show', container : window, - data_attribute : "original", + data_attribute : 'original', skip_invisible : false, appear : null, load : null, - placeholder : "data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" + placeholder : 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' }; function update() { var counter = 0; elements.each(function() { var $this = $(this); - if (settings.skip_invisible && !$this.is(":visible")) { + if (settings.skip_invisible && !$this.is(':visible')) { return; } if ($.abovethetop(this, settings) || $.leftofbegin(this, settings)) { /* Nothing. */ } else if (!$.belowthefold(this, settings) && !$.rightoffold(this, settings)) { - $this.trigger("appear"); + $this.trigger('appear'); /* if we found an image we'll load, reset the counter */ counter = 0; } else { @@ -245,7 +245,7 @@ $container = (settings.container === undefined || settings.container === window) ? $window : $(settings.container); /* Fire one scroll event per scroll. Not one scroll event per image. */ - if (0 === settings.event.indexOf("scroll")) { + if (0 === settings.event.indexOf('scroll')) { $container.bind(settings.event, function() { return update(); }); @@ -255,26 +255,26 @@ var $self = $(self); self.loaded = false; /* If no src attribute given use data:uri. */ - if ($self.attr("src") === undefined || $self.attr("src") === false) { - if ($self.is("img")) { - $self.attr("src", settings.placeholder); + if ($self.attr('src') === undefined || $self.attr('src') === false) { + if ($self.is('img')) { + $self.attr('src', settings.placeholder); } } /* When appear is triggered load original image. */ - $self.one("appear", function() { + $self.one('appear', function() { if (!this.loaded) { if (settings.appear) { var elements_left = elements.length; settings.appear.call(self, elements_left, settings); } - $("") - .bind("load", function() { - var original = $self.attr("data-" + settings.data_attribute); + $('') + .bind('load', function() { + var original = $self.attr('data-' + settings.data_attribute); $self.hide(); - if ($self.is("img")) { - $self.attr("src", original); + if ($self.is('img')) { + $self.attr('src', original); } else { - $self.css("background-image", "url('" + original + "')"); + $self.css('background-image', 'url("' + original + '")'); } $self[settings.effect](settings.effect_speed); self.loaded = true; @@ -288,30 +288,30 @@ settings.load.call(self, elements_left, settings); } }) - .attr("src", $self.attr("data-" + settings.data_attribute)); + .attr('src', $self.attr('data-' + settings.data_attribute)); } }); /* When wanted event is triggered load original image */ /* by triggering appear. */ - if (0 !== settings.event.indexOf("scroll")) { + if (0 !== settings.event.indexOf('scroll')) { $self.bind(settings.event, function() { if (!self.loaded) { - $self.trigger("appear"); + $self.trigger('appear'); } }); } }); /* Check if something appears when window is resized. */ - $window.bind("resize", function() { + $window.bind('resize', function() { update(); }); /* With IOS5 force loading images when navigating with back button. */ /* Non optimal workaround. */ if ((/(?:iphone|ipod|ipad).*os 5/gi).test(navigator.appVersion)) { - $window.bind("pageshow", function(event) { + $window.bind('pageshow', function(event) { if (event.originalEvent && event.originalEvent.persisted) { elements.each(function() { - $(this).trigger("appear"); + $(this).trigger('appear'); }); } }); @@ -365,17 +365,17 @@ !$.belowthefold(element, settings) && !$.abovethetop(element, settings); }; /* Custom selectors for your convenience. */ - /* Use as $("img:below-the-fold").something() or */ - /* $("img").filter(":below-the-fold").something() which is faster */ - $.extend($.expr[":"], { - "below-the-fold" : function(a) { return $.belowthefold(a, {threshold : 0}); }, - "above-the-top" : function(a) { return !$.belowthefold(a, {threshold : 0}); }, - "right-of-screen": function(a) { return $.rightoffold(a, {threshold : 0}); }, - "left-of-screen" : function(a) { return !$.rightoffold(a, {threshold : 0}); }, - "in-viewport" : function(a) { return $.inviewport(a, {threshold : 0}); }, + /* Use as $('img:below-the-fold').something() or */ + /* $('img').filter(':below-the-fold').something() which is faster */ + $.extend($.expr[':'], { + 'below-the-fold' : function(a) { return $.belowthefold(a, {threshold : 0}); }, + 'above-the-top' : function(a) { return !$.belowthefold(a, {threshold : 0}); }, + 'right-of-screen': function(a) { return $.rightoffold(a, {threshold : 0}); }, + 'left-of-screen' : function(a) { return !$.rightoffold(a, {threshold : 0}); }, + 'in-viewport' : function(a) { return $.inviewport(a, {threshold : 0}); }, /* Maintain BC for couple of versions. */ - "above-the-fold" : function(a) { return !$.belowthefold(a, {threshold : 0}); }, - "right-of-fold" : function(a) { return $.rightoffold(a, {threshold : 0}); }, - "left-of-fold" : function(a) { return !$.rightoffold(a, {threshold : 0}); } + 'above-the-fold' : function(a) { return !$.belowthefold(a, {threshold : 0}); }, + 'right-of-fold' : function(a) { return $.rightoffold(a, {threshold : 0}); }, + 'left-of-fold' : function(a) { return !$.rightoffold(a, {threshold : 0}); } }); })(jQuery, window, document); diff --git a/js/widgets/widget-math.js b/js/widgets/widget-math.js index ccafa32e5..38f6fa54a 100644 --- a/js/widgets/widget-math.js +++ b/js/widgets/widget-math.js @@ -171,7 +171,6 @@ if ( hasFilter || !$row.hasClass( filtered ) ) { $cells = $row.children().not( mathIgnore ); cellLen = $cells.length; - // $row.children().each(function(){ for ( cellIndex = 0; cellIndex < cellLen; cellIndex++ ) { $t = $cells.eq( cellIndex ); col = math.getCellIndex( $t ); @@ -221,7 +220,7 @@ recalculate : function(c, wo, init) { if ( c && ( !wo.math_isUpdating || init ) ) { - var undef, time, mathAttr, $mathCells, indx, len, + var time, mathAttr, $mathCells, indx, len, changed = false, filters = {}; if ( c.debug || wo.math_debug ) { @@ -435,7 +434,7 @@ mask = mask.substring( start, index ); // convert any string to number according to formation sign. - val = mask.charAt( 0 ) == '-' ? -val : +val; + val = mask.charAt( 0 ) === '-' ? -val : +val; isNegative = val < 0 ? val = -val : 0; // process only abs(), and turn on flag. // search for separator for grp & decimal, anything not digit, not +/- sign, not #. @@ -517,7 +516,7 @@ len = arry.length; if ( len > 1 ) { // https://gist.github.com/caseyjustus/1166258 - arry.sort( function( a, b ){ return a - b; } ); + arry.sort( function( a, b ) { return a - b; } ); half = Math.floor( len / 2 ); return ( len % 2 ) ? arry[ half ] : ( arry[ half - 1 ] + arry[ half ] ) / 2; } @@ -542,7 +541,7 @@ } } // returns arry of modes if there is a tie - return modes.sort( function( a, b ){ return a - b; } ); + return modes.sort( function( a, b ) { return a - b; } ); }, max : function(arry) { return Math.max.apply( Math, arry ); @@ -551,7 +550,7 @@ return Math.min.apply( Math, arry ); }, range: function(arry) { - var v = arry.sort( function( a, b ){ return a - b; } ); + var v = arry.sort( function( a, b ) { return a - b; } ); return v[ arry.length - 1 ] - v[ 0 ]; }, // common variance equation @@ -604,9 +603,9 @@ // mask info: https://code.google.com/p/javascript-number-formatter/ math_mask : '#,##0.00', // complete executed after each fucntion - math_complete : null, // function($cell, wo, result, value, arry){ return result; }, + math_complete : null, // function($cell, wo, result, value, arry) { return result; }, // math_completed called after all math calculations have completed - math_completed: function( config ) {}, + math_completed: function( /* config */ ) {}, // order of calculation; 'all' is last math_priority : [ 'row', 'above', 'below', 'col' ], // template for or just prepend the mask prefix & suffix with this HTML @@ -639,7 +638,7 @@ } }) .on( update, function() { - setTimeout( function(){ + setTimeout( function() { math.updateComplete( c ); }, 40 ); }); diff --git a/js/widgets/widget-output.js b/js/widgets/widget-output.js index 53bc110d6..f9d12158e 100644 --- a/js/widgets/widget-output.js +++ b/js/widgets/widget-output.js @@ -7,7 +7,7 @@ */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery:false, alert:false */ -;(function($){ +;(function($) { 'use strict'; var ts = $.tablesorter, @@ -164,11 +164,12 @@ headers = output.processRow(c, $this, true, outputJSON); // all tbody rows - do not include widget added rows (e.g. grouping widget headers) - if ( !$rows ) + if ( !$rows ) { $rows = $el.children('tbody').children('tr').not(c.selectorRemove); + } // check for a filter callback function first! because - // /^f/.test(function(){ console.log('test'); }) is TRUE! (function is converted to a string) + // /^f/.test(function() { console.log('test'); }) is TRUE! (function is converted to a string) $rows = typeof saveRows === 'function' ? $rows.filter(saveRows) : // get (f)iltered, (v)isible, all rows (look for the first letter only), or jQuery filter selector /^f/.test(saveRows) ? $rows.not('.' + (wo.filter_filteredRow || 'filtered') ) : @@ -410,11 +411,11 @@ output_popupStyle : 'width=500,height=300', output_saveFileName : 'mytable.csv', // format $cell content callback - output_formatContent : null, // function(config, widgetOptions, data){ return data.content; } + output_formatContent : null, // function(config, widgetOptions, data) { return data.content; } // callback executed when processing completes // return true to continue download/output // return false to stop delivery & do something else with the data - output_callback : function(config, data){ return true; }, + output_callback : function(/* config, data */) { return true; }, // JSON callback executed when a colspan is encountered in the header output_callbackJSON : function($cell, txt, cellIndex) { return txt + '(' + (cellIndex) + ')'; }, // the need to modify this for Excel no longer exists @@ -429,7 +430,7 @@ init: function(table, thisWidget, c) { output.init(c); }, - remove: function(table, c){ + remove: function(table, c) { output.remove(c); } diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js index d2ccf0f0e..1b38b912c 100644 --- a/js/widgets/widget-pager.js +++ b/js/widgets/widget-pager.js @@ -1352,9 +1352,10 @@ } // allow message to include entire row HTML! - $row = ( /tr\>/.test( message ) ? - $( message ) : - $( '' + message + '' ) ) + $( /tr\>/.test( message ) ? + message : + '' + message + '' + ) .click( function() { $( this ).remove(); }) diff --git a/js/widgets/widget-print.js b/js/widgets/widget-print.js index 64c9f170c..1bdf3adb7 100644 --- a/js/widgets/widget-print.js +++ b/js/widgets/widget-print.js @@ -46,7 +46,7 @@ // Make sure all lazy loaded images are visible - see #1169 data = 'data-' + (wo.lazyload_data_attribute || 'original'); - $table.find('img[' + data + ']').each(function(){ + $table.find('img[' + data + ']').each(function() { $this = $(this); $this.attr('src', $this.attr(data)); }); diff --git a/js/widgets/widget-reflow.js b/js/widgets/widget-reflow.js index 781e20aec..4a32f34bd 100644 --- a/js/widgets/widget-reflow.js +++ b/js/widgets/widget-reflow.js @@ -49,7 +49,7 @@ */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery: false */ -;(function($){ +;(function($) { 'use strict'; var ts = $.tablesorter, @@ -68,15 +68,15 @@ .off('refresh.tsreflow updateComplete.tsreflow2') // emulate jQuery Mobile refresh // https://api.jquerymobile.com/table-reflow/#method-refresh - .on('refresh.tsreflow updateComplete.tsreflow2', function(){ + .on('refresh.tsreflow updateComplete.tsreflow2', function() { tablereflow.init(table, c, wo); }); - c.$headers.each(function(){ + c.$headers.each(function() { $this = $(this); headers.push( $.trim( $this.attr(header) || $this.text() ) ); }); - c.$tbodies.children().each(function(){ - $(this).children().each(function(i){ + c.$tbodies.children().each(function() { + $(this).children().each(function(i) { $(this).attr(title, headers[i]); }); }); @@ -91,7 +91,7 @@ .off('refresh.tsreflow2 updateComplete.tsreflow2') // emulate jQuery Mobile refresh // https://api.jquerymobile.com/table-reflow/#method-refresh - .on('refresh.tsreflow2 updateComplete.tsreflow2', function(){ + .on('refresh.tsreflow2 updateComplete.tsreflow2', function() { tablereflow.init2(table, c, wo); }); @@ -101,7 +101,7 @@ if ($hdr.length > 1) { txt = []; /*jshint loopfunc:true */ - $hdr.each(function(){ + $hdr.each(function() { $this = $(this); if (!$this.hasClass(wo.reflow2_classIgnore)) { txt.push( $this.attr(header) || $this.text() ); @@ -114,9 +114,9 @@ } // include 'remove-me' class so these additional elements are removed before updating txt = '' ); - $fCells = $foot.children( 'tfoot' ).eq( 0 ).children( 'tr' ).children(); } wo.scroller_$footer = $foot; @@ -361,7 +360,7 @@ // updateAll called - need to give the browser time to adjust the layout // before calculating fix column widths if ( c.table.hasInitialized && c.isScrolling ) { - setTimeout(function(){ + setTimeout(function() { ts.scroller.resize( c, wo ); }, 50); } diff --git a/js/widgets/widget-sort2Hash.js b/js/widgets/widget-sort2Hash.js index b8501b42e..303b8cbd9 100644 --- a/js/widgets/widget-sort2Hash.js +++ b/js/widgets/widget-sort2Hash.js @@ -25,7 +25,7 @@ if ( filter ) { filter = filter.split( wo.sort2Hash_separator ); c.$table.one( 'tablesorter-ready', function() { - setTimeout(function(){ + setTimeout(function() { c.$table.one( 'filterEnd', function() { $(this).triggerHandler( 'pageAndSize', [ page, size ] ); }); @@ -237,7 +237,7 @@ var baseUrl = window.location.href.split(hashChar)[0]; // Ensure that there is a leading hash character var firstChar = newHash[0]; - if (firstChar != hashChar) { + if (firstChar !== hashChar) { newHash = hashChar + newHash; } // Update URL in browser diff --git a/js/widgets/widget-sortTbodies.js b/js/widgets/widget-sortTbodies.js index 8bd3cfc0e..eba047e51 100644 --- a/js/widgets/widget-sortTbodies.js +++ b/js/widgets/widget-sortTbodies.js @@ -230,7 +230,7 @@ init : function( table, thisWidget, c, wo ) { ts.sortTbodies.init( c, wo ); }, - remove : function( table, c, wo, refreshing ) { + remove : function( table, c, wo ) { c.$table.unbind( 'sortBegin updateComplete '.split( ' ' ).join( c.namespace + 'sortTbody ' ) ); c.serverSideSorting = wo.sortTbody_original_serverSideSorting; c.cssInfoBlock = wo.sortTbody_original_cssInfoBlock; diff --git a/js/widgets/widget-staticRow.js b/js/widgets/widget-staticRow.js index a68abd330..ff8411e31 100644 --- a/js/widgets/widget-staticRow.js +++ b/js/widgets/widget-staticRow.js @@ -11,19 +11,19 @@ */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery: false */ -;(function($){ +;(function($) { 'use strict'; var ts = $.tablesorter, // add/refresh row indexes - addIndexes = function(table){ + addIndexes = function(table) { var $tr, wo, v, indx, rows, c = table.config; // 'Index' the static rows, saving their current (starting) position in the // table inside a data() param on the element itself for later use. if (c) { wo = c.widgetOptions; - c.$tbodies.each(function(){ + c.$tbodies.each(function() { $tr = $(this).children(); rows = $tr.length; $tr.filter(wo.staticRow_class).each(function() { @@ -55,12 +55,12 @@ staticRow_event : 'staticRowsRefresh' }, - init: function(table, thisWidget, c, wo){ + init: function(table, thisWidget, c, wo) { addIndexes(table); // refresh static rows after updates c.$table .unbind( ('updateComplete.tsstaticrows ' + wo.staticRow_event).replace(/\s+/g, ' ') ) - .bind('updateComplete.tsstaticrows ' + wo.staticRow_event, function(){ + .bind('updateComplete.tsstaticrows ' + wo.staticRow_event, function() { addIndexes(table); ts.applyWidget( table ); }); @@ -71,7 +71,7 @@ // & repeat until no more re-shuffling is needed var targetIndex, $thisRow, indx, numRows, $tbody, hasShuffled, $rows, max; - c.$tbodies.each(function(){ + c.$tbodies.each(function() { $tbody = $.tablesorter.processTbody(table, $(this), true); // remove tbody hasShuffled = true; indx = 0; @@ -112,7 +112,7 @@ c.$table.triggerHandler('staticRowsComplete', table); }, - remove : function(table, c, wo){ + remove : function(table, c, wo) { c.$table.unbind( ('updateComplete.tsstaticrows ' + wo.staticRow_event).replace(/\s+/g, ' ') ); } diff --git a/js/widgets/widget-stickyHeaders.js b/js/widgets/widget-stickyHeaders.js index 89b027a0f..32018efd8 100644 --- a/js/widgets/widget-stickyHeaders.js +++ b/js/widgets/widget-stickyHeaders.js @@ -120,7 +120,7 @@ $stickyThead = $stickyTable.children('thead:first'), $stickyCells, laststate = '', - setWidth = function($orig, $clone){ + setWidth = function($orig, $clone) { var index, width, border, $cell, $this, $cells = $orig.filter(':visible'), len = $cells.length; @@ -261,7 +261,7 @@ }); c.$table .unbind('stickyHeadersUpdate' + namespace) - .bind('stickyHeadersUpdate' + namespace, function(){ + .bind('stickyHeadersUpdate' + namespace, function() { scrollSticky( true ); }); diff --git a/js/widgets/widget-vertical-group.js b/js/widgets/widget-vertical-group.js index 2cbf9242f..9cb39e1cf 100644 --- a/js/widgets/widget-vertical-group.js +++ b/js/widgets/widget-vertical-group.js @@ -1,5 +1,5 @@ /*! Widget: vertical-group (BETA) - updated 12/13/2017 (v2.29.1) */ -/* Requires tablesorter and jQuery +/* Requires tablesorter and jQuery * Originally by @aavmurphy (Andrew Murphy) * Adapted for tablesorter by Rob Garrison - see #1469 & #1470 * @@ -7,7 +7,7 @@ */ /* jshint browser:true, jquery:true, unused:false */ /* global jQuery:false */ -;(function($){ +;(function($) { 'use strict'; var ts = $.tablesorter, @@ -19,11 +19,11 @@ verticalGroupShow: 'tablesorter-vertical-group-show' }); - ts.addWidget({ - id: 'vertical-group', + ts.addWidget({ + id: 'vertical-group', priority: 99, init: verticalGroup, - format: verticalGroup + format: verticalGroup }); function cleanUp( el ) { @@ -37,7 +37,7 @@ .addClass( wo.zebra[ indx % 2] ); } - function verticalGroup( table, c, wo, init ) { + function verticalGroup( table, c, wo ) { // ------------------------------------------------------------------------- // loop thru the header row, // - look for .vertical-group @@ -51,9 +51,9 @@ // else if this column does not have '.vertical-group', then this cell is SHOW // else if this cell is NOT the same as the cell-above, then this cell is SHOW // else this cell is HIDE - // if this cell is SHOW, set ALWAYS_SHOW - // if this cell is SHOW, - // then + // if this cell is SHOW, set ALWAYS_SHOW + // if this cell is SHOW, + // then // set the cell class to .vertical_group_show // else // set the cell class to vertical_group_show @@ -69,10 +69,8 @@ // - the border-color needs to be the same // // ------------------------------------------------------------------------------------------------ - var tmp, - zebra_index = -1, // increments at start of loop + var zebra_index = -1, // increments at start of loop rows = table.tBodies[0].rows, - header = table.tHead.rows, has_zebra = ts.hasWidget( table, 'zebra'), is_vertical_group_col = [], last_row = []; diff --git a/js/widgets/widget-view.js b/js/widgets/widget-view.js index e84e82c41..8c76db9ac 100644 --- a/js/widgets/widget-view.js +++ b/js/widgets/widget-view.js @@ -31,7 +31,7 @@ $.each(wo.view_layouts, function(k, v) { var classes = wo.view_switcher_class; - if (k == wo.view_layout) { + if (k === wo.view_layout) { classes += ' active'; } @@ -108,7 +108,7 @@ var $tmpl = $(tmpl); $.each(data.$row[0].attributes, function(idx, attr) { - if (attr.nodeName == 'class') { + if (attr.nodeName === 'class') { $tmpl.attr(attr.nodeName, $tmpl.attr(attr.nodeName) + ' ' + attr.nodeValue); } else { $tmpl.attr(attr.nodeName, attr.nodeValue); @@ -125,7 +125,7 @@ $(wo.view_container).empty(); }, - hideTable: function(c, wo) { + hideTable: function(c) { tpos = c.$table.css('position'); ttop = c.$table.css('bottom'); tleft = c.$table.css('left'); diff --git a/package.json b/package.json index 53322a84e..b070eb58c 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "url": "git://github.com/Mottie/tablesorter.git" }, "scripts": { - "authors": "bash testing/authors.sh" + "authors": "bash testing/authors.sh", + "eslint": "eslint --color Gruntfile.js js/jquery.tablesorter.js js/parsers/* js/widgets/*" }, "npmName": "tablesorter", "npmFileMap": [