mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Global: Add editor eslint & fix issues
This commit is contained in:
parent
aa113834db
commit
03eeb2e819
5
.eslintignore
Normal file
5
.eslintignore
Normal file
@ -0,0 +1,5 @@
|
||||
_test*.js
|
||||
*.min.js
|
||||
*mod.js
|
||||
*.metadata.js
|
||||
semver.js
|
31
.eslintrc
Normal file
31
.eslintrc
Normal 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
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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},
|
||||
@ -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 );
|
||||
|
||||
@ -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 ),
|
||||
@ -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 ||
|
||||
@ -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();
|
||||
})
|
||||
|
@ -5,7 +5,7 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($) {
|
||||
"use strict";
|
||||
'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;
|
||||
@ -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) );
|
||||
|
@ -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 = {
|
||||
@ -297,7 +297,7 @@
|
||||
|
||||
<div class="next-up">
|
||||
<hr />
|
||||
Next up: <a href="example-widget-resizable.html">Resizable Columns widget ››</a>
|
||||
Next up: <a href="example-widget-vertical-group.html">Vertical group widget ››</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -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,
|
||||
|
@ -686,8 +686,7 @@ $(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
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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;
|
||||
@ -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 ),
|
||||
|
@ -6,7 +6,7 @@
|
||||
;( function( $ ) {
|
||||
'use strict';
|
||||
|
||||
var updateServer = function( event, $table, $input ) {
|
||||
var updateServer = function( /* event, $table, $input */ ) {
|
||||
// do something here to update your server, if needed
|
||||
// event = change event object
|
||||
// $table = jQuery object of the table that was just updated
|
||||
|
@ -18,6 +18,7 @@
|
||||
str = number.toString();
|
||||
if (
|
||||
!isNaN( number ) &&
|
||||
// eslint-disable-next-line eqeqeq
|
||||
number == val && // jshint ignore:line
|
||||
val.length !== str.length
|
||||
) {
|
||||
|
@ -53,7 +53,7 @@
|
||||
address = address.replace( ts.regex.ipv4Extract, t );
|
||||
}
|
||||
|
||||
if (address.indexOf('::') == -1) {
|
||||
if (address.indexOf('::') === -1) {
|
||||
// All eight groups are present
|
||||
fullAddress = address;
|
||||
} else {
|
||||
@ -74,7 +74,7 @@
|
||||
// it's fastest & easiest for tablesorter to sort decimal values (vs hex)
|
||||
groups[i] = hex ? ('0000' + groups[i]).slice(-4) :
|
||||
('00000' + (parseInt(groups[i], 16) || 0)).slice(-5);
|
||||
expandedAddress += ( i != validGroupCount - 1) ? groups[i] + ':' : groups[i];
|
||||
expandedAddress += ( i !== validGroupCount - 1) ? groups[i] + ':' : groups[i];
|
||||
}
|
||||
return expandedAddress;
|
||||
},
|
||||
|
@ -86,7 +86,7 @@
|
||||
format: function(s) {
|
||||
var val,
|
||||
// find roman numerals
|
||||
roman = $.grep(s.split(/\b/), function(v, i){
|
||||
roman = $.grep(s.split(/\b/), function(v) {
|
||||
return validator.test(v) ? v : '';
|
||||
}).join('').match(matcher),
|
||||
|
||||
|
@ -208,10 +208,12 @@
|
||||
// hidden input changes may include compare symbols
|
||||
v = ( typeof v === 'undefined' ? $input.val() : v ).toString().replace(/[<>=]/g, '') || o.value;
|
||||
var compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '',
|
||||
// eslint-disable-next-line eqeqeq
|
||||
t = ' (' + (compare ? compare + v : v == o.min ? o.allText : v) + ')',
|
||||
searchType = c.$table[0].hasInitialized ? (delayed ? delayed : o.delayed) || '' : true;
|
||||
$cell.find('input[type=hidden]')
|
||||
// add equal to the beginning, so we filter exact numbers
|
||||
// eslint-disable-next-line eqeqeq
|
||||
.val( ( compare ? compare + v : ( v == o.min ? '' : ( o.exactMatch ? '=' : '' ) + v ) ) )
|
||||
// ( val == o.min ? '' : val + (o.exactMatch ? '=' : ''))
|
||||
.trigger( notrigger ? '' : 'search', searchType ).end()
|
||||
@ -242,6 +244,7 @@
|
||||
var v = this.value,
|
||||
compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '';
|
||||
if (v !== this.lastValue) {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
this.lastValue = ( compare ? compare + v : ( v == o.min ? '' : ( o.exactMatch ? '=' : '' ) + v ) );
|
||||
this.value = this.lastValue;
|
||||
updateRange( v );
|
||||
|
@ -280,6 +280,7 @@
|
||||
if ( tsfRegex.exact.test( data.iFilter ) ) {
|
||||
var txt = data.iFilter.replace( tsfRegex.exact, '' ),
|
||||
filter = tsf.parseFilter( c, txt, data ) || '';
|
||||
// eslint-disable-next-line eqeqeq
|
||||
return data.anyMatch ? $.inArray( filter, data.rowArray ) >= 0 : filter == data.iExact;
|
||||
}
|
||||
return null;
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
types : {
|
||||
number : function(c, $column, txt, num) {
|
||||
var word, result,
|
||||
var result,
|
||||
ascSort = $column.hasClass( ts.css.sortAsc );
|
||||
if ( num > 1 && txt !== '' ) {
|
||||
if ( ascSort ) {
|
||||
@ -43,7 +43,7 @@
|
||||
letter : function(c, $column, txt, num) {
|
||||
return txt ? (txt + ' ').substring(0, num) : '';
|
||||
},
|
||||
date : function(c, $column, txt, part, group) {
|
||||
date : function(c, $column, txt, part) {
|
||||
var year, month,
|
||||
wo = c.widgetOptions,
|
||||
time = new Date(txt || '');
|
||||
@ -203,7 +203,7 @@
|
||||
return savedGroup;
|
||||
},
|
||||
findColumnGroups : function( c, wo, data ) {
|
||||
var tbodyIndex, norm_rows, $row, rowIndex, end, undef,
|
||||
var tbodyIndex, norm_rows, rowIndex, end, undef,
|
||||
hasPager = ts.hasWidget( c.table, 'pager' ),
|
||||
p = c.pager || {};
|
||||
data.groupIndex = 0;
|
||||
@ -259,7 +259,7 @@
|
||||
event.stopPropagation();
|
||||
// pressing enter will toggle the group
|
||||
if (event.type === 'keyup' && event.which !== 13) { return; }
|
||||
var isCollapsed, $groups, indx,
|
||||
var isCollapsed, indx,
|
||||
$this = $(this),
|
||||
name = $this.find('.group-name').text().toLowerCase() + $this.attr('data-group-index');
|
||||
// use shift-click to toggle ALL groups
|
||||
@ -276,7 +276,6 @@
|
||||
}
|
||||
// save collapsed groups
|
||||
if (wo.group_saveGroups && ts.storage) {
|
||||
$groups = c.$table.find('.group-header');
|
||||
if (!wo.group_collapsedGroups[wo.group_collapsedGroup]) {
|
||||
wo.group_collapsedGroups[wo.group_collapsedGroup] = [];
|
||||
}
|
||||
@ -347,10 +346,10 @@
|
||||
init: function(table, thisWidget, c, wo) {
|
||||
tsg.bindEvents(table, c, wo);
|
||||
},
|
||||
format: function(table, c, wo) {
|
||||
format: function(table) {
|
||||
tsg.update(table);
|
||||
},
|
||||
remove : function(table, c, wo){
|
||||
remove : function(table, c) {
|
||||
c.$table
|
||||
.off('click', 'tr.group-header')
|
||||
.off('pagerChange.tsgrouping')
|
||||
|
@ -52,8 +52,7 @@
|
||||
format: function (table, c, wo) {
|
||||
var txt;
|
||||
c.$headers.each(function() {
|
||||
var t = this,
|
||||
$this = $(this),
|
||||
var $this = $(this),
|
||||
col = parseInt( $this.attr( 'data-column' ), 10 ),
|
||||
sortType = wo.headerTitle_type[ col ] || c.parsers[ col ].type || 'text',
|
||||
sortDirection = $this.hasClass(ts.css.sortAsc) ? 0 : $this.hasClass(ts.css.sortDesc) ? 1 : 2,
|
||||
|
@ -51,7 +51,7 @@
|
||||
$(window).scroll();
|
||||
}, 1);
|
||||
},
|
||||
remove : function( c, wo ) {
|
||||
remove : function( c ) {
|
||||
c.$table.off( c.namespace + 'lazyload' );
|
||||
}
|
||||
};
|
||||
@ -200,26 +200,26 @@
|
||||
var settings = {
|
||||
threshold : 0,
|
||||
failure_limit : 0,
|
||||
event : "scroll",
|
||||
effect : "show",
|
||||
event : 'scroll',
|
||||
effect : 'show',
|
||||
container : window,
|
||||
data_attribute : "original",
|
||||
data_attribute : 'original',
|
||||
skip_invisible : false,
|
||||
appear : null,
|
||||
load : null,
|
||||
placeholder : "data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
|
||||
placeholder : 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='
|
||||
};
|
||||
function update() {
|
||||
var counter = 0;
|
||||
elements.each(function() {
|
||||
var $this = $(this);
|
||||
if (settings.skip_invisible && !$this.is(":visible")) {
|
||||
if (settings.skip_invisible && !$this.is(':visible')) {
|
||||
return;
|
||||
}
|
||||
if ($.abovethetop(this, settings) || $.leftofbegin(this, settings)) {
|
||||
/* Nothing. */
|
||||
} else if (!$.belowthefold(this, settings) && !$.rightoffold(this, settings)) {
|
||||
$this.trigger("appear");
|
||||
$this.trigger('appear');
|
||||
/* if we found an image we'll load, reset the counter */
|
||||
counter = 0;
|
||||
} else {
|
||||
@ -245,7 +245,7 @@
|
||||
$container = (settings.container === undefined ||
|
||||
settings.container === window) ? $window : $(settings.container);
|
||||
/* Fire one scroll event per scroll. Not one scroll event per image. */
|
||||
if (0 === settings.event.indexOf("scroll")) {
|
||||
if (0 === settings.event.indexOf('scroll')) {
|
||||
$container.bind(settings.event, function() {
|
||||
return update();
|
||||
});
|
||||
@ -255,26 +255,26 @@
|
||||
var $self = $(self);
|
||||
self.loaded = false;
|
||||
/* If no src attribute given use data:uri. */
|
||||
if ($self.attr("src") === undefined || $self.attr("src") === false) {
|
||||
if ($self.is("img")) {
|
||||
$self.attr("src", settings.placeholder);
|
||||
if ($self.attr('src') === undefined || $self.attr('src') === false) {
|
||||
if ($self.is('img')) {
|
||||
$self.attr('src', settings.placeholder);
|
||||
}
|
||||
}
|
||||
/* When appear is triggered load original image. */
|
||||
$self.one("appear", function() {
|
||||
$self.one('appear', function() {
|
||||
if (!this.loaded) {
|
||||
if (settings.appear) {
|
||||
var elements_left = elements.length;
|
||||
settings.appear.call(self, elements_left, settings);
|
||||
}
|
||||
$("<img />")
|
||||
.bind("load", function() {
|
||||
var original = $self.attr("data-" + settings.data_attribute);
|
||||
$('<img />')
|
||||
.bind('load', function() {
|
||||
var original = $self.attr('data-' + settings.data_attribute);
|
||||
$self.hide();
|
||||
if ($self.is("img")) {
|
||||
$self.attr("src", original);
|
||||
if ($self.is('img')) {
|
||||
$self.attr('src', original);
|
||||
} else {
|
||||
$self.css("background-image", "url('" + original + "')");
|
||||
$self.css('background-image', 'url("' + original + '")');
|
||||
}
|
||||
$self[settings.effect](settings.effect_speed);
|
||||
self.loaded = true;
|
||||
@ -288,30 +288,30 @@
|
||||
settings.load.call(self, elements_left, settings);
|
||||
}
|
||||
})
|
||||
.attr("src", $self.attr("data-" + settings.data_attribute));
|
||||
.attr('src', $self.attr('data-' + settings.data_attribute));
|
||||
}
|
||||
});
|
||||
/* When wanted event is triggered load original image */
|
||||
/* by triggering appear. */
|
||||
if (0 !== settings.event.indexOf("scroll")) {
|
||||
if (0 !== settings.event.indexOf('scroll')) {
|
||||
$self.bind(settings.event, function() {
|
||||
if (!self.loaded) {
|
||||
$self.trigger("appear");
|
||||
$self.trigger('appear');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
/* Check if something appears when window is resized. */
|
||||
$window.bind("resize", function() {
|
||||
$window.bind('resize', function() {
|
||||
update();
|
||||
});
|
||||
/* With IOS5 force loading images when navigating with back button. */
|
||||
/* Non optimal workaround. */
|
||||
if ((/(?:iphone|ipod|ipad).*os 5/gi).test(navigator.appVersion)) {
|
||||
$window.bind("pageshow", function(event) {
|
||||
$window.bind('pageshow', function(event) {
|
||||
if (event.originalEvent && event.originalEvent.persisted) {
|
||||
elements.each(function() {
|
||||
$(this).trigger("appear");
|
||||
$(this).trigger('appear');
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -365,17 +365,17 @@
|
||||
!$.belowthefold(element, settings) && !$.abovethetop(element, settings);
|
||||
};
|
||||
/* Custom selectors for your convenience. */
|
||||
/* Use as $("img:below-the-fold").something() or */
|
||||
/* $("img").filter(":below-the-fold").something() which is faster */
|
||||
$.extend($.expr[":"], {
|
||||
"below-the-fold" : function(a) { return $.belowthefold(a, {threshold : 0}); },
|
||||
"above-the-top" : function(a) { return !$.belowthefold(a, {threshold : 0}); },
|
||||
"right-of-screen": function(a) { return $.rightoffold(a, {threshold : 0}); },
|
||||
"left-of-screen" : function(a) { return !$.rightoffold(a, {threshold : 0}); },
|
||||
"in-viewport" : function(a) { return $.inviewport(a, {threshold : 0}); },
|
||||
/* Use as $('img:below-the-fold').something() or */
|
||||
/* $('img').filter(':below-the-fold').something() which is faster */
|
||||
$.extend($.expr[':'], {
|
||||
'below-the-fold' : function(a) { return $.belowthefold(a, {threshold : 0}); },
|
||||
'above-the-top' : function(a) { return !$.belowthefold(a, {threshold : 0}); },
|
||||
'right-of-screen': function(a) { return $.rightoffold(a, {threshold : 0}); },
|
||||
'left-of-screen' : function(a) { return !$.rightoffold(a, {threshold : 0}); },
|
||||
'in-viewport' : function(a) { return $.inviewport(a, {threshold : 0}); },
|
||||
/* Maintain BC for couple of versions. */
|
||||
"above-the-fold" : function(a) { return !$.belowthefold(a, {threshold : 0}); },
|
||||
"right-of-fold" : function(a) { return $.rightoffold(a, {threshold : 0}); },
|
||||
"left-of-fold" : function(a) { return !$.rightoffold(a, {threshold : 0}); }
|
||||
'above-the-fold' : function(a) { return !$.belowthefold(a, {threshold : 0}); },
|
||||
'right-of-fold' : function(a) { return $.rightoffold(a, {threshold : 0}); },
|
||||
'left-of-fold' : function(a) { return !$.rightoffold(a, {threshold : 0}); }
|
||||
});
|
||||
})(jQuery, window, document);
|
||||
|
@ -171,7 +171,6 @@
|
||||
if ( hasFilter || !$row.hasClass( filtered ) ) {
|
||||
$cells = $row.children().not( mathIgnore );
|
||||
cellLen = $cells.length;
|
||||
// $row.children().each(function(){
|
||||
for ( cellIndex = 0; cellIndex < cellLen; cellIndex++ ) {
|
||||
$t = $cells.eq( cellIndex );
|
||||
col = math.getCellIndex( $t );
|
||||
@ -221,7 +220,7 @@
|
||||
recalculate : function(c, wo, init) {
|
||||
if ( c && ( !wo.math_isUpdating || init ) ) {
|
||||
|
||||
var undef, time, mathAttr, $mathCells, indx, len,
|
||||
var time, mathAttr, $mathCells, indx, len,
|
||||
changed = false,
|
||||
filters = {};
|
||||
if ( c.debug || wo.math_debug ) {
|
||||
@ -435,7 +434,7 @@
|
||||
mask = mask.substring( start, index );
|
||||
|
||||
// convert any string to number according to formation sign.
|
||||
val = mask.charAt( 0 ) == '-' ? -val : +val;
|
||||
val = mask.charAt( 0 ) === '-' ? -val : +val;
|
||||
isNegative = val < 0 ? val = -val : 0; // process only abs(), and turn on flag.
|
||||
|
||||
// search for separator for grp & decimal, anything not digit, not +/- sign, not #.
|
||||
@ -606,7 +605,7 @@
|
||||
// complete executed after each fucntion
|
||||
math_complete : null, // function($cell, wo, result, value, arry) { return result; },
|
||||
// math_completed called after all math calculations have completed
|
||||
math_completed: function( config ) {},
|
||||
math_completed: function( /* config */ ) {},
|
||||
// order of calculation; 'all' is last
|
||||
math_priority : [ 'row', 'above', 'below', 'col' ],
|
||||
// template for or just prepend the mask prefix & suffix with this HTML
|
||||
|
@ -164,8 +164,9 @@
|
||||
headers = output.processRow(c, $this, true, outputJSON);
|
||||
|
||||
// all tbody rows - do not include widget added rows (e.g. grouping widget headers)
|
||||
if ( !$rows )
|
||||
if ( !$rows ) {
|
||||
$rows = $el.children('tbody').children('tr').not(c.selectorRemove);
|
||||
}
|
||||
|
||||
// check for a filter callback function first! because
|
||||
// /^f/.test(function() { console.log('test'); }) is TRUE! (function is converted to a string)
|
||||
@ -414,7 +415,7 @@
|
||||
// callback executed when processing completes
|
||||
// return true to continue download/output
|
||||
// return false to stop delivery & do something else with the data
|
||||
output_callback : function(config, data){ return true; },
|
||||
output_callback : function(/* config, data */) { return true; },
|
||||
// JSON callback executed when a colspan is encountered in the header
|
||||
output_callbackJSON : function($cell, txt, cellIndex) { return txt + '(' + (cellIndex) + ')'; },
|
||||
// the need to modify this for Excel no longer exists
|
||||
|
@ -1352,9 +1352,10 @@
|
||||
}
|
||||
|
||||
// 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();
|
||||
})
|
||||
|
@ -188,7 +188,7 @@
|
||||
},
|
||||
|
||||
setup : function( c, wo ) {
|
||||
var tbHt, $hdr, $t, $hCells, $fCells, $tableWrap, events, tmp, detectedWidth,
|
||||
var tbHt, $hdr, $t, $hCells, $tableWrap, events, tmp, detectedWidth,
|
||||
$win = $( window ),
|
||||
tsScroller = ts.scroller,
|
||||
namespace = c.namespace + 'tsscroller',
|
||||
@ -228,7 +228,6 @@
|
||||
// maintain any bindings on the tfoot cells
|
||||
.append( $t.clone( true ) )
|
||||
.wrap( '<div class="' + tscss.scrollerFooter + '"/>' );
|
||||
$fCells = $foot.children( 'tfoot' ).eq( 0 ).children( 'tr' ).children();
|
||||
}
|
||||
wo.scroller_$footer = $foot;
|
||||
|
||||
|
@ -237,7 +237,7 @@
|
||||
var baseUrl = window.location.href.split(hashChar)[0];
|
||||
// Ensure that there is a leading hash character
|
||||
var firstChar = newHash[0];
|
||||
if (firstChar != hashChar) {
|
||||
if (firstChar !== hashChar) {
|
||||
newHash = hashChar + newHash;
|
||||
}
|
||||
// Update URL in browser
|
||||
|
@ -230,7 +230,7 @@
|
||||
init : function( table, thisWidget, c, wo ) {
|
||||
ts.sortTbodies.init( c, wo );
|
||||
},
|
||||
remove : function( table, c, wo, refreshing ) {
|
||||
remove : function( table, c, wo ) {
|
||||
c.$table.unbind( 'sortBegin updateComplete '.split( ' ' ).join( c.namespace + 'sortTbody ' ) );
|
||||
c.serverSideSorting = wo.sortTbody_original_serverSideSorting;
|
||||
c.cssInfoBlock = wo.sortTbody_original_cssInfoBlock;
|
||||
|
@ -37,7 +37,7 @@
|
||||
.addClass( wo.zebra[ indx % 2] );
|
||||
}
|
||||
|
||||
function verticalGroup( table, c, wo, init ) {
|
||||
function verticalGroup( table, c, wo ) {
|
||||
// -------------------------------------------------------------------------
|
||||
// loop thru the header row,
|
||||
// - look for .vertical-group
|
||||
@ -69,10 +69,8 @@
|
||||
// - the border-color needs to be the same
|
||||
//
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
var tmp,
|
||||
zebra_index = -1, // increments at start of loop
|
||||
var zebra_index = -1, // increments at start of loop
|
||||
rows = table.tBodies[0].rows,
|
||||
header = table.tHead.rows,
|
||||
has_zebra = ts.hasWidget( table, 'zebra'),
|
||||
is_vertical_group_col = [],
|
||||
last_row = [];
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
$.each(wo.view_layouts, function(k, v) {
|
||||
var classes = wo.view_switcher_class;
|
||||
if (k == wo.view_layout) {
|
||||
if (k === wo.view_layout) {
|
||||
classes += ' active';
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@
|
||||
|
||||
var $tmpl = $(tmpl);
|
||||
$.each(data.$row[0].attributes, function(idx, attr) {
|
||||
if (attr.nodeName == 'class') {
|
||||
if (attr.nodeName === 'class') {
|
||||
$tmpl.attr(attr.nodeName, $tmpl.attr(attr.nodeName) + ' ' + attr.nodeValue);
|
||||
} else {
|
||||
$tmpl.attr(attr.nodeName, attr.nodeValue);
|
||||
@ -125,7 +125,7 @@
|
||||
$(wo.view_container).empty();
|
||||
},
|
||||
|
||||
hideTable: function(c, wo) {
|
||||
hideTable: function(c) {
|
||||
tpos = c.$table.css('position');
|
||||
ttop = c.$table.css('bottom');
|
||||
tleft = c.$table.css('left');
|
||||
|
@ -39,7 +39,8 @@
|
||||
"url": "git://github.com/Mottie/tablesorter.git"
|
||||
},
|
||||
"scripts": {
|
||||
"authors": "bash testing/authors.sh"
|
||||
"authors": "bash testing/authors.sh",
|
||||
"eslint": "eslint --color Gruntfile.js js/jquery.tablesorter.js js/parsers/* js/widgets/*"
|
||||
},
|
||||
"npmName": "tablesorter",
|
||||
"npmFileMap": [
|
||||
|
Loading…
Reference in New Issue
Block a user