Global: Add editor eslint & fix issues

This commit is contained in:
Rob Garrison 2018-03-17 15:30:25 -05:00
parent aa113834db
commit 03eeb2e819
134 changed files with 823 additions and 792 deletions

5
.eslintignore Normal file
View File

@ -0,0 +1,5 @@
_test*.js
*.min.js
*mod.js
*.metadata.js
semver.js

31
.eslintrc Normal file
View File

@ -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
}
}

View File

@ -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

View File

@ -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) : $('<tr><td colspan="' + c.columns + '">' + message + '</td></tr>') )
$( /tr\>/.test(message) ? message : '<tr><td colspan="' + c.columns + '">' + message + '</td></tr>' )
.click( function() {
$( this ).remove();
})

View File

@ -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);

View File

@ -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 = '<tr><td>Frank</td><td>Smith</td><td>53</td><td>$39.95</td><td>22%</td><td>Mar 22, 2011 9:33 AM</td></tr>' +
'<tr><td>Inigo</td><td>Montoya</td><td>34</td><td>$19.99</td><td>15%</td><td>Sep 25, 1987 12:00PM</td></tr>',

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -21,7 +21,7 @@
<script src="../js/widgets/widget-filter.js"></script>
<script>
$(function(){
$(function() {
var dupe = true;
$( '#dupe' ).click( function() {
dupe = !dupe;
@ -32,7 +32,7 @@
$('table').on('filterEnd', function( event, c ) {
$( '#show-filter' ).html( '[ "' + c.lastSearch.join('", "') + '" ]' );
});
$('.search').click(function(){
$('.search').click(function() {
var $this = $(this),
filter = [],
col = $this.attr( 'data-column' );

View File

@ -343,16 +343,16 @@ table.focus-highlight td:before {
<script>
/* highlight hover & focus selectors in the syntax highlighted code */
$(window).on('load', function(){
setTimeout(function(){
$(window).on('load', function() {
setTimeout(function() {
// css
$('.pln:contains(highlight)').each(function(){
$('.pln:contains(highlight)').each(function() {
var $this = $(this),
$prev = $this.prev().prev(),
text = $prev.text() || '',
type = /hover/.test(text) ? 'hover-hl' : /focus/.test(text) ? 'focus-hl' : '';
if (type) {
$this.html(function(i,h){
$this.html(function(i,h) {
return h.replace('highlight', '<span>highlight</span>');
});
// "highlight".. "-" .... "hover"/"focus" ... "."

View File

@ -62,7 +62,7 @@ div.table-handle-disabled {
// this option MUST match the tablesorter selectorSort option!
sortClass: '.sorter',
// this function is called after everything has been updated
tablesorterComplete: function(table){},
tablesorterComplete: function(table) {},
// *** original dragtable settings (non-default) ***
dragaccept: '.drag-enable', // class name of draggable cols -> default null = all columns draggable

View File

@ -25,7 +25,7 @@
widgets: ['zebra']
});
$('button').click(function(){
$('button').click(function() {
$('table').trigger('sortReset');
return false;
});

View File

@ -45,7 +45,7 @@
// alphanumeric sort from sugar v2.0+ (https://sugarjs.com/docs/#/Array/getOption)
1 : Sugar.Array.getOption('sortCollate'),
// function parameters were previously (a, b, table, column) - *** THEY HAVE CHANGED!!! ***
2 : function(a, b, direction, column, table){
2 : function(a, b, direction, column, table) {
// this is the original sort method from tablesorter 2.0.3
if (table.config.sortLocaleCompare) { return a.localeCompare(b); }
return ((a < b) ? -1 : ((a > b) ? 1 : 0));

View File

@ -34,7 +34,7 @@
$("table").tablesorter({
theme : 'blue',
headerTemplate: '{content} {icon}',
onRenderHeader: function(index){
onRenderHeader: function(index) {
// the TH content is wrapped with a div.tablesorter-header-inner by default, so just add the new class
$(this).find('div').addClass('roundedCorners header' + index );
}

View File

@ -25,7 +25,7 @@
// {icon} isn't used by the blue theme; it is optional here
headerTemplate : '{icon}{content}',
// manipulate the template string after is it created
onRenderTemplate : function(i, t){
onRenderTemplate : function(i, t) {
// add the column number to the beginning
// it's a zero-based index, so we add one
return '<em>' + (i+1) + ':</em> ' + t;

View File

@ -22,7 +22,7 @@
<script src="../js/jquery.tablesorter.js"></script>
<script src="../js/jquery.tablesorter.widgets.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
var t, start,
vis = false;
@ -53,12 +53,12 @@
$("#display").append(t).find('li:first').remove();
});
$('.toggle').click(function(){
$('.toggle').click(function() {
vis = !vis;
$.tablesorter.isProcessing($("table"), vis);
});
$('[data-search]').click(function(){
$('[data-search]').click(function() {
var search = $(this).attr('data-search').split(',');
$('table').trigger('search', [search]);
return false;

View File

@ -43,7 +43,7 @@
<script>
$(function() {
// show sortList
$('table').on('sortEnd', function(){
$('table').on('sortEnd', function() {
var indx,
list = '&nbsp;[ ',
sortList = this.config.sortList,

View File

@ -28,8 +28,8 @@
});</script>
<script>
$(function(){
$('select').change(function(){
$(function() {
$('select').change(function() {
var t = $('table'),
v = $(this).val();
t[0].config.emptyTo = v;

View File

@ -33,12 +33,12 @@
// In this example, textExtraction 1-5 functions don't really need to
// be defined, since they can also be obtained using `$(node).text()`
textExtraction: {
0: function(node, table, cellIndex){ return $(node).find("strong").text(); },
1: function(node, table, cellIndex){ return $(node).find("div").text(); },
2: function(node, table, cellIndex){ return $(node).find("span").text(); },
3: function(node, table, cellIndex){ return $(node).find("em").text(); },
4: function(node, table, cellIndex){ return $(node).find("a").text(); },
'.date' : function(node, table, cellIndex){ return $(node).find("u").text(); }
0: function(node, table, cellIndex) { return $(node).find("strong").text(); },
1: function(node, table, cellIndex) { return $(node).find("div").text(); },
2: function(node, table, cellIndex) { return $(node).find("span").text(); },
3: function(node, table, cellIndex) { return $(node).find("em").text(); },
4: function(node, table, cellIndex) { return $(node).find("a").text(); },
'.date' : function(node, table, cellIndex) { return $(node).find("u").text(); }
}
});

View File

@ -39,12 +39,12 @@
}
},
// extra code to highlight invalid semver numbers
initialized : function(table){
initialized : function(table) {
var $cell,
c = table.config,
column = 1; // search second column (zero-based index)
if (window.semver) {
c.$tbodies.each(function(tbindex, tb){
c.$tbodies.each(function(tbindex, tb) {
$(tb).children('tr').each(function(rowindex, tr) {
$cell = $(tr).children().eq(column);
if (semver.valid( $.trim( $cell.text() ) ) === null) {

View File

@ -25,7 +25,7 @@
<script id="js">$(function() {
// NOTE: $.tablesorter.theme.bootstrap is ALREADY INCLUDED in the jquery.tablesorter.widgets.js
// NOTE: $.tablesorter.themes.bootstrap is ALREADY INCLUDED in the jquery.tablesorter.widgets.js
// file for Bootstrap v3.x; it is included here because of class name differences in Bootstrap v2
// for version 2.x (the iconSortAsc & iconSortDesc use different classes)
$.tablesorter.themes.bootstrap = {
@ -103,10 +103,10 @@
});</script>
<script>
$(function(){
$(function() {
// filter button demo code
$('button.filter').click(function(){
$('button.filter').click(function() {
var col = $(this).data('column'),
txt = $(this).data('filter');
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
@ -115,7 +115,7 @@
});
// toggle zebra widget
$('button.zebra').click(function(){
$('button.zebra').click(function() {
var t = $(this).hasClass('btn-success');
// if (t) {
// removing classes applied by the zebra widget
@ -297,7 +297,7 @@
<div class="next-up">
<hr />
Next up: <a href="example-widget-resizable.html">Resizable Columns widget &rsaquo;&rsaquo;</a>
Next up: <a href="example-widget-vertical-group.html">Vertical group widget &rsaquo;&rsaquo;</a>
</div>
</div>

View File

@ -25,7 +25,7 @@
<script id="js">$(function() {
// NOTE: $.tablesorter.theme.bootstrap is ALREADY INCLUDED in the jquery.tablesorter.widgets.js
// NOTE: $.tablesorter.themes.bootstrap is ALREADY INCLUDED in the jquery.tablesorter.widgets.js
// file; it is included here to show how you can modify the default classes
$.tablesorter.themes.bootstrap = {
// these classes are added to the table. To see other table classes available,
@ -106,10 +106,10 @@
});</script>
<script>
$(function(){
$(function() {
// filter button demo code
$('button.filter').click(function(){
$('button.filter').click(function() {
var col = $(this).data('column'),
txt = $(this).data('filter');
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
@ -118,7 +118,7 @@
});
// toggle zebra widget
$('button.zebra').click(function(){
$('button.zebra').click(function() {
var t = $(this).hasClass('btn-success');
// if (t) {
// removing classes applied by the zebra widget

View File

@ -85,10 +85,10 @@
});</script>
<script>
$(function(){
$(function() {
// filter button demo code
$('button.filter').click(function(){
$('button.filter').click(function() {
var col = $(this).data('column'),
txt = $(this).data('filter');
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
@ -97,7 +97,7 @@
});
// toggle zebra widget
$('button.zebra').click(function(){
$('button.zebra').click(function() {
var t = $(this).hasClass('btn-success');
$('table')
.toggleClass('table-striped')[0]

View File

@ -74,10 +74,10 @@ ul { padding-left: 20px; }
});</script>
<script>
$(function(){
$(function() {
// filter button demo code
$('button.filter').click(function(){
$('button.filter').click(function() {
var col = $(this).data('column'),
txt = $(this).data('filter');
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
@ -86,7 +86,7 @@ ul { padding-left: 20px; }
});
// toggle zebra widget
$('button.zebra').click(function(){
$('button.zebra').click(function() {
var t = $(this).hasClass('green');
$('table')
.toggleClass('striped')[0]

View File

@ -28,7 +28,7 @@
color: #fff;
}</style>
<script id="js">$(function(){
<script id="js">$(function() {
$("table")
.tablesorter({

View File

@ -17,7 +17,7 @@
<link rel="stylesheet" href="../css/theme.blue.css">
<script src="../js/jquery.tablesorter.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
$("table").tablesorter({
theme : 'blue',
// pass the headers argument and passing a object

View File

@ -17,7 +17,7 @@
<link rel="stylesheet" href="../css/theme.blue.css">
<script src="../js/jquery.tablesorter.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
$("table").tablesorter({
theme : 'blue',

View File

@ -18,8 +18,8 @@
<script src="../js/jquery.tablesorter.js"></script>
<script>
$(function(){
$('table').on('tablesorter-initialized', function(){
$(function() {
$('table').on('tablesorter-initialized', function() {
var i, j, t = [],
cache = this.config.cache[0].normalized;
for (i = 0; i < cache.length; i++) {
@ -30,7 +30,7 @@
});
</script>
<script id="js">$(function(){
<script id="js">$(function() {
$("table").tablesorter({
theme : 'blue',

View File

@ -17,7 +17,7 @@
<link rel="stylesheet" href="../css/theme.blue.css">
<script src="../js/jquery.tablesorter.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
// BONUS TIP: disable a column using jQuery data directly
// but do it before the table initializes

View File

@ -26,7 +26,7 @@
<!-- Tablesorter: optional -->
<script src="../js/jquery.tablesorter.widgets.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
// Initialize tablesorter
// ***********************
@ -72,7 +72,7 @@
},
// 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,
@ -98,7 +98,7 @@
// ]
// OR
// return [ total_rows, $rows (jQuery object; optional), headers (array; optional) ]
ajaxProcessing: function(data){
ajaxProcessing: function(data) {
if (data && data.hasOwnProperty('rows')) {
var indx, r, row, c, d = data.rows,
// total number of rows (required)
@ -465,11 +465,11 @@ var $url = $('#url');
$('table')
// show current URL for the DEMO ONLY
.on('changingUrl', function(e, url){
.on('changingUrl', function(e, url) {
$url.html(url);
})
.on('pagerInitialized', function(){
.on('pagerInitialized', function() {
// allow THIS demo to sort the content; this variable is automatically set to true when ajax
// is used as there isn't any way to sort the server side data from the client side.
this.config.serverSideSorting = false;

View File

@ -22,7 +22,7 @@
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
<script src="../js/jquery.tablesorter.widgets.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
var $table = $('table'),
// define pager options
@ -64,9 +64,9 @@
var r, $row, num = 50,
row = '<tr><td>Student{i}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>' +
'<tr><td>Student{j}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>';
$('button:contains(Add)').click(function(){
$('button:contains(Add)').click(function() {
// add two rows of random data!
r = row.replace(/\{[gijmr]\}/g, function(m){
r = row.replace(/\{[gijmr]\}/g, function(m) {
return {
'{i}' : num + 1,
'{j}' : num + 2,
@ -85,7 +85,7 @@
// Delete a row
// *************
$table.delegate('button.remove', 'click' ,function(){
$table.delegate('button.remove', 'click' ,function() {
// NOTE this special treatment is only needed if `removeRows` is `true`
// disabling the pager will restore all table rows
$table.trigger('disablePager');
@ -97,10 +97,10 @@
// Destroy pager / Restore pager
// **************
$('button:contains(Destroy)').click(function(){
$('button:contains(Destroy)').click(function() {
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs
var $t = $(this);
if (/Destroy/.test( $t.text() )){
if (/Destroy/.test( $t.text() )) {
$table.trigger('destroyPager');
$t.text('Restore Pager');
} else {
@ -112,14 +112,14 @@
// Disable / Enable
// **************
$('.toggle').click(function(){
$('.toggle').click(function() {
var mode = /Disable/.test( $(this).text() );
// triggering disablePager or enablePager
$table.trigger( (mode ? 'disable' : 'enable') + 'Pager');
$(this).text( ( mode ? 'Enable' : 'Disable' ) + ' Pager');
return false;
});
$table.bind('pagerChange', function(){
$table.bind('pagerChange', function() {
// pager automatically enables when table is sorted.
$('.toggle').text( 'Disable Pager' );
});

View File

@ -22,7 +22,7 @@
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
// **********************************
// Description of ALL pager options
@ -39,7 +39,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,
@ -121,7 +121,7 @@
// bind to pager events
// *********************
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c){
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c) {
var msg = '"</span> event triggered, ' + (e.type === 'pagerChange' ? 'going to' : 'now on') +
' page <span class="typ">' + (c.page + 1) + '/' + c.totalPages + '</span>';
$('#display')
@ -140,9 +140,9 @@
var r, $row, num = 50,
row = '<tr><td>Student{i}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>' +
'<tr><td>Student{j}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>';
$('button:contains(Add)').click(function(){
$('button:contains(Add)').click(function() {
// add two rows of random data!
r = row.replace(/\{[gijmr]\}/g, function(m){
r = row.replace(/\{[gijmr]\}/g, function(m) {
return {
'{i}' : num + 1,
'{j}' : num + 2,
@ -161,7 +161,7 @@
// Delete a row
// *************
$('table').delegate('button.remove', 'click' ,function(){
$('table').delegate('button.remove', 'click' ,function() {
var t = $('table');
// disabling the pager will restore all table rows
// t.trigger('disablePager');
@ -175,10 +175,10 @@
// Destroy pager / Restore pager
// **************
$('button:contains(Destroy)').click(function(){
$('button:contains(Destroy)').click(function() {
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs
var $t = $(this);
if (/Destroy/.test( $t.text() )){
if (/Destroy/.test( $t.text() )) {
$('table').trigger('destroyPager');
$t.text('Restore Pager');
} else {
@ -190,26 +190,26 @@
// Disable / Enable
// **************
$('.toggle').click(function(){
$('.toggle').click(function() {
var mode = /Disable/.test( $(this).text() );
$('table').trigger( (mode ? 'disable' : 'enable') + 'Pager');
$(this).text( (mode ? 'Enable' : 'Disable') + 'Pager');
return false;
});
$('table').bind('pagerChange', function(){
$('table').bind('pagerChange', function() {
// pager automatically enables when table is sorted.
$('.toggle').text('Disable Pager');
});
// clear storage (page & size)
$('.clear-pager-data').click(function(){
$('.clear-pager-data').click(function() {
// clears user set page & size from local storage, so on page
// reload the page & size resets to the original settings
$.tablesorter.storage( $('table'), 'tablesorter-pager', '' );
});
// go to page 1 showing 10 rows
$('.goto').click(function(){
$('.goto').click(function() {
// triggering "pageAndSize" without parameters will reset the
// pager to page 1 and the original set size (10 by default)
// $('table').trigger('pageAndSize')
@ -218,8 +218,8 @@
});</script>
<script>
$(function(){
$('.clear').click(function(){
$(function() {
$('.clear').click(function() {
$('#display').html( new Array(6).join('<li>&nbsp;</li>') );
});
});

View File

@ -18,7 +18,7 @@
<script src="../js/jquery.tablesorter.js"></script>
<script id="js">// add parser through the tablesorter addParser method
$(function(){
$(function() {
$.tablesorter.addParser({
// set a unique id

View File

@ -17,7 +17,7 @@
<link rel="stylesheet" href="../css/theme.blue.css">
<script src="../js/jquery.tablesorter.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
$("table").tablesorter({ theme: 'blue' });
});</script>
</head>

View File

@ -35,7 +35,7 @@
});
// filter buttons
$('button').on('click', function(){
$('button').on('click', function() {
var $this = $(this),
filter = [],
column = $this.attr('data-column');

View File

@ -196,7 +196,7 @@
.params { font-size: 0.8em; }
</style>
<script>
$(function(){
$(function() {
var tdy = $('.tdy'), // two digit year
a = $('.result'), // answer
r = $('.range'), // range
@ -206,7 +206,7 @@ $(function(){
tdy.val( (y + 20).toString().slice(-2) ); // use this year + 20
c.val( y );
$('input').on('change', function(){
$('input').on('change', function() {
var y = parseInt(tdy.val(), 10),
result = 1900 + y,
range = parseInt(r.val(), 10);

View File

@ -148,12 +148,12 @@
</div>
<script>
$(function(){
$(function() {
var $table = $('table'),
len = $table[0].config.durationLength,
regex = new RegExp('(\\d{' + len + '})', 'g');
// add parsed values to order & value column
addParsedValues( $table, [1,2], function(v){
addParsedValues( $table, [1,2], function(v) {
var t = v.replace(regex, '$1|');
return t.substring(0, t.length - 1);
});

View File

@ -117,9 +117,9 @@
</div>
<script>
$(function(){
$(function() {
// add parsed values to columns [0,1]
addParsedValues($('table'), [0,1], function(num){ return Math.round(num * 100)/100; });
addParsedValues($('table'), [0,1], function(num) { return Math.round(num * 100)/100; });
});
</script>

View File

@ -170,8 +170,8 @@ $.tablesorter.fileTypes.equivalents["Fonts"] += '|svg'; // just add it to the en
<script>
/* DEMO ONLY CODE */
$(function(){
$('button').click(function(){
$(function() {
$('button').click(function() {
$('#media').toggleClass('group-separator-1 group-separator-2');
$('table').trigger('sorton', [ [[3,0]] ]);
});

View File

@ -59,7 +59,7 @@
</ul>
</li>
<li>If the parser doesn't auto-detect which column has IPv6 addresses, use the headers sorter option to set it:
<pre class="prettyprint lang-javascript">$(function(){
<pre class="prettyprint lang-javascript">$(function() {
$('table').tablesorter({
headers: {
1: { sorter: 'MAC' },
@ -130,7 +130,7 @@ $(function() {
</div>
<script>
$(function(){
$(function() {
// add parsed values to columns [0,1]
addParsedValues($('table'), [1,2,3]);
});

View File

@ -17,7 +17,7 @@
<link rel="stylesheet" href="../css/theme.blue.css">
<script src="../js/jquery.tablesorter.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
// set Discount column parser using jQuery data (either 'digit' or 'percent' will work)
$('th.discount').data('sorter', 'digit');
// set an initial sort on the table using jQuery data

View File

@ -111,7 +111,7 @@
</div>
<script>
$(function(){
$(function() {
// add parsed values to columns [0,1]
addParsedValues($('table'), [0, 1, 2, 3]);
});

View File

@ -124,9 +124,9 @@
</div>
<script>
$(function(){
$(function() {
// add parsed values to columns [0,1]
addParsedValues($('table'), [0,1], function(num){ return num.toExponential(); });
addParsedValues($('table'), [0,1], function(num) { return num.toExponential(); });
});
</script>

View File

@ -167,7 +167,7 @@
</div>
<script>
$(function(){
$(function() {
// add parsed values to columns [0,1]
addParsedValues($('table'), [0,1]);
});

View File

@ -228,7 +228,7 @@
</div>
<script>
$(function(){
$(function() {
// add parsed values to order & value column
addParsedValues($('table'), [0,1,2,3,4]);
});

View File

@ -51,13 +51,13 @@
});
// sort using data-sort attribute value
$('button[data-sort]').click(function(){
$('button[data-sort]').click(function() {
var sort = $(this).data('sort');
$(this).closest('.block').find('table').trigger('sorton', [ sort ]);
return false;
});
$('.sortReset-toggle').click(function(){
$('.sortReset-toggle').click(function() {
var c = $(this).closest('.block').find('table')[0].config;
c.sortReset = !c.sortReset;
$(this).next().html('' + c.sortReset);
@ -74,7 +74,7 @@
<script>
// demo stuff (update pre with current sort)
$(function() {
$('button[data-sort]').click(function(){
$('button[data-sort]').click(function() {
var $this = $(this),
$box = $this.closest('.box'),
sort = $this.data('sort'),

View File

@ -17,7 +17,7 @@
<link rel="stylesheet" href="../css/theme.blue.css">
<script src="../js/jquery.tablesorter.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
var start;
// call the tablesorter plugin, the magic happens in the markup
@ -29,12 +29,12 @@
})
// assign the sortStart event
.bind("sortStart",function(e, t){
.bind("sortStart",function(e, t) {
start = e.timeStamp;
$("#display").append('<li>Sort Started</li>').find('li:first').remove();
})
.bind("sortEnd",function(e, t){
.bind("sortEnd",function(e, t) {
$("#display").append('<li>Sort Ended after ' + ( (e.timeStamp - start)/1000 ).toFixed(2) + ' seconds</li>').find('li:first').remove();
});

View File

@ -31,12 +31,12 @@
// append new html to thead & tbody
$("table thead th:eq(2)").html("Age");
$("table tbody").find('td:nth-child(3)').html(function(i,h){
$("table tbody").find('td:nth-child(3)').html(function(i,h) {
return h.substring(1); // remove x & y prefix
});
var resort = true, // re-apply the current sort
callback = function(){
callback = function() {
// do something after the updateAll method has completed
};

View File

@ -30,7 +30,7 @@
// randomize a number
var resort = "", // resort variable set to anything BUT false (without quotes) will trigger the automatic resort
discount = '$' + Math.round(Math.random() * Math.random() * 100) + '.' + ('0' + Math.round(Math.random() * Math.random() * 100)).slice(-2),
callback = function(table){ /* do something */ };
callback = function(table) { /* do something */ };
$(this).text(discount);
// set resort flag to false to prevent automatic resort

View File

@ -391,7 +391,7 @@ td:nth-child(3) .ts-align-right i {
<script>
/* DEMO ONLY CODE */
$(function(){
$(function() {
var $table = $('#demo table'),
c = $table[0].config,
$animals = c.$headers.eq(2),
@ -403,7 +403,7 @@ $(function(){
min: 0,
max: 3,
step: 1,
create: function(){
create: function() {
$animals.find('span').html( $animals.attr('data-align-index') );
},
slide: function( event, ui ) {
@ -419,7 +419,7 @@ $(function(){
min: 0,
max: 4,
step: 1,
create: function(){
create: function() {
$sites.find('span').html( $sites.attr('data-align-index') );
},
slide: function( event, ui ) {
@ -435,7 +435,7 @@ $(function(){
min: -30,
max: 30,
step: 5,
create: function(){
create: function() {
$sites.find('span').html( $sites.attr('data-align-index') );
},
slide: function( event, ui ) {

View File

@ -152,7 +152,7 @@
Add a function that returns a useable build_type. (e.g. string to array)
<div class="collapsible"><br>
The function receives two parameters: <code>data</code> which contains the obtained data and <code>wo</code> which is the widget options (<code>table.config.widgetOptions</code>).<br>
Example: <code>build_processing: function(data, wo){ return data.split(';'); }</code>
Example: <code>build_processing: function(data, wo) { return data.split(';'); }</code>
</div>
</td>
</tr>

View File

@ -521,7 +521,7 @@ FusionCharts.ready(function () {
packages: ["bar", "corechart", "line"]
});
$(function(){
$(function() {
/* Initial settings */
var $table = $('#table'),
$chart = $('#chart'),
@ -629,7 +629,7 @@ $(function(){
}
$icons.removeClass('active');
var $t = $(this).addClass('active');
$.each(types, function(i, v){
$.each(types, function(i, v) {
if ($t.hasClass(v.icon)) {
settings.type = i;
}
@ -637,7 +637,7 @@ $(function(){
drawChart();
});
$rowType.on('change', function(){
$rowType.on('change', function() {
$table[0].config.widgetOptions.chart_incRows = $rowType.filter(':checked').attr('data-type');
// update data, then draw new chart
$table.trigger('chartData');
@ -686,15 +686,14 @@ $(function(){
pager_output: 'Showing {startRow} to {endRow} of {filteredRows} results',
pager_size: 5,
chart_incRows: 'f',
chart_useSelector: true,
chart_hideTable: false
chart_useSelector: true
}
});
});</script>
<script>
$(function(){
$(function() {
$('[data-toggle="tooltip"]').tooltip();
});
</script>

View File

@ -108,7 +108,7 @@
// container layout
columnSelector_layout : '<label><input type="checkbox">{name}</label>',
// 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 @@
<div class="collapsible">
<br>
<p>Bind to this event if you to need to perform an action after the columnSelector has finished hiding or showing columns.</p>
Use it as follows<pre class="prettyprint lang-js">$('table').on('columnUpdate', function(){
Use it as follows<pre class="prettyprint lang-js">$('table').on('columnUpdate', function() {
// set ascending sort on first column
$(this).trigger('sorton', [ [[0,0]] ]);
});</pre>

View File

@ -62,7 +62,7 @@ $(function() {
}
$('select')
.html(o)
.change(function(){
.change(function() {
var theme = $(this).val().toLowerCase();
$('table')
.removeClass('tablesorter-' + t.join(' tablesorter-'))

View File

@ -56,7 +56,7 @@
<script src="../js/jquery.tablesorter.widgets.js"></script>
<script src="../js/widgets/widget-cssStickyHeaders.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
$('.open-popup-link').magnificPopup({
type: 'inline',
@ -114,7 +114,7 @@
});</script>
<script>
$(function() {
$('link.theme').each(function(){ this.disabled = true; });
$('link.theme').each(function() { this.disabled = true; });
var themes = 'default blue green grey ice black-ice dark dropbox',
i, o = '', t = themes.split(' ');
@ -124,12 +124,12 @@ $(function() {
$('select:first')
.append(o)
.change(function(){
.change(function() {
var theme = $(this).val().toLowerCase(),
files = $('link.theme').each(function(){
files = $('link.theme').each(function() {
this.disabled = true;
})
files.filter('[href$="theme.' + theme + '.css"]').each(function(){
files.filter('[href$="theme.' + theme + '.css"]').each(function() {
this.disabled = false;
});
$('table')
@ -138,10 +138,10 @@ $(function() {
}).change();
window.addCaption = true;
$('.caption').on('click', function(){
$('.caption').on('click', function() {
addCaption = !addCaption;
$(this).html( '' + addCaption );
$('#table0, #table1, #table2, #table3, .nested').each(function(){
$('#table0, #table1, #table2, #table3, .nested').each(function() {
if (this.config) {
this.config.widgetOptions.cssStickyHeaders_addCaption = addCaption;
}

View File

@ -21,7 +21,7 @@
#display li:last-child { color: #008080; }
</style>
<script id="js">$(function(){
<script id="js">$(function() {
$.tablesorter.currentSortLanguage = {
0: 'asc',

View File

@ -58,7 +58,7 @@ td.editable_updated {
editable_enterToAccept : true, // press enter to accept content, or click outside if false
editable_autoAccept : true, // accepts any changes made to the table cell automatically (v2.17.6)
editable_autoResort : false, // auto resort after the content has changed.
editable_validate : null, // return a valid string: function(text, original, columnIndex){ return text; }
editable_validate : null, // return a valid string: function(text, original, columnIndex) { return text; }
editable_focused : function(txt, columnIndex, $element) {
// $element is the div, not the td
// to get the td, use $element.closest('td')
@ -69,7 +69,7 @@ td.editable_updated {
// to get the td, use $element.closest('td')
$element.removeClass('focused');
},
editable_selectAll : function(txt, columnIndex, $element){
editable_selectAll : function(txt, columnIndex, $element) {
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
// only select everthing within the element when the content starts with the letter "B"
return /^b/i.test(txt) && columnIndex === 0;
@ -81,7 +81,7 @@ td.editable_updated {
}
})
// config event variable new in v2.17.6
.children('tbody').on('editComplete', 'td', function(event, config){
.children('tbody').on('editComplete', 'td', function(event, config) {
var $this = $(this),
newContent = $this.text(),
cellIndex = this.cellIndex, // there shouldn't be any colspans in the tbody
@ -90,7 +90,7 @@ td.editable_updated {
// Do whatever you want here to indicate
// that the content was updated
$this.addClass( 'editable_updated' ); // green background + white text
setTimeout(function(){
setTimeout(function() {
$this.removeClass( 'editable_updated' );
}, 500);
@ -285,7 +285,7 @@ td.editable_updated {
<td>Event fired after the table content has been edited
<div class="collapsible">
<br>
<pre class="prettyprint lang-js">$(function(){
<pre class="prettyprint lang-js">$(function() {
$('#table')
.tablesorter({
@ -295,7 +295,7 @@ td.editable_updated {
}
})
// use delegated event binding
.on('giterdone', 'td', function(event, config){
.on('giterdone', 'td', function(event, config) {
// this = td; the event bubble up
console.log( 'new content = ' + $(this).text() );
});
@ -312,16 +312,16 @@ td.editable_updated {
<div class="collapsible">
<br>
Set this function to manipulate or adjust the content when the content editable is focused
<pre class="prettyprint lang-js">$(function(){
<pre class="prettyprint lang-js">$(function() {
$('#table').tablesorter({
widgets : ['editable'],
widgetOptions : {
editable_focused : function(txt, columnIndex, $element){
editable_focused : function(txt, columnIndex, $element) {
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
$element.closest('td').addClass('focused');
},
editable_blur : function(txt, columnIndex, $element){
editable_blur : function(txt, columnIndex, $element) {
$element.closest('td').removeClass('focused');
}
}
@ -339,16 +339,16 @@ td.editable_updated {
<div class="collapsible">
<br>
Set this function to manipulate or adjust the content when the content editable is blurred
<pre class="prettyprint lang-js">$(function(){
<pre class="prettyprint lang-js">$(function() {
$('#table').tablesorter({
widgets : ['editable'],
widgetOptions : {
editable_focused : function(txt, columnIndex, $element){
editable_focused : function(txt, columnIndex, $element) {
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
$element.closest('td').addClass('focused');
},
editable_blur : function(txt, columnIndex, $element){
editable_blur : function(txt, columnIndex, $element) {
$element.closest('td').removeClass('focused');
}
}
@ -371,12 +371,12 @@ td.editable_updated {
<li>When <code>false</code>, no selection is made.</li>
<li>When this option contains a function, return either <code>true</code> to select all of the text within the element, or <code>false</code> to not select any text.</li>
</ul>
<pre class="prettyprint lang-js">$(function(){
<pre class="prettyprint lang-js">$(function() {
$('#table').tablesorter({
widgets : ['editable'],
widgetOptions : {
editable_selectAll : function(txt, columnIndex, $element){
editable_selectAll : function(txt, columnIndex, $element) {
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
// only select everthing within the element when the content starts with the letter "B"
return /^b/i.test(txt) && columnIndex === 0;
@ -404,13 +404,13 @@ td.editable_updated {
<li>A <code>$element</code> parameter has been included which contains the contenteditable element. To get the table cell, use <code>$element.closest('td');</code></li>
</ul>
This function must return either a string containing the modified content or <code>false</code> to revert the content back to it's original value. Example:
<pre class="prettyprint lang-js">$(function(){
<pre class="prettyprint lang-js">$(function() {
$('#table1').tablesorter({
widgets : ['editable'],
widgetOptions : {
// global validate function
editable_validate : function(txt, orig, columnIndex, $element){
editable_validate : function(txt, orig, columnIndex, $element) {
// only allow one word
var t = /\s/.test(txt) ? txt.split(/\s/)[0] : txt;
return t || false;
@ -423,7 +423,7 @@ td.editable_updated {
widgetOptions : {
// validate function per column
editable_validate : {
0 : function(txt, orig, columnIndex, $element){
0 : function(txt, orig, columnIndex, $element) {
// allow up to two words
var t = txt.split(' ');
return t.length > 2 ? t[0] + (t[1] ? ' ' + t[1] : '') : txt;
@ -455,7 +455,7 @@ td.editable_updated {
If this option is <code>true</code>, this widget will trim content <em>upon initialization</em>; this is necessary if you need cleaned it up content before editing, like with an autocomplete script.<br>
<br>
Use this option as follows:
<pre class="prettyprint lang-js">$(function(){
<pre class="prettyprint lang-js">$(function() {
$('#table').tablesorter({
widgets : ['editable'],
@ -482,7 +482,7 @@ td.editable_updated {
<li>If the cell already has children (one or more) immediately inside of the table cell, no wrapping occurs and the child element(s) that don't have the class name set in <code>editable_noEdit</code>, will have the "contenteditable" attribute enabled.</li>
</ul>
Note: that this option uses jQuery's <code>wrapInner</code>, so this option can be set to a html string or selector, jQuery object, DOM element, or a function (jQuery 1.4+)
<pre class="prettyprint lang-js">$(function(){
<pre class="prettyprint lang-js">$(function() {
$('#table').tablesorter({
widgets : ['editable'],
@ -583,11 +583,11 @@ td.editable_updated {
<script>
$(function() {
var wo = $('#table')[0].config.widgetOptions;
$('.enter').click(function(){
$('.enter').click(function() {
var t = wo.editable_enterToAccept = !wo.editable_enterToAccept;
$(this).next().find('span').html('' + t);
});
$('.auto').click(function(){
$('.auto').click(function() {
var t = wo.editable_autoAccept = !wo.editable_autoAccept;
$(this).next().find('span').html('' + t);
});

View File

@ -42,7 +42,7 @@
});
// make demo search buttons work
$('button[data-column]').on('click', function(){
$('button[data-column]').on('click', function() {
var $this = $(this),
totalColumns = $table[0].config.columns,
col = $this.data('column'), // zero-based index or "all"

View File

@ -99,7 +99,7 @@ tr.group-header.collapsed td i {
return false;
});
$('.toggle').click(function(){
$('.toggle').click(function() {
var wo = $table[0].config.widgetOptions,
set = !wo.filter_childWithSibs;
wo.filter_childWithSibs = set;
@ -108,7 +108,7 @@ tr.group-header.collapsed td i {
$table.trigger( 'search', false );
});
$('.search').click(function(){
$('.search').click(function() {
var filter = [],
$this = $(this),
col = parseInt( $this.attr('data-column'), 10 );

View File

@ -24,7 +24,7 @@
#types { width: 100%; }
</style>
<script>
$(function(){
$(function() {
$('#types').tablesorter();
});
</script>
@ -70,7 +70,7 @@ $(function() {
// External search
// buttons set up like this:
// <button type="button" class="search" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
$('button').click(function(){
$('button').click(function() {
var $t = $(this),
col = $t.data('filter-column'), // zero-based index
filter = [];
@ -211,7 +211,7 @@ $.tablesorter.filter.types.start = function( config, data ) {
<div>
<ul>
<li>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):
<pre class="prettyprint lang-js">$(function(){
<pre class="prettyprint lang-js">$(function() {
// Remove fuzzy search
delete $.tablesorter.filter.types.fuzzy;

View File

@ -44,8 +44,8 @@
});</script>
<script>
$(function(){
$('button').on('click', function(){
$(function() {
$('button').on('click', function() {
var $this = $(this),
filters = [],
col = $(this).data('column'),

View File

@ -22,12 +22,12 @@
<script src="../js/widgets/widget-filter.js"></script>
<script>
$(function(){
$(function() {
// External search
// buttons set up like this:
// <button type="button" class="search" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
$('button.match').click(function(){
$('button.match').click(function() {
// toggle "filter-match" class on first column
var first = $('table').find('th:first').toggleClass('filter-match');
@ -44,7 +44,7 @@
return false;
});
$('.accordion button[data-filter-column]').click(function(){
$('.accordion button[data-filter-column]').click(function() {
var filters = [],
$t = $(this),
col = $t.data('filter-column'), // zero-based index
@ -54,7 +54,7 @@
return false;
});
$('button.search-type').click(function(){
$('button.search-type').click(function() {
var c = $('#demo table')[0].config,
wo = c.widgetOptions,
search = wo.filter_searchFiltered = !wo.filter_searchFiltered;

View File

@ -52,7 +52,7 @@
*/
// Allow changing an input from one column (any column) to another
$('select').change(function(){
$('select').change(function() {
// modify the search input data-column value (swap "0" or "all in this demo)
$('.selectable').attr( 'data-column', $(this).val() );
// update external search inputs

View File

@ -39,19 +39,19 @@
<script src="../js/widgets/widget-uitheme.js"></script>
<script src="../js/widgets/widget-filter-formatter-jui.js"></script>
<script>
$(function(){
$(function() {
$('#switcher').jui_theme_switch({
stylesheet_link_id : 'ui-theme',
datasource_url : 'assets/theme_switcher.json'
});
$('.accordion button').on('click', function(){
$('.accordion button').on('click', function() {
var $this = $(this),
column = $this.data('column'),
filters = [];
filters[ column ] = $this.data('value');
$('table').trigger('sorton', [ [[column, 0]], function(){
$('table').trigger('sorton', [ [[column, 0]], function() {
$.tablesorter.setFilters( $('table'), filters, true );
} ]);
});
@ -77,7 +77,7 @@
filter_formatter : {
// Rank (jQuery selector added v2.17.0)
'th:contains("Rank")' : function($cell, indx){
'th:contains("Rank")' : function($cell, indx) {
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
delayed : true,
valueToHeader : false,
@ -92,7 +92,7 @@
},
// Age
1 : function($cell, indx){
1 : function($cell, indx) {
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
delayed : false,
valueToHeader : false,
@ -108,7 +108,7 @@
},
// Total (jQuery selector added v2.17.0)
'.total' : function($cell, indx){
'.total' : function($cell, indx) {
return $.tablesorter.filterFormatter.uiRange( $cell, indx, {
delayed : false,
valueToHeader : false,
@ -120,7 +120,7 @@
},
// Discount
3 : function($cell, indx){
3 : function($cell, indx) {
return $.tablesorter.filterFormatter.uiSpinner( $cell, indx, {
delayed : true,
addToggle : false,
@ -136,7 +136,7 @@
},
// Date (one input)
4 : function($cell, indx){
4 : function($cell, indx) {
return $.tablesorter.filterFormatter.uiDateCompare( $cell, indx, {
cellText : 'Dates', // text added before the input
compare : [ '', '=', '>=', '<=' ],
@ -150,7 +150,7 @@
},
// Date (two inputs)
5 : function($cell, indx){
5 : function($cell, indx) {
return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
// from : '08/01/2013', // default from date
// to : '1/18/2014', // default to date
@ -266,7 +266,7 @@
filter_formatter : {
// Rank (jQuery selector added v2.17.0)
'th:contains("Rank")' : function($cell, indx){
'th:contains("Rank")' : function($cell, indx) {
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
// filterFormatter options
cellText : 'Rank:',
@ -285,7 +285,7 @@
},
// Age
1 : function($cell, indx){
1 : function($cell, indx) {
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
delayed: false, // delay search (set by filter_searchDelay)
valueToHeader: false, // add current slider value to the header cell
@ -334,7 +334,7 @@
filter_formatter : {
// Total column (jQuery selector added v2.17.0)
'.total' : function($cell, indx){
'.total' : function($cell, indx) {
return $.tablesorter.filterFormatter.uiRange( $cell, indx, {
delayed: true, // delay search (set by filter_searchDelay)
valueToHeader: false, // add current slider value to the header cell
@ -378,7 +378,7 @@
filter_formatter : {
// Discount column
3 : function($cell, indx){
3 : function($cell, indx) {
return $.tablesorter.filterFormatter.uiSpinner( $cell, indx, {
delayed: true, // delay search (set by filter_searchDelay)
addToggle: false, // add a toggle switch to activate/deactive the search
@ -433,7 +433,7 @@
filter_formatter : {
// Date (one input)
4 : function($cell, indx){
4 : function($cell, indx) {
return $.tablesorter.filterFormatter.uiDateCompare( $cell, indx, {
cellText : 'Dates', // text added before the input
compare : [ '', '=', '&gt;=', '&lt;=' ], // search values greater/less than selected value; overrides exactMatch
@ -496,7 +496,7 @@
filter_formatter : {
// Date (two inputs)
5 : function($cell, indx){
5 : function($cell, indx) {
return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
// add any of the jQuery UI Datepicker options here (http://api.jqueryui.com/datepicker/)
// from : '8/1/2013', // starting date
@ -543,10 +543,10 @@
</li>
<li>Some method should be added to show the user the current value of the selector - update a data attribute for css3 tooltips, or update the header cell.</li>
<li>A reset function needs to also be included; bind to the <code>filterReset</code> event and clear out or disable your custom selector when triggered.
<pre class="prettyprint lang-javascript">$cell.closest('table').bind('filterReset', function(){ /* update the input here */ });</pre>
<pre class="prettyprint lang-javascript">$cell.closest('table').bind('filterReset', function() { /* update the input here */ });</pre>
</li>
<li>In <span class="version">v2.15.0</span>, in order to update your custom input with any saved filter searches, you will need to bind to the <code>filterFomatterUpdate</code> event to get the saved filter value from the hidden input and apply it to your custom input.
<pre class="prettyprint lang-javascript">$cell.closest('table').bind('filterFomatterUpdate', function(){
<pre class="prettyprint lang-javascript">$cell.closest('table').bind('filterFomatterUpdate', function() {
var savedSearch = $cell.find('input[type=hidden]').val();
// apply this saved search to your custom input
$.tablesorter.filter.formatterUpdated($cell, indx); // new v2.17.5

View File

@ -42,7 +42,7 @@
filter_formatter : {
// Rank
0 : function($cell, indx){
0 : function($cell, indx) {
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
value: 0,
min: 0,
@ -55,7 +55,7 @@
},
// Color
1 : function($cell, indx){
1 : function($cell, indx) {
return $.tablesorter.filterFormatter.html5Color( $cell, indx, {
value: '#000000',
addToggle: true,
@ -65,7 +65,7 @@
},
// Age
3: function($cell, indx){
3: function($cell, indx) {
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
value: 1,
min: 1,
@ -78,7 +78,7 @@
},
// Total
4 : function($cell, indx){
4 : function($cell, indx) {
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
value: 0,
min: 0,
@ -90,7 +90,7 @@
},
// Discount
5: function($cell, indx){
5: function($cell, indx) {
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
value: 1,
min: 1,
@ -155,7 +155,7 @@
filter_formatter : {
// Rank
0 : function($cell, indx){
0 : function($cell, indx) {
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
value: 0,
min: 0,
@ -168,7 +168,7 @@
},
// Total
4 : function($cell, indx){
4 : function($cell, indx) {
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
value: 0,
min: 0,
@ -212,7 +212,7 @@
filter_formatter : {
// Color
1 : function($cell, indx){
1 : function($cell, indx) {
return $.tablesorter.filterFormatter.html5Color( $cell, indx, {
value: '#000000',
addToggle: true,
@ -254,7 +254,7 @@
filter_formatter : {
// Age
3: function($cell, indx){
3: function($cell, indx) {
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
value: 1,
min: 1,
@ -267,7 +267,7 @@
},
// Discount
5: function($cell, indx){
5: function($cell, indx) {
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
value: 1,
min: 1,

View File

@ -25,7 +25,7 @@
<script src="js/select2-3.4.6.min.js"></script>
<script src="../js/widgets/widget-filter-formatter-select2.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
$('.tablesorter').tablesorter({
theme: 'blue',
@ -40,7 +40,7 @@
filter_formatter : {
// Alphanumeric (match)
0 : function($cell, indx){
0 : function($cell, indx) {
return $.tablesorter.filterFormatter.select2( $cell, indx, {
match : true, // adds "filter-match" to header
cellText : 'Match: ', // Cell text
@ -50,7 +50,7 @@
},
// Alphanumeric (exact)
1 : function($cell, indx){
1 : function($cell, indx) {
return $.tablesorter.filterFormatter.select2( $cell, indx, {
match : false // exact match only
});
@ -153,7 +153,7 @@
This is an example of how to set these options:
<pre class="prettyprint lang-js">filter_formatter : {
// default settings on first column
0 : function($cell, indx){
0 : function($cell, indx) {
return $.tablesorter.filterFormatter.select2( $cell, indx, {
// *** select2 filter formatter options ***
cellText : '', // Text (wrapped in a label element)

View File

@ -55,7 +55,7 @@
$table
.find( '.' + selectmenuClass )
.iconselectmenu({
change: function(){
change: function() {
// start a new search
$table.trigger( 'search' );
}

View File

@ -163,12 +163,12 @@
});
// Clear stored filters - added v2.25.6
$('.resetsaved').click(function(){
$('.resetsaved').click(function() {
$('#table').trigger('filterResetSaved');
// show quick popup to indicate something happened
var $message = $('<span class="results"> Reset</span>').insertAfter(this);
setTimeout(function(){
setTimeout(function() {
$message.remove();
}, 500);
return false;
@ -177,7 +177,7 @@
// External search
// buttons set up like this:
// <button type="button" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
$('button[data-filter-column]').click(function(){
$('button[data-filter-column]').click(function() {
/*** first method *** data-filter-column="1" data-filter-text="!son"
add search value to Discount column (zero based index) input */
var filters = [],
@ -211,10 +211,10 @@
});</script>
<script>
$(function(){
$(function() {
// *** widgetfilter_startsWith toggle button ***
$('button.toggle').click(function(){
$('button.toggle').click(function() {
var c = $('#table')[0].config,
$t = $(this),
// toggle the boolean

View File

@ -9,12 +9,12 @@
<script>
// tweak "Added" column to keep recent dates
$(function(){
$(function() {
var d, t,
tweaks = [ 9e5, 8e8, 2e7, 0, 6e10, 1e11 ],
$t = $('#demo tbody'),
date = new Date().getTime();
$t.find('tr td:nth-child(4)').each(function(i){
$t.find('tr td:nth-child(4)').each(function(i) {
d = new Date( date - tweaks[i] );
t = (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear() + ' ' +
d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
@ -88,7 +88,7 @@
* Copyright (c) 2011 John Resig (ejohn.org)
* Licensed under the MIT and GPL licenses.
*/
function prettyDate(date){
function prettyDate(date) {
var diff = (((new Date()).getTime() - date.getTime()) / 1000),
day_diff = Math.floor(diff / 86400);
if ( isNaN(day_diff) || day_diff < 0 ) { return ''; }

View File

@ -81,7 +81,7 @@ tr.group-header.collapsed td i {
<!-- grouping widget -->
<script src="../js/widgets/widget-grouping.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
$("table").tablesorter({
theme : 'blue',
@ -97,7 +97,7 @@ tr.group-header.collapsed td i {
$('.tablesorter-childRow td').hide();
$('.tablesorter').on('click', '.toggle', function(){
$('.tablesorter').on('click', '.toggle', function() {
$(this).closest('tr').nextUntil('tr:not(.tablesorter-childRow)').find('td').toggle();
return false;
});

View File

@ -73,7 +73,7 @@ tr.group-header.collapsed td i {
<script src="../js/widgets/widget-grouping.js"></script>
<script src="../js/widgets/widget-storage.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
$("#groups").tablesorter({
theme : "blue",
@ -135,7 +135,7 @@ tr.group-header.collapsed td i {
// column = current column being sorted/grouped
if (column === 2) {
var subtotal = 0;
$rows.each(function(){
$rows.each(function() {
subtotal += parseFloat( $(this).find("td").eq(column).text() );
});
$cell.find(".group-count").append("; subtotal: " + subtotal );
@ -349,7 +349,7 @@ group_separator : /[/.]/</pre>
<li><code>column</code> - current table column being grouped (zero-based index).</li>
<li><code>table</code> - current table (DOM).</li>
</ul>
<pre class="prettyprint lang-js">group_callback : function($cell, $rows, column, table){
<pre class="prettyprint lang-js">group_callback : function($cell, $rows, column, table) {
$cell.find('.group-name').append(' group'); // adds "group" to the end of the group name
}</pre>
</div>
@ -361,7 +361,7 @@ group_separator : /[/.]/</pre>
<td>
Event triggered on the table when the grouping widget has finished work <span class="version">v2.12</span>.
<div class="collapsible">
<pre class="prettyprint lang-js">$('table').on('groupingComplete', function(){
<pre class="prettyprint lang-js">$('table').on('groupingComplete', function() {
// always hide empty groups ("Empty" can be added by the group_formatter function)
$(this).find('.group-header:contains("Empty")').trigger('toggleGroup');
});</pre>
@ -613,7 +613,7 @@ group_dateString : function(date, config, $header ) {
Target the group header(s) and trigger a "toggleGroup" event to show/hide rows associated with that group.
<pre class="prettyprint lang-js">// "toggle" class name added to a button/link
$('.toggle').click(function(){
$('.toggle').click(function() {
// show/hide all groups - table must be grouped (sorted or force grouping)
$('table').find('.group-header').trigger('toggleGroup');
return false;
@ -886,7 +886,7 @@ $(function() {
<script>
/* DEMO ONLY CODE */
$(function(){
$(function() {
var $groups = $('#groups'),
startBlock = 10,
startVal = 1,
@ -901,13 +901,13 @@ $(function() {
min: 10,
max: 50,
step: 10,
create: function(){
create: function() {
$('.numberclass').html(' "group-number-' + startBlock + '"');
$groups.find('.tablesorter-header-inner:eq(' + numcol + ')').find('span').html(startBlock);
},
slide: function( event, ui ) {
$groups[0].config.$headers.eq(numcol)
.attr('class', function(i,v){
.attr('class', function(i,v) {
return v.replace(/group-number-\d+/, 'group-number-' + ui.value);
})
.trigger('sorton', [ [[numcol,0]] ]);
@ -921,13 +921,13 @@ $(function() {
min: 1,
max: 5,
step: 1,
create: function(){
create: function() {
$('.animalclass').html(' "group-letter-' + startVal + '"');
$groups.find('.tablesorter-header-inner:eq(' + letcol + ')').find('span').html(startVal === 1 ? 'letter' : startVal + ' letters');
},
slide: function( event, ui ) {
$groups[0].config.$headers.eq(letcol)
.attr('class', function(i,v){
.attr('class', function(i,v) {
return v.replace(/group-letter-\d+/, 'group-letter-' + ui.value);
})
.trigger('sorton', [ [[letcol,0]] ]);
@ -941,13 +941,13 @@ $(function() {
min: 0,
max: dateGroups.length - 1,
step: 1,
create: function(){
create: function() {
$('.dateclass').html(' "group-date' + (curGroup > 0 ? '-' + dateGroups[curGroup] : '') + '"');
$groups.find('.tablesorter-header-inner:eq(' + datecol + ')').find('span').html(curGroup === 0 ? 'full' : dateGroups[curGroup]);
},
slide: function( event, ui ) {
var $h = $groups[0].config.$headers.eq(datecol)
.attr('class', function(i,v){
.attr('class', function(i,v) {
return v.replace(/group-date(-\w+)?/, 'group-date' + (ui.value > 0 ? '-' + dateGroups[ui.value] : ''));
});
$h.removeClass('sorter-weekday-index sorter-time');

View File

@ -105,7 +105,7 @@
$table1 = $('#table1'),
// first table only
wo = $table1[0].config.widgetOptions;
$('button').on('click', function(){
$('button').on('click', function() {
wo.headerTitle_useAria = !wo.headerTitle_useAria;
// show current state in demo
$state.text( wo.headerTitle_useAria );

View File

@ -84,7 +84,7 @@ th.tablesorter-header.ignore, .ignore { background-color: #e6bf99; }
});
// preset searches for the first table
$('button[data-filter-column]').click(function(){
$('button[data-filter-column]').click(function() {
var filters = [],
config = $table[0].config,
$t = $(this),
@ -115,7 +115,7 @@ th.tablesorter-header.ignore, .ignore { background-color: #e6bf99; }
});
// preset searches on the second table
$('button.table2').click(function(){
$('button.table2').click(function() {
// check for reset
var query = $(this).hasClass('reset2') ? '' : this.textContent;
config = $table2[0].config;
@ -229,7 +229,7 @@ th.tablesorter-header.ignore, .ignore { background-color: #e6bf99; }
}
});
$('button.update').click(function(){
$('button.update').click(function() {
// update the marks in the table
$('table').trigger('markFu');
});</pre>
@ -322,12 +322,12 @@ $('button.update').click(function(){
</tr>
<tr id="mark-each">
<td><span class="permalink">mark_each</span></td>
<td>function(element){}</td>
<td>function(element) {}</td>
<td>A callback for each marked element.</td>
</tr>
<tr id="mark-filter">
<td><a href="#" class="permalink">mark_filter</a></td>
<td>function(parameters){ return true; }</td>
<td>function(parameters) { return true; }</td>
<td>A callback to filter or limit matches.
<div class="collapsible">
<br>
@ -342,7 +342,7 @@ $('button.update').click(function(){
</tr>
<tr id="mark-nomatch">
<td><a href="#" class="permalink">mark_noMatch</a></td>
<td>function(keyword){}</td>
<td>function(keyword) {}</td>
<td>A callback function that will be called when there are no matches.
<div class="collapsible">
<br>
@ -354,7 +354,7 @@ $('button.update').click(function(){
</tr>
<tr id="mark-done">
<td><span class="permalink">mark_done</span></td>
<td>function(totalMatches){}</td>
<td>function(totalMatches) {}</td>
<td>A callback function after all marks are done.</td>
</tr>
<tr id="mark-debug">

View File

@ -77,7 +77,7 @@
$('.resultz').html(results.join('<br>'));
};
$(function(){
$(function() {
$('button').click(function () {
process();
});
@ -145,7 +145,7 @@
$.tablesorter.equations['product'] = function(arry) {
// multiple all array values together
var product = 1;
$.each(arry, function(i,v){
$.each(arry, function(i,v) {
// oops, we shouldn't have any zero values in the array
if (v !== 0) {
product *= v;
@ -407,7 +407,7 @@ math_complete : function($cell, wo, result, value, arry) {
<br>
Use this option as follows:
<pre class="prettyprint lang-js">// complete executed after each function
math_complete : function($cell, wo, result, value, arry){
math_complete : function($cell, wo, result, value, arry) {
return '$ ' + result + $cell.attr('data-suffix');
}</pre>
<ul>
@ -420,7 +420,7 @@ math_complete : function($cell, wo, result, value, arry){
In this function, if a anything is returned, it will be automatically added to the <code>$cell</code> as html. Or, return <code>false</code> and no change is made to the cell contents; use this method if you manipulate the <code>$cell</code> contents and don't want the widget to do it.<br>
<br>
If you need to format the data output after manipulating the <code>value</code>, you can use <code>wo.math_mask</code>, or a different mask, by using the <code>$.tablesorter.formatMask( mask, value );</code> function. For example:
<pre class="prettyprint lang-js">math_complete : function($cell, wo, result, value, arry){
<pre class="prettyprint lang-js">math_complete : function($cell, wo, result, value, arry) {
var percent = Math.round( value * 1e4 ) / 100; // percent with two decimal places
return $.tablesorter.formatMask( wo.math_mask, percent ) + ' %';
}</pre>
@ -593,7 +593,7 @@ math_rowFilter : ':visible:not(.filtered)'</pre>
$.tablesorter.equations['product'] = function(arry, config) {
// multiple all array values together
var product = 1;
$.each(arry, function(i,v){
$.each(arry, function(i,v) {
// oops, we shouldn't have any zero values in the array
if (v !== 0) {
product *= v;

View File

@ -79,7 +79,7 @@ table.tablesorter tbody tr.even.checked td {
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
<script>
$(function(){
$(function() {
$('#output-options').tablesorter({
theme: 'bootstrap',
widthFixed : true,
@ -90,7 +90,7 @@ table.tablesorter tbody tr.even.checked td {
// External search
// buttons set up like this:
// <button type="button" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
$('button[data-filter-column]').click(function(){
$('button[data-filter-column]').click(function() {
/*** first method *** data-filter-column="2" data-filter-text="!son"
add search value to Discount column (zero based index) input */
var filters = [],
@ -177,21 +177,21 @@ table.tablesorter tbody tr.even.checked td {
// set up download buttons for two table groups
var demos = ['.group1', '.group2'];
$.each(demos, function(groupIndex){
$.each(demos, function(groupIndex) {
var $this = $(demos[groupIndex]);
$this.find('.dropdown-toggle').click(function(e){
$this.find('.dropdown-toggle').click(function(e) {
// this is needed because clicking inside the dropdown will close
// the menu with only bootstrap controlling it.
$this.find('.dropdown-menu').toggle();
return false;
});
// make separator & replace quotes buttons update the value
$this.find('.output-separator').click(function(){
$this.find('.output-separator').click(function() {
$this.find('.output-separator').removeClass('active');
var txt = $(this).addClass('active').html();
$this.find('.output-separator-input').val( txt );
$this.find('.output-filename').val(function(i, v){
$this.find('.output-filename').val(function(i, v) {
// change filename extension based on separator
var filetype = (txt === 'json' || txt === 'array') ? 'js' :
txt === ',' ? 'csv' : 'txt';
@ -199,18 +199,18 @@ table.tablesorter tbody tr.even.checked td {
});
return false;
});
$this.find('.output-quotes').click(function(){
$this.find('.output-quotes').click(function() {
$this.find('.output-quotes').removeClass('active');
$this.find('.output-replacequotes').val( $(this).addClass('active').text() );
return false;
});
// header/footer toggle buttons
$this.find('.output-header, .output-footer').click(function(){
$this.find('.output-header, .output-footer').click(function() {
$(this).toggleClass('active');
});
// clicking the download button; all you really need is to
// trigger an "output" event on the table
$this.find('.download').click(function(){
$this.find('.download').click(function() {
var typ,
$table = $this.find('table'),
wo = $table[0].config.widgetOptions,
@ -406,7 +406,7 @@ table.tablesorter tbody tr.even.checked td {
<pre class="prettyprint lang-js">$(function () {
var $table = $('table');
$('.download').click(function(){
$('.download').click(function() {
// tell the output widget do it's thing
$table.trigger('outputTable');
});
@ -847,7 +847,7 @@ line,value1,value2,value3
</li>
</ul>
Default setting:
<pre class="prettyprint lang-js">function(config, data, url){
<pre class="prettyprint lang-js">function(config, data, url) {
// return data.replace( /Mary Smith/g, 'Mary Smith-Jones' ); // v2.25.1+
return true;
}</pre>
@ -864,7 +864,7 @@ line,value1,value2,value3
// entire table using the current filters, sort, etc.
if (url) {
return $.getJSON(url + "&csv=1")
.done(function(data){
.done(function(data) {
return data.csv;
})
.fail(function() {

View File

@ -25,7 +25,7 @@
<!-- Tablesorter: optional -->
<script src="../js/jquery.tablesorter.widgets.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
// Initialize tablesorter
// ***********************
@ -116,7 +116,7 @@
},
// ajax error callback from $.tablesorter.showError function
// pager_ajaxError: function( config, xhr, settings, exception ){ return exception; };
// pager_ajaxError: function( config, xhr, settings, exception ) { return exception; };
// returning false will abort the error message
pager_ajaxError: null,
@ -151,7 +151,7 @@
// ],
// [ "header1", "header2", ... "headerN" ] // optional
// ]
pager_ajaxProcessing: function(data){
pager_ajaxProcessing: function(data) {
if (data && data.hasOwnProperty('rows')) {
var indx, r, row, c, d = data.rows,
// total number of rows (required)
@ -400,11 +400,11 @@ var $url = $('#url');
$('table')
// show current URL for the DEMO ONLY
.on('changingUrl', function(e, url){
.on('changingUrl', function(e, url) {
$url.html(url);
})
.on('pagerInitialized', function(){
.on('pagerInitialized', function() {
// allow THIS demo to sort the content; this variable is automatically set to true when ajax
// is used as there isn't any way to sort the server side data from the client side.
this.config.serverSideSorting = false;

View File

@ -22,7 +22,7 @@
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
<script src="../js/widgets/widget-pager.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
var $table = $('table');
@ -103,7 +103,7 @@
// bind to pager events
// *********************
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c){
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c) {
var p = c.pager, // NEW with the widget... it returns config, instead of config.pager
msg = '"</span> event triggered, ' + (e.type === 'pagerChange' ? 'going to' : 'now on') +
' page <span class="typ">' + (p.page + 1) + '/' + p.totalPages + '</span>';
@ -119,9 +119,9 @@
var r, $row, num = 50,
row = '<tr><td>Student{i}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>' +
'<tr><td>Student{j}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>';
$('button:contains(Add)').click(function(){
$('button:contains(Add)').click(function() {
// add two rows of random data!
r = row.replace(/\{[gijmr]\}/g, function(m){
r = row.replace(/\{[gijmr]\}/g, function(m) {
return {
'{i}' : num + 1,
'{j}' : num + 2,
@ -140,7 +140,7 @@
// Delete a row
// *************
$table.delegate('button.remove', 'click' ,function(){
$table.delegate('button.remove', 'click' ,function() {
// disabling the pager will restore all table rows
// $table.trigger('disablePager');
// remove chosen row
@ -153,10 +153,10 @@
// Destroy pager / Restore pager
// **************
$('button:contains(Destroy)').click(function(){
$('button:contains(Destroy)').click(function() {
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs
var $t = $(this);
if (/Destroy/.test( $t.text() )){
if (/Destroy/.test( $t.text() )) {
$table.trigger('destroyPager');
$t.text('Restore Pager');
} else {
@ -168,27 +168,27 @@
// Disable / Enable
// **************
$('.toggle').click(function(){
$('.toggle').click(function() {
var mode = /Disable/.test( $(this).text() );
// using disablePager or enablePager
$table.trigger( (mode ? 'disable' : 'enable') + 'Pager');
$(this).text( (mode ? 'Enable' : 'Disable') + 'Pager');
return false;
});
$table.bind('pagerChange', function(){
$table.bind('pagerChange', function() {
// pager automatically enables when table is sorted.
$('.toggle').text('Disable Pager');
});
// clear storage (page & size)
$('.clear-pager-data').click(function(){
$('.clear-pager-data').click(function() {
// clears user set page & size from local storage, so on page
// reload the page & size resets to the original settings
$.tablesorter.storage( $table, 'tablesorter-pager', '' );
});
// go to page 1 showing 10 rows
$('.goto').click(function(){
$('.goto').click(function() {
// triggering "pageAndSize" without parameters will reset the
// pager to page 1 and the original set size (10 by default)
// $('table').trigger('pageAndSize')

View File

@ -91,7 +91,7 @@
print_styleSheet : '../css/theme.blue.css', // add the url of your print stylesheet
print_now : true, // Open the print dialog immediately if true
// callback executed when processing completes - default setting is null
print_callback : function(config, $table, printStyle){
print_callback : function(config, $table, printStyle) {
// do something to the $table (jQuery object of table wrapped in a div)
// or add to the printStyle string, then...
// print the table using the following code
@ -100,7 +100,7 @@
}
});
$('.print').click(function(){
$('.print').click(function() {
$('.tablesorter').trigger('printTable');
});
@ -300,7 +300,7 @@ print_callback : function( config, $table, printStyle ) {
<div>
<ul>
<li>To make the print widget work programmatically, trigger a "printTable" event.
<pre class="prettyprint lang-js">$('.print').click(function(){
<pre class="prettyprint lang-js">$('.print').click(function() {
$('.tablesorter').trigger('printTable');
});</pre>
</li>

View File

@ -186,7 +186,7 @@
</style>
<script src="../js/widgets/widget-reflow.js"></script>
<script>
$(function(){
$(function() {
// screen size class names
var j = 0,
allClasses = '',
@ -199,7 +199,7 @@
[ 'smart-p', 'smartphone portrait 320x480' ]
];
$('.resize-frame li')
.each(function(i){
.each(function(i) {
// add tooltip to each table size button
$(this).attr('title', sizes[j][1]);
j = (j + 1) % 6;
@ -207,14 +207,14 @@
allClasses += sizes[i][0] + ' ';
}
})
.on('click', function(){
.on('click', function() {
var $t = $(this),
indx = $t.index();
$t.addClass('active').siblings().removeClass('active');
$t.parent().nextAll('div:first').removeClass(allClasses).addClass( sizes[indx][0] );
});
// toggle thead in iframe
$('button.toggle').click(function(){
$('button.toggle').click(function() {
$(this).nextAll('div:first').find('iframe').contents().find('thead').toggleClass('hide-header');
});

View File

@ -137,7 +137,7 @@
</style>
<script src="../js/widgets/widget-reflow.js"></script>
<script>
$(function(){
$(function() {
$('#table1').resizable({
handles : 'e'
});

View File

@ -30,7 +30,7 @@
});
$('button').click(function(){
$('button').click(function() {
$('table')
.trigger('saveSortReset') // clear saved sort
.trigger("sortReset"); // reset current table sort

View File

@ -80,7 +80,7 @@
</style>
<script src="js/jquery.jui_theme_switch.min.js"></script>
<script>
$(function(){
$(function() {
$('#switcher').jui_theme_switch({
stylesheet_link_id : 'ui-theme',
switcher_label : 'Select jQuery UI Theme:',
@ -89,7 +89,7 @@
});
});
</script>
<script id="js">$(function(){
<script id="js">$(function() {
$('.tablesorter').tablesorter({
theme: 'jui',
@ -168,7 +168,7 @@ $(function() {
$('#theme')
.append(o)
.val('jui')
.change(function(){
.change(function() {
var theme = $(this).val().toLowerCase();
// show jui select only if jQuery UI selected
@ -177,7 +177,7 @@ $(function() {
$('#main').attr( 'class', 'using-' + theme + '-theme' );
// refresh uitheme widget class names
$('#main .tablesorter').each(function(){
$('#main .tablesorter').each(function() {
if (this.config) {
this.config.theme = theme === 'black-ice' ? 'blackice' : theme;
}
@ -188,7 +188,7 @@ $(function() {
$(window).trigger('resize');
}).change();
$('button').click(function(){
$('button').click(function() {
var jth = $jth.text() === 'true',
uas = $uas.text() === 'true';
if (this.id === 'jthb') {
@ -196,7 +196,7 @@ $(function() {
} else {
uas = !uas;
}
$('.tablesorter-scroller-table table').each(function(){
$('.tablesorter-scroller-table table').each(function() {
var c = this.config;
if (c) {
c.widgetOptions.scroller_jumpToHeader = jth;

View File

@ -43,7 +43,7 @@
widgets: ['zebra', 'staticRow']
})
// (ctrl or mac command) + click to toggle static row
.find('tbody tr').click(function(event){
.find('tbody tr').click(function(event) {
if (event.ctrlKey || event.metaKey) {
$(this)
.toggleClass('static')
@ -51,14 +51,14 @@
}
});
$('.addrow').click(function(){
$('.addrow').click(function() {
$('#alphimals tbody')
.append('<tr><td>AA</td><td>0</td><td>Aardvark</td></tr>')
.trigger('update');
});
// move row up or down
$('.move').click(function(){
$('.move').click(function() {
var direction = $(this).hasClass('up'),
$rows = $('#alphimals tr'),
$ig = $rows.filter(':contains(Iguana)').addClass('static'),
@ -179,7 +179,7 @@ $(table).trigger('staticRowsRefresh');</pre>
this allows moving a static row dynamically; try the Move "Ignuana" row buttons above the "Single tbody" demo.
<h3>Event</h3>
A <code>staticRowsComplete</code> event is triggered after the static rows widget has completed moving the static rows back into place. Use it as follows:
<pre class="prettyprint lang-js">$(table).bind('staticRowsComplete', function(table){
<pre class="prettyprint lang-js">$(table).bind('staticRowsComplete', function(table) {
console.log('static rows applied to ' + table.id);
});</pre>
</div>

View File

@ -61,7 +61,7 @@ Note:
<script src="../js/widgets/widget-filter.js"></script>
<script src="../js/widgets/widget-stickyHeaders.js"></script>
<script id="js">$(function(){
<script id="js">$(function() {
$('.open-popup-link').magnificPopup({
type: 'inline',
@ -145,10 +145,10 @@ Note:
$(function() {
window.includeCaption = true;
$('.caption').on('click', function(){
$('.caption').on('click', function() {
includeCaption = !includeCaption;
$(this).html( '' + includeCaption );
$('#table0, #table1, #table2, #table3, .nested').each(function(){
$('#table0, #table1, #table2, #table3, .nested').each(function() {
if (this.config) {
this.config.widgetOptions.stickyHeaders_includeCaption = includeCaption;
this.config.widgetOptions.$sticky.children('caption').toggle(includeCaption);
@ -157,7 +157,7 @@ $(function() {
});
// removed jQuery UI theme because of the accordion!
$('link.theme').each(function(){ this.disabled = true; });
$('link.theme').each(function() { this.disabled = true; });
var themes = 'blue default green grey ice black-ice dark dropbox metro-dark',
i, o = '', t = themes.split(' ');
@ -167,13 +167,13 @@ $(function() {
$('select:first')
.append(o)
.change(function(){
.change(function() {
var theme = $(this).val().toLowerCase(),
// ui-theme is added by the themeswitcher
files = $('link.theme').each(function(){
files = $('link.theme').each(function() {
this.disabled = true;
})
files.filter('.' + theme).each(function(){
files.filter('.' + theme).each(function() {
this.disabled = false;
});
$('table')

View File

@ -85,7 +85,7 @@
});</script>
<script>
$(function(){
$(function() {
$('#switcher').jui_theme_switch({
stylesheet_link_id : 'ui-theme',
default_theme : 'cupertino',

View File

@ -725,7 +725,7 @@ html[xmlns] .clearfix {
</div>
<script id="js">$(function(){
<script id="js">$(function() {
/* Initial settings */
var template = '<li class="clearfix">' +
'<section class="left">{col0}' +
@ -786,7 +786,7 @@ html[xmlns] .clearfix {
});</script>
<script>
$(function(){
$(function() {
$('[data-toggle="tooltip"]').tooltip();
});
</script>

View File

@ -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 @@ $.tablesorter.addWidget({
},
// 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 @@ $.tablesorter.addWidget({
// 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

File diff suppressed because it is too large Load Diff

View File

@ -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} = <i/> // 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

View File

@ -1,6 +1,6 @@
/*! Parser: Extract out date - updated 10/26/2014 (v2.18.0) */
/*jshint jquery:true */
;(function($){
;(function($) {
'use strict';
var regex = {

View File

@ -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})))?)?)?)?$/;

View File

@ -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;

View File

@ -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,

View File

@ -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

View File

@ -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;

View File

@ -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) */

View File

@ -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

View File

@ -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

View File

@ -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;

Some files were not shown because too many files have changed in this diff Show More