mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Build: Add jscs checking & fix style issues
Thanks @Herst!
This commit is contained in:
parent
bd296c844f
commit
75de112ef6
65
.jscsrc
Normal file
65
.jscsrc
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"disallowDanglingUnderscores": true,
|
||||
"disallowEmptyBlocks": true,
|
||||
"disallowKeywords": [
|
||||
"with"
|
||||
],
|
||||
"disallowMixedSpacesAndTabs": "smart",
|
||||
"disallowMultipleLineBreaks": true,
|
||||
"disallowMultipleLineStrings": true,
|
||||
"disallowNewlineBeforeBlockStatements": true,
|
||||
"disallowOperatorBeforeLineBreak": [
|
||||
"."
|
||||
],
|
||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||
"disallowSpaceBeforeBinaryOperators": [
|
||||
","
|
||||
],
|
||||
"disallowSpaceBeforePostfixUnaryOperators": true,
|
||||
"disallowSpacesInCallExpression": true,
|
||||
|
||||
"disallowTrailingComma": true,
|
||||
"maximumLineLength": {
|
||||
"allowRegex": true,
|
||||
"allowUrlComments": true,
|
||||
"tabSize": 2,
|
||||
"value": 180
|
||||
},
|
||||
"requireBlocksOnNewline": 1,
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
"requireCurlyBraces": [
|
||||
"do"
|
||||
],
|
||||
"requireDollarBeforejQueryAssignment": true,
|
||||
"requireDotNotation": true,
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
"requireSemicolons": true,
|
||||
"requireSpaceAfterBinaryOperators": true,
|
||||
"requireSpaceAfterKeywords": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"switch",
|
||||
"case",
|
||||
"return",
|
||||
"try",
|
||||
"catch",
|
||||
"typeof"
|
||||
],
|
||||
"requireSpaceAfterLineComment": true,
|
||||
"requireSpaceBeforeBinaryOperators": true,
|
||||
"requireSpacesInConditionalExpression": true,
|
||||
"requireSpacesInForStatement": true,
|
||||
"requireSpacesInsideArrayBrackets": "all",
|
||||
"validateIndentation": {
|
||||
"includeEmptyLines": false,
|
||||
"value": "\t"
|
||||
},
|
||||
"validateQuoteMarks": {
|
||||
"escape": true,
|
||||
"mark": "'"
|
||||
}
|
||||
}
|
23
Gruntfile.js
23
Gruntfile.js
@ -209,6 +209,26 @@ module.exports = function( grunt ) {
|
||||
}
|
||||
},
|
||||
|
||||
jscs: {
|
||||
src: [
|
||||
'addons/pager/*.js',
|
||||
'!addons/pager/*.min.js',
|
||||
'js/jquery.*.js',
|
||||
'js/**/*.js',
|
||||
'!js/_test-*.js',
|
||||
'!js/jquery.tablesorter.combined.js',
|
||||
'!js/jquery.tablesorter.widgets.js',
|
||||
'!js/extras/jquery.dragtable.mod.js', // indents with spaces; keeping original formatting to make diffs easier
|
||||
'!js/extras/jquery.metadata.js', // phasing this one out anyway
|
||||
'!js/**/_test-*.js',
|
||||
'!js/*.min.js',
|
||||
'!js/**/semver*.js'
|
||||
],
|
||||
options: {
|
||||
config: '.jscsrc'
|
||||
}
|
||||
},
|
||||
|
||||
jshint: {
|
||||
files: {
|
||||
src: [
|
||||
@ -317,8 +337,9 @@ module.exports = function( grunt ) {
|
||||
grunt.loadNpmTasks( 'grunt-contrib-copy' );
|
||||
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
||||
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
|
||||
grunt.loadNpmTasks( 'grunt-jscs' );
|
||||
|
||||
grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );
|
||||
grunt.registerTask( 'test', [ 'jscs', 'jshint', 'qunit' ] );
|
||||
|
||||
tasks = [
|
||||
'clean:build',
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function($) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
/*jshint supernew:true */
|
||||
var ts = $.tablesorter;
|
||||
|
||||
@ -176,13 +176,13 @@
|
||||
// form the output string (can now get a new output string from the server)
|
||||
s = ( p.ajaxData && p.ajaxData.output ? p.ajaxData.output || p.output : p.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){
|
||||
var len, indx,
|
||||
str = m.replace(/[{}\s]/g,''),
|
||||
str = m.replace(/[{}\s]/g, ''),
|
||||
extra = str.split(':'),
|
||||
data = p.ajaxData,
|
||||
// return zero for default page/row numbers
|
||||
@ -209,7 +209,7 @@
|
||||
// rebind startRow/page inputs
|
||||
$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/p.size ) + 1 : v;
|
||||
pg = $(this).hasClass('ts-startRow') ? Math.floor( v / p.size ) + 1 : v;
|
||||
c.$table.trigger('pageSet' + namespace, [ pg ]);
|
||||
});
|
||||
}
|
||||
@ -242,7 +242,7 @@
|
||||
current_page = p.page + 1,
|
||||
start_page = skip_set_size,
|
||||
end_page = pg - skip_set_size,
|
||||
option_pages = [1],
|
||||
option_pages = [ 1 ],
|
||||
// construct default options pages array
|
||||
option_pages_start_page = (large_collection) ? skip_set_size : 1;
|
||||
|
||||
@ -286,7 +286,7 @@
|
||||
option_pages = $.grep(option_pages, function(value, indx) {
|
||||
return $.inArray(value, option_pages) === indx;
|
||||
})
|
||||
.sort(function(a,b) { return a - b; });
|
||||
.sort(function(a, b) { return a - b; });
|
||||
|
||||
return option_pages;
|
||||
},
|
||||
@ -376,7 +376,7 @@
|
||||
|
||||
renderAjax = function(data, table, p, xhr, exception){
|
||||
// process data
|
||||
if ( typeof(p.ajaxProcessing) === "function" ) {
|
||||
if ( typeof p.ajaxProcessing === 'function' ) {
|
||||
// ajaxProcessing result: [ total, rows, headers ]
|
||||
var i, j, t, hsh, $f, $sh, $headers, $h, icon, th, d, l, rr_count, len,
|
||||
c = table.config,
|
||||
@ -483,7 +483,7 @@
|
||||
p.last.currentFilters = p.currentFilters;
|
||||
p.last.sortList = (c.sortList || []).join(',');
|
||||
updatePageDisplay(table, p, false);
|
||||
$table.trigger('updateCache', [function(){
|
||||
$table.trigger('updateCache', [ function(){
|
||||
if (p.initialized) {
|
||||
// apply widgets after table has rendered & after a delay to prevent
|
||||
// multiple applyWidget blocking code from blocking this trigger
|
||||
@ -497,7 +497,7 @@
|
||||
updatePageDisplay(table, p, true);
|
||||
}, 0);
|
||||
}
|
||||
}]);
|
||||
} ]);
|
||||
|
||||
}
|
||||
if (!p.initialized) {
|
||||
@ -555,7 +555,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); })
|
||||
.replace(/\{size\}/g, p.size) : '',
|
||||
sortList = c.sortList,
|
||||
filterList = p.currentFilters || $(table).data('lastSearch') || [],
|
||||
@ -584,7 +584,7 @@
|
||||
url = url.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g, arry.length ? arry.join('&') : filterCol );
|
||||
p.currentFilters = filterList;
|
||||
}
|
||||
if ( typeof(p.customAjaxUrl) === "function" ) {
|
||||
if ( typeof p.customAjaxUrl === 'function' ) {
|
||||
url = p.customAjaxUrl(table, url);
|
||||
}
|
||||
if (c.debug) {
|
||||
@ -940,13 +940,13 @@
|
||||
changeHeight(table, p);
|
||||
updatePageDisplay(table, p, true);
|
||||
})
|
||||
.bind('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e,v){
|
||||
.bind('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e, v){
|
||||
e.stopPropagation();
|
||||
setPageSize(table, parseInt(v, 10) || p.settings.size || 10, p);
|
||||
hideRows(table, p);
|
||||
updatePageDisplay(table, p, false);
|
||||
})
|
||||
.bind('pageSet pagerUpdate '.split(' ').join(namespace + ' '), function(e,v){
|
||||
.bind('pageSet pagerUpdate '.split(' ').join(namespace + ' '), function(e, v){
|
||||
e.stopPropagation();
|
||||
// force pager refresh
|
||||
if (e.type === 'pagerUpdate') {
|
||||
@ -973,7 +973,7 @@
|
||||
ts.log('Pager: >> Container not found');
|
||||
}
|
||||
pager.find(ctrls.join(','))
|
||||
.attr("tabindex", 0)
|
||||
.attr('tabindex', 0)
|
||||
.unbind('click' + namespace)
|
||||
.bind('click' + namespace, function(e){
|
||||
e.stopPropagation();
|
||||
@ -1024,17 +1024,18 @@
|
||||
$t.trigger('pagerBeforeInitialized', p);
|
||||
|
||||
enablePager(table, p, false);
|
||||
if ( typeof(p.ajaxUrl) === 'string' ) {
|
||||
if ( typeof p.ajaxUrl === 'string' ) {
|
||||
// ajax pager; interact with database
|
||||
p.ajax = true;
|
||||
//When filtering with ajax, allow only custom filtering function, disable default filtering since it will be done server side.
|
||||
// When filtering with ajax, allow only custom filtering function, disable default
|
||||
// filtering since it will be done server side.
|
||||
c.widgetOptions.filter_serversideFiltering = true;
|
||||
c.serverSideSorting = true;
|
||||
moveToPage(table, p);
|
||||
} else {
|
||||
p.ajax = false;
|
||||
// Regular pager; all rows stored in memory
|
||||
$(this).trigger("appendCache", true);
|
||||
$(this).trigger('appendCache', true);
|
||||
hideRowsSetup(table, p);
|
||||
}
|
||||
|
||||
@ -1087,9 +1088,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
// extend plugin scope
|
||||
$.fn.extend({
|
||||
// extend plugin scope
|
||||
$.fn.extend({
|
||||
tablesorterPager: $.tablesorterPager.construct
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
327
dist/js/jquery.tablesorter.combined.js
vendored
327
dist/js/jquery.tablesorter.combined.js
vendored
@ -200,7 +200,7 @@
|
||||
// node could be a jquery object
|
||||
// http://jsperf.com/jquery-vs-instanceof-jquery/2
|
||||
$node = node.jquery ? node : $(node);
|
||||
if (typeof(t) === 'string') {
|
||||
if (typeof t === 'string') {
|
||||
// check data-attribute first when set to 'basic'; don't use node.innerText - it's really slow!
|
||||
// http://www.kellegous.com/j/2013/02/27/innertext-vs-textcontent/
|
||||
if ( t === 'basic' && typeof ( te = $node.attr(c.textAttribute) ) !== 'undefined' ) {
|
||||
@ -208,7 +208,7 @@
|
||||
}
|
||||
return $.trim( node.textContent || $node.text() );
|
||||
} else {
|
||||
if (typeof(t) === 'function') {
|
||||
if (typeof t === 'function') {
|
||||
return $.trim( t($node[0], c.table, cellIndex) );
|
||||
} else if (typeof (te = ts.getColumnData( c.table, t, cellIndex )) === 'function') {
|
||||
return $.trim( te($node[0], c.table, cellIndex) );
|
||||
@ -512,20 +512,22 @@
|
||||
// set up header template
|
||||
t = c.headerTemplate.replace(/\{content\}/g, $t.html()).replace(/\{icon\}/g, $t.find('.' + ts.css.icon).length ? '' : i);
|
||||
if (c.onRenderTemplate) {
|
||||
h = c.onRenderTemplate.apply($t, [index, t]);
|
||||
h = c.onRenderTemplate.apply( $t, [ index, t ] );
|
||||
if (h && typeof h === 'string') { t = h; } // only change t if something is returned
|
||||
}
|
||||
$t.html('<div class="' + ts.css.headerIn + '">' + t + '</div>'); // faster than wrapInner
|
||||
}
|
||||
if (c.onRenderHeader) { c.onRenderHeader.apply($t, [index, c, c.$table]); }
|
||||
if (c.onRenderHeader) { c.onRenderHeader.apply( $t, [ index, c, c.$table ] ); }
|
||||
// *** remove this.column value if no conflicts found
|
||||
elem.column = parseInt( $t.attr('data-column'), 10);
|
||||
elem.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
|
||||
elem.order = formatSortingOrder( ts.getData( $t, ch, 'sortInitialOrder' ) || c.sortInitialOrder ) ?
|
||||
[ 1, 0, 2 ] : // desc, asc, unsorted
|
||||
[ 0, 1, 2 ]; // asc, desc, unsorted
|
||||
elem.count = -1; // set to -1 because clicking on the header automatically adds one
|
||||
elem.lockedOrder = false;
|
||||
lock = ts.getData($t, ch, 'lockedOrder') || false;
|
||||
if (typeof lock !== 'undefined' && lock !== false) {
|
||||
elem.order = elem.lockedOrder = formatSortingOrder(lock) ? [1,1,1] : [0,0,0];
|
||||
elem.order = elem.lockedOrder = formatSortingOrder(lock) ? [ 1, 1, 1 ] : [ 0, 0, 0 ];
|
||||
}
|
||||
$t.addClass(ts.css.header + ' ' + c.cssHeader);
|
||||
// add cell to headerList
|
||||
@ -595,9 +597,9 @@
|
||||
list = c.sortList,
|
||||
len = list.length,
|
||||
none = ts.css.sortNone + ' ' + c.cssNone,
|
||||
css = [ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc],
|
||||
css = [ ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc ],
|
||||
cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
|
||||
aria = ['ascending', 'descending'],
|
||||
aria = [ 'ascending', 'descending' ],
|
||||
// find the footer
|
||||
$t = $(table).find('tfoot tr').children()
|
||||
.add( $( c.namespace + '_extra_headers' ) )
|
||||
@ -667,7 +669,7 @@
|
||||
dir = ('' + val[1]).match(/^(1|d|s|o|n)/);
|
||||
dir = dir ? dir[0] : '';
|
||||
// 0/(a)sc (default), 1/(d)esc, (s)ame, (o)pposite, (n)ext
|
||||
switch(dir) {
|
||||
switch (dir) {
|
||||
case '1': case 'd': // descending
|
||||
dir = 1;
|
||||
break;
|
||||
@ -743,11 +745,11 @@
|
||||
// add column to sort list
|
||||
order = cell.order[cell.count];
|
||||
if (order < 2) {
|
||||
c.sortList.push([indx, order]);
|
||||
c.sortList.push([ indx, order ]);
|
||||
// add other columns if header spans across multiple
|
||||
if (cell.colSpan > 1) {
|
||||
for (col = 1; col < cell.colSpan; col++) {
|
||||
c.sortList.push([indx + col, order]);
|
||||
c.sortList.push([ indx + col, order ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -758,7 +760,7 @@
|
||||
for (col = 0; col < c.sortAppend.length; col++) {
|
||||
s = ts.isValueInArray(c.sortAppend[col][0], c.sortList);
|
||||
if (s >= 0) {
|
||||
c.sortList.splice(s,1);
|
||||
c.sortList.splice(s, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -772,7 +774,7 @@
|
||||
// order.count seems to be incorrect when compared to cell.count
|
||||
s[1] = order.order[cell.count];
|
||||
if (s[1] === 2) {
|
||||
c.sortList.splice(col,1);
|
||||
c.sortList.splice(col, 1);
|
||||
order.count = -1;
|
||||
}
|
||||
}
|
||||
@ -781,11 +783,11 @@
|
||||
// add column to sort list array
|
||||
order = cell.order[cell.count];
|
||||
if (order < 2) {
|
||||
c.sortList.push([indx, order]);
|
||||
c.sortList.push([ indx, order ]);
|
||||
// add other columns if header spans across multiple
|
||||
if (cell.colSpan > 1) {
|
||||
for (col = 1; col < cell.colSpan; col++) {
|
||||
c.sortList.push([indx + col, order]);
|
||||
c.sortList.push([ indx + col, order ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -859,10 +861,10 @@
|
||||
x = dir ? a : b;
|
||||
y = dir ? b : a;
|
||||
// text sort function
|
||||
if (typeof(cts) === 'function') {
|
||||
if (typeof cts === 'function') {
|
||||
// custom OVERALL text sorter
|
||||
sort = cts(x[col], y[col], dir, col, table);
|
||||
} else if (typeof(cts) === 'object' && cts.hasOwnProperty(col)) {
|
||||
} else if (typeof cts === 'object' && cts.hasOwnProperty(col)) {
|
||||
// custom text sorter for a SPECIFIC COLUMN
|
||||
sort = cts[col](x[col], y[col], dir, col, table);
|
||||
} else {
|
||||
@ -895,14 +897,14 @@
|
||||
// this will catch spamming of the updateCell method
|
||||
if (resrt !== false && !c.serverSideSorting && !c.table.isProcessing) {
|
||||
if (sl.length) {
|
||||
c.$table.trigger('sorton', [sl, function(){
|
||||
c.$table.trigger('sorton', [ sl, function(){
|
||||
resortComplete(c, callback);
|
||||
}, true]);
|
||||
}, true ]);
|
||||
} else {
|
||||
c.$table.trigger('sortReset', [function(){
|
||||
c.$table.trigger('sortReset', [ function(){
|
||||
resortComplete(c, callback);
|
||||
ts.applyWidget(c.table, false);
|
||||
}]);
|
||||
} ]);
|
||||
}
|
||||
} else {
|
||||
resortComplete(c, callback);
|
||||
@ -1160,7 +1162,7 @@
|
||||
c.namespace = '.tablesorter' + Math.random().toString(16).slice(2);
|
||||
} else {
|
||||
// make sure namespace starts with a period & doesn't have weird characters
|
||||
c.namespace = '.' + c.namespace.replace(/\W/g,'');
|
||||
c.namespace = '.' + c.namespace.replace(/\W/g, '');
|
||||
}
|
||||
|
||||
c.$table.children().children('tr').attr('role', 'row');
|
||||
@ -1204,7 +1206,7 @@
|
||||
ts.applyWidget(table, true);
|
||||
// if user has supplied a sort list to constructor
|
||||
if (c.sortList.length > 0) {
|
||||
$table.trigger('sorton', [c.sortList, {}, !c.initWidgets, true]);
|
||||
$table.trigger('sorton', [ c.sortList, {}, !c.initWidgets, true ]);
|
||||
} else {
|
||||
setHeadersCss(table);
|
||||
if (c.initWidgets) {
|
||||
@ -1243,22 +1245,22 @@
|
||||
table = $(table)[0];
|
||||
var overallWidth, percent, $tbodies, len, index,
|
||||
c = table.config,
|
||||
colgroup = c.$table.children('colgroup');
|
||||
$colgroup = c.$table.children('colgroup');
|
||||
// remove plugin-added colgroup, in case we need to refresh the widths
|
||||
if (colgroup.length && colgroup.hasClass(ts.css.colgroup)) {
|
||||
colgroup.remove();
|
||||
if ($colgroup.length && $colgroup.hasClass(ts.css.colgroup)) {
|
||||
$colgroup.remove();
|
||||
}
|
||||
if (c.widthFixed && c.$table.children('colgroup').length === 0) {
|
||||
colgroup = $('<colgroup class="' + ts.css.colgroup + '">');
|
||||
$colgroup = $('<colgroup class="' + ts.css.colgroup + '">');
|
||||
overallWidth = c.$table.width();
|
||||
// only add col for visible columns - fixes #371
|
||||
$tbodies = c.$tbodies.find('tr:first').children(':visible'); //.each(function()
|
||||
$tbodies = c.$tbodies.find('tr:first').children(':visible'); // .each(function()
|
||||
len = $tbodies.length;
|
||||
for ( index = 0; index < len; index++ ) {
|
||||
percent = parseInt( ( $tbodies.eq( index ).width() / overallWidth ) * 1000, 10 ) / 10 + '%';
|
||||
colgroup.append( $('<col>').css('width', percent) );
|
||||
$colgroup.append( $('<col>').css('width', percent) );
|
||||
}
|
||||
c.$table.prepend(colgroup);
|
||||
c.$table.prepend($colgroup);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1305,12 +1307,12 @@
|
||||
cellId = rowIndex + '-' + $cell.index();
|
||||
rowSpan = cell.rowSpan || 1;
|
||||
colSpan = cell.colSpan || 1;
|
||||
if (typeof(matrix[rowIndex]) === 'undefined') {
|
||||
if (typeof matrix[rowIndex] === 'undefined') {
|
||||
matrix[rowIndex] = [];
|
||||
}
|
||||
// Find first available column in the first row
|
||||
for (k = 0; k < matrix[rowIndex].length + 1; k++) {
|
||||
if (typeof(matrix[rowIndex][k]) === 'undefined') {
|
||||
if (typeof matrix[rowIndex][k] === 'undefined') {
|
||||
firstAvailCol = k;
|
||||
break;
|
||||
}
|
||||
@ -1319,7 +1321,7 @@
|
||||
// add data-column
|
||||
$cell.attr({ 'data-column' : firstAvailCol }); // 'data-row' : rowIndex
|
||||
for (k = rowIndex; k < rowIndex + rowSpan; k++) {
|
||||
if (typeof(matrix[k]) === 'undefined') {
|
||||
if (typeof matrix[k] === 'undefined') {
|
||||
matrix[k] = [];
|
||||
}
|
||||
matrixrow = matrix[k];
|
||||
@ -1335,10 +1337,10 @@
|
||||
// *** Process table ***
|
||||
// add processing indicator
|
||||
ts.isProcessing = function(table, toggle, $ths) {
|
||||
table = $(table);
|
||||
var c = table[0].config,
|
||||
$table = $(table);
|
||||
var c = $table[0].config,
|
||||
// default to all headers
|
||||
$h = $ths || table.find('.' + ts.css.header);
|
||||
$h = $ths || $table.find('.' + ts.css.header);
|
||||
if (toggle) {
|
||||
// don't use sortList if custom $ths used
|
||||
if (typeof $ths !== 'undefined' && c.sortList.length > 0) {
|
||||
@ -1348,9 +1350,9 @@
|
||||
return this.sortDisabled ? false : ts.isValueInArray( parseFloat($(this).attr('data-column')), c.sortList) >= 0;
|
||||
});
|
||||
}
|
||||
table.add($h).addClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
$table.add($h).addClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
} else {
|
||||
table.add($h).removeClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
$table.add($h).removeClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1480,8 +1482,8 @@
|
||||
$f = $t.find('tfoot:first > tr').children('th, td');
|
||||
if (removeClasses === false && $.inArray('uitheme', c.widgets) >= 0) {
|
||||
// reapply uitheme classes, in case we want to maintain appearance
|
||||
$t.trigger('applyWidgetId', ['uitheme']);
|
||||
$t.trigger('applyWidgetId', ['zebra']);
|
||||
$t.trigger('applyWidgetId', [ 'uitheme' ]);
|
||||
$t.trigger('applyWidgetId', [ 'zebra' ]);
|
||||
}
|
||||
// remove widget added rows, just in case
|
||||
$h.find('tr').not($r).remove();
|
||||
@ -1493,7 +1495,7 @@
|
||||
.removeData('tablesorter')
|
||||
.unbind( events.replace(/\s+/g, ' ') );
|
||||
c.$headers.add($f)
|
||||
.removeClass( [ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone].join(' ') )
|
||||
.removeClass( [ ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone ].join(' ') )
|
||||
.removeAttr('data-column')
|
||||
.removeAttr('aria-label')
|
||||
.attr('aria-disabled', 'true');
|
||||
@ -1699,8 +1701,8 @@
|
||||
};
|
||||
|
||||
ts.hasWidget = function(table, name){
|
||||
table = $(table);
|
||||
return table.length && table[0].config && table[0].config.widgetInit[name] || false;
|
||||
$table = $(table);
|
||||
return $table.length && $table[0].config && $table[0].config.widgetInit[name] || false;
|
||||
};
|
||||
|
||||
ts.getWidgetById = function(name) {
|
||||
@ -1740,7 +1742,7 @@
|
||||
if (c.debug) { time = new Date(); }
|
||||
// look for widgets to apply from in table class
|
||||
// stop using \b otherwise this matches 'ui-widget-content' & adds 'content' widget
|
||||
wd = new RegExp( '\\s' + c.widgetClass.replace( /\{name\}/i, '([\\w-]+)' )+ '\\s', 'g' );
|
||||
wd = new RegExp( '\\s' + c.widgetClass.replace( /\{name\}/i, '([\\w-]+)' ) + '\\s', 'g' );
|
||||
if ( tableClass.match( wd ) ) {
|
||||
// extract out the widget id from the table class (widget id's can include dashes)
|
||||
w = tableClass.match( wd );
|
||||
@ -1948,13 +1950,13 @@
|
||||
typeof table !== 'undefined' ? table : true;
|
||||
if (t) {
|
||||
// US Format - 1,234,567.89 -> 1234567.89
|
||||
s = s.replace(/,/g,'');
|
||||
s = s.replace(/,/g, '');
|
||||
} else {
|
||||
// German Format = 1.234.567,89 -> 1234567.89
|
||||
// French Format = 1 234 567,89 -> 1234567.89
|
||||
s = s.replace(/[\s|\.]/g,'').replace(/,/g,'.');
|
||||
s = s.replace(/[\s|\.]/g, '').replace(/,/g, '.');
|
||||
}
|
||||
if(/^\s*\([.\d]+\)/.test(s)) {
|
||||
if (/^\s*\([.\d]+\)/.test(s)) {
|
||||
// make (#) into a negative number -> (10) = -10
|
||||
s = s.replace(/^\s*\(([.\d]+)\)/, '-$1');
|
||||
}
|
||||
@ -2022,7 +2024,7 @@
|
||||
ts.addParser({
|
||||
id: 'currency',
|
||||
is: function(s) {
|
||||
return (/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/).test((s || '').replace(/[+\-,. ]/g,'')); // £$€¤¥¢
|
||||
return (/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/).test((s || '').replace(/[+\-,. ]/g, '')); // £$€¤¥¢
|
||||
},
|
||||
format: function(s, table) {
|
||||
var n = ts.formatFloat((s || '').replace(/[^\w,. \-()]/g, ''), table);
|
||||
@ -2097,7 +2099,7 @@
|
||||
id: 'shortDate', // 'mmddyyyy', 'ddmmyyyy' or 'yyyymmdd'
|
||||
is: function(s) {
|
||||
// testing for ##-##-#### or ####-##-##, so it's not perfect; time can be included
|
||||
return (/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/).test((s || '').replace(/\s+/g,' ').replace(/[\-.,]/g, '/'));
|
||||
return (/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/).test((s || '').replace(/\s+/g, ' ').replace(/[\-.,]/g, '/'));
|
||||
},
|
||||
format: function(s, table, cell, cellIndex) {
|
||||
if (s) {
|
||||
@ -2190,11 +2192,11 @@
|
||||
|
||||
/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
|
||||
;(function ($, window, document) {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter || {};
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
var ts = $.tablesorter || {};
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
if you need it, then include https://github.com/douglascrockford/JSON-js
|
||||
|
||||
$.parseJSON is not available is jQuery versions older than 1.4.1, using older
|
||||
@ -2210,9 +2212,9 @@ var ts = $.tablesorter || {};
|
||||
v = $.tablesorter.storage(table, 'tablesorter-mywidget');
|
||||
// val may be empty, so also check for your data
|
||||
val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
|
||||
alert(val); // "data1" if saved, or "" if not
|
||||
*/
|
||||
ts.storage = function(table, key, value, options) {
|
||||
alert(val); // 'data1' if saved, or '' if not
|
||||
*/
|
||||
ts.storage = function(table, key, value, options) {
|
||||
table = $(table)[0];
|
||||
var cookieIndex, cookies, date,
|
||||
hasStorage = false,
|
||||
@ -2222,12 +2224,12 @@ ts.storage = function(table, key, value, options) {
|
||||
storageType = ( options && options.useSessionStorage ) || ( wo && wo.storage_useSessionStorage ) ?
|
||||
'sessionStorage' : 'localStorage',
|
||||
$table = $(table),
|
||||
// id from (1) options ID, (2) table "data-table-group" attribute, (3) widgetOptions.storage_tableId,
|
||||
// id from (1) options ID, (2) table 'data-table-group' attribute, (3) widgetOptions.storage_tableId,
|
||||
// (4) table ID, then (5) table index
|
||||
id = options && options.id ||
|
||||
$table.attr( options && options.group || wo && wo.storage_group || 'data-table-group') ||
|
||||
wo && wo.storage_tableId || table.id || $('.tablesorter').index( $table ),
|
||||
// url from (1) options url, (2) table "data-table-page" attribute, (3) widgetOptions.storage_fixedUrl,
|
||||
// url from (1) options url, (2) table 'data-table-page' attribute, (3) widgetOptions.storage_fixedUrl,
|
||||
// (4) table.config.fixedUrl (deprecated), then (5) window location path
|
||||
url = options && options.url ||
|
||||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
|
||||
@ -2238,7 +2240,7 @@ ts.storage = function(table, key, value, options) {
|
||||
window[storageType].setItem('_tmptest', 'temp');
|
||||
hasStorage = true;
|
||||
window[storageType].removeItem('_tmptest');
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
if (c && c.debug) {
|
||||
ts.log( storageType + ' is not supported in this browser' );
|
||||
}
|
||||
@ -2269,21 +2271,21 @@ ts.storage = function(table, key, value, options) {
|
||||
} else {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (31536e+6)); // 365 days
|
||||
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g,'\"') + '; expires=' + date.toGMTString() + '; path=/';
|
||||
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g, '\"') + '; expires=' + date.toGMTString() + '; path=/';
|
||||
}
|
||||
} else {
|
||||
return values && values[url] ? values[url][id] : '';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
})(jQuery, window, document);
|
||||
|
||||
/*! Widget: uitheme - updated 3/26/2015 (v2.21.3) */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
ts.themes = {
|
||||
ts.themes = {
|
||||
'bootstrap' : {
|
||||
table : 'table table-bordered table-striped',
|
||||
caption : 'caption',
|
||||
@ -2295,7 +2297,7 @@ ts.themes = {
|
||||
active : '', // applied when column is sorted
|
||||
hover : '', // custom css required - a defined bootstrap style may not override other classes
|
||||
// icon class names
|
||||
icons : '', // add "icon-white" to make them white; this icon class is added to the <i> in the header
|
||||
icons : '', // add 'icon-white' to make them white; this icon class is added to the <i> in the header
|
||||
iconSortNone : 'bootstrap-icon-unsorted', // class name added to icon when column is not sorted
|
||||
iconSortAsc : 'icon-chevron-up glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort
|
||||
iconSortDesc : 'icon-chevron-down glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort
|
||||
@ -2326,14 +2328,14 @@ ts.themes = {
|
||||
even : 'ui-widget-content', // even row zebra striping
|
||||
odd : 'ui-state-default' // odd row zebra striping
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
wrapper : 'tablesorter-wrapper' // ui theme & resizable
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
id: "uitheme",
|
||||
ts.addWidget({
|
||||
id: 'uitheme',
|
||||
priority: 10,
|
||||
format: function(table, c, wo) {
|
||||
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
||||
@ -2355,7 +2357,7 @@ ts.addWidget({
|
||||
if (hasOldTheme) {
|
||||
wo.zebra[0] = $.trim( ' ' + wo.zebra[0].replace(' ' + oldtheme.even, '') );
|
||||
wo.zebra[1] = $.trim( ' ' + wo.zebra[1].replace(' ' + oldtheme.odd, '') );
|
||||
c.$tbodies.children().removeClass( [oldtheme.even, oldtheme.odd].join(' ') );
|
||||
c.$tbodies.children().removeClass( [ oldtheme.even, oldtheme.odd ].join(' ') );
|
||||
}
|
||||
// update zebra stripes
|
||||
if (themes.even) { wo.zebra[0] += ' ' + themes.even; }
|
||||
@ -2380,7 +2382,7 @@ ts.addWidget({
|
||||
}
|
||||
// update header classes
|
||||
$headers
|
||||
.removeClass( (hasOldTheme ? [oldtheme.header, oldtheme.hover, oldremove].join(' ') : '') || '' )
|
||||
.removeClass( (hasOldTheme ? [ oldtheme.header, oldtheme.hover, oldremove ].join(' ') : '') || '' )
|
||||
.addClass(themes.header)
|
||||
.not('.sorter-false')
|
||||
.unbind('mouseenter.tsuitheme mouseleave.tsuitheme')
|
||||
@ -2400,7 +2402,7 @@ ts.addWidget({
|
||||
// if c.cssIcon is '', then no <i> is added to the header
|
||||
$headers
|
||||
.find('.' + ts.css.icon)
|
||||
.removeClass(hasOldTheme ? [oldtheme.icons, oldIconRmv].join(' ') : '')
|
||||
.removeClass(hasOldTheme ? [ oldtheme.icons, oldIconRmv ].join(' ') : '')
|
||||
.addClass(themes.icons || '');
|
||||
}
|
||||
if ($table.hasClass('hasFilters')) {
|
||||
@ -2426,10 +2428,10 @@ ts.addWidget({
|
||||
hdr = themes.sortNone;
|
||||
icon = themes.iconSortNone;
|
||||
if ($h.hasClass(ts.css.sortAsc)) {
|
||||
hdr = [themes.sortAsc, themes.active].join(' ');
|
||||
hdr = [ themes.sortAsc, themes.active ].join(' ');
|
||||
icon = themes.iconSortAsc;
|
||||
} else if ($h.hasClass(ts.css.sortDesc)) {
|
||||
hdr = [themes.sortDesc, themes.active].join(' ');
|
||||
hdr = [ themes.sortDesc, themes.active ].join(' ');
|
||||
icon = themes.iconSortDesc;
|
||||
}
|
||||
$header.addClass(hdr);
|
||||
@ -2438,7 +2440,7 @@ ts.addWidget({
|
||||
}
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.benchmark("Applying " + theme + " theme", time);
|
||||
ts.benchmark('Applying ' + theme + ' theme', time);
|
||||
}
|
||||
},
|
||||
remove: function(table, c, wo, refreshing) {
|
||||
@ -2460,20 +2462,20 @@ ts.addWidget({
|
||||
.removeClass(themes.filterRow);
|
||||
$headers.find('.' + ts.css.icon).removeClass(themes.icons + ' ' + iconRmv);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
/*! Widget: columns */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
ts.addWidget({
|
||||
id: "columns",
|
||||
ts.addWidget({
|
||||
id: 'columns',
|
||||
priority: 30,
|
||||
options : {
|
||||
columns : [ "primary", "secondary", "tertiary" ]
|
||||
columns : [ 'primary', 'secondary', 'tertiary' ]
|
||||
},
|
||||
format: function(table, c, wo) {
|
||||
var $tbody, tbodyIndex, $rows, rows, $row, $cells, remove, indx,
|
||||
@ -2482,7 +2484,7 @@ ts.addWidget({
|
||||
sortList = c.sortList,
|
||||
len = sortList.length,
|
||||
// removed c.widgetColumns support
|
||||
css = wo && wo.columns || [ "primary", "secondary", "tertiary" ],
|
||||
css = wo && wo.columns || [ 'primary', 'secondary', 'tertiary' ],
|
||||
last = css.length - 1;
|
||||
remove = css.join(' ');
|
||||
// check if there is a sort (on initialization there may not be one)
|
||||
@ -2511,7 +2513,7 @@ ts.addWidget({
|
||||
ts.processTbody(table, $tbody, false);
|
||||
}
|
||||
// add classes to thead and tfoot
|
||||
rows = wo.columns_thead !== false ? ['thead tr'] : [];
|
||||
rows = wo.columns_thead !== false ? [ 'thead tr' ] : [];
|
||||
if (wo.columns_tfoot !== false) {
|
||||
rows.push('tfoot tr');
|
||||
}
|
||||
@ -2528,7 +2530,7 @@ ts.addWidget({
|
||||
remove: function(table, c, wo) {
|
||||
var tbodyIndex, $tbody,
|
||||
$tbodies = c.$tbodies,
|
||||
remove = (wo.columns || [ "primary", "secondary", "tertiary" ]).join(' ');
|
||||
remove = (wo.columns || [ 'primary', 'secondary', 'tertiary' ]).join(' ');
|
||||
c.$headers.removeClass(remove);
|
||||
c.$table.children('tfoot').children('tr').children('th, td').removeClass(remove);
|
||||
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
|
||||
@ -2539,7 +2541,7 @@ ts.addWidget({
|
||||
ts.processTbody(table, $tbody, false); // restore tbody
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
@ -2548,18 +2550,18 @@ ts.addWidget({
|
||||
* by Rob Garrison
|
||||
*/
|
||||
;( function ( $ ) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
tscss = ts.css;
|
||||
|
||||
$.extend( tscss, {
|
||||
$.extend( tscss, {
|
||||
filterRow : 'tablesorter-filter-row',
|
||||
filter : 'tablesorter-filter',
|
||||
filterDisabled : 'disabled',
|
||||
filterRowHide : 'hideme'
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id: 'filter',
|
||||
priority: 50,
|
||||
options : {
|
||||
@ -2588,7 +2590,7 @@ ts.addWidget({
|
||||
filter_selectSource : null, // include a function to return an array of values to be added to the column filter select
|
||||
filter_startsWith : false, // if true, filter start from the beginning of the cell contents
|
||||
filter_useParsedData : false, // filter all data using parsed content
|
||||
filter_serversideFiltering : false, // if true, server-side filtering should be performed because client-side filtering will be disabled, but the ui and events will still be used.
|
||||
filter_serversideFiltering : false, // if true, must perform server-side filtering b/c client-side filtering is disabled, but the ui and events will still be used.
|
||||
filter_defaultAttrib : 'data-value', // data attribute in the header cell that contains the default filter value
|
||||
filter_selectSourceSeparator : '|' // filter_selectSource array text left of the separator is added to the option value, right into the option text
|
||||
},
|
||||
@ -2619,9 +2621,9 @@ ts.addWidget({
|
||||
$( document ).undelegate( wo.filter_reset, 'click.tsfilter' );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.filter = {
|
||||
ts.filter = {
|
||||
|
||||
// regex used in filter 'check' functions - not for general use and not documented
|
||||
regex: {
|
||||
@ -2895,7 +2897,7 @@ ts.filter = {
|
||||
filtered : new RegExp( wo.filter_filteredRow ),
|
||||
alreadyFiltered : new RegExp( '(\\s+(' + ts.language.or + '|-|' + ts.language.to + ')\\s+)', 'i' ),
|
||||
toTest : new RegExp( '\\s+(-|' + ts.language.to + ')\\s+', 'i' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)' ,'gi' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)', 'gi' ),
|
||||
andTest : new RegExp( '\\s+(' + ts.language.and + '|&&)\\s+', 'i' ),
|
||||
andSplit : new RegExp( '(?:\\s+(?:' + ts.language.and + '|&&)\\s+)', 'gi' ),
|
||||
orSplit : new RegExp( '(?:\\s+(?:' + ts.language.or + ')\\s+|\\|)', 'gi' ),
|
||||
@ -3330,7 +3332,7 @@ ts.filter = {
|
||||
c.lastSearch = [];
|
||||
}
|
||||
if ( wo.filter_initialized ) {
|
||||
c.$table.trigger( 'filterStart', [filters] );
|
||||
c.$table.trigger( 'filterStart', [ filters ] );
|
||||
}
|
||||
if ( c.showProcessing ) {
|
||||
// give it time for the processing icon to kick in
|
||||
@ -3560,7 +3562,7 @@ ts.filter = {
|
||||
// in case select filter option has a different value vs text 'a - z|A through Z'
|
||||
ffxn = wo.filter_columnFilters ?
|
||||
c.$filters.add( c.$externalFilters )
|
||||
.filter( '[data-column="'+ columnIndex + '"]' )
|
||||
.filter( '[data-column="' + columnIndex + '"]' )
|
||||
.find( 'select option:selected' )
|
||||
.attr( 'data-function-name' ) || '' : '';
|
||||
// replace accents - see #357
|
||||
@ -3920,7 +3922,7 @@ ts.filter = {
|
||||
if ( $.isFunction( cts ) ) {
|
||||
// custom OVERALL text sorter
|
||||
return cts( x, y, true, column, table );
|
||||
} else if ( typeof( cts ) === 'object' && cts.hasOwnProperty( column ) ) {
|
||||
} else if ( typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
||||
// custom text sorter for a SPECIFIC COLUMN
|
||||
return cts[column]( x, y, true, column, table );
|
||||
} else if ( ts.sortNatural ) {
|
||||
@ -4062,9 +4064,9 @@ ts.filter = {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
var i, $filters, $column, cols,
|
||||
filters = false,
|
||||
c = table ? $( table )[0].config : '',
|
||||
@ -4135,9 +4137,9 @@ ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
filters = false;
|
||||
}
|
||||
return filters;
|
||||
};
|
||||
};
|
||||
|
||||
ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
var c = table ? $( table )[0].config : '',
|
||||
valid = ts.getFilters( table, true, filter, skipFirst );
|
||||
if ( c && apply ) {
|
||||
@ -4148,7 +4150,7 @@ ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
c.$table.trigger( 'filterFomatterUpdate' );
|
||||
}
|
||||
return !!valid;
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery );
|
||||
|
||||
@ -4157,18 +4159,18 @@ ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
* by Rob Garrison
|
||||
*/
|
||||
;(function ($, window) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
sticky : 'tablesorter-stickyHeader', // stickyHeader
|
||||
stickyVis : 'tablesorter-sticky-visible',
|
||||
stickyHide: 'tablesorter-sticky-hidden',
|
||||
stickyWrap: 'tablesorter-sticky-wrapper'
|
||||
});
|
||||
});
|
||||
|
||||
// Add a resize event to table headers
|
||||
ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
// Add a resize event to table headers
|
||||
ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
table = $(table)[0]; // make sure we're using a dom element
|
||||
if ( !table.config ) { return; }
|
||||
var defaults = {
|
||||
@ -4184,7 +4186,7 @@ ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
headers = [];
|
||||
for ( index = 0; index < len; index++ ) {
|
||||
$header = c.$headers.eq( index );
|
||||
sizes = $header.data( 'savedSizes' ) || [ 0,0 ]; // fixes #394
|
||||
sizes = $header.data( 'savedSizes' ) || [ 0, 0 ]; // fixes #394
|
||||
width = $header[0].offsetWidth;
|
||||
height = $header[0].offsetHeight;
|
||||
if ( width !== sizes[0] || height !== sizes[1] ) {
|
||||
@ -4207,14 +4209,14 @@ ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
if (wo.resize_flag) { return; }
|
||||
checkSizes();
|
||||
}, options.timer);
|
||||
};
|
||||
};
|
||||
|
||||
// Sticky headers based on this awesome article:
|
||||
// http://css-tricks.com/13465-persistent-headers/
|
||||
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: "stickyHeaders",
|
||||
// Sticky headers based on this awesome article:
|
||||
// http://css-tricks.com/13465-persistent-headers/
|
||||
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'stickyHeaders',
|
||||
priority: 60, // sticky widget must be initialized after the filter widget!
|
||||
options: {
|
||||
stickyHeaders : '', // extra class name added to the sticky header row
|
||||
@ -4224,7 +4226,7 @@ ts.addWidget({
|
||||
stickyHeaders_offset : 0, // number or jquery selector targeting the position:fixed element
|
||||
stickyHeaders_filteredToTop: true, // scroll table top into view after filtering
|
||||
stickyHeaders_cloneId : '-sticky', // added to table ID, if it exists
|
||||
stickyHeaders_addResizeEvent : true, // trigger "resize" event on headers
|
||||
stickyHeaders_addResizeEvent : true, // trigger 'resize' event on headers
|
||||
stickyHeaders_includeCaption : true, // if false and a caption exist, it won't be included in the sticky header
|
||||
stickyHeaders_zIndex : 2 // The zIndex of the stickyHeaders, allows the user to adjust this to their needs
|
||||
},
|
||||
@ -4437,25 +4439,25 @@ ts.addWidget({
|
||||
.unbind( ('scroll resize '.split(' ').join(namespace)).replace(/\s+/g, ' ') );
|
||||
ts.addHeaderResizeEvent(table, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, window);
|
||||
|
||||
/*! Widget: resizable - updated 6/26/2015 (v2.22.2) */
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function ($, window) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
resizableContainer : 'tablesorter-resizable-container',
|
||||
resizableHandle : 'tablesorter-resizable-handle',
|
||||
resizableNoSelect : 'tablesorter-disableSelection',
|
||||
resizableStorage : 'tablesorter-resizable'
|
||||
});
|
||||
});
|
||||
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
var s = '<style>' +
|
||||
'body.' + ts.css.resizableNoSelect + ' { -ms-user-select: none; -moz-user-select: -moz-none;' +
|
||||
'-khtml-user-select: none; -webkit-user-select: none; user-select: none; }' +
|
||||
@ -4465,9 +4467,9 @@ $(function(){
|
||||
'top: 1px; cursor: ew-resize; z-index: 3; user-select: none; -moz-user-select: none; }' +
|
||||
'</style>';
|
||||
$(s).appendTo('body');
|
||||
});
|
||||
});
|
||||
|
||||
ts.resizable = {
|
||||
ts.resizable = {
|
||||
init : function( c, wo ) {
|
||||
if ( c.$table.hasClass( 'hasResizable' ) ) { return; }
|
||||
c.$table.addClass( 'hasResizable' );
|
||||
@ -4478,7 +4480,7 @@ ts.resizable = {
|
||||
marginTop = parseInt( $table.css( 'margin-top' ), 10 ),
|
||||
|
||||
// internal variables
|
||||
vars = wo.resizable_ = {
|
||||
vars = wo.resizable_vars = {
|
||||
useStorage : ts.storage && wo.resizable !== false,
|
||||
$wrap : $parent,
|
||||
mouseXPosition : 0,
|
||||
@ -4500,7 +4502,7 @@ ts.resizable = {
|
||||
vars.fullWidth = Math.abs( $parent.width() - vars.tableWidth ) < 20;
|
||||
|
||||
/*
|
||||
// Hacky method to determine if table width is set to "auto"
|
||||
// Hacky method to determine if table width is set to 'auto'
|
||||
// http://stackoverflow.com/a/20892048/145346
|
||||
if ( !vars.fullWidth ) {
|
||||
tmp = $table.width();
|
||||
@ -4520,7 +4522,7 @@ ts.resizable = {
|
||||
tmp = ts.storage( c.table, 'tablesorter-table-resized-width' ) || 'auto';
|
||||
ts.resizable.setWidth( $table, tmp, true );
|
||||
}
|
||||
wo.resizable_.storedSizes = storedSizes = ( vars.useStorage ?
|
||||
wo.resizable_vars.storedSizes = storedSizes = ( vars.useStorage ?
|
||||
ts.storage( c.table, ts.css.resizableStorage ) :
|
||||
[] ) || [];
|
||||
ts.resizable.setWidths( c, wo, storedSizes );
|
||||
@ -4554,7 +4556,7 @@ ts.resizable = {
|
||||
updateStoredSizes : function( c, wo ) {
|
||||
var column, $header,
|
||||
len = c.columns,
|
||||
vars = wo.resizable_;
|
||||
vars = wo.resizable_vars;
|
||||
vars.storedSizes = [];
|
||||
for ( column = 0; column < len; column++ ) {
|
||||
$header = c.$headerIndexed[ column ];
|
||||
@ -4573,7 +4575,7 @@ ts.resizable = {
|
||||
|
||||
setWidths : function( c, wo, storedSizes ) {
|
||||
var column, $temp,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$extra = $( c.namespace + '_extra_headers' ),
|
||||
$col = c.$table.children( 'colgroup' ).children( 'col' );
|
||||
storedSizes = storedSizes || vars.storedSizes || [];
|
||||
@ -4633,7 +4635,7 @@ ts.resizable = {
|
||||
// prevent text selection while dragging resize bar
|
||||
toggleTextSelection : function( c, toggle ) {
|
||||
var namespace = c.namespace + 'tsresize';
|
||||
c.widgetOptions.resizable_.disabled = toggle;
|
||||
c.widgetOptions.resizable_vars.disabled = toggle;
|
||||
$( 'body' ).toggleClass( ts.css.resizableNoSelect, toggle );
|
||||
if ( toggle ) {
|
||||
$( 'body' )
|
||||
@ -4651,7 +4653,7 @@ ts.resizable = {
|
||||
wo.$resizable_container.children().bind( 'mousedown', function( event ) {
|
||||
// save header cell and mouse position
|
||||
var column,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$extras = $( c.namespace + '_extra_headers' ),
|
||||
$header = $( event.target ).data( 'header' );
|
||||
|
||||
@ -4675,7 +4677,7 @@ ts.resizable = {
|
||||
|
||||
$( document )
|
||||
.bind( 'mousemove' + namespace, function( event ) {
|
||||
var vars = wo.resizable_;
|
||||
var vars = wo.resizable_vars;
|
||||
// ignore mousemove if no mousedown
|
||||
if ( !vars.disabled || vars.mouseXPosition === 0 || !vars.$target ) { return; }
|
||||
if ( wo.resizable_throttle ) {
|
||||
@ -4688,7 +4690,7 @@ ts.resizable = {
|
||||
}
|
||||
})
|
||||
.bind( 'mouseup' + namespace, function() {
|
||||
if (!wo.resizable_.disabled) { return; }
|
||||
if (!wo.resizable_vars.disabled) { return; }
|
||||
ts.resizable.toggleTextSelection( c, false );
|
||||
ts.resizable.stopResize( c, wo );
|
||||
ts.resizable.setHandlePosition( c, wo );
|
||||
@ -4708,21 +4710,21 @@ ts.resizable = {
|
||||
.add( $( c.namespace + '_extra_table' ).find( 'thead:first' ) )
|
||||
.bind( 'contextmenu' + namespace, function() {
|
||||
// $.isEmptyObject() needs jQuery 1.4+; allow right click if already reset
|
||||
var allowClick = wo.resizable_.storedSizes.length === 0;
|
||||
var allowClick = wo.resizable_vars.storedSizes.length === 0;
|
||||
ts.resizableReset( c.table );
|
||||
ts.resizable.setHandlePosition( c, wo );
|
||||
wo.resizable_.storedSizes = [];
|
||||
wo.resizable_vars.storedSizes = [];
|
||||
return allowClick;
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
mouseMove : function( c, wo, event ) {
|
||||
if ( wo.resizable_.mouseXPosition === 0 || !wo.resizable_.$target ) { return; }
|
||||
if ( wo.resizable_vars.mouseXPosition === 0 || !wo.resizable_vars.$target ) { return; }
|
||||
// resize columns
|
||||
var column,
|
||||
total = 0,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$next = vars.$next,
|
||||
tar = vars.storedSizes[ vars.target ],
|
||||
leftEdge = event.pageX - vars.mouseXPosition;
|
||||
@ -4754,7 +4756,7 @@ ts.resizable = {
|
||||
},
|
||||
|
||||
stopResize : function( c, wo ) {
|
||||
var vars = wo.resizable_;
|
||||
var vars = wo.resizable_vars;
|
||||
ts.resizable.updateStoredSizes( c, wo );
|
||||
if ( vars.useStorage ) {
|
||||
// save all column widths
|
||||
@ -4766,13 +4768,13 @@ ts.resizable = {
|
||||
// will update stickyHeaders, just in case, see #912
|
||||
c.$table.trigger('stickyHeadersUpdate');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// this widget saves the column widths if
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: "resizable",
|
||||
// this widget saves the column widths if
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'resizable',
|
||||
priority: 40,
|
||||
options: {
|
||||
resizable : true, // save column widths to storage
|
||||
@ -4790,7 +4792,8 @@ ts.addWidget({
|
||||
var namespace = c.namespace + 'tsresize';
|
||||
c.$table.add( $( c.namespace + '_extra_table' ) )
|
||||
.removeClass('hasResizable')
|
||||
.children( 'thead' ).unbind( 'contextmenu' + namespace );
|
||||
.children( 'thead' )
|
||||
.unbind( 'contextmenu' + namespace );
|
||||
|
||||
wo.$resizable_container.remove();
|
||||
ts.resizable.toggleTextSelection( c, false );
|
||||
@ -4798,14 +4801,14 @@ ts.addWidget({
|
||||
$( document ).unbind( 'mousemove' + namespace + ' mouseup' + namespace );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.resizableReset = function( table, refreshing ) {
|
||||
ts.resizableReset = function( table, refreshing ) {
|
||||
$( table ).each(function(){
|
||||
var index, $t,
|
||||
c = this.config,
|
||||
wo = c && c.widgetOptions,
|
||||
vars = wo.resizable_;
|
||||
vars = wo.resizable_vars;
|
||||
if ( table && c && c.$headerIndexed.length ) {
|
||||
// restore the initial table width
|
||||
if ( vars.overflow && vars.tableWidth ) {
|
||||
@ -4831,20 +4834,20 @@ ts.resizableReset = function( table, refreshing ) {
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery, window );
|
||||
|
||||
/*! Widget: saveSort */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
// this widget saves the last sort only if the
|
||||
// saveSort widget option is true AND the
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
// this widget saves the last sort only if the
|
||||
// saveSort widget option is true AND the
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'saveSort',
|
||||
priority: 20,
|
||||
options: {
|
||||
@ -4858,7 +4861,7 @@ ts.addWidget({
|
||||
var stored, time,
|
||||
$table = c.$table,
|
||||
saveSort = wo.saveSort !== false, // make saveSort active/inactive; default to true
|
||||
sortList = { "sortList" : c.sortList };
|
||||
sortList = { 'sortList' : c.sortList };
|
||||
if (c.debug) {
|
||||
time = new Date();
|
||||
}
|
||||
@ -4891,7 +4894,7 @@ ts.addWidget({
|
||||
c.sortList = sortList;
|
||||
} else if (table.hasInitialized && sortList && sortList.length > 0) {
|
||||
// update sort change
|
||||
$table.trigger('sorton', [sortList]);
|
||||
$table.trigger('sorton', [ sortList ]);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -4900,7 +4903,7 @@ ts.addWidget({
|
||||
// clear storage
|
||||
if (ts.storage) { ts.storage( table, 'tablesorter-savesort', '' ); }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
6
dist/js/jquery.tablesorter.combined.min.js
vendored
6
dist/js/jquery.tablesorter.combined.min.js
vendored
File diff suppressed because one or more lines are too long
100
dist/js/jquery.tablesorter.js
vendored
100
dist/js/jquery.tablesorter.js
vendored
@ -198,7 +198,7 @@
|
||||
// node could be a jquery object
|
||||
// http://jsperf.com/jquery-vs-instanceof-jquery/2
|
||||
$node = node.jquery ? node : $(node);
|
||||
if (typeof(t) === 'string') {
|
||||
if (typeof t === 'string') {
|
||||
// check data-attribute first when set to 'basic'; don't use node.innerText - it's really slow!
|
||||
// http://www.kellegous.com/j/2013/02/27/innertext-vs-textcontent/
|
||||
if ( t === 'basic' && typeof ( te = $node.attr(c.textAttribute) ) !== 'undefined' ) {
|
||||
@ -206,7 +206,7 @@
|
||||
}
|
||||
return $.trim( node.textContent || $node.text() );
|
||||
} else {
|
||||
if (typeof(t) === 'function') {
|
||||
if (typeof t === 'function') {
|
||||
return $.trim( t($node[0], c.table, cellIndex) );
|
||||
} else if (typeof (te = ts.getColumnData( c.table, t, cellIndex )) === 'function') {
|
||||
return $.trim( te($node[0], c.table, cellIndex) );
|
||||
@ -510,20 +510,22 @@
|
||||
// set up header template
|
||||
t = c.headerTemplate.replace(/\{content\}/g, $t.html()).replace(/\{icon\}/g, $t.find('.' + ts.css.icon).length ? '' : i);
|
||||
if (c.onRenderTemplate) {
|
||||
h = c.onRenderTemplate.apply($t, [index, t]);
|
||||
h = c.onRenderTemplate.apply( $t, [ index, t ] );
|
||||
if (h && typeof h === 'string') { t = h; } // only change t if something is returned
|
||||
}
|
||||
$t.html('<div class="' + ts.css.headerIn + '">' + t + '</div>'); // faster than wrapInner
|
||||
}
|
||||
if (c.onRenderHeader) { c.onRenderHeader.apply($t, [index, c, c.$table]); }
|
||||
if (c.onRenderHeader) { c.onRenderHeader.apply( $t, [ index, c, c.$table ] ); }
|
||||
// *** remove this.column value if no conflicts found
|
||||
elem.column = parseInt( $t.attr('data-column'), 10);
|
||||
elem.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
|
||||
elem.order = formatSortingOrder( ts.getData( $t, ch, 'sortInitialOrder' ) || c.sortInitialOrder ) ?
|
||||
[ 1, 0, 2 ] : // desc, asc, unsorted
|
||||
[ 0, 1, 2 ]; // asc, desc, unsorted
|
||||
elem.count = -1; // set to -1 because clicking on the header automatically adds one
|
||||
elem.lockedOrder = false;
|
||||
lock = ts.getData($t, ch, 'lockedOrder') || false;
|
||||
if (typeof lock !== 'undefined' && lock !== false) {
|
||||
elem.order = elem.lockedOrder = formatSortingOrder(lock) ? [1,1,1] : [0,0,0];
|
||||
elem.order = elem.lockedOrder = formatSortingOrder(lock) ? [ 1, 1, 1 ] : [ 0, 0, 0 ];
|
||||
}
|
||||
$t.addClass(ts.css.header + ' ' + c.cssHeader);
|
||||
// add cell to headerList
|
||||
@ -593,9 +595,9 @@
|
||||
list = c.sortList,
|
||||
len = list.length,
|
||||
none = ts.css.sortNone + ' ' + c.cssNone,
|
||||
css = [ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc],
|
||||
css = [ ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc ],
|
||||
cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
|
||||
aria = ['ascending', 'descending'],
|
||||
aria = [ 'ascending', 'descending' ],
|
||||
// find the footer
|
||||
$t = $(table).find('tfoot tr').children()
|
||||
.add( $( c.namespace + '_extra_headers' ) )
|
||||
@ -665,7 +667,7 @@
|
||||
dir = ('' + val[1]).match(/^(1|d|s|o|n)/);
|
||||
dir = dir ? dir[0] : '';
|
||||
// 0/(a)sc (default), 1/(d)esc, (s)ame, (o)pposite, (n)ext
|
||||
switch(dir) {
|
||||
switch (dir) {
|
||||
case '1': case 'd': // descending
|
||||
dir = 1;
|
||||
break;
|
||||
@ -741,11 +743,11 @@
|
||||
// add column to sort list
|
||||
order = cell.order[cell.count];
|
||||
if (order < 2) {
|
||||
c.sortList.push([indx, order]);
|
||||
c.sortList.push([ indx, order ]);
|
||||
// add other columns if header spans across multiple
|
||||
if (cell.colSpan > 1) {
|
||||
for (col = 1; col < cell.colSpan; col++) {
|
||||
c.sortList.push([indx + col, order]);
|
||||
c.sortList.push([ indx + col, order ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -756,7 +758,7 @@
|
||||
for (col = 0; col < c.sortAppend.length; col++) {
|
||||
s = ts.isValueInArray(c.sortAppend[col][0], c.sortList);
|
||||
if (s >= 0) {
|
||||
c.sortList.splice(s,1);
|
||||
c.sortList.splice(s, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -770,7 +772,7 @@
|
||||
// order.count seems to be incorrect when compared to cell.count
|
||||
s[1] = order.order[cell.count];
|
||||
if (s[1] === 2) {
|
||||
c.sortList.splice(col,1);
|
||||
c.sortList.splice(col, 1);
|
||||
order.count = -1;
|
||||
}
|
||||
}
|
||||
@ -779,11 +781,11 @@
|
||||
// add column to sort list array
|
||||
order = cell.order[cell.count];
|
||||
if (order < 2) {
|
||||
c.sortList.push([indx, order]);
|
||||
c.sortList.push([ indx, order ]);
|
||||
// add other columns if header spans across multiple
|
||||
if (cell.colSpan > 1) {
|
||||
for (col = 1; col < cell.colSpan; col++) {
|
||||
c.sortList.push([indx + col, order]);
|
||||
c.sortList.push([ indx + col, order ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -857,10 +859,10 @@
|
||||
x = dir ? a : b;
|
||||
y = dir ? b : a;
|
||||
// text sort function
|
||||
if (typeof(cts) === 'function') {
|
||||
if (typeof cts === 'function') {
|
||||
// custom OVERALL text sorter
|
||||
sort = cts(x[col], y[col], dir, col, table);
|
||||
} else if (typeof(cts) === 'object' && cts.hasOwnProperty(col)) {
|
||||
} else if (typeof cts === 'object' && cts.hasOwnProperty(col)) {
|
||||
// custom text sorter for a SPECIFIC COLUMN
|
||||
sort = cts[col](x[col], y[col], dir, col, table);
|
||||
} else {
|
||||
@ -893,14 +895,14 @@
|
||||
// this will catch spamming of the updateCell method
|
||||
if (resrt !== false && !c.serverSideSorting && !c.table.isProcessing) {
|
||||
if (sl.length) {
|
||||
c.$table.trigger('sorton', [sl, function(){
|
||||
c.$table.trigger('sorton', [ sl, function(){
|
||||
resortComplete(c, callback);
|
||||
}, true]);
|
||||
}, true ]);
|
||||
} else {
|
||||
c.$table.trigger('sortReset', [function(){
|
||||
c.$table.trigger('sortReset', [ function(){
|
||||
resortComplete(c, callback);
|
||||
ts.applyWidget(c.table, false);
|
||||
}]);
|
||||
} ]);
|
||||
}
|
||||
} else {
|
||||
resortComplete(c, callback);
|
||||
@ -1158,7 +1160,7 @@
|
||||
c.namespace = '.tablesorter' + Math.random().toString(16).slice(2);
|
||||
} else {
|
||||
// make sure namespace starts with a period & doesn't have weird characters
|
||||
c.namespace = '.' + c.namespace.replace(/\W/g,'');
|
||||
c.namespace = '.' + c.namespace.replace(/\W/g, '');
|
||||
}
|
||||
|
||||
c.$table.children().children('tr').attr('role', 'row');
|
||||
@ -1202,7 +1204,7 @@
|
||||
ts.applyWidget(table, true);
|
||||
// if user has supplied a sort list to constructor
|
||||
if (c.sortList.length > 0) {
|
||||
$table.trigger('sorton', [c.sortList, {}, !c.initWidgets, true]);
|
||||
$table.trigger('sorton', [ c.sortList, {}, !c.initWidgets, true ]);
|
||||
} else {
|
||||
setHeadersCss(table);
|
||||
if (c.initWidgets) {
|
||||
@ -1241,22 +1243,22 @@
|
||||
table = $(table)[0];
|
||||
var overallWidth, percent, $tbodies, len, index,
|
||||
c = table.config,
|
||||
colgroup = c.$table.children('colgroup');
|
||||
$colgroup = c.$table.children('colgroup');
|
||||
// remove plugin-added colgroup, in case we need to refresh the widths
|
||||
if (colgroup.length && colgroup.hasClass(ts.css.colgroup)) {
|
||||
colgroup.remove();
|
||||
if ($colgroup.length && $colgroup.hasClass(ts.css.colgroup)) {
|
||||
$colgroup.remove();
|
||||
}
|
||||
if (c.widthFixed && c.$table.children('colgroup').length === 0) {
|
||||
colgroup = $('<colgroup class="' + ts.css.colgroup + '">');
|
||||
$colgroup = $('<colgroup class="' + ts.css.colgroup + '">');
|
||||
overallWidth = c.$table.width();
|
||||
// only add col for visible columns - fixes #371
|
||||
$tbodies = c.$tbodies.find('tr:first').children(':visible'); //.each(function()
|
||||
$tbodies = c.$tbodies.find('tr:first').children(':visible'); // .each(function()
|
||||
len = $tbodies.length;
|
||||
for ( index = 0; index < len; index++ ) {
|
||||
percent = parseInt( ( $tbodies.eq( index ).width() / overallWidth ) * 1000, 10 ) / 10 + '%';
|
||||
colgroup.append( $('<col>').css('width', percent) );
|
||||
$colgroup.append( $('<col>').css('width', percent) );
|
||||
}
|
||||
c.$table.prepend(colgroup);
|
||||
c.$table.prepend($colgroup);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1303,12 +1305,12 @@
|
||||
cellId = rowIndex + '-' + $cell.index();
|
||||
rowSpan = cell.rowSpan || 1;
|
||||
colSpan = cell.colSpan || 1;
|
||||
if (typeof(matrix[rowIndex]) === 'undefined') {
|
||||
if (typeof matrix[rowIndex] === 'undefined') {
|
||||
matrix[rowIndex] = [];
|
||||
}
|
||||
// Find first available column in the first row
|
||||
for (k = 0; k < matrix[rowIndex].length + 1; k++) {
|
||||
if (typeof(matrix[rowIndex][k]) === 'undefined') {
|
||||
if (typeof matrix[rowIndex][k] === 'undefined') {
|
||||
firstAvailCol = k;
|
||||
break;
|
||||
}
|
||||
@ -1317,7 +1319,7 @@
|
||||
// add data-column
|
||||
$cell.attr({ 'data-column' : firstAvailCol }); // 'data-row' : rowIndex
|
||||
for (k = rowIndex; k < rowIndex + rowSpan; k++) {
|
||||
if (typeof(matrix[k]) === 'undefined') {
|
||||
if (typeof matrix[k] === 'undefined') {
|
||||
matrix[k] = [];
|
||||
}
|
||||
matrixrow = matrix[k];
|
||||
@ -1333,10 +1335,10 @@
|
||||
// *** Process table ***
|
||||
// add processing indicator
|
||||
ts.isProcessing = function(table, toggle, $ths) {
|
||||
table = $(table);
|
||||
var c = table[0].config,
|
||||
$table = $(table);
|
||||
var c = $table[0].config,
|
||||
// default to all headers
|
||||
$h = $ths || table.find('.' + ts.css.header);
|
||||
$h = $ths || $table.find('.' + ts.css.header);
|
||||
if (toggle) {
|
||||
// don't use sortList if custom $ths used
|
||||
if (typeof $ths !== 'undefined' && c.sortList.length > 0) {
|
||||
@ -1346,9 +1348,9 @@
|
||||
return this.sortDisabled ? false : ts.isValueInArray( parseFloat($(this).attr('data-column')), c.sortList) >= 0;
|
||||
});
|
||||
}
|
||||
table.add($h).addClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
$table.add($h).addClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
} else {
|
||||
table.add($h).removeClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
$table.add($h).removeClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1478,8 +1480,8 @@
|
||||
$f = $t.find('tfoot:first > tr').children('th, td');
|
||||
if (removeClasses === false && $.inArray('uitheme', c.widgets) >= 0) {
|
||||
// reapply uitheme classes, in case we want to maintain appearance
|
||||
$t.trigger('applyWidgetId', ['uitheme']);
|
||||
$t.trigger('applyWidgetId', ['zebra']);
|
||||
$t.trigger('applyWidgetId', [ 'uitheme' ]);
|
||||
$t.trigger('applyWidgetId', [ 'zebra' ]);
|
||||
}
|
||||
// remove widget added rows, just in case
|
||||
$h.find('tr').not($r).remove();
|
||||
@ -1491,7 +1493,7 @@
|
||||
.removeData('tablesorter')
|
||||
.unbind( events.replace(/\s+/g, ' ') );
|
||||
c.$headers.add($f)
|
||||
.removeClass( [ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone].join(' ') )
|
||||
.removeClass( [ ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone ].join(' ') )
|
||||
.removeAttr('data-column')
|
||||
.removeAttr('aria-label')
|
||||
.attr('aria-disabled', 'true');
|
||||
@ -1697,8 +1699,8 @@
|
||||
};
|
||||
|
||||
ts.hasWidget = function(table, name){
|
||||
table = $(table);
|
||||
return table.length && table[0].config && table[0].config.widgetInit[name] || false;
|
||||
$table = $(table);
|
||||
return $table.length && $table[0].config && $table[0].config.widgetInit[name] || false;
|
||||
};
|
||||
|
||||
ts.getWidgetById = function(name) {
|
||||
@ -1738,7 +1740,7 @@
|
||||
if (c.debug) { time = new Date(); }
|
||||
// look for widgets to apply from in table class
|
||||
// stop using \b otherwise this matches 'ui-widget-content' & adds 'content' widget
|
||||
wd = new RegExp( '\\s' + c.widgetClass.replace( /\{name\}/i, '([\\w-]+)' )+ '\\s', 'g' );
|
||||
wd = new RegExp( '\\s' + c.widgetClass.replace( /\{name\}/i, '([\\w-]+)' ) + '\\s', 'g' );
|
||||
if ( tableClass.match( wd ) ) {
|
||||
// extract out the widget id from the table class (widget id's can include dashes)
|
||||
w = tableClass.match( wd );
|
||||
@ -1946,13 +1948,13 @@
|
||||
typeof table !== 'undefined' ? table : true;
|
||||
if (t) {
|
||||
// US Format - 1,234,567.89 -> 1234567.89
|
||||
s = s.replace(/,/g,'');
|
||||
s = s.replace(/,/g, '');
|
||||
} else {
|
||||
// German Format = 1.234.567,89 -> 1234567.89
|
||||
// French Format = 1 234 567,89 -> 1234567.89
|
||||
s = s.replace(/[\s|\.]/g,'').replace(/,/g,'.');
|
||||
s = s.replace(/[\s|\.]/g, '').replace(/,/g, '.');
|
||||
}
|
||||
if(/^\s*\([.\d]+\)/.test(s)) {
|
||||
if (/^\s*\([.\d]+\)/.test(s)) {
|
||||
// make (#) into a negative number -> (10) = -10
|
||||
s = s.replace(/^\s*\(([.\d]+)\)/, '-$1');
|
||||
}
|
||||
@ -2020,7 +2022,7 @@
|
||||
ts.addParser({
|
||||
id: 'currency',
|
||||
is: function(s) {
|
||||
return (/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/).test((s || '').replace(/[+\-,. ]/g,'')); // £$€¤¥¢
|
||||
return (/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/).test((s || '').replace(/[+\-,. ]/g, '')); // £$€¤¥¢
|
||||
},
|
||||
format: function(s, table) {
|
||||
var n = ts.formatFloat((s || '').replace(/[^\w,. \-()]/g, ''), table);
|
||||
@ -2095,7 +2097,7 @@
|
||||
id: 'shortDate', // 'mmddyyyy', 'ddmmyyyy' or 'yyyymmdd'
|
||||
is: function(s) {
|
||||
// testing for ##-##-#### or ####-##-##, so it's not perfect; time can be included
|
||||
return (/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/).test((s || '').replace(/\s+/g,' ').replace(/[\-.,]/g, '/'));
|
||||
return (/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/).test((s || '').replace(/\s+/g, ' ').replace(/[\-.,]/g, '/'));
|
||||
},
|
||||
format: function(s, table, cell, cellIndex) {
|
||||
if (s) {
|
||||
|
4
dist/js/jquery.tablesorter.min.js
vendored
4
dist/js/jquery.tablesorter.min.js
vendored
File diff suppressed because one or more lines are too long
227
dist/js/jquery.tablesorter.widgets.js
vendored
227
dist/js/jquery.tablesorter.widgets.js
vendored
@ -12,11 +12,11 @@
|
||||
|
||||
/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
|
||||
;(function ($, window, document) {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter || {};
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
var ts = $.tablesorter || {};
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
if you need it, then include https://github.com/douglascrockford/JSON-js
|
||||
|
||||
$.parseJSON is not available is jQuery versions older than 1.4.1, using older
|
||||
@ -32,9 +32,9 @@ var ts = $.tablesorter || {};
|
||||
v = $.tablesorter.storage(table, 'tablesorter-mywidget');
|
||||
// val may be empty, so also check for your data
|
||||
val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
|
||||
alert(val); // "data1" if saved, or "" if not
|
||||
*/
|
||||
ts.storage = function(table, key, value, options) {
|
||||
alert(val); // 'data1' if saved, or '' if not
|
||||
*/
|
||||
ts.storage = function(table, key, value, options) {
|
||||
table = $(table)[0];
|
||||
var cookieIndex, cookies, date,
|
||||
hasStorage = false,
|
||||
@ -44,12 +44,12 @@ ts.storage = function(table, key, value, options) {
|
||||
storageType = ( options && options.useSessionStorage ) || ( wo && wo.storage_useSessionStorage ) ?
|
||||
'sessionStorage' : 'localStorage',
|
||||
$table = $(table),
|
||||
// id from (1) options ID, (2) table "data-table-group" attribute, (3) widgetOptions.storage_tableId,
|
||||
// id from (1) options ID, (2) table 'data-table-group' attribute, (3) widgetOptions.storage_tableId,
|
||||
// (4) table ID, then (5) table index
|
||||
id = options && options.id ||
|
||||
$table.attr( options && options.group || wo && wo.storage_group || 'data-table-group') ||
|
||||
wo && wo.storage_tableId || table.id || $('.tablesorter').index( $table ),
|
||||
// url from (1) options url, (2) table "data-table-page" attribute, (3) widgetOptions.storage_fixedUrl,
|
||||
// url from (1) options url, (2) table 'data-table-page' attribute, (3) widgetOptions.storage_fixedUrl,
|
||||
// (4) table.config.fixedUrl (deprecated), then (5) window location path
|
||||
url = options && options.url ||
|
||||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
|
||||
@ -60,7 +60,7 @@ ts.storage = function(table, key, value, options) {
|
||||
window[storageType].setItem('_tmptest', 'temp');
|
||||
hasStorage = true;
|
||||
window[storageType].removeItem('_tmptest');
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
if (c && c.debug) {
|
||||
ts.log( storageType + ' is not supported in this browser' );
|
||||
}
|
||||
@ -91,21 +91,21 @@ ts.storage = function(table, key, value, options) {
|
||||
} else {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (31536e+6)); // 365 days
|
||||
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g,'\"') + '; expires=' + date.toGMTString() + '; path=/';
|
||||
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g, '\"') + '; expires=' + date.toGMTString() + '; path=/';
|
||||
}
|
||||
} else {
|
||||
return values && values[url] ? values[url][id] : '';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
})(jQuery, window, document);
|
||||
|
||||
/*! Widget: uitheme - updated 3/26/2015 (v2.21.3) */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
ts.themes = {
|
||||
ts.themes = {
|
||||
'bootstrap' : {
|
||||
table : 'table table-bordered table-striped',
|
||||
caption : 'caption',
|
||||
@ -117,7 +117,7 @@ ts.themes = {
|
||||
active : '', // applied when column is sorted
|
||||
hover : '', // custom css required - a defined bootstrap style may not override other classes
|
||||
// icon class names
|
||||
icons : '', // add "icon-white" to make them white; this icon class is added to the <i> in the header
|
||||
icons : '', // add 'icon-white' to make them white; this icon class is added to the <i> in the header
|
||||
iconSortNone : 'bootstrap-icon-unsorted', // class name added to icon when column is not sorted
|
||||
iconSortAsc : 'icon-chevron-up glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort
|
||||
iconSortDesc : 'icon-chevron-down glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort
|
||||
@ -148,14 +148,14 @@ ts.themes = {
|
||||
even : 'ui-widget-content', // even row zebra striping
|
||||
odd : 'ui-state-default' // odd row zebra striping
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
wrapper : 'tablesorter-wrapper' // ui theme & resizable
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
id: "uitheme",
|
||||
ts.addWidget({
|
||||
id: 'uitheme',
|
||||
priority: 10,
|
||||
format: function(table, c, wo) {
|
||||
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
||||
@ -177,7 +177,7 @@ ts.addWidget({
|
||||
if (hasOldTheme) {
|
||||
wo.zebra[0] = $.trim( ' ' + wo.zebra[0].replace(' ' + oldtheme.even, '') );
|
||||
wo.zebra[1] = $.trim( ' ' + wo.zebra[1].replace(' ' + oldtheme.odd, '') );
|
||||
c.$tbodies.children().removeClass( [oldtheme.even, oldtheme.odd].join(' ') );
|
||||
c.$tbodies.children().removeClass( [ oldtheme.even, oldtheme.odd ].join(' ') );
|
||||
}
|
||||
// update zebra stripes
|
||||
if (themes.even) { wo.zebra[0] += ' ' + themes.even; }
|
||||
@ -202,7 +202,7 @@ ts.addWidget({
|
||||
}
|
||||
// update header classes
|
||||
$headers
|
||||
.removeClass( (hasOldTheme ? [oldtheme.header, oldtheme.hover, oldremove].join(' ') : '') || '' )
|
||||
.removeClass( (hasOldTheme ? [ oldtheme.header, oldtheme.hover, oldremove ].join(' ') : '') || '' )
|
||||
.addClass(themes.header)
|
||||
.not('.sorter-false')
|
||||
.unbind('mouseenter.tsuitheme mouseleave.tsuitheme')
|
||||
@ -222,7 +222,7 @@ ts.addWidget({
|
||||
// if c.cssIcon is '', then no <i> is added to the header
|
||||
$headers
|
||||
.find('.' + ts.css.icon)
|
||||
.removeClass(hasOldTheme ? [oldtheme.icons, oldIconRmv].join(' ') : '')
|
||||
.removeClass(hasOldTheme ? [ oldtheme.icons, oldIconRmv ].join(' ') : '')
|
||||
.addClass(themes.icons || '');
|
||||
}
|
||||
if ($table.hasClass('hasFilters')) {
|
||||
@ -248,10 +248,10 @@ ts.addWidget({
|
||||
hdr = themes.sortNone;
|
||||
icon = themes.iconSortNone;
|
||||
if ($h.hasClass(ts.css.sortAsc)) {
|
||||
hdr = [themes.sortAsc, themes.active].join(' ');
|
||||
hdr = [ themes.sortAsc, themes.active ].join(' ');
|
||||
icon = themes.iconSortAsc;
|
||||
} else if ($h.hasClass(ts.css.sortDesc)) {
|
||||
hdr = [themes.sortDesc, themes.active].join(' ');
|
||||
hdr = [ themes.sortDesc, themes.active ].join(' ');
|
||||
icon = themes.iconSortDesc;
|
||||
}
|
||||
$header.addClass(hdr);
|
||||
@ -260,7 +260,7 @@ ts.addWidget({
|
||||
}
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.benchmark("Applying " + theme + " theme", time);
|
||||
ts.benchmark('Applying ' + theme + ' theme', time);
|
||||
}
|
||||
},
|
||||
remove: function(table, c, wo, refreshing) {
|
||||
@ -282,20 +282,20 @@ ts.addWidget({
|
||||
.removeClass(themes.filterRow);
|
||||
$headers.find('.' + ts.css.icon).removeClass(themes.icons + ' ' + iconRmv);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
/*! Widget: columns */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
ts.addWidget({
|
||||
id: "columns",
|
||||
ts.addWidget({
|
||||
id: 'columns',
|
||||
priority: 30,
|
||||
options : {
|
||||
columns : [ "primary", "secondary", "tertiary" ]
|
||||
columns : [ 'primary', 'secondary', 'tertiary' ]
|
||||
},
|
||||
format: function(table, c, wo) {
|
||||
var $tbody, tbodyIndex, $rows, rows, $row, $cells, remove, indx,
|
||||
@ -304,7 +304,7 @@ ts.addWidget({
|
||||
sortList = c.sortList,
|
||||
len = sortList.length,
|
||||
// removed c.widgetColumns support
|
||||
css = wo && wo.columns || [ "primary", "secondary", "tertiary" ],
|
||||
css = wo && wo.columns || [ 'primary', 'secondary', 'tertiary' ],
|
||||
last = css.length - 1;
|
||||
remove = css.join(' ');
|
||||
// check if there is a sort (on initialization there may not be one)
|
||||
@ -333,7 +333,7 @@ ts.addWidget({
|
||||
ts.processTbody(table, $tbody, false);
|
||||
}
|
||||
// add classes to thead and tfoot
|
||||
rows = wo.columns_thead !== false ? ['thead tr'] : [];
|
||||
rows = wo.columns_thead !== false ? [ 'thead tr' ] : [];
|
||||
if (wo.columns_tfoot !== false) {
|
||||
rows.push('tfoot tr');
|
||||
}
|
||||
@ -350,7 +350,7 @@ ts.addWidget({
|
||||
remove: function(table, c, wo) {
|
||||
var tbodyIndex, $tbody,
|
||||
$tbodies = c.$tbodies,
|
||||
remove = (wo.columns || [ "primary", "secondary", "tertiary" ]).join(' ');
|
||||
remove = (wo.columns || [ 'primary', 'secondary', 'tertiary' ]).join(' ');
|
||||
c.$headers.removeClass(remove);
|
||||
c.$table.children('tfoot').children('tr').children('th, td').removeClass(remove);
|
||||
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
|
||||
@ -361,7 +361,7 @@ ts.addWidget({
|
||||
ts.processTbody(table, $tbody, false); // restore tbody
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
@ -370,18 +370,18 @@ ts.addWidget({
|
||||
* by Rob Garrison
|
||||
*/
|
||||
;( function ( $ ) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
tscss = ts.css;
|
||||
|
||||
$.extend( tscss, {
|
||||
$.extend( tscss, {
|
||||
filterRow : 'tablesorter-filter-row',
|
||||
filter : 'tablesorter-filter',
|
||||
filterDisabled : 'disabled',
|
||||
filterRowHide : 'hideme'
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id: 'filter',
|
||||
priority: 50,
|
||||
options : {
|
||||
@ -410,7 +410,7 @@ ts.addWidget({
|
||||
filter_selectSource : null, // include a function to return an array of values to be added to the column filter select
|
||||
filter_startsWith : false, // if true, filter start from the beginning of the cell contents
|
||||
filter_useParsedData : false, // filter all data using parsed content
|
||||
filter_serversideFiltering : false, // if true, server-side filtering should be performed because client-side filtering will be disabled, but the ui and events will still be used.
|
||||
filter_serversideFiltering : false, // if true, must perform server-side filtering b/c client-side filtering is disabled, but the ui and events will still be used.
|
||||
filter_defaultAttrib : 'data-value', // data attribute in the header cell that contains the default filter value
|
||||
filter_selectSourceSeparator : '|' // filter_selectSource array text left of the separator is added to the option value, right into the option text
|
||||
},
|
||||
@ -441,9 +441,9 @@ ts.addWidget({
|
||||
$( document ).undelegate( wo.filter_reset, 'click.tsfilter' );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.filter = {
|
||||
ts.filter = {
|
||||
|
||||
// regex used in filter 'check' functions - not for general use and not documented
|
||||
regex: {
|
||||
@ -717,7 +717,7 @@ ts.filter = {
|
||||
filtered : new RegExp( wo.filter_filteredRow ),
|
||||
alreadyFiltered : new RegExp( '(\\s+(' + ts.language.or + '|-|' + ts.language.to + ')\\s+)', 'i' ),
|
||||
toTest : new RegExp( '\\s+(-|' + ts.language.to + ')\\s+', 'i' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)' ,'gi' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)', 'gi' ),
|
||||
andTest : new RegExp( '\\s+(' + ts.language.and + '|&&)\\s+', 'i' ),
|
||||
andSplit : new RegExp( '(?:\\s+(?:' + ts.language.and + '|&&)\\s+)', 'gi' ),
|
||||
orSplit : new RegExp( '(?:\\s+(?:' + ts.language.or + ')\\s+|\\|)', 'gi' ),
|
||||
@ -1152,7 +1152,7 @@ ts.filter = {
|
||||
c.lastSearch = [];
|
||||
}
|
||||
if ( wo.filter_initialized ) {
|
||||
c.$table.trigger( 'filterStart', [filters] );
|
||||
c.$table.trigger( 'filterStart', [ filters ] );
|
||||
}
|
||||
if ( c.showProcessing ) {
|
||||
// give it time for the processing icon to kick in
|
||||
@ -1382,7 +1382,7 @@ ts.filter = {
|
||||
// in case select filter option has a different value vs text 'a - z|A through Z'
|
||||
ffxn = wo.filter_columnFilters ?
|
||||
c.$filters.add( c.$externalFilters )
|
||||
.filter( '[data-column="'+ columnIndex + '"]' )
|
||||
.filter( '[data-column="' + columnIndex + '"]' )
|
||||
.find( 'select option:selected' )
|
||||
.attr( 'data-function-name' ) || '' : '';
|
||||
// replace accents - see #357
|
||||
@ -1742,7 +1742,7 @@ ts.filter = {
|
||||
if ( $.isFunction( cts ) ) {
|
||||
// custom OVERALL text sorter
|
||||
return cts( x, y, true, column, table );
|
||||
} else if ( typeof( cts ) === 'object' && cts.hasOwnProperty( column ) ) {
|
||||
} else if ( typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
||||
// custom text sorter for a SPECIFIC COLUMN
|
||||
return cts[column]( x, y, true, column, table );
|
||||
} else if ( ts.sortNatural ) {
|
||||
@ -1884,9 +1884,9 @@ ts.filter = {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
var i, $filters, $column, cols,
|
||||
filters = false,
|
||||
c = table ? $( table )[0].config : '',
|
||||
@ -1957,9 +1957,9 @@ ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
filters = false;
|
||||
}
|
||||
return filters;
|
||||
};
|
||||
};
|
||||
|
||||
ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
var c = table ? $( table )[0].config : '',
|
||||
valid = ts.getFilters( table, true, filter, skipFirst );
|
||||
if ( c && apply ) {
|
||||
@ -1970,7 +1970,7 @@ ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
c.$table.trigger( 'filterFomatterUpdate' );
|
||||
}
|
||||
return !!valid;
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery );
|
||||
|
||||
@ -1979,18 +1979,18 @@ ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
* by Rob Garrison
|
||||
*/
|
||||
;(function ($, window) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
sticky : 'tablesorter-stickyHeader', // stickyHeader
|
||||
stickyVis : 'tablesorter-sticky-visible',
|
||||
stickyHide: 'tablesorter-sticky-hidden',
|
||||
stickyWrap: 'tablesorter-sticky-wrapper'
|
||||
});
|
||||
});
|
||||
|
||||
// Add a resize event to table headers
|
||||
ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
// Add a resize event to table headers
|
||||
ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
table = $(table)[0]; // make sure we're using a dom element
|
||||
if ( !table.config ) { return; }
|
||||
var defaults = {
|
||||
@ -2006,7 +2006,7 @@ ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
headers = [];
|
||||
for ( index = 0; index < len; index++ ) {
|
||||
$header = c.$headers.eq( index );
|
||||
sizes = $header.data( 'savedSizes' ) || [ 0,0 ]; // fixes #394
|
||||
sizes = $header.data( 'savedSizes' ) || [ 0, 0 ]; // fixes #394
|
||||
width = $header[0].offsetWidth;
|
||||
height = $header[0].offsetHeight;
|
||||
if ( width !== sizes[0] || height !== sizes[1] ) {
|
||||
@ -2029,14 +2029,14 @@ ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
if (wo.resize_flag) { return; }
|
||||
checkSizes();
|
||||
}, options.timer);
|
||||
};
|
||||
};
|
||||
|
||||
// Sticky headers based on this awesome article:
|
||||
// http://css-tricks.com/13465-persistent-headers/
|
||||
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: "stickyHeaders",
|
||||
// Sticky headers based on this awesome article:
|
||||
// http://css-tricks.com/13465-persistent-headers/
|
||||
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'stickyHeaders',
|
||||
priority: 60, // sticky widget must be initialized after the filter widget!
|
||||
options: {
|
||||
stickyHeaders : '', // extra class name added to the sticky header row
|
||||
@ -2046,7 +2046,7 @@ ts.addWidget({
|
||||
stickyHeaders_offset : 0, // number or jquery selector targeting the position:fixed element
|
||||
stickyHeaders_filteredToTop: true, // scroll table top into view after filtering
|
||||
stickyHeaders_cloneId : '-sticky', // added to table ID, if it exists
|
||||
stickyHeaders_addResizeEvent : true, // trigger "resize" event on headers
|
||||
stickyHeaders_addResizeEvent : true, // trigger 'resize' event on headers
|
||||
stickyHeaders_includeCaption : true, // if false and a caption exist, it won't be included in the sticky header
|
||||
stickyHeaders_zIndex : 2 // The zIndex of the stickyHeaders, allows the user to adjust this to their needs
|
||||
},
|
||||
@ -2259,25 +2259,25 @@ ts.addWidget({
|
||||
.unbind( ('scroll resize '.split(' ').join(namespace)).replace(/\s+/g, ' ') );
|
||||
ts.addHeaderResizeEvent(table, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, window);
|
||||
|
||||
/*! Widget: resizable - updated 6/26/2015 (v2.22.2) */
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function ($, window) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
resizableContainer : 'tablesorter-resizable-container',
|
||||
resizableHandle : 'tablesorter-resizable-handle',
|
||||
resizableNoSelect : 'tablesorter-disableSelection',
|
||||
resizableStorage : 'tablesorter-resizable'
|
||||
});
|
||||
});
|
||||
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
var s = '<style>' +
|
||||
'body.' + ts.css.resizableNoSelect + ' { -ms-user-select: none; -moz-user-select: -moz-none;' +
|
||||
'-khtml-user-select: none; -webkit-user-select: none; user-select: none; }' +
|
||||
@ -2287,9 +2287,9 @@ $(function(){
|
||||
'top: 1px; cursor: ew-resize; z-index: 3; user-select: none; -moz-user-select: none; }' +
|
||||
'</style>';
|
||||
$(s).appendTo('body');
|
||||
});
|
||||
});
|
||||
|
||||
ts.resizable = {
|
||||
ts.resizable = {
|
||||
init : function( c, wo ) {
|
||||
if ( c.$table.hasClass( 'hasResizable' ) ) { return; }
|
||||
c.$table.addClass( 'hasResizable' );
|
||||
@ -2300,7 +2300,7 @@ ts.resizable = {
|
||||
marginTop = parseInt( $table.css( 'margin-top' ), 10 ),
|
||||
|
||||
// internal variables
|
||||
vars = wo.resizable_ = {
|
||||
vars = wo.resizable_vars = {
|
||||
useStorage : ts.storage && wo.resizable !== false,
|
||||
$wrap : $parent,
|
||||
mouseXPosition : 0,
|
||||
@ -2322,7 +2322,7 @@ ts.resizable = {
|
||||
vars.fullWidth = Math.abs( $parent.width() - vars.tableWidth ) < 20;
|
||||
|
||||
/*
|
||||
// Hacky method to determine if table width is set to "auto"
|
||||
// Hacky method to determine if table width is set to 'auto'
|
||||
// http://stackoverflow.com/a/20892048/145346
|
||||
if ( !vars.fullWidth ) {
|
||||
tmp = $table.width();
|
||||
@ -2342,7 +2342,7 @@ ts.resizable = {
|
||||
tmp = ts.storage( c.table, 'tablesorter-table-resized-width' ) || 'auto';
|
||||
ts.resizable.setWidth( $table, tmp, true );
|
||||
}
|
||||
wo.resizable_.storedSizes = storedSizes = ( vars.useStorage ?
|
||||
wo.resizable_vars.storedSizes = storedSizes = ( vars.useStorage ?
|
||||
ts.storage( c.table, ts.css.resizableStorage ) :
|
||||
[] ) || [];
|
||||
ts.resizable.setWidths( c, wo, storedSizes );
|
||||
@ -2376,7 +2376,7 @@ ts.resizable = {
|
||||
updateStoredSizes : function( c, wo ) {
|
||||
var column, $header,
|
||||
len = c.columns,
|
||||
vars = wo.resizable_;
|
||||
vars = wo.resizable_vars;
|
||||
vars.storedSizes = [];
|
||||
for ( column = 0; column < len; column++ ) {
|
||||
$header = c.$headerIndexed[ column ];
|
||||
@ -2395,7 +2395,7 @@ ts.resizable = {
|
||||
|
||||
setWidths : function( c, wo, storedSizes ) {
|
||||
var column, $temp,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$extra = $( c.namespace + '_extra_headers' ),
|
||||
$col = c.$table.children( 'colgroup' ).children( 'col' );
|
||||
storedSizes = storedSizes || vars.storedSizes || [];
|
||||
@ -2455,7 +2455,7 @@ ts.resizable = {
|
||||
// prevent text selection while dragging resize bar
|
||||
toggleTextSelection : function( c, toggle ) {
|
||||
var namespace = c.namespace + 'tsresize';
|
||||
c.widgetOptions.resizable_.disabled = toggle;
|
||||
c.widgetOptions.resizable_vars.disabled = toggle;
|
||||
$( 'body' ).toggleClass( ts.css.resizableNoSelect, toggle );
|
||||
if ( toggle ) {
|
||||
$( 'body' )
|
||||
@ -2473,7 +2473,7 @@ ts.resizable = {
|
||||
wo.$resizable_container.children().bind( 'mousedown', function( event ) {
|
||||
// save header cell and mouse position
|
||||
var column,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$extras = $( c.namespace + '_extra_headers' ),
|
||||
$header = $( event.target ).data( 'header' );
|
||||
|
||||
@ -2497,7 +2497,7 @@ ts.resizable = {
|
||||
|
||||
$( document )
|
||||
.bind( 'mousemove' + namespace, function( event ) {
|
||||
var vars = wo.resizable_;
|
||||
var vars = wo.resizable_vars;
|
||||
// ignore mousemove if no mousedown
|
||||
if ( !vars.disabled || vars.mouseXPosition === 0 || !vars.$target ) { return; }
|
||||
if ( wo.resizable_throttle ) {
|
||||
@ -2510,7 +2510,7 @@ ts.resizable = {
|
||||
}
|
||||
})
|
||||
.bind( 'mouseup' + namespace, function() {
|
||||
if (!wo.resizable_.disabled) { return; }
|
||||
if (!wo.resizable_vars.disabled) { return; }
|
||||
ts.resizable.toggleTextSelection( c, false );
|
||||
ts.resizable.stopResize( c, wo );
|
||||
ts.resizable.setHandlePosition( c, wo );
|
||||
@ -2530,21 +2530,21 @@ ts.resizable = {
|
||||
.add( $( c.namespace + '_extra_table' ).find( 'thead:first' ) )
|
||||
.bind( 'contextmenu' + namespace, function() {
|
||||
// $.isEmptyObject() needs jQuery 1.4+; allow right click if already reset
|
||||
var allowClick = wo.resizable_.storedSizes.length === 0;
|
||||
var allowClick = wo.resizable_vars.storedSizes.length === 0;
|
||||
ts.resizableReset( c.table );
|
||||
ts.resizable.setHandlePosition( c, wo );
|
||||
wo.resizable_.storedSizes = [];
|
||||
wo.resizable_vars.storedSizes = [];
|
||||
return allowClick;
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
mouseMove : function( c, wo, event ) {
|
||||
if ( wo.resizable_.mouseXPosition === 0 || !wo.resizable_.$target ) { return; }
|
||||
if ( wo.resizable_vars.mouseXPosition === 0 || !wo.resizable_vars.$target ) { return; }
|
||||
// resize columns
|
||||
var column,
|
||||
total = 0,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$next = vars.$next,
|
||||
tar = vars.storedSizes[ vars.target ],
|
||||
leftEdge = event.pageX - vars.mouseXPosition;
|
||||
@ -2576,7 +2576,7 @@ ts.resizable = {
|
||||
},
|
||||
|
||||
stopResize : function( c, wo ) {
|
||||
var vars = wo.resizable_;
|
||||
var vars = wo.resizable_vars;
|
||||
ts.resizable.updateStoredSizes( c, wo );
|
||||
if ( vars.useStorage ) {
|
||||
// save all column widths
|
||||
@ -2588,13 +2588,13 @@ ts.resizable = {
|
||||
// will update stickyHeaders, just in case, see #912
|
||||
c.$table.trigger('stickyHeadersUpdate');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// this widget saves the column widths if
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: "resizable",
|
||||
// this widget saves the column widths if
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'resizable',
|
||||
priority: 40,
|
||||
options: {
|
||||
resizable : true, // save column widths to storage
|
||||
@ -2612,7 +2612,8 @@ ts.addWidget({
|
||||
var namespace = c.namespace + 'tsresize';
|
||||
c.$table.add( $( c.namespace + '_extra_table' ) )
|
||||
.removeClass('hasResizable')
|
||||
.children( 'thead' ).unbind( 'contextmenu' + namespace );
|
||||
.children( 'thead' )
|
||||
.unbind( 'contextmenu' + namespace );
|
||||
|
||||
wo.$resizable_container.remove();
|
||||
ts.resizable.toggleTextSelection( c, false );
|
||||
@ -2620,14 +2621,14 @@ ts.addWidget({
|
||||
$( document ).unbind( 'mousemove' + namespace + ' mouseup' + namespace );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.resizableReset = function( table, refreshing ) {
|
||||
ts.resizableReset = function( table, refreshing ) {
|
||||
$( table ).each(function(){
|
||||
var index, $t,
|
||||
c = this.config,
|
||||
wo = c && c.widgetOptions,
|
||||
vars = wo.resizable_;
|
||||
vars = wo.resizable_vars;
|
||||
if ( table && c && c.$headerIndexed.length ) {
|
||||
// restore the initial table width
|
||||
if ( vars.overflow && vars.tableWidth ) {
|
||||
@ -2653,20 +2654,20 @@ ts.resizableReset = function( table, refreshing ) {
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery, window );
|
||||
|
||||
/*! Widget: saveSort */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
// this widget saves the last sort only if the
|
||||
// saveSort widget option is true AND the
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
// this widget saves the last sort only if the
|
||||
// saveSort widget option is true AND the
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'saveSort',
|
||||
priority: 20,
|
||||
options: {
|
||||
@ -2680,7 +2681,7 @@ ts.addWidget({
|
||||
var stored, time,
|
||||
$table = c.$table,
|
||||
saveSort = wo.saveSort !== false, // make saveSort active/inactive; default to true
|
||||
sortList = { "sortList" : c.sortList };
|
||||
sortList = { 'sortList' : c.sortList };
|
||||
if (c.debug) {
|
||||
time = new Date();
|
||||
}
|
||||
@ -2713,7 +2714,7 @@ ts.addWidget({
|
||||
c.sortList = sortList;
|
||||
} else if (table.hasInitialized && sortList && sortList.length > 0) {
|
||||
// update sort change
|
||||
$table.trigger('sorton', [sortList]);
|
||||
$table.trigger('sorton', [ sortList ]);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2722,7 +2723,7 @@ ts.addWidget({
|
||||
// clear storage
|
||||
if (ts.storage) { ts.storage( table, 'tablesorter-savesort', '' ); }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
2
dist/js/jquery.tablesorter.widgets.min.js
vendored
2
dist/js/jquery.tablesorter.widgets.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
||||
/*! Parser: distance */
|
||||
!function(a){"use strict";var b=a.tablesorter;b.symbolRegex=/[\u215b\u215c\u215d\u215e\u00bc\u00bd\u00be]/g,b.processFractions=function(c,d){if(c){var e,f=0;c=a.trim(c.replace(/\"/,"")),/\s/.test(c)&&(f=b.formatFloat(c.split(" ")[0],d),c=a.trim(c.substring(c.indexOf(" "),c.length))),/\//g.test(c)?(e=c.split("/"),c=f+parseInt(e[0],10)/parseInt(e[1]||1,10)):b.symbolRegex.test(c)&&(c=f+c.replace(b.symbolRegex,function(a){return{"⅛":".125","⅜":".375","⅝":".625","⅞":".875","¼":".25","½":".5","¾":".75"}[a]}))}return c||0},a.tablesorter.addParser({id:"distance",is:function(){return!1},format:function(a,c){if(""===a)return"";var d=/^\s*\S*(\s+\S+)?\s*\'/.test(a)?a.split("'"):[0,a],e=b.processFractions(d[0],c),f=b.processFractions(d[1],c);return/[\'\"]/.test(a)?parseFloat(e)+(parseFloat(f)/12||0):parseFloat(e)+parseFloat(f)},type:"numeric"})}(jQuery);
|
||||
!function(a){"use strict";var b=a.tablesorter;b.symbolRegex=/[\u215b\u215c\u215d\u215e\u00bc\u00bd\u00be]/g,b.processFractions=function(c,d){if(c){var e,f=0;c=a.trim(c.replace(/\"/,"")),/\s/.test(c)&&(f=b.formatFloat(c.split(" ")[0],d),c=a.trim(c.substring(c.indexOf(" "),c.length))),/\//g.test(c)?(e=c.split("/"),c=f+parseInt(e[0],10)/parseInt(e[1]||1,10)):b.symbolRegex.test(c)&&(c=f+c.replace(b.symbolRegex,function(a){return{"⅛":".125","⅜":".375","⅝":".625","⅞":".875","¼":".25","½":".5","¾":".75"}[a]}))}return c||0},a.tablesorter.addParser({id:"distance",is:function(){return!1},format:function(a,c){if(""===a)return"";var d=/^\s*\S*(\s+\S+)?\s*\'/.test(a)?a.split(/\'/):[0,a],e=b.processFractions(d[0],c),f=b.processFractions(d[1],c);return/[\'\"]/.test(a)?parseFloat(e)+(parseFloat(f)/12||0):parseFloat(e)+parseFloat(f)},type:"numeric"})}(jQuery);
|
2
dist/js/widgets/widget-resizable.min.js
vendored
2
dist/js/widgets/widget-resizable.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/widgets/widget-scroller.min.js
vendored
2
dist/js/widgets/widget-scroller.min.js
vendored
File diff suppressed because one or more lines are too long
@ -206,7 +206,7 @@
|
||||
// node could be a jquery object
|
||||
// http://jsperf.com/jquery-vs-instanceof-jquery/2
|
||||
$node = node.jquery ? node : $(node);
|
||||
if (typeof(t) === 'string') {
|
||||
if (typeof t === 'string') {
|
||||
// check data-attribute first when set to 'basic'; don't use node.innerText - it's really slow!
|
||||
// http://www.kellegous.com/j/2013/02/27/innertext-vs-textcontent/
|
||||
if ( t === 'basic' && typeof ( te = $node.attr(c.textAttribute) ) !== 'undefined' ) {
|
||||
@ -214,7 +214,7 @@
|
||||
}
|
||||
return $.trim( node.textContent || $node.text() );
|
||||
} else {
|
||||
if (typeof(t) === 'function') {
|
||||
if (typeof t === 'function') {
|
||||
return $.trim( t($node[0], c.table, cellIndex) );
|
||||
} else if (typeof (te = ts.getColumnData( c.table, t, cellIndex )) === 'function') {
|
||||
return $.trim( te($node[0], c.table, cellIndex) );
|
||||
@ -518,20 +518,22 @@
|
||||
// set up header template
|
||||
t = c.headerTemplate.replace(/\{content\}/g, $t.html()).replace(/\{icon\}/g, $t.find('.' + ts.css.icon).length ? '' : i);
|
||||
if (c.onRenderTemplate) {
|
||||
h = c.onRenderTemplate.apply($t, [index, t]);
|
||||
h = c.onRenderTemplate.apply( $t, [ index, t ] );
|
||||
if (h && typeof h === 'string') { t = h; } // only change t if something is returned
|
||||
}
|
||||
$t.html('<div class="' + ts.css.headerIn + '">' + t + '</div>'); // faster than wrapInner
|
||||
}
|
||||
if (c.onRenderHeader) { c.onRenderHeader.apply($t, [index, c, c.$table]); }
|
||||
if (c.onRenderHeader) { c.onRenderHeader.apply( $t, [ index, c, c.$table ] ); }
|
||||
// *** remove this.column value if no conflicts found
|
||||
elem.column = parseInt( $t.attr('data-column'), 10);
|
||||
elem.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
|
||||
elem.order = formatSortingOrder( ts.getData( $t, ch, 'sortInitialOrder' ) || c.sortInitialOrder ) ?
|
||||
[ 1, 0, 2 ] : // desc, asc, unsorted
|
||||
[ 0, 1, 2 ]; // asc, desc, unsorted
|
||||
elem.count = -1; // set to -1 because clicking on the header automatically adds one
|
||||
elem.lockedOrder = false;
|
||||
lock = ts.getData($t, ch, 'lockedOrder') || false;
|
||||
if (typeof lock !== 'undefined' && lock !== false) {
|
||||
elem.order = elem.lockedOrder = formatSortingOrder(lock) ? [1,1,1] : [0,0,0];
|
||||
elem.order = elem.lockedOrder = formatSortingOrder(lock) ? [ 1, 1, 1 ] : [ 0, 0, 0 ];
|
||||
}
|
||||
$t.addClass(ts.css.header + ' ' + c.cssHeader);
|
||||
// add cell to headerList
|
||||
@ -601,9 +603,9 @@
|
||||
list = c.sortList,
|
||||
len = list.length,
|
||||
none = ts.css.sortNone + ' ' + c.cssNone,
|
||||
css = [ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc],
|
||||
css = [ ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc ],
|
||||
cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
|
||||
aria = ['ascending', 'descending'],
|
||||
aria = [ 'ascending', 'descending' ],
|
||||
// find the footer
|
||||
$t = $(table).find('tfoot tr').children()
|
||||
.add( $( c.namespace + '_extra_headers' ) )
|
||||
@ -673,7 +675,7 @@
|
||||
dir = ('' + val[1]).match(/^(1|d|s|o|n)/);
|
||||
dir = dir ? dir[0] : '';
|
||||
// 0/(a)sc (default), 1/(d)esc, (s)ame, (o)pposite, (n)ext
|
||||
switch(dir) {
|
||||
switch (dir) {
|
||||
case '1': case 'd': // descending
|
||||
dir = 1;
|
||||
break;
|
||||
@ -749,11 +751,11 @@
|
||||
// add column to sort list
|
||||
order = cell.order[cell.count];
|
||||
if (order < 2) {
|
||||
c.sortList.push([indx, order]);
|
||||
c.sortList.push([ indx, order ]);
|
||||
// add other columns if header spans across multiple
|
||||
if (cell.colSpan > 1) {
|
||||
for (col = 1; col < cell.colSpan; col++) {
|
||||
c.sortList.push([indx + col, order]);
|
||||
c.sortList.push([ indx + col, order ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -764,7 +766,7 @@
|
||||
for (col = 0; col < c.sortAppend.length; col++) {
|
||||
s = ts.isValueInArray(c.sortAppend[col][0], c.sortList);
|
||||
if (s >= 0) {
|
||||
c.sortList.splice(s,1);
|
||||
c.sortList.splice(s, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -778,7 +780,7 @@
|
||||
// order.count seems to be incorrect when compared to cell.count
|
||||
s[1] = order.order[cell.count];
|
||||
if (s[1] === 2) {
|
||||
c.sortList.splice(col,1);
|
||||
c.sortList.splice(col, 1);
|
||||
order.count = -1;
|
||||
}
|
||||
}
|
||||
@ -787,11 +789,11 @@
|
||||
// add column to sort list array
|
||||
order = cell.order[cell.count];
|
||||
if (order < 2) {
|
||||
c.sortList.push([indx, order]);
|
||||
c.sortList.push([ indx, order ]);
|
||||
// add other columns if header spans across multiple
|
||||
if (cell.colSpan > 1) {
|
||||
for (col = 1; col < cell.colSpan; col++) {
|
||||
c.sortList.push([indx + col, order]);
|
||||
c.sortList.push([ indx + col, order ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -865,10 +867,10 @@
|
||||
x = dir ? a : b;
|
||||
y = dir ? b : a;
|
||||
// text sort function
|
||||
if (typeof(cts) === 'function') {
|
||||
if (typeof cts === 'function') {
|
||||
// custom OVERALL text sorter
|
||||
sort = cts(x[col], y[col], dir, col, table);
|
||||
} else if (typeof(cts) === 'object' && cts.hasOwnProperty(col)) {
|
||||
} else if (typeof cts === 'object' && cts.hasOwnProperty(col)) {
|
||||
// custom text sorter for a SPECIFIC COLUMN
|
||||
sort = cts[col](x[col], y[col], dir, col, table);
|
||||
} else {
|
||||
@ -901,14 +903,14 @@
|
||||
// this will catch spamming of the updateCell method
|
||||
if (resrt !== false && !c.serverSideSorting && !c.table.isProcessing) {
|
||||
if (sl.length) {
|
||||
c.$table.trigger('sorton', [sl, function(){
|
||||
c.$table.trigger('sorton', [ sl, function(){
|
||||
resortComplete(c, callback);
|
||||
}, true]);
|
||||
}, true ]);
|
||||
} else {
|
||||
c.$table.trigger('sortReset', [function(){
|
||||
c.$table.trigger('sortReset', [ function(){
|
||||
resortComplete(c, callback);
|
||||
ts.applyWidget(c.table, false);
|
||||
}]);
|
||||
} ]);
|
||||
}
|
||||
} else {
|
||||
resortComplete(c, callback);
|
||||
@ -1166,7 +1168,7 @@
|
||||
c.namespace = '.tablesorter' + Math.random().toString(16).slice(2);
|
||||
} else {
|
||||
// make sure namespace starts with a period & doesn't have weird characters
|
||||
c.namespace = '.' + c.namespace.replace(/\W/g,'');
|
||||
c.namespace = '.' + c.namespace.replace(/\W/g, '');
|
||||
}
|
||||
|
||||
c.$table.children().children('tr').attr('role', 'row');
|
||||
@ -1210,7 +1212,7 @@
|
||||
ts.applyWidget(table, true);
|
||||
// if user has supplied a sort list to constructor
|
||||
if (c.sortList.length > 0) {
|
||||
$table.trigger('sorton', [c.sortList, {}, !c.initWidgets, true]);
|
||||
$table.trigger('sorton', [ c.sortList, {}, !c.initWidgets, true ]);
|
||||
} else {
|
||||
setHeadersCss(table);
|
||||
if (c.initWidgets) {
|
||||
@ -1249,22 +1251,22 @@
|
||||
table = $(table)[0];
|
||||
var overallWidth, percent, $tbodies, len, index,
|
||||
c = table.config,
|
||||
colgroup = c.$table.children('colgroup');
|
||||
$colgroup = c.$table.children('colgroup');
|
||||
// remove plugin-added colgroup, in case we need to refresh the widths
|
||||
if (colgroup.length && colgroup.hasClass(ts.css.colgroup)) {
|
||||
colgroup.remove();
|
||||
if ($colgroup.length && $colgroup.hasClass(ts.css.colgroup)) {
|
||||
$colgroup.remove();
|
||||
}
|
||||
if (c.widthFixed && c.$table.children('colgroup').length === 0) {
|
||||
colgroup = $('<colgroup class="' + ts.css.colgroup + '">');
|
||||
$colgroup = $('<colgroup class="' + ts.css.colgroup + '">');
|
||||
overallWidth = c.$table.width();
|
||||
// only add col for visible columns - fixes #371
|
||||
$tbodies = c.$tbodies.find('tr:first').children(':visible'); //.each(function()
|
||||
$tbodies = c.$tbodies.find('tr:first').children(':visible'); // .each(function()
|
||||
len = $tbodies.length;
|
||||
for ( index = 0; index < len; index++ ) {
|
||||
percent = parseInt( ( $tbodies.eq( index ).width() / overallWidth ) * 1000, 10 ) / 10 + '%';
|
||||
colgroup.append( $('<col>').css('width', percent) );
|
||||
$colgroup.append( $('<col>').css('width', percent) );
|
||||
}
|
||||
c.$table.prepend(colgroup);
|
||||
c.$table.prepend($colgroup);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1311,12 +1313,12 @@
|
||||
cellId = rowIndex + '-' + $cell.index();
|
||||
rowSpan = cell.rowSpan || 1;
|
||||
colSpan = cell.colSpan || 1;
|
||||
if (typeof(matrix[rowIndex]) === 'undefined') {
|
||||
if (typeof matrix[rowIndex] === 'undefined') {
|
||||
matrix[rowIndex] = [];
|
||||
}
|
||||
// Find first available column in the first row
|
||||
for (k = 0; k < matrix[rowIndex].length + 1; k++) {
|
||||
if (typeof(matrix[rowIndex][k]) === 'undefined') {
|
||||
if (typeof matrix[rowIndex][k] === 'undefined') {
|
||||
firstAvailCol = k;
|
||||
break;
|
||||
}
|
||||
@ -1325,7 +1327,7 @@
|
||||
// add data-column
|
||||
$cell.attr({ 'data-column' : firstAvailCol }); // 'data-row' : rowIndex
|
||||
for (k = rowIndex; k < rowIndex + rowSpan; k++) {
|
||||
if (typeof(matrix[k]) === 'undefined') {
|
||||
if (typeof matrix[k] === 'undefined') {
|
||||
matrix[k] = [];
|
||||
}
|
||||
matrixrow = matrix[k];
|
||||
@ -1341,10 +1343,10 @@
|
||||
// *** Process table ***
|
||||
// add processing indicator
|
||||
ts.isProcessing = function(table, toggle, $ths) {
|
||||
table = $(table);
|
||||
var c = table[0].config,
|
||||
$table = $(table);
|
||||
var c = $table[0].config,
|
||||
// default to all headers
|
||||
$h = $ths || table.find('.' + ts.css.header);
|
||||
$h = $ths || $table.find('.' + ts.css.header);
|
||||
if (toggle) {
|
||||
// don't use sortList if custom $ths used
|
||||
if (typeof $ths !== 'undefined' && c.sortList.length > 0) {
|
||||
@ -1354,9 +1356,9 @@
|
||||
return this.sortDisabled ? false : ts.isValueInArray( parseFloat($(this).attr('data-column')), c.sortList) >= 0;
|
||||
});
|
||||
}
|
||||
table.add($h).addClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
$table.add($h).addClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
} else {
|
||||
table.add($h).removeClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
$table.add($h).removeClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1486,8 +1488,8 @@
|
||||
$f = $t.find('tfoot:first > tr').children('th, td');
|
||||
if (removeClasses === false && $.inArray('uitheme', c.widgets) >= 0) {
|
||||
// reapply uitheme classes, in case we want to maintain appearance
|
||||
$t.trigger('applyWidgetId', ['uitheme']);
|
||||
$t.trigger('applyWidgetId', ['zebra']);
|
||||
$t.trigger('applyWidgetId', [ 'uitheme' ]);
|
||||
$t.trigger('applyWidgetId', [ 'zebra' ]);
|
||||
}
|
||||
// remove widget added rows, just in case
|
||||
$h.find('tr').not($r).remove();
|
||||
@ -1499,7 +1501,7 @@
|
||||
.removeData('tablesorter')
|
||||
.unbind( events.replace(/\s+/g, ' ') );
|
||||
c.$headers.add($f)
|
||||
.removeClass( [ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone].join(' ') )
|
||||
.removeClass( [ ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone ].join(' ') )
|
||||
.removeAttr('data-column')
|
||||
.removeAttr('aria-label')
|
||||
.attr('aria-disabled', 'true');
|
||||
@ -1705,8 +1707,8 @@
|
||||
};
|
||||
|
||||
ts.hasWidget = function(table, name){
|
||||
table = $(table);
|
||||
return table.length && table[0].config && table[0].config.widgetInit[name] || false;
|
||||
$table = $(table);
|
||||
return $table.length && $table[0].config && $table[0].config.widgetInit[name] || false;
|
||||
};
|
||||
|
||||
ts.getWidgetById = function(name) {
|
||||
@ -1746,7 +1748,7 @@
|
||||
if (c.debug) { time = new Date(); }
|
||||
// look for widgets to apply from in table class
|
||||
// stop using \b otherwise this matches 'ui-widget-content' & adds 'content' widget
|
||||
wd = new RegExp( '\\s' + c.widgetClass.replace( /\{name\}/i, '([\\w-]+)' )+ '\\s', 'g' );
|
||||
wd = new RegExp( '\\s' + c.widgetClass.replace( /\{name\}/i, '([\\w-]+)' ) + '\\s', 'g' );
|
||||
if ( tableClass.match( wd ) ) {
|
||||
// extract out the widget id from the table class (widget id's can include dashes)
|
||||
w = tableClass.match( wd );
|
||||
@ -1954,13 +1956,13 @@
|
||||
typeof table !== 'undefined' ? table : true;
|
||||
if (t) {
|
||||
// US Format - 1,234,567.89 -> 1234567.89
|
||||
s = s.replace(/,/g,'');
|
||||
s = s.replace(/,/g, '');
|
||||
} else {
|
||||
// German Format = 1.234.567,89 -> 1234567.89
|
||||
// French Format = 1 234 567,89 -> 1234567.89
|
||||
s = s.replace(/[\s|\.]/g,'').replace(/,/g,'.');
|
||||
s = s.replace(/[\s|\.]/g, '').replace(/,/g, '.');
|
||||
}
|
||||
if(/^\s*\([.\d]+\)/.test(s)) {
|
||||
if (/^\s*\([.\d]+\)/.test(s)) {
|
||||
// make (#) into a negative number -> (10) = -10
|
||||
s = s.replace(/^\s*\(([.\d]+)\)/, '-$1');
|
||||
}
|
||||
@ -2028,7 +2030,7 @@
|
||||
ts.addParser({
|
||||
id: 'currency',
|
||||
is: function(s) {
|
||||
return (/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/).test((s || '').replace(/[+\-,. ]/g,'')); // £$€¤¥¢
|
||||
return (/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/).test((s || '').replace(/[+\-,. ]/g, '')); // £$€¤¥¢
|
||||
},
|
||||
format: function(s, table) {
|
||||
var n = ts.formatFloat((s || '').replace(/[^\w,. \-()]/g, ''), table);
|
||||
@ -2103,7 +2105,7 @@
|
||||
id: 'shortDate', // 'mmddyyyy', 'ddmmyyyy' or 'yyyymmdd'
|
||||
is: function(s) {
|
||||
// testing for ##-##-#### or ####-##-##, so it's not perfect; time can be included
|
||||
return (/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/).test((s || '').replace(/\s+/g,' ').replace(/[\-.,]/g, '/'));
|
||||
return (/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/).test((s || '').replace(/\s+/g, ' ').replace(/[\-.,]/g, '/'));
|
||||
},
|
||||
format: function(s, table, cell, cellIndex) {
|
||||
if (s) {
|
||||
@ -2196,11 +2198,11 @@
|
||||
|
||||
/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
|
||||
;(function ($, window, document) {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter || {};
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
var ts = $.tablesorter || {};
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
if you need it, then include https://github.com/douglascrockford/JSON-js
|
||||
|
||||
$.parseJSON is not available is jQuery versions older than 1.4.1, using older
|
||||
@ -2216,9 +2218,9 @@ var ts = $.tablesorter || {};
|
||||
v = $.tablesorter.storage(table, 'tablesorter-mywidget');
|
||||
// val may be empty, so also check for your data
|
||||
val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
|
||||
alert(val); // "data1" if saved, or "" if not
|
||||
*/
|
||||
ts.storage = function(table, key, value, options) {
|
||||
alert(val); // 'data1' if saved, or '' if not
|
||||
*/
|
||||
ts.storage = function(table, key, value, options) {
|
||||
table = $(table)[0];
|
||||
var cookieIndex, cookies, date,
|
||||
hasStorage = false,
|
||||
@ -2228,12 +2230,12 @@ ts.storage = function(table, key, value, options) {
|
||||
storageType = ( options && options.useSessionStorage ) || ( wo && wo.storage_useSessionStorage ) ?
|
||||
'sessionStorage' : 'localStorage',
|
||||
$table = $(table),
|
||||
// id from (1) options ID, (2) table "data-table-group" attribute, (3) widgetOptions.storage_tableId,
|
||||
// id from (1) options ID, (2) table 'data-table-group' attribute, (3) widgetOptions.storage_tableId,
|
||||
// (4) table ID, then (5) table index
|
||||
id = options && options.id ||
|
||||
$table.attr( options && options.group || wo && wo.storage_group || 'data-table-group') ||
|
||||
wo && wo.storage_tableId || table.id || $('.tablesorter').index( $table ),
|
||||
// url from (1) options url, (2) table "data-table-page" attribute, (3) widgetOptions.storage_fixedUrl,
|
||||
// url from (1) options url, (2) table 'data-table-page' attribute, (3) widgetOptions.storage_fixedUrl,
|
||||
// (4) table.config.fixedUrl (deprecated), then (5) window location path
|
||||
url = options && options.url ||
|
||||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
|
||||
@ -2244,7 +2246,7 @@ ts.storage = function(table, key, value, options) {
|
||||
window[storageType].setItem('_tmptest', 'temp');
|
||||
hasStorage = true;
|
||||
window[storageType].removeItem('_tmptest');
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
if (c && c.debug) {
|
||||
ts.log( storageType + ' is not supported in this browser' );
|
||||
}
|
||||
@ -2275,21 +2277,21 @@ ts.storage = function(table, key, value, options) {
|
||||
} else {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (31536e+6)); // 365 days
|
||||
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g,'\"') + '; expires=' + date.toGMTString() + '; path=/';
|
||||
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g, '\"') + '; expires=' + date.toGMTString() + '; path=/';
|
||||
}
|
||||
} else {
|
||||
return values && values[url] ? values[url][id] : '';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
})(jQuery, window, document);
|
||||
|
||||
/*! Widget: uitheme - updated 3/26/2015 (v2.21.3) */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
ts.themes = {
|
||||
ts.themes = {
|
||||
'bootstrap' : {
|
||||
table : 'table table-bordered table-striped',
|
||||
caption : 'caption',
|
||||
@ -2301,7 +2303,7 @@ ts.themes = {
|
||||
active : '', // applied when column is sorted
|
||||
hover : '', // custom css required - a defined bootstrap style may not override other classes
|
||||
// icon class names
|
||||
icons : '', // add "icon-white" to make them white; this icon class is added to the <i> in the header
|
||||
icons : '', // add 'icon-white' to make them white; this icon class is added to the <i> in the header
|
||||
iconSortNone : 'bootstrap-icon-unsorted', // class name added to icon when column is not sorted
|
||||
iconSortAsc : 'icon-chevron-up glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort
|
||||
iconSortDesc : 'icon-chevron-down glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort
|
||||
@ -2332,14 +2334,14 @@ ts.themes = {
|
||||
even : 'ui-widget-content', // even row zebra striping
|
||||
odd : 'ui-state-default' // odd row zebra striping
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
wrapper : 'tablesorter-wrapper' // ui theme & resizable
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
id: "uitheme",
|
||||
ts.addWidget({
|
||||
id: 'uitheme',
|
||||
priority: 10,
|
||||
format: function(table, c, wo) {
|
||||
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
||||
@ -2361,7 +2363,7 @@ ts.addWidget({
|
||||
if (hasOldTheme) {
|
||||
wo.zebra[0] = $.trim( ' ' + wo.zebra[0].replace(' ' + oldtheme.even, '') );
|
||||
wo.zebra[1] = $.trim( ' ' + wo.zebra[1].replace(' ' + oldtheme.odd, '') );
|
||||
c.$tbodies.children().removeClass( [oldtheme.even, oldtheme.odd].join(' ') );
|
||||
c.$tbodies.children().removeClass( [ oldtheme.even, oldtheme.odd ].join(' ') );
|
||||
}
|
||||
// update zebra stripes
|
||||
if (themes.even) { wo.zebra[0] += ' ' + themes.even; }
|
||||
@ -2386,7 +2388,7 @@ ts.addWidget({
|
||||
}
|
||||
// update header classes
|
||||
$headers
|
||||
.removeClass( (hasOldTheme ? [oldtheme.header, oldtheme.hover, oldremove].join(' ') : '') || '' )
|
||||
.removeClass( (hasOldTheme ? [ oldtheme.header, oldtheme.hover, oldremove ].join(' ') : '') || '' )
|
||||
.addClass(themes.header)
|
||||
.not('.sorter-false')
|
||||
.unbind('mouseenter.tsuitheme mouseleave.tsuitheme')
|
||||
@ -2406,7 +2408,7 @@ ts.addWidget({
|
||||
// if c.cssIcon is '', then no <i> is added to the header
|
||||
$headers
|
||||
.find('.' + ts.css.icon)
|
||||
.removeClass(hasOldTheme ? [oldtheme.icons, oldIconRmv].join(' ') : '')
|
||||
.removeClass(hasOldTheme ? [ oldtheme.icons, oldIconRmv ].join(' ') : '')
|
||||
.addClass(themes.icons || '');
|
||||
}
|
||||
if ($table.hasClass('hasFilters')) {
|
||||
@ -2432,10 +2434,10 @@ ts.addWidget({
|
||||
hdr = themes.sortNone;
|
||||
icon = themes.iconSortNone;
|
||||
if ($h.hasClass(ts.css.sortAsc)) {
|
||||
hdr = [themes.sortAsc, themes.active].join(' ');
|
||||
hdr = [ themes.sortAsc, themes.active ].join(' ');
|
||||
icon = themes.iconSortAsc;
|
||||
} else if ($h.hasClass(ts.css.sortDesc)) {
|
||||
hdr = [themes.sortDesc, themes.active].join(' ');
|
||||
hdr = [ themes.sortDesc, themes.active ].join(' ');
|
||||
icon = themes.iconSortDesc;
|
||||
}
|
||||
$header.addClass(hdr);
|
||||
@ -2444,7 +2446,7 @@ ts.addWidget({
|
||||
}
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.benchmark("Applying " + theme + " theme", time);
|
||||
ts.benchmark('Applying ' + theme + ' theme', time);
|
||||
}
|
||||
},
|
||||
remove: function(table, c, wo, refreshing) {
|
||||
@ -2466,20 +2468,20 @@ ts.addWidget({
|
||||
.removeClass(themes.filterRow);
|
||||
$headers.find('.' + ts.css.icon).removeClass(themes.icons + ' ' + iconRmv);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
/*! Widget: columns */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
ts.addWidget({
|
||||
id: "columns",
|
||||
ts.addWidget({
|
||||
id: 'columns',
|
||||
priority: 30,
|
||||
options : {
|
||||
columns : [ "primary", "secondary", "tertiary" ]
|
||||
columns : [ 'primary', 'secondary', 'tertiary' ]
|
||||
},
|
||||
format: function(table, c, wo) {
|
||||
var $tbody, tbodyIndex, $rows, rows, $row, $cells, remove, indx,
|
||||
@ -2488,7 +2490,7 @@ ts.addWidget({
|
||||
sortList = c.sortList,
|
||||
len = sortList.length,
|
||||
// removed c.widgetColumns support
|
||||
css = wo && wo.columns || [ "primary", "secondary", "tertiary" ],
|
||||
css = wo && wo.columns || [ 'primary', 'secondary', 'tertiary' ],
|
||||
last = css.length - 1;
|
||||
remove = css.join(' ');
|
||||
// check if there is a sort (on initialization there may not be one)
|
||||
@ -2517,7 +2519,7 @@ ts.addWidget({
|
||||
ts.processTbody(table, $tbody, false);
|
||||
}
|
||||
// add classes to thead and tfoot
|
||||
rows = wo.columns_thead !== false ? ['thead tr'] : [];
|
||||
rows = wo.columns_thead !== false ? [ 'thead tr' ] : [];
|
||||
if (wo.columns_tfoot !== false) {
|
||||
rows.push('tfoot tr');
|
||||
}
|
||||
@ -2534,7 +2536,7 @@ ts.addWidget({
|
||||
remove: function(table, c, wo) {
|
||||
var tbodyIndex, $tbody,
|
||||
$tbodies = c.$tbodies,
|
||||
remove = (wo.columns || [ "primary", "secondary", "tertiary" ]).join(' ');
|
||||
remove = (wo.columns || [ 'primary', 'secondary', 'tertiary' ]).join(' ');
|
||||
c.$headers.removeClass(remove);
|
||||
c.$table.children('tfoot').children('tr').children('th, td').removeClass(remove);
|
||||
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
|
||||
@ -2545,7 +2547,7 @@ ts.addWidget({
|
||||
ts.processTbody(table, $tbody, false); // restore tbody
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
@ -2554,18 +2556,18 @@ ts.addWidget({
|
||||
* by Rob Garrison
|
||||
*/
|
||||
;( function ( $ ) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
tscss = ts.css;
|
||||
|
||||
$.extend( tscss, {
|
||||
$.extend( tscss, {
|
||||
filterRow : 'tablesorter-filter-row',
|
||||
filter : 'tablesorter-filter',
|
||||
filterDisabled : 'disabled',
|
||||
filterRowHide : 'hideme'
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id: 'filter',
|
||||
priority: 50,
|
||||
options : {
|
||||
@ -2594,7 +2596,7 @@ ts.addWidget({
|
||||
filter_selectSource : null, // include a function to return an array of values to be added to the column filter select
|
||||
filter_startsWith : false, // if true, filter start from the beginning of the cell contents
|
||||
filter_useParsedData : false, // filter all data using parsed content
|
||||
filter_serversideFiltering : false, // if true, server-side filtering should be performed because client-side filtering will be disabled, but the ui and events will still be used.
|
||||
filter_serversideFiltering : false, // if true, must perform server-side filtering b/c client-side filtering is disabled, but the ui and events will still be used.
|
||||
filter_defaultAttrib : 'data-value', // data attribute in the header cell that contains the default filter value
|
||||
filter_selectSourceSeparator : '|' // filter_selectSource array text left of the separator is added to the option value, right into the option text
|
||||
},
|
||||
@ -2625,9 +2627,9 @@ ts.addWidget({
|
||||
$( document ).undelegate( wo.filter_reset, 'click.tsfilter' );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.filter = {
|
||||
ts.filter = {
|
||||
|
||||
// regex used in filter 'check' functions - not for general use and not documented
|
||||
regex: {
|
||||
@ -2901,7 +2903,7 @@ ts.filter = {
|
||||
filtered : new RegExp( wo.filter_filteredRow ),
|
||||
alreadyFiltered : new RegExp( '(\\s+(' + ts.language.or + '|-|' + ts.language.to + ')\\s+)', 'i' ),
|
||||
toTest : new RegExp( '\\s+(-|' + ts.language.to + ')\\s+', 'i' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)' ,'gi' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)', 'gi' ),
|
||||
andTest : new RegExp( '\\s+(' + ts.language.and + '|&&)\\s+', 'i' ),
|
||||
andSplit : new RegExp( '(?:\\s+(?:' + ts.language.and + '|&&)\\s+)', 'gi' ),
|
||||
orSplit : new RegExp( '(?:\\s+(?:' + ts.language.or + ')\\s+|\\|)', 'gi' ),
|
||||
@ -3336,7 +3338,7 @@ ts.filter = {
|
||||
c.lastSearch = [];
|
||||
}
|
||||
if ( wo.filter_initialized ) {
|
||||
c.$table.trigger( 'filterStart', [filters] );
|
||||
c.$table.trigger( 'filterStart', [ filters ] );
|
||||
}
|
||||
if ( c.showProcessing ) {
|
||||
// give it time for the processing icon to kick in
|
||||
@ -3566,7 +3568,7 @@ ts.filter = {
|
||||
// in case select filter option has a different value vs text 'a - z|A through Z'
|
||||
ffxn = wo.filter_columnFilters ?
|
||||
c.$filters.add( c.$externalFilters )
|
||||
.filter( '[data-column="'+ columnIndex + '"]' )
|
||||
.filter( '[data-column="' + columnIndex + '"]' )
|
||||
.find( 'select option:selected' )
|
||||
.attr( 'data-function-name' ) || '' : '';
|
||||
// replace accents - see #357
|
||||
@ -3926,7 +3928,7 @@ ts.filter = {
|
||||
if ( $.isFunction( cts ) ) {
|
||||
// custom OVERALL text sorter
|
||||
return cts( x, y, true, column, table );
|
||||
} else if ( typeof( cts ) === 'object' && cts.hasOwnProperty( column ) ) {
|
||||
} else if ( typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
||||
// custom text sorter for a SPECIFIC COLUMN
|
||||
return cts[column]( x, y, true, column, table );
|
||||
} else if ( ts.sortNatural ) {
|
||||
@ -4068,9 +4070,9 @@ ts.filter = {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
var i, $filters, $column, cols,
|
||||
filters = false,
|
||||
c = table ? $( table )[0].config : '',
|
||||
@ -4141,9 +4143,9 @@ ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
filters = false;
|
||||
}
|
||||
return filters;
|
||||
};
|
||||
};
|
||||
|
||||
ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
var c = table ? $( table )[0].config : '',
|
||||
valid = ts.getFilters( table, true, filter, skipFirst );
|
||||
if ( c && apply ) {
|
||||
@ -4154,7 +4156,7 @@ ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
c.$table.trigger( 'filterFomatterUpdate' );
|
||||
}
|
||||
return !!valid;
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery );
|
||||
|
||||
@ -4163,18 +4165,18 @@ ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
* by Rob Garrison
|
||||
*/
|
||||
;(function ($, window) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
sticky : 'tablesorter-stickyHeader', // stickyHeader
|
||||
stickyVis : 'tablesorter-sticky-visible',
|
||||
stickyHide: 'tablesorter-sticky-hidden',
|
||||
stickyWrap: 'tablesorter-sticky-wrapper'
|
||||
});
|
||||
});
|
||||
|
||||
// Add a resize event to table headers
|
||||
ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
// Add a resize event to table headers
|
||||
ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
table = $(table)[0]; // make sure we're using a dom element
|
||||
if ( !table.config ) { return; }
|
||||
var defaults = {
|
||||
@ -4190,7 +4192,7 @@ ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
headers = [];
|
||||
for ( index = 0; index < len; index++ ) {
|
||||
$header = c.$headers.eq( index );
|
||||
sizes = $header.data( 'savedSizes' ) || [ 0,0 ]; // fixes #394
|
||||
sizes = $header.data( 'savedSizes' ) || [ 0, 0 ]; // fixes #394
|
||||
width = $header[0].offsetWidth;
|
||||
height = $header[0].offsetHeight;
|
||||
if ( width !== sizes[0] || height !== sizes[1] ) {
|
||||
@ -4213,14 +4215,14 @@ ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
if (wo.resize_flag) { return; }
|
||||
checkSizes();
|
||||
}, options.timer);
|
||||
};
|
||||
};
|
||||
|
||||
// Sticky headers based on this awesome article:
|
||||
// http://css-tricks.com/13465-persistent-headers/
|
||||
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: "stickyHeaders",
|
||||
// Sticky headers based on this awesome article:
|
||||
// http://css-tricks.com/13465-persistent-headers/
|
||||
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'stickyHeaders',
|
||||
priority: 60, // sticky widget must be initialized after the filter widget!
|
||||
options: {
|
||||
stickyHeaders : '', // extra class name added to the sticky header row
|
||||
@ -4230,7 +4232,7 @@ ts.addWidget({
|
||||
stickyHeaders_offset : 0, // number or jquery selector targeting the position:fixed element
|
||||
stickyHeaders_filteredToTop: true, // scroll table top into view after filtering
|
||||
stickyHeaders_cloneId : '-sticky', // added to table ID, if it exists
|
||||
stickyHeaders_addResizeEvent : true, // trigger "resize" event on headers
|
||||
stickyHeaders_addResizeEvent : true, // trigger 'resize' event on headers
|
||||
stickyHeaders_includeCaption : true, // if false and a caption exist, it won't be included in the sticky header
|
||||
stickyHeaders_zIndex : 2 // The zIndex of the stickyHeaders, allows the user to adjust this to their needs
|
||||
},
|
||||
@ -4443,25 +4445,25 @@ ts.addWidget({
|
||||
.unbind( ('scroll resize '.split(' ').join(namespace)).replace(/\s+/g, ' ') );
|
||||
ts.addHeaderResizeEvent(table, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, window);
|
||||
|
||||
/*! Widget: resizable - updated 6/26/2015 (v2.22.2) */
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function ($, window) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
resizableContainer : 'tablesorter-resizable-container',
|
||||
resizableHandle : 'tablesorter-resizable-handle',
|
||||
resizableNoSelect : 'tablesorter-disableSelection',
|
||||
resizableStorage : 'tablesorter-resizable'
|
||||
});
|
||||
});
|
||||
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
var s = '<style>' +
|
||||
'body.' + ts.css.resizableNoSelect + ' { -ms-user-select: none; -moz-user-select: -moz-none;' +
|
||||
'-khtml-user-select: none; -webkit-user-select: none; user-select: none; }' +
|
||||
@ -4471,9 +4473,9 @@ $(function(){
|
||||
'top: 1px; cursor: ew-resize; z-index: 3; user-select: none; -moz-user-select: none; }' +
|
||||
'</style>';
|
||||
$(s).appendTo('body');
|
||||
});
|
||||
});
|
||||
|
||||
ts.resizable = {
|
||||
ts.resizable = {
|
||||
init : function( c, wo ) {
|
||||
if ( c.$table.hasClass( 'hasResizable' ) ) { return; }
|
||||
c.$table.addClass( 'hasResizable' );
|
||||
@ -4484,7 +4486,7 @@ ts.resizable = {
|
||||
marginTop = parseInt( $table.css( 'margin-top' ), 10 ),
|
||||
|
||||
// internal variables
|
||||
vars = wo.resizable_ = {
|
||||
vars = wo.resizable_vars = {
|
||||
useStorage : ts.storage && wo.resizable !== false,
|
||||
$wrap : $parent,
|
||||
mouseXPosition : 0,
|
||||
@ -4506,7 +4508,7 @@ ts.resizable = {
|
||||
vars.fullWidth = Math.abs( $parent.width() - vars.tableWidth ) < 20;
|
||||
|
||||
/*
|
||||
// Hacky method to determine if table width is set to "auto"
|
||||
// Hacky method to determine if table width is set to 'auto'
|
||||
// http://stackoverflow.com/a/20892048/145346
|
||||
if ( !vars.fullWidth ) {
|
||||
tmp = $table.width();
|
||||
@ -4526,7 +4528,7 @@ ts.resizable = {
|
||||
tmp = ts.storage( c.table, 'tablesorter-table-resized-width' ) || 'auto';
|
||||
ts.resizable.setWidth( $table, tmp, true );
|
||||
}
|
||||
wo.resizable_.storedSizes = storedSizes = ( vars.useStorage ?
|
||||
wo.resizable_vars.storedSizes = storedSizes = ( vars.useStorage ?
|
||||
ts.storage( c.table, ts.css.resizableStorage ) :
|
||||
[] ) || [];
|
||||
ts.resizable.setWidths( c, wo, storedSizes );
|
||||
@ -4560,7 +4562,7 @@ ts.resizable = {
|
||||
updateStoredSizes : function( c, wo ) {
|
||||
var column, $header,
|
||||
len = c.columns,
|
||||
vars = wo.resizable_;
|
||||
vars = wo.resizable_vars;
|
||||
vars.storedSizes = [];
|
||||
for ( column = 0; column < len; column++ ) {
|
||||
$header = c.$headerIndexed[ column ];
|
||||
@ -4579,7 +4581,7 @@ ts.resizable = {
|
||||
|
||||
setWidths : function( c, wo, storedSizes ) {
|
||||
var column, $temp,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$extra = $( c.namespace + '_extra_headers' ),
|
||||
$col = c.$table.children( 'colgroup' ).children( 'col' );
|
||||
storedSizes = storedSizes || vars.storedSizes || [];
|
||||
@ -4639,7 +4641,7 @@ ts.resizable = {
|
||||
// prevent text selection while dragging resize bar
|
||||
toggleTextSelection : function( c, toggle ) {
|
||||
var namespace = c.namespace + 'tsresize';
|
||||
c.widgetOptions.resizable_.disabled = toggle;
|
||||
c.widgetOptions.resizable_vars.disabled = toggle;
|
||||
$( 'body' ).toggleClass( ts.css.resizableNoSelect, toggle );
|
||||
if ( toggle ) {
|
||||
$( 'body' )
|
||||
@ -4657,7 +4659,7 @@ ts.resizable = {
|
||||
wo.$resizable_container.children().bind( 'mousedown', function( event ) {
|
||||
// save header cell and mouse position
|
||||
var column,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$extras = $( c.namespace + '_extra_headers' ),
|
||||
$header = $( event.target ).data( 'header' );
|
||||
|
||||
@ -4681,7 +4683,7 @@ ts.resizable = {
|
||||
|
||||
$( document )
|
||||
.bind( 'mousemove' + namespace, function( event ) {
|
||||
var vars = wo.resizable_;
|
||||
var vars = wo.resizable_vars;
|
||||
// ignore mousemove if no mousedown
|
||||
if ( !vars.disabled || vars.mouseXPosition === 0 || !vars.$target ) { return; }
|
||||
if ( wo.resizable_throttle ) {
|
||||
@ -4694,7 +4696,7 @@ ts.resizable = {
|
||||
}
|
||||
})
|
||||
.bind( 'mouseup' + namespace, function() {
|
||||
if (!wo.resizable_.disabled) { return; }
|
||||
if (!wo.resizable_vars.disabled) { return; }
|
||||
ts.resizable.toggleTextSelection( c, false );
|
||||
ts.resizable.stopResize( c, wo );
|
||||
ts.resizable.setHandlePosition( c, wo );
|
||||
@ -4714,21 +4716,21 @@ ts.resizable = {
|
||||
.add( $( c.namespace + '_extra_table' ).find( 'thead:first' ) )
|
||||
.bind( 'contextmenu' + namespace, function() {
|
||||
// $.isEmptyObject() needs jQuery 1.4+; allow right click if already reset
|
||||
var allowClick = wo.resizable_.storedSizes.length === 0;
|
||||
var allowClick = wo.resizable_vars.storedSizes.length === 0;
|
||||
ts.resizableReset( c.table );
|
||||
ts.resizable.setHandlePosition( c, wo );
|
||||
wo.resizable_.storedSizes = [];
|
||||
wo.resizable_vars.storedSizes = [];
|
||||
return allowClick;
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
mouseMove : function( c, wo, event ) {
|
||||
if ( wo.resizable_.mouseXPosition === 0 || !wo.resizable_.$target ) { return; }
|
||||
if ( wo.resizable_vars.mouseXPosition === 0 || !wo.resizable_vars.$target ) { return; }
|
||||
// resize columns
|
||||
var column,
|
||||
total = 0,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$next = vars.$next,
|
||||
tar = vars.storedSizes[ vars.target ],
|
||||
leftEdge = event.pageX - vars.mouseXPosition;
|
||||
@ -4760,7 +4762,7 @@ ts.resizable = {
|
||||
},
|
||||
|
||||
stopResize : function( c, wo ) {
|
||||
var vars = wo.resizable_;
|
||||
var vars = wo.resizable_vars;
|
||||
ts.resizable.updateStoredSizes( c, wo );
|
||||
if ( vars.useStorage ) {
|
||||
// save all column widths
|
||||
@ -4772,13 +4774,13 @@ ts.resizable = {
|
||||
// will update stickyHeaders, just in case, see #912
|
||||
c.$table.trigger('stickyHeadersUpdate');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// this widget saves the column widths if
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: "resizable",
|
||||
// this widget saves the column widths if
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'resizable',
|
||||
priority: 40,
|
||||
options: {
|
||||
resizable : true, // save column widths to storage
|
||||
@ -4796,7 +4798,8 @@ ts.addWidget({
|
||||
var namespace = c.namespace + 'tsresize';
|
||||
c.$table.add( $( c.namespace + '_extra_table' ) )
|
||||
.removeClass('hasResizable')
|
||||
.children( 'thead' ).unbind( 'contextmenu' + namespace );
|
||||
.children( 'thead' )
|
||||
.unbind( 'contextmenu' + namespace );
|
||||
|
||||
wo.$resizable_container.remove();
|
||||
ts.resizable.toggleTextSelection( c, false );
|
||||
@ -4804,14 +4807,14 @@ ts.addWidget({
|
||||
$( document ).unbind( 'mousemove' + namespace + ' mouseup' + namespace );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.resizableReset = function( table, refreshing ) {
|
||||
ts.resizableReset = function( table, refreshing ) {
|
||||
$( table ).each(function(){
|
||||
var index, $t,
|
||||
c = this.config,
|
||||
wo = c && c.widgetOptions,
|
||||
vars = wo.resizable_;
|
||||
vars = wo.resizable_vars;
|
||||
if ( table && c && c.$headerIndexed.length ) {
|
||||
// restore the initial table width
|
||||
if ( vars.overflow && vars.tableWidth ) {
|
||||
@ -4837,20 +4840,20 @@ ts.resizableReset = function( table, refreshing ) {
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery, window );
|
||||
|
||||
/*! Widget: saveSort */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
// this widget saves the last sort only if the
|
||||
// saveSort widget option is true AND the
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
// this widget saves the last sort only if the
|
||||
// saveSort widget option is true AND the
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'saveSort',
|
||||
priority: 20,
|
||||
options: {
|
||||
@ -4864,7 +4867,7 @@ ts.addWidget({
|
||||
var stored, time,
|
||||
$table = c.$table,
|
||||
saveSort = wo.saveSort !== false, // make saveSort active/inactive; default to true
|
||||
sortList = { "sortList" : c.sortList };
|
||||
sortList = { 'sortList' : c.sortList };
|
||||
if (c.debug) {
|
||||
time = new Date();
|
||||
}
|
||||
@ -4897,7 +4900,7 @@ ts.addWidget({
|
||||
c.sortList = sortList;
|
||||
} else if (table.hasInitialized && sortList && sortList.length > 0) {
|
||||
// update sort change
|
||||
$table.trigger('sorton', [sortList]);
|
||||
$table.trigger('sorton', [ sortList ]);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -4906,7 +4909,7 @@ ts.addWidget({
|
||||
// clear storage
|
||||
if (ts.storage) { ts.storage( table, 'tablesorter-savesort', '' ); }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
@ -188,7 +188,7 @@
|
||||
// node could be a jquery object
|
||||
// http://jsperf.com/jquery-vs-instanceof-jquery/2
|
||||
$node = node.jquery ? node : $(node);
|
||||
if (typeof(t) === 'string') {
|
||||
if (typeof t === 'string') {
|
||||
// check data-attribute first when set to 'basic'; don't use node.innerText - it's really slow!
|
||||
// http://www.kellegous.com/j/2013/02/27/innertext-vs-textcontent/
|
||||
if ( t === 'basic' && typeof ( te = $node.attr(c.textAttribute) ) !== 'undefined' ) {
|
||||
@ -196,7 +196,7 @@
|
||||
}
|
||||
return $.trim( node.textContent || $node.text() );
|
||||
} else {
|
||||
if (typeof(t) === 'function') {
|
||||
if (typeof t === 'function') {
|
||||
return $.trim( t($node[0], c.table, cellIndex) );
|
||||
} else if (typeof (te = ts.getColumnData( c.table, t, cellIndex )) === 'function') {
|
||||
return $.trim( te($node[0], c.table, cellIndex) );
|
||||
@ -500,20 +500,22 @@
|
||||
// set up header template
|
||||
t = c.headerTemplate.replace(/\{content\}/g, $t.html()).replace(/\{icon\}/g, $t.find('.' + ts.css.icon).length ? '' : i);
|
||||
if (c.onRenderTemplate) {
|
||||
h = c.onRenderTemplate.apply($t, [index, t]);
|
||||
h = c.onRenderTemplate.apply( $t, [ index, t ] );
|
||||
if (h && typeof h === 'string') { t = h; } // only change t if something is returned
|
||||
}
|
||||
$t.html('<div class="' + ts.css.headerIn + '">' + t + '</div>'); // faster than wrapInner
|
||||
}
|
||||
if (c.onRenderHeader) { c.onRenderHeader.apply($t, [index, c, c.$table]); }
|
||||
if (c.onRenderHeader) { c.onRenderHeader.apply( $t, [ index, c, c.$table ] ); }
|
||||
// *** remove this.column value if no conflicts found
|
||||
elem.column = parseInt( $t.attr('data-column'), 10);
|
||||
elem.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
|
||||
elem.order = formatSortingOrder( ts.getData( $t, ch, 'sortInitialOrder' ) || c.sortInitialOrder ) ?
|
||||
[ 1, 0, 2 ] : // desc, asc, unsorted
|
||||
[ 0, 1, 2 ]; // asc, desc, unsorted
|
||||
elem.count = -1; // set to -1 because clicking on the header automatically adds one
|
||||
elem.lockedOrder = false;
|
||||
lock = ts.getData($t, ch, 'lockedOrder') || false;
|
||||
if (typeof lock !== 'undefined' && lock !== false) {
|
||||
elem.order = elem.lockedOrder = formatSortingOrder(lock) ? [1,1,1] : [0,0,0];
|
||||
elem.order = elem.lockedOrder = formatSortingOrder(lock) ? [ 1, 1, 1 ] : [ 0, 0, 0 ];
|
||||
}
|
||||
$t.addClass(ts.css.header + ' ' + c.cssHeader);
|
||||
// add cell to headerList
|
||||
@ -583,9 +585,9 @@
|
||||
list = c.sortList,
|
||||
len = list.length,
|
||||
none = ts.css.sortNone + ' ' + c.cssNone,
|
||||
css = [ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc],
|
||||
css = [ ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc ],
|
||||
cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
|
||||
aria = ['ascending', 'descending'],
|
||||
aria = [ 'ascending', 'descending' ],
|
||||
// find the footer
|
||||
$t = $(table).find('tfoot tr').children()
|
||||
.add( $( c.namespace + '_extra_headers' ) )
|
||||
@ -655,7 +657,7 @@
|
||||
dir = ('' + val[1]).match(/^(1|d|s|o|n)/);
|
||||
dir = dir ? dir[0] : '';
|
||||
// 0/(a)sc (default), 1/(d)esc, (s)ame, (o)pposite, (n)ext
|
||||
switch(dir) {
|
||||
switch (dir) {
|
||||
case '1': case 'd': // descending
|
||||
dir = 1;
|
||||
break;
|
||||
@ -731,11 +733,11 @@
|
||||
// add column to sort list
|
||||
order = cell.order[cell.count];
|
||||
if (order < 2) {
|
||||
c.sortList.push([indx, order]);
|
||||
c.sortList.push([ indx, order ]);
|
||||
// add other columns if header spans across multiple
|
||||
if (cell.colSpan > 1) {
|
||||
for (col = 1; col < cell.colSpan; col++) {
|
||||
c.sortList.push([indx + col, order]);
|
||||
c.sortList.push([ indx + col, order ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -746,7 +748,7 @@
|
||||
for (col = 0; col < c.sortAppend.length; col++) {
|
||||
s = ts.isValueInArray(c.sortAppend[col][0], c.sortList);
|
||||
if (s >= 0) {
|
||||
c.sortList.splice(s,1);
|
||||
c.sortList.splice(s, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -760,7 +762,7 @@
|
||||
// order.count seems to be incorrect when compared to cell.count
|
||||
s[1] = order.order[cell.count];
|
||||
if (s[1] === 2) {
|
||||
c.sortList.splice(col,1);
|
||||
c.sortList.splice(col, 1);
|
||||
order.count = -1;
|
||||
}
|
||||
}
|
||||
@ -769,11 +771,11 @@
|
||||
// add column to sort list array
|
||||
order = cell.order[cell.count];
|
||||
if (order < 2) {
|
||||
c.sortList.push([indx, order]);
|
||||
c.sortList.push([ indx, order ]);
|
||||
// add other columns if header spans across multiple
|
||||
if (cell.colSpan > 1) {
|
||||
for (col = 1; col < cell.colSpan; col++) {
|
||||
c.sortList.push([indx + col, order]);
|
||||
c.sortList.push([ indx + col, order ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -847,10 +849,10 @@
|
||||
x = dir ? a : b;
|
||||
y = dir ? b : a;
|
||||
// text sort function
|
||||
if (typeof(cts) === 'function') {
|
||||
if (typeof cts === 'function') {
|
||||
// custom OVERALL text sorter
|
||||
sort = cts(x[col], y[col], dir, col, table);
|
||||
} else if (typeof(cts) === 'object' && cts.hasOwnProperty(col)) {
|
||||
} else if (typeof cts === 'object' && cts.hasOwnProperty(col)) {
|
||||
// custom text sorter for a SPECIFIC COLUMN
|
||||
sort = cts[col](x[col], y[col], dir, col, table);
|
||||
} else {
|
||||
@ -883,14 +885,14 @@
|
||||
// this will catch spamming of the updateCell method
|
||||
if (resrt !== false && !c.serverSideSorting && !c.table.isProcessing) {
|
||||
if (sl.length) {
|
||||
c.$table.trigger('sorton', [sl, function(){
|
||||
c.$table.trigger('sorton', [ sl, function(){
|
||||
resortComplete(c, callback);
|
||||
}, true]);
|
||||
}, true ]);
|
||||
} else {
|
||||
c.$table.trigger('sortReset', [function(){
|
||||
c.$table.trigger('sortReset', [ function(){
|
||||
resortComplete(c, callback);
|
||||
ts.applyWidget(c.table, false);
|
||||
}]);
|
||||
} ]);
|
||||
}
|
||||
} else {
|
||||
resortComplete(c, callback);
|
||||
@ -1148,7 +1150,7 @@
|
||||
c.namespace = '.tablesorter' + Math.random().toString(16).slice(2);
|
||||
} else {
|
||||
// make sure namespace starts with a period & doesn't have weird characters
|
||||
c.namespace = '.' + c.namespace.replace(/\W/g,'');
|
||||
c.namespace = '.' + c.namespace.replace(/\W/g, '');
|
||||
}
|
||||
|
||||
c.$table.children().children('tr').attr('role', 'row');
|
||||
@ -1192,7 +1194,7 @@
|
||||
ts.applyWidget(table, true);
|
||||
// if user has supplied a sort list to constructor
|
||||
if (c.sortList.length > 0) {
|
||||
$table.trigger('sorton', [c.sortList, {}, !c.initWidgets, true]);
|
||||
$table.trigger('sorton', [ c.sortList, {}, !c.initWidgets, true ]);
|
||||
} else {
|
||||
setHeadersCss(table);
|
||||
if (c.initWidgets) {
|
||||
@ -1231,22 +1233,22 @@
|
||||
table = $(table)[0];
|
||||
var overallWidth, percent, $tbodies, len, index,
|
||||
c = table.config,
|
||||
colgroup = c.$table.children('colgroup');
|
||||
$colgroup = c.$table.children('colgroup');
|
||||
// remove plugin-added colgroup, in case we need to refresh the widths
|
||||
if (colgroup.length && colgroup.hasClass(ts.css.colgroup)) {
|
||||
colgroup.remove();
|
||||
if ($colgroup.length && $colgroup.hasClass(ts.css.colgroup)) {
|
||||
$colgroup.remove();
|
||||
}
|
||||
if (c.widthFixed && c.$table.children('colgroup').length === 0) {
|
||||
colgroup = $('<colgroup class="' + ts.css.colgroup + '">');
|
||||
$colgroup = $('<colgroup class="' + ts.css.colgroup + '">');
|
||||
overallWidth = c.$table.width();
|
||||
// only add col for visible columns - fixes #371
|
||||
$tbodies = c.$tbodies.find('tr:first').children(':visible'); //.each(function()
|
||||
$tbodies = c.$tbodies.find('tr:first').children(':visible'); // .each(function()
|
||||
len = $tbodies.length;
|
||||
for ( index = 0; index < len; index++ ) {
|
||||
percent = parseInt( ( $tbodies.eq( index ).width() / overallWidth ) * 1000, 10 ) / 10 + '%';
|
||||
colgroup.append( $('<col>').css('width', percent) );
|
||||
$colgroup.append( $('<col>').css('width', percent) );
|
||||
}
|
||||
c.$table.prepend(colgroup);
|
||||
c.$table.prepend($colgroup);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1293,12 +1295,12 @@
|
||||
cellId = rowIndex + '-' + $cell.index();
|
||||
rowSpan = cell.rowSpan || 1;
|
||||
colSpan = cell.colSpan || 1;
|
||||
if (typeof(matrix[rowIndex]) === 'undefined') {
|
||||
if (typeof matrix[rowIndex] === 'undefined') {
|
||||
matrix[rowIndex] = [];
|
||||
}
|
||||
// Find first available column in the first row
|
||||
for (k = 0; k < matrix[rowIndex].length + 1; k++) {
|
||||
if (typeof(matrix[rowIndex][k]) === 'undefined') {
|
||||
if (typeof matrix[rowIndex][k] === 'undefined') {
|
||||
firstAvailCol = k;
|
||||
break;
|
||||
}
|
||||
@ -1307,7 +1309,7 @@
|
||||
// add data-column
|
||||
$cell.attr({ 'data-column' : firstAvailCol }); // 'data-row' : rowIndex
|
||||
for (k = rowIndex; k < rowIndex + rowSpan; k++) {
|
||||
if (typeof(matrix[k]) === 'undefined') {
|
||||
if (typeof matrix[k] === 'undefined') {
|
||||
matrix[k] = [];
|
||||
}
|
||||
matrixrow = matrix[k];
|
||||
@ -1323,10 +1325,10 @@
|
||||
// *** Process table ***
|
||||
// add processing indicator
|
||||
ts.isProcessing = function(table, toggle, $ths) {
|
||||
table = $(table);
|
||||
var c = table[0].config,
|
||||
$table = $(table);
|
||||
var c = $table[0].config,
|
||||
// default to all headers
|
||||
$h = $ths || table.find('.' + ts.css.header);
|
||||
$h = $ths || $table.find('.' + ts.css.header);
|
||||
if (toggle) {
|
||||
// don't use sortList if custom $ths used
|
||||
if (typeof $ths !== 'undefined' && c.sortList.length > 0) {
|
||||
@ -1336,9 +1338,9 @@
|
||||
return this.sortDisabled ? false : ts.isValueInArray( parseFloat($(this).attr('data-column')), c.sortList) >= 0;
|
||||
});
|
||||
}
|
||||
table.add($h).addClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
$table.add($h).addClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
} else {
|
||||
table.add($h).removeClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
$table.add($h).removeClass(ts.css.processing + ' ' + c.cssProcessing);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1468,8 +1470,8 @@
|
||||
$f = $t.find('tfoot:first > tr').children('th, td');
|
||||
if (removeClasses === false && $.inArray('uitheme', c.widgets) >= 0) {
|
||||
// reapply uitheme classes, in case we want to maintain appearance
|
||||
$t.trigger('applyWidgetId', ['uitheme']);
|
||||
$t.trigger('applyWidgetId', ['zebra']);
|
||||
$t.trigger('applyWidgetId', [ 'uitheme' ]);
|
||||
$t.trigger('applyWidgetId', [ 'zebra' ]);
|
||||
}
|
||||
// remove widget added rows, just in case
|
||||
$h.find('tr').not($r).remove();
|
||||
@ -1481,7 +1483,7 @@
|
||||
.removeData('tablesorter')
|
||||
.unbind( events.replace(/\s+/g, ' ') );
|
||||
c.$headers.add($f)
|
||||
.removeClass( [ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone].join(' ') )
|
||||
.removeClass( [ ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone ].join(' ') )
|
||||
.removeAttr('data-column')
|
||||
.removeAttr('aria-label')
|
||||
.attr('aria-disabled', 'true');
|
||||
@ -1687,8 +1689,8 @@
|
||||
};
|
||||
|
||||
ts.hasWidget = function(table, name){
|
||||
table = $(table);
|
||||
return table.length && table[0].config && table[0].config.widgetInit[name] || false;
|
||||
$table = $(table);
|
||||
return $table.length && $table[0].config && $table[0].config.widgetInit[name] || false;
|
||||
};
|
||||
|
||||
ts.getWidgetById = function(name) {
|
||||
@ -1728,7 +1730,7 @@
|
||||
if (c.debug) { time = new Date(); }
|
||||
// look for widgets to apply from in table class
|
||||
// stop using \b otherwise this matches 'ui-widget-content' & adds 'content' widget
|
||||
wd = new RegExp( '\\s' + c.widgetClass.replace( /\{name\}/i, '([\\w-]+)' )+ '\\s', 'g' );
|
||||
wd = new RegExp( '\\s' + c.widgetClass.replace( /\{name\}/i, '([\\w-]+)' ) + '\\s', 'g' );
|
||||
if ( tableClass.match( wd ) ) {
|
||||
// extract out the widget id from the table class (widget id's can include dashes)
|
||||
w = tableClass.match( wd );
|
||||
@ -1936,13 +1938,13 @@
|
||||
typeof table !== 'undefined' ? table : true;
|
||||
if (t) {
|
||||
// US Format - 1,234,567.89 -> 1234567.89
|
||||
s = s.replace(/,/g,'');
|
||||
s = s.replace(/,/g, '');
|
||||
} else {
|
||||
// German Format = 1.234.567,89 -> 1234567.89
|
||||
// French Format = 1 234 567,89 -> 1234567.89
|
||||
s = s.replace(/[\s|\.]/g,'').replace(/,/g,'.');
|
||||
s = s.replace(/[\s|\.]/g, '').replace(/,/g, '.');
|
||||
}
|
||||
if(/^\s*\([.\d]+\)/.test(s)) {
|
||||
if (/^\s*\([.\d]+\)/.test(s)) {
|
||||
// make (#) into a negative number -> (10) = -10
|
||||
s = s.replace(/^\s*\(([.\d]+)\)/, '-$1');
|
||||
}
|
||||
@ -2010,7 +2012,7 @@
|
||||
ts.addParser({
|
||||
id: 'currency',
|
||||
is: function(s) {
|
||||
return (/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/).test((s || '').replace(/[+\-,. ]/g,'')); // £$€¤¥¢
|
||||
return (/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/).test((s || '').replace(/[+\-,. ]/g, '')); // £$€¤¥¢
|
||||
},
|
||||
format: function(s, table) {
|
||||
var n = ts.formatFloat((s || '').replace(/[^\w,. \-()]/g, ''), table);
|
||||
@ -2085,7 +2087,7 @@
|
||||
id: 'shortDate', // 'mmddyyyy', 'ddmmyyyy' or 'yyyymmdd'
|
||||
is: function(s) {
|
||||
// testing for ##-##-#### or ####-##-##, so it's not perfect; time can be included
|
||||
return (/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/).test((s || '').replace(/\s+/g,' ').replace(/[\-.,]/g, '/'));
|
||||
return (/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/).test((s || '').replace(/\s+/g, ' ').replace(/[\-.,]/g, '/'));
|
||||
},
|
||||
format: function(s, table, cell, cellIndex) {
|
||||
if (s) {
|
||||
|
@ -18,11 +18,11 @@
|
||||
|
||||
/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
|
||||
;(function ($, window, document) {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter || {};
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
var ts = $.tablesorter || {};
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
if you need it, then include https://github.com/douglascrockford/JSON-js
|
||||
|
||||
$.parseJSON is not available is jQuery versions older than 1.4.1, using older
|
||||
@ -38,9 +38,9 @@ var ts = $.tablesorter || {};
|
||||
v = $.tablesorter.storage(table, 'tablesorter-mywidget');
|
||||
// val may be empty, so also check for your data
|
||||
val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
|
||||
alert(val); // "data1" if saved, or "" if not
|
||||
*/
|
||||
ts.storage = function(table, key, value, options) {
|
||||
alert(val); // 'data1' if saved, or '' if not
|
||||
*/
|
||||
ts.storage = function(table, key, value, options) {
|
||||
table = $(table)[0];
|
||||
var cookieIndex, cookies, date,
|
||||
hasStorage = false,
|
||||
@ -50,12 +50,12 @@ ts.storage = function(table, key, value, options) {
|
||||
storageType = ( options && options.useSessionStorage ) || ( wo && wo.storage_useSessionStorage ) ?
|
||||
'sessionStorage' : 'localStorage',
|
||||
$table = $(table),
|
||||
// id from (1) options ID, (2) table "data-table-group" attribute, (3) widgetOptions.storage_tableId,
|
||||
// id from (1) options ID, (2) table 'data-table-group' attribute, (3) widgetOptions.storage_tableId,
|
||||
// (4) table ID, then (5) table index
|
||||
id = options && options.id ||
|
||||
$table.attr( options && options.group || wo && wo.storage_group || 'data-table-group') ||
|
||||
wo && wo.storage_tableId || table.id || $('.tablesorter').index( $table ),
|
||||
// url from (1) options url, (2) table "data-table-page" attribute, (3) widgetOptions.storage_fixedUrl,
|
||||
// url from (1) options url, (2) table 'data-table-page' attribute, (3) widgetOptions.storage_fixedUrl,
|
||||
// (4) table.config.fixedUrl (deprecated), then (5) window location path
|
||||
url = options && options.url ||
|
||||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
|
||||
@ -66,7 +66,7 @@ ts.storage = function(table, key, value, options) {
|
||||
window[storageType].setItem('_tmptest', 'temp');
|
||||
hasStorage = true;
|
||||
window[storageType].removeItem('_tmptest');
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
if (c && c.debug) {
|
||||
ts.log( storageType + ' is not supported in this browser' );
|
||||
}
|
||||
@ -97,21 +97,21 @@ ts.storage = function(table, key, value, options) {
|
||||
} else {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (31536e+6)); // 365 days
|
||||
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g,'\"') + '; expires=' + date.toGMTString() + '; path=/';
|
||||
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g, '\"') + '; expires=' + date.toGMTString() + '; path=/';
|
||||
}
|
||||
} else {
|
||||
return values && values[url] ? values[url][id] : '';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
})(jQuery, window, document);
|
||||
|
||||
/*! Widget: uitheme - updated 3/26/2015 (v2.21.3) */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
ts.themes = {
|
||||
ts.themes = {
|
||||
'bootstrap' : {
|
||||
table : 'table table-bordered table-striped',
|
||||
caption : 'caption',
|
||||
@ -123,7 +123,7 @@ ts.themes = {
|
||||
active : '', // applied when column is sorted
|
||||
hover : '', // custom css required - a defined bootstrap style may not override other classes
|
||||
// icon class names
|
||||
icons : '', // add "icon-white" to make them white; this icon class is added to the <i> in the header
|
||||
icons : '', // add 'icon-white' to make them white; this icon class is added to the <i> in the header
|
||||
iconSortNone : 'bootstrap-icon-unsorted', // class name added to icon when column is not sorted
|
||||
iconSortAsc : 'icon-chevron-up glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort
|
||||
iconSortDesc : 'icon-chevron-down glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort
|
||||
@ -154,14 +154,14 @@ ts.themes = {
|
||||
even : 'ui-widget-content', // even row zebra striping
|
||||
odd : 'ui-state-default' // odd row zebra striping
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
wrapper : 'tablesorter-wrapper' // ui theme & resizable
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
id: "uitheme",
|
||||
ts.addWidget({
|
||||
id: 'uitheme',
|
||||
priority: 10,
|
||||
format: function(table, c, wo) {
|
||||
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
||||
@ -183,7 +183,7 @@ ts.addWidget({
|
||||
if (hasOldTheme) {
|
||||
wo.zebra[0] = $.trim( ' ' + wo.zebra[0].replace(' ' + oldtheme.even, '') );
|
||||
wo.zebra[1] = $.trim( ' ' + wo.zebra[1].replace(' ' + oldtheme.odd, '') );
|
||||
c.$tbodies.children().removeClass( [oldtheme.even, oldtheme.odd].join(' ') );
|
||||
c.$tbodies.children().removeClass( [ oldtheme.even, oldtheme.odd ].join(' ') );
|
||||
}
|
||||
// update zebra stripes
|
||||
if (themes.even) { wo.zebra[0] += ' ' + themes.even; }
|
||||
@ -208,7 +208,7 @@ ts.addWidget({
|
||||
}
|
||||
// update header classes
|
||||
$headers
|
||||
.removeClass( (hasOldTheme ? [oldtheme.header, oldtheme.hover, oldremove].join(' ') : '') || '' )
|
||||
.removeClass( (hasOldTheme ? [ oldtheme.header, oldtheme.hover, oldremove ].join(' ') : '') || '' )
|
||||
.addClass(themes.header)
|
||||
.not('.sorter-false')
|
||||
.unbind('mouseenter.tsuitheme mouseleave.tsuitheme')
|
||||
@ -228,7 +228,7 @@ ts.addWidget({
|
||||
// if c.cssIcon is '', then no <i> is added to the header
|
||||
$headers
|
||||
.find('.' + ts.css.icon)
|
||||
.removeClass(hasOldTheme ? [oldtheme.icons, oldIconRmv].join(' ') : '')
|
||||
.removeClass(hasOldTheme ? [ oldtheme.icons, oldIconRmv ].join(' ') : '')
|
||||
.addClass(themes.icons || '');
|
||||
}
|
||||
if ($table.hasClass('hasFilters')) {
|
||||
@ -254,10 +254,10 @@ ts.addWidget({
|
||||
hdr = themes.sortNone;
|
||||
icon = themes.iconSortNone;
|
||||
if ($h.hasClass(ts.css.sortAsc)) {
|
||||
hdr = [themes.sortAsc, themes.active].join(' ');
|
||||
hdr = [ themes.sortAsc, themes.active ].join(' ');
|
||||
icon = themes.iconSortAsc;
|
||||
} else if ($h.hasClass(ts.css.sortDesc)) {
|
||||
hdr = [themes.sortDesc, themes.active].join(' ');
|
||||
hdr = [ themes.sortDesc, themes.active ].join(' ');
|
||||
icon = themes.iconSortDesc;
|
||||
}
|
||||
$header.addClass(hdr);
|
||||
@ -266,7 +266,7 @@ ts.addWidget({
|
||||
}
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.benchmark("Applying " + theme + " theme", time);
|
||||
ts.benchmark('Applying ' + theme + ' theme', time);
|
||||
}
|
||||
},
|
||||
remove: function(table, c, wo, refreshing) {
|
||||
@ -288,20 +288,20 @@ ts.addWidget({
|
||||
.removeClass(themes.filterRow);
|
||||
$headers.find('.' + ts.css.icon).removeClass(themes.icons + ' ' + iconRmv);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
/*! Widget: columns */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
ts.addWidget({
|
||||
id: "columns",
|
||||
ts.addWidget({
|
||||
id: 'columns',
|
||||
priority: 30,
|
||||
options : {
|
||||
columns : [ "primary", "secondary", "tertiary" ]
|
||||
columns : [ 'primary', 'secondary', 'tertiary' ]
|
||||
},
|
||||
format: function(table, c, wo) {
|
||||
var $tbody, tbodyIndex, $rows, rows, $row, $cells, remove, indx,
|
||||
@ -310,7 +310,7 @@ ts.addWidget({
|
||||
sortList = c.sortList,
|
||||
len = sortList.length,
|
||||
// removed c.widgetColumns support
|
||||
css = wo && wo.columns || [ "primary", "secondary", "tertiary" ],
|
||||
css = wo && wo.columns || [ 'primary', 'secondary', 'tertiary' ],
|
||||
last = css.length - 1;
|
||||
remove = css.join(' ');
|
||||
// check if there is a sort (on initialization there may not be one)
|
||||
@ -339,7 +339,7 @@ ts.addWidget({
|
||||
ts.processTbody(table, $tbody, false);
|
||||
}
|
||||
// add classes to thead and tfoot
|
||||
rows = wo.columns_thead !== false ? ['thead tr'] : [];
|
||||
rows = wo.columns_thead !== false ? [ 'thead tr' ] : [];
|
||||
if (wo.columns_tfoot !== false) {
|
||||
rows.push('tfoot tr');
|
||||
}
|
||||
@ -356,7 +356,7 @@ ts.addWidget({
|
||||
remove: function(table, c, wo) {
|
||||
var tbodyIndex, $tbody,
|
||||
$tbodies = c.$tbodies,
|
||||
remove = (wo.columns || [ "primary", "secondary", "tertiary" ]).join(' ');
|
||||
remove = (wo.columns || [ 'primary', 'secondary', 'tertiary' ]).join(' ');
|
||||
c.$headers.removeClass(remove);
|
||||
c.$table.children('tfoot').children('tr').children('th, td').removeClass(remove);
|
||||
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
|
||||
@ -367,7 +367,7 @@ ts.addWidget({
|
||||
ts.processTbody(table, $tbody, false); // restore tbody
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
@ -376,18 +376,18 @@ ts.addWidget({
|
||||
* by Rob Garrison
|
||||
*/
|
||||
;( function ( $ ) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
tscss = ts.css;
|
||||
|
||||
$.extend( tscss, {
|
||||
$.extend( tscss, {
|
||||
filterRow : 'tablesorter-filter-row',
|
||||
filter : 'tablesorter-filter',
|
||||
filterDisabled : 'disabled',
|
||||
filterRowHide : 'hideme'
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id: 'filter',
|
||||
priority: 50,
|
||||
options : {
|
||||
@ -416,7 +416,7 @@ ts.addWidget({
|
||||
filter_selectSource : null, // include a function to return an array of values to be added to the column filter select
|
||||
filter_startsWith : false, // if true, filter start from the beginning of the cell contents
|
||||
filter_useParsedData : false, // filter all data using parsed content
|
||||
filter_serversideFiltering : false, // if true, server-side filtering should be performed because client-side filtering will be disabled, but the ui and events will still be used.
|
||||
filter_serversideFiltering : false, // if true, must perform server-side filtering b/c client-side filtering is disabled, but the ui and events will still be used.
|
||||
filter_defaultAttrib : 'data-value', // data attribute in the header cell that contains the default filter value
|
||||
filter_selectSourceSeparator : '|' // filter_selectSource array text left of the separator is added to the option value, right into the option text
|
||||
},
|
||||
@ -447,9 +447,9 @@ ts.addWidget({
|
||||
$( document ).undelegate( wo.filter_reset, 'click.tsfilter' );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.filter = {
|
||||
ts.filter = {
|
||||
|
||||
// regex used in filter 'check' functions - not for general use and not documented
|
||||
regex: {
|
||||
@ -723,7 +723,7 @@ ts.filter = {
|
||||
filtered : new RegExp( wo.filter_filteredRow ),
|
||||
alreadyFiltered : new RegExp( '(\\s+(' + ts.language.or + '|-|' + ts.language.to + ')\\s+)', 'i' ),
|
||||
toTest : new RegExp( '\\s+(-|' + ts.language.to + ')\\s+', 'i' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)' ,'gi' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)', 'gi' ),
|
||||
andTest : new RegExp( '\\s+(' + ts.language.and + '|&&)\\s+', 'i' ),
|
||||
andSplit : new RegExp( '(?:\\s+(?:' + ts.language.and + '|&&)\\s+)', 'gi' ),
|
||||
orSplit : new RegExp( '(?:\\s+(?:' + ts.language.or + ')\\s+|\\|)', 'gi' ),
|
||||
@ -1158,7 +1158,7 @@ ts.filter = {
|
||||
c.lastSearch = [];
|
||||
}
|
||||
if ( wo.filter_initialized ) {
|
||||
c.$table.trigger( 'filterStart', [filters] );
|
||||
c.$table.trigger( 'filterStart', [ filters ] );
|
||||
}
|
||||
if ( c.showProcessing ) {
|
||||
// give it time for the processing icon to kick in
|
||||
@ -1388,7 +1388,7 @@ ts.filter = {
|
||||
// in case select filter option has a different value vs text 'a - z|A through Z'
|
||||
ffxn = wo.filter_columnFilters ?
|
||||
c.$filters.add( c.$externalFilters )
|
||||
.filter( '[data-column="'+ columnIndex + '"]' )
|
||||
.filter( '[data-column="' + columnIndex + '"]' )
|
||||
.find( 'select option:selected' )
|
||||
.attr( 'data-function-name' ) || '' : '';
|
||||
// replace accents - see #357
|
||||
@ -1748,7 +1748,7 @@ ts.filter = {
|
||||
if ( $.isFunction( cts ) ) {
|
||||
// custom OVERALL text sorter
|
||||
return cts( x, y, true, column, table );
|
||||
} else if ( typeof( cts ) === 'object' && cts.hasOwnProperty( column ) ) {
|
||||
} else if ( typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
||||
// custom text sorter for a SPECIFIC COLUMN
|
||||
return cts[column]( x, y, true, column, table );
|
||||
} else if ( ts.sortNatural ) {
|
||||
@ -1890,9 +1890,9 @@ ts.filter = {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
var i, $filters, $column, cols,
|
||||
filters = false,
|
||||
c = table ? $( table )[0].config : '',
|
||||
@ -1963,9 +1963,9 @@ ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
filters = false;
|
||||
}
|
||||
return filters;
|
||||
};
|
||||
};
|
||||
|
||||
ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
var c = table ? $( table )[0].config : '',
|
||||
valid = ts.getFilters( table, true, filter, skipFirst );
|
||||
if ( c && apply ) {
|
||||
@ -1976,7 +1976,7 @@ ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
c.$table.trigger( 'filterFomatterUpdate' );
|
||||
}
|
||||
return !!valid;
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery );
|
||||
|
||||
@ -1985,18 +1985,18 @@ ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
* by Rob Garrison
|
||||
*/
|
||||
;(function ($, window) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
sticky : 'tablesorter-stickyHeader', // stickyHeader
|
||||
stickyVis : 'tablesorter-sticky-visible',
|
||||
stickyHide: 'tablesorter-sticky-hidden',
|
||||
stickyWrap: 'tablesorter-sticky-wrapper'
|
||||
});
|
||||
});
|
||||
|
||||
// Add a resize event to table headers
|
||||
ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
// Add a resize event to table headers
|
||||
ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
table = $(table)[0]; // make sure we're using a dom element
|
||||
if ( !table.config ) { return; }
|
||||
var defaults = {
|
||||
@ -2012,7 +2012,7 @@ ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
headers = [];
|
||||
for ( index = 0; index < len; index++ ) {
|
||||
$header = c.$headers.eq( index );
|
||||
sizes = $header.data( 'savedSizes' ) || [ 0,0 ]; // fixes #394
|
||||
sizes = $header.data( 'savedSizes' ) || [ 0, 0 ]; // fixes #394
|
||||
width = $header[0].offsetWidth;
|
||||
height = $header[0].offsetHeight;
|
||||
if ( width !== sizes[0] || height !== sizes[1] ) {
|
||||
@ -2035,14 +2035,14 @@ ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
if (wo.resize_flag) { return; }
|
||||
checkSizes();
|
||||
}, options.timer);
|
||||
};
|
||||
};
|
||||
|
||||
// Sticky headers based on this awesome article:
|
||||
// http://css-tricks.com/13465-persistent-headers/
|
||||
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: "stickyHeaders",
|
||||
// Sticky headers based on this awesome article:
|
||||
// http://css-tricks.com/13465-persistent-headers/
|
||||
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'stickyHeaders',
|
||||
priority: 60, // sticky widget must be initialized after the filter widget!
|
||||
options: {
|
||||
stickyHeaders : '', // extra class name added to the sticky header row
|
||||
@ -2052,7 +2052,7 @@ ts.addWidget({
|
||||
stickyHeaders_offset : 0, // number or jquery selector targeting the position:fixed element
|
||||
stickyHeaders_filteredToTop: true, // scroll table top into view after filtering
|
||||
stickyHeaders_cloneId : '-sticky', // added to table ID, if it exists
|
||||
stickyHeaders_addResizeEvent : true, // trigger "resize" event on headers
|
||||
stickyHeaders_addResizeEvent : true, // trigger 'resize' event on headers
|
||||
stickyHeaders_includeCaption : true, // if false and a caption exist, it won't be included in the sticky header
|
||||
stickyHeaders_zIndex : 2 // The zIndex of the stickyHeaders, allows the user to adjust this to their needs
|
||||
},
|
||||
@ -2265,25 +2265,25 @@ ts.addWidget({
|
||||
.unbind( ('scroll resize '.split(' ').join(namespace)).replace(/\s+/g, ' ') );
|
||||
ts.addHeaderResizeEvent(table, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, window);
|
||||
|
||||
/*! Widget: resizable - updated 6/26/2015 (v2.22.2) */
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function ($, window) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
resizableContainer : 'tablesorter-resizable-container',
|
||||
resizableHandle : 'tablesorter-resizable-handle',
|
||||
resizableNoSelect : 'tablesorter-disableSelection',
|
||||
resizableStorage : 'tablesorter-resizable'
|
||||
});
|
||||
});
|
||||
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
var s = '<style>' +
|
||||
'body.' + ts.css.resizableNoSelect + ' { -ms-user-select: none; -moz-user-select: -moz-none;' +
|
||||
'-khtml-user-select: none; -webkit-user-select: none; user-select: none; }' +
|
||||
@ -2293,9 +2293,9 @@ $(function(){
|
||||
'top: 1px; cursor: ew-resize; z-index: 3; user-select: none; -moz-user-select: none; }' +
|
||||
'</style>';
|
||||
$(s).appendTo('body');
|
||||
});
|
||||
});
|
||||
|
||||
ts.resizable = {
|
||||
ts.resizable = {
|
||||
init : function( c, wo ) {
|
||||
if ( c.$table.hasClass( 'hasResizable' ) ) { return; }
|
||||
c.$table.addClass( 'hasResizable' );
|
||||
@ -2306,7 +2306,7 @@ ts.resizable = {
|
||||
marginTop = parseInt( $table.css( 'margin-top' ), 10 ),
|
||||
|
||||
// internal variables
|
||||
vars = wo.resizable_ = {
|
||||
vars = wo.resizable_vars = {
|
||||
useStorage : ts.storage && wo.resizable !== false,
|
||||
$wrap : $parent,
|
||||
mouseXPosition : 0,
|
||||
@ -2328,7 +2328,7 @@ ts.resizable = {
|
||||
vars.fullWidth = Math.abs( $parent.width() - vars.tableWidth ) < 20;
|
||||
|
||||
/*
|
||||
// Hacky method to determine if table width is set to "auto"
|
||||
// Hacky method to determine if table width is set to 'auto'
|
||||
// http://stackoverflow.com/a/20892048/145346
|
||||
if ( !vars.fullWidth ) {
|
||||
tmp = $table.width();
|
||||
@ -2348,7 +2348,7 @@ ts.resizable = {
|
||||
tmp = ts.storage( c.table, 'tablesorter-table-resized-width' ) || 'auto';
|
||||
ts.resizable.setWidth( $table, tmp, true );
|
||||
}
|
||||
wo.resizable_.storedSizes = storedSizes = ( vars.useStorage ?
|
||||
wo.resizable_vars.storedSizes = storedSizes = ( vars.useStorage ?
|
||||
ts.storage( c.table, ts.css.resizableStorage ) :
|
||||
[] ) || [];
|
||||
ts.resizable.setWidths( c, wo, storedSizes );
|
||||
@ -2382,7 +2382,7 @@ ts.resizable = {
|
||||
updateStoredSizes : function( c, wo ) {
|
||||
var column, $header,
|
||||
len = c.columns,
|
||||
vars = wo.resizable_;
|
||||
vars = wo.resizable_vars;
|
||||
vars.storedSizes = [];
|
||||
for ( column = 0; column < len; column++ ) {
|
||||
$header = c.$headerIndexed[ column ];
|
||||
@ -2401,7 +2401,7 @@ ts.resizable = {
|
||||
|
||||
setWidths : function( c, wo, storedSizes ) {
|
||||
var column, $temp,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$extra = $( c.namespace + '_extra_headers' ),
|
||||
$col = c.$table.children( 'colgroup' ).children( 'col' );
|
||||
storedSizes = storedSizes || vars.storedSizes || [];
|
||||
@ -2461,7 +2461,7 @@ ts.resizable = {
|
||||
// prevent text selection while dragging resize bar
|
||||
toggleTextSelection : function( c, toggle ) {
|
||||
var namespace = c.namespace + 'tsresize';
|
||||
c.widgetOptions.resizable_.disabled = toggle;
|
||||
c.widgetOptions.resizable_vars.disabled = toggle;
|
||||
$( 'body' ).toggleClass( ts.css.resizableNoSelect, toggle );
|
||||
if ( toggle ) {
|
||||
$( 'body' )
|
||||
@ -2479,7 +2479,7 @@ ts.resizable = {
|
||||
wo.$resizable_container.children().bind( 'mousedown', function( event ) {
|
||||
// save header cell and mouse position
|
||||
var column,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$extras = $( c.namespace + '_extra_headers' ),
|
||||
$header = $( event.target ).data( 'header' );
|
||||
|
||||
@ -2503,7 +2503,7 @@ ts.resizable = {
|
||||
|
||||
$( document )
|
||||
.bind( 'mousemove' + namespace, function( event ) {
|
||||
var vars = wo.resizable_;
|
||||
var vars = wo.resizable_vars;
|
||||
// ignore mousemove if no mousedown
|
||||
if ( !vars.disabled || vars.mouseXPosition === 0 || !vars.$target ) { return; }
|
||||
if ( wo.resizable_throttle ) {
|
||||
@ -2516,7 +2516,7 @@ ts.resizable = {
|
||||
}
|
||||
})
|
||||
.bind( 'mouseup' + namespace, function() {
|
||||
if (!wo.resizable_.disabled) { return; }
|
||||
if (!wo.resizable_vars.disabled) { return; }
|
||||
ts.resizable.toggleTextSelection( c, false );
|
||||
ts.resizable.stopResize( c, wo );
|
||||
ts.resizable.setHandlePosition( c, wo );
|
||||
@ -2536,21 +2536,21 @@ ts.resizable = {
|
||||
.add( $( c.namespace + '_extra_table' ).find( 'thead:first' ) )
|
||||
.bind( 'contextmenu' + namespace, function() {
|
||||
// $.isEmptyObject() needs jQuery 1.4+; allow right click if already reset
|
||||
var allowClick = wo.resizable_.storedSizes.length === 0;
|
||||
var allowClick = wo.resizable_vars.storedSizes.length === 0;
|
||||
ts.resizableReset( c.table );
|
||||
ts.resizable.setHandlePosition( c, wo );
|
||||
wo.resizable_.storedSizes = [];
|
||||
wo.resizable_vars.storedSizes = [];
|
||||
return allowClick;
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
mouseMove : function( c, wo, event ) {
|
||||
if ( wo.resizable_.mouseXPosition === 0 || !wo.resizable_.$target ) { return; }
|
||||
if ( wo.resizable_vars.mouseXPosition === 0 || !wo.resizable_vars.$target ) { return; }
|
||||
// resize columns
|
||||
var column,
|
||||
total = 0,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$next = vars.$next,
|
||||
tar = vars.storedSizes[ vars.target ],
|
||||
leftEdge = event.pageX - vars.mouseXPosition;
|
||||
@ -2582,7 +2582,7 @@ ts.resizable = {
|
||||
},
|
||||
|
||||
stopResize : function( c, wo ) {
|
||||
var vars = wo.resizable_;
|
||||
var vars = wo.resizable_vars;
|
||||
ts.resizable.updateStoredSizes( c, wo );
|
||||
if ( vars.useStorage ) {
|
||||
// save all column widths
|
||||
@ -2594,13 +2594,13 @@ ts.resizable = {
|
||||
// will update stickyHeaders, just in case, see #912
|
||||
c.$table.trigger('stickyHeadersUpdate');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// this widget saves the column widths if
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: "resizable",
|
||||
// this widget saves the column widths if
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'resizable',
|
||||
priority: 40,
|
||||
options: {
|
||||
resizable : true, // save column widths to storage
|
||||
@ -2618,7 +2618,8 @@ ts.addWidget({
|
||||
var namespace = c.namespace + 'tsresize';
|
||||
c.$table.add( $( c.namespace + '_extra_table' ) )
|
||||
.removeClass('hasResizable')
|
||||
.children( 'thead' ).unbind( 'contextmenu' + namespace );
|
||||
.children( 'thead' )
|
||||
.unbind( 'contextmenu' + namespace );
|
||||
|
||||
wo.$resizable_container.remove();
|
||||
ts.resizable.toggleTextSelection( c, false );
|
||||
@ -2626,14 +2627,14 @@ ts.addWidget({
|
||||
$( document ).unbind( 'mousemove' + namespace + ' mouseup' + namespace );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.resizableReset = function( table, refreshing ) {
|
||||
ts.resizableReset = function( table, refreshing ) {
|
||||
$( table ).each(function(){
|
||||
var index, $t,
|
||||
c = this.config,
|
||||
wo = c && c.widgetOptions,
|
||||
vars = wo.resizable_;
|
||||
vars = wo.resizable_vars;
|
||||
if ( table && c && c.$headerIndexed.length ) {
|
||||
// restore the initial table width
|
||||
if ( vars.overflow && vars.tableWidth ) {
|
||||
@ -2659,20 +2660,20 @@ ts.resizableReset = function( table, refreshing ) {
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery, window );
|
||||
|
||||
/*! Widget: saveSort */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
// this widget saves the last sort only if the
|
||||
// saveSort widget option is true AND the
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
// this widget saves the last sort only if the
|
||||
// saveSort widget option is true AND the
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'saveSort',
|
||||
priority: 20,
|
||||
options: {
|
||||
@ -2686,7 +2687,7 @@ ts.addWidget({
|
||||
var stored, time,
|
||||
$table = c.$table,
|
||||
saveSort = wo.saveSort !== false, // make saveSort active/inactive; default to true
|
||||
sortList = { "sortList" : c.sortList };
|
||||
sortList = { 'sortList' : c.sortList };
|
||||
if (c.debug) {
|
||||
time = new Date();
|
||||
}
|
||||
@ -2719,7 +2720,7 @@ ts.addWidget({
|
||||
c.sortList = sortList;
|
||||
} else if (table.hasInitialized && sortList && sortList.length > 0) {
|
||||
// update sort change
|
||||
$table.trigger('sorton', [sortList]);
|
||||
$table.trigger('sorton', [ sortList ]);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2728,7 +2729,7 @@ ts.addWidget({
|
||||
// clear storage
|
||||
if (ts.storage) { ts.storage( table, 'tablesorter-savesort', '' ); }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*! Parser: Extract out date - updated 10/26/2014 (v2.18.0) */
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var regex = {
|
||||
usLong : /[A-Z]{3,10}\.?\s+\d{1,2},?\s+(?:\d{4})(?:\s+\d{1,2}:\d{2}(?::\d{2})?(?:\s+[AP]M)?)?/i,
|
||||
@ -15,10 +15,10 @@
|
||||
};
|
||||
|
||||
/*! extract US Long Date *//* (ignore any other text)
|
||||
* e.g. "Sue's Birthday! Jun 26, 2004 7:22 AM (8# 2oz)"
|
||||
* e.g. 'Sue's Birthday! Jun 26, 2004 7:22 AM (8# 2oz)'
|
||||
* demo: http://jsfiddle.net/Mottie/abkNM/4165/ */
|
||||
$.tablesorter.addParser({
|
||||
id: "extractUSLongDate",
|
||||
id: 'extractUSLongDate',
|
||||
is: function () {
|
||||
// don't auto detect this parser
|
||||
return false;
|
||||
@ -32,67 +32,67 @@
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
/*! extract MMDDYYYY *//* (ignore any other text)
|
||||
* demo: http://jsfiddle.net/Mottie/abkNM/4166/ */
|
||||
$.tablesorter.addParser({
|
||||
id: "extractMMDDYYYY",
|
||||
id: 'extractMMDDYYYY',
|
||||
is: function () {
|
||||
// don't auto detect this parser
|
||||
return false;
|
||||
},
|
||||
format: function (s) {
|
||||
var date,
|
||||
str = s ? s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(regex.mdy) : s;
|
||||
str = s ? s.replace(/\s+/g, ' ').replace(/[\-.,]/g, '/').match(regex.mdy) : s;
|
||||
if (str) {
|
||||
date = new Date( str[0] );
|
||||
return date instanceof Date && isFinite(date) ? date.getTime() : s;
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
/*! extract DDMMYYYY *//* (ignore any other text)
|
||||
* demo: http://jsfiddle.net/Mottie/abkNM/4167/ */
|
||||
$.tablesorter.addParser({
|
||||
id: "extractDDMMYYYY",
|
||||
id: 'extractDDMMYYYY',
|
||||
is: function () {
|
||||
// don't auto detect this parser
|
||||
return false;
|
||||
},
|
||||
format: function (s) {
|
||||
var date,
|
||||
str = s ? s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(regex.dmy) : s;
|
||||
str = s ? s.replace(/\s+/g, ' ').replace(/[\-.,]/g, '/').match(regex.dmy) : s;
|
||||
if (str) {
|
||||
date = new Date( str[0].replace(regex.dmyreplace, "$2/$1/$3") );
|
||||
date = new Date( str[0].replace(regex.dmyreplace, '$2/$1/$3') );
|
||||
return date instanceof Date && isFinite(date) ? date.getTime() : s;
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
/*! extract YYYYMMDD *//* (ignore any other text)
|
||||
* demo: http://jsfiddle.net/Mottie/abkNM/4168/ */
|
||||
$.tablesorter.addParser({
|
||||
id: "extractYYYYMMDD",
|
||||
id: 'extractYYYYMMDD',
|
||||
is: function () {
|
||||
// don't auto detect this parser
|
||||
return false;
|
||||
},
|
||||
format: function (s) {
|
||||
var date,
|
||||
str = s ? s.replace(/\s+/g," ").replace(/[\-.,]/g, "/").match(regex.ymd) : s;
|
||||
str = s ? s.replace(/\s+/g, ' ').replace(/[\-.,]/g, '/').match(regex.ymd) : s;
|
||||
if (str) {
|
||||
date = new Date( str[0].replace(regex.ymdreplace, "$2/$3/$1") );
|
||||
date = new Date( str[0].replace(regex.ymdreplace, '$2/$3/$1') );
|
||||
return date instanceof Date && isFinite(date) ? date.getTime() : s;
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'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})))?)?)?)?$/;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter;
|
||||
ts.dates = $.extend({}, ts.dates, {
|
||||
@ -12,7 +12,7 @@
|
||||
ts.dates.monthLower = ts.dates.monthCased.join(',').toLocaleLowerCase().split(',');
|
||||
|
||||
ts.addParser({
|
||||
id: "month",
|
||||
id: 'month',
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
@ -20,7 +20,7 @@
|
||||
if (s) {
|
||||
var j = -1, c = table.config,
|
||||
n = c.ignoreCase ? s.toLocaleLowerCase() : s;
|
||||
$.each(ts.dates[ 'month' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
|
||||
$.each(ts.dates[ 'month' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i, v){
|
||||
if (j < 0 && n.match(v)) {
|
||||
j = i;
|
||||
return false;
|
||||
@ -32,7 +32,7 @@
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Include the 'widget-filter-type-insideRange.js' to filter ranges */
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var regex = {
|
||||
mdy : /(\d{1,2}[-\s]\d{1,2}[-\s]\d{4}(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?)/gi,
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Demo: http://mottie.github.io/tablesorter/docs/example-parsers-dates.html */
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
// Make the date be within +/- range of the 2 digit year
|
||||
// so if the current year is 2020, and the 2 digit year is 80 (2080 - 2020 > 50), it becomes 1980
|
||||
@ -23,7 +23,7 @@
|
||||
var y, rng,
|
||||
n = s
|
||||
// replace separators
|
||||
.replace(/\s+/g," ").replace(/[-.,]/g, "/")
|
||||
.replace(/\s+/g, ' ').replace(/[-.,]/g, '/')
|
||||
// reformat xx/xx/xx to mm/dd/19yy;
|
||||
.replace(regex, format),
|
||||
d = new Date(n);
|
||||
@ -31,7 +31,7 @@
|
||||
y = d.getFullYear();
|
||||
rng = table && table.config.dateRange || range;
|
||||
// if date > 50 years old (set range), add 100 years
|
||||
// this will work when people start using "50" and mean "2050"
|
||||
// this will work when people start using '50' and mean '2050'
|
||||
while (now - y > rng) {
|
||||
y += 100;
|
||||
}
|
||||
@ -42,39 +42,39 @@
|
||||
};
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "ddmmyy",
|
||||
id: 'ddmmyy',
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
// reformat dd/mm/yy to mm/dd/19yy;
|
||||
return ts.formatDate(s, ts.dates.regxxxxyy, "$2/$1/19$3", table);
|
||||
return ts.formatDate(s, ts.dates.regxxxxyy, '$2/$1/19$3', table);
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "mmddyy",
|
||||
id: 'mmddyy',
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
// reformat mm/dd/yy to mm/dd/19yy
|
||||
return ts.formatDate(s, ts.dates.regxxxxyy, "$1/$2/19$3", table);
|
||||
return ts.formatDate(s, ts.dates.regxxxxyy, '$1/$2/19$3', table);
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "yymmdd",
|
||||
id: 'yymmdd',
|
||||
is: function() {
|
||||
return false;
|
||||
},
|
||||
format: function(s, table) {
|
||||
// reformat yy/mm/dd to mm/dd/19yy
|
||||
return ts.formatDate(s, ts.dates.regyyxxxx, "$2/$3/19$1", table);
|
||||
return ts.formatDate(s, ts.dates.regyyxxxx, '$2/$3/19$1', table);
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter;
|
||||
ts.dates = $.extend({}, ts.dates, {
|
||||
@ -12,7 +12,7 @@
|
||||
ts.dates.weekdayLower = ts.dates.weekdayCased.join(',').toLocaleLowerCase().split(',');
|
||||
|
||||
ts.addParser({
|
||||
id: "weekday",
|
||||
id: 'weekday',
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
@ -20,7 +20,7 @@
|
||||
if (s) {
|
||||
var j = -1, c = table.config;
|
||||
s = c.ignoreCase ? s.toLocaleLowerCase() : s;
|
||||
$.each(ts.dates[ 'weekday' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i,v){
|
||||
$.each(ts.dates[ 'weekday' + (c.ignoreCase ? 'Lower' : 'Cased') ], function(i, v){
|
||||
if (j < 0 && s.match(v)) {
|
||||
j = i;
|
||||
return false;
|
||||
@ -32,7 +32,7 @@
|
||||
}
|
||||
return s;
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Extract dates using popular natural language date parsers */
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
/*! Sugar (http://sugarjs.com/dates#comparing_dates) */
|
||||
/* demo: http://jsfiddle.net/Mottie/abkNM/4163/ */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*! Parser: duration & countdown - updated 2/7/2015 (v2.19.0) */
|
||||
/*jshint jquery:true, unused:false */
|
||||
;(function($){
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
// If any number > 9999, then set table.config.durationLength = 5
|
||||
// The below regex matches this duration example: 1y 23d 12h 44m 9s
|
||||
|
@ -5,21 +5,21 @@
|
||||
*/
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter;
|
||||
ts.symbolRegex = /[\u215b\u215c\u215d\u215e\u00bc\u00bd\u00be]/g;
|
||||
ts.processFractions = function(n, table) {
|
||||
if (n) {
|
||||
var t, p = 0;
|
||||
n = $.trim(n.replace(/\"/,''));
|
||||
// look for a space in the first part of the number: "10 3/4" and save the "10"
|
||||
n = $.trim(n.replace(/\"/, ''));
|
||||
// look for a space in the first part of the number: '10 3/4' and save the '10'
|
||||
if (/\s/.test(n)) {
|
||||
p = ts.formatFloat(n.split(' ')[0], table);
|
||||
// remove stuff to the left of the space
|
||||
n = $.trim(n.substring(n.indexOf(' '), n.length));
|
||||
}
|
||||
// look for a "/" to calculate fractions
|
||||
// look for a '/' to calculate fractions
|
||||
if (/\//g.test(n)) {
|
||||
t = n.split('/');
|
||||
// turn 3/4 into .75; make sure we don't divide by zero
|
||||
@ -52,10 +52,10 @@
|
||||
if (s === '') { return ''; }
|
||||
// look for feet symbol = '
|
||||
// very generic test to catch 1.1', 1 1/2' and 1½'
|
||||
var d = (/^\s*\S*(\s+\S+)?\s*\'/.test(s)) ? s.split("'") : [0,s],
|
||||
var d = (/^\s*\S*(\s+\S+)?\s*\'/.test(s)) ? s.split(/\'/) : [ 0, s ],
|
||||
f = ts.processFractions(d[0], table), // feet
|
||||
i = ts.processFractions(d[1], table); // inches
|
||||
return (/[\'\"]/).test(s) ? parseFloat(f) + (parseFloat(i)/12 || 0) : parseFloat(f) + parseFloat(i);
|
||||
return (/[\'\"]/).test(s) ? parseFloat(f) + (parseFloat(i) / 12 || 0) : parseFloat(f) + parseFloat(i);
|
||||
},
|
||||
type: 'numeric'
|
||||
});
|
||||
|
@ -4,33 +4,33 @@
|
||||
*/
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
// basic list from http://en.wikipedia.org/wiki/List_of_file_formats
|
||||
// To add a custom equivalent, define:
|
||||
// $.tablesorter.fileTypes.equivalents['xx'] = "A|B|C";
|
||||
// $.tablesorter.fileTypes.equivalents['xx'] = 'A|B|C';
|
||||
$.tablesorter.fileTypes = {
|
||||
// divides filetype extensions in the equivalent list below
|
||||
separator : '|',
|
||||
equivalents : {
|
||||
"3D Image" : "3dm|3ds|dwg|max|obj",
|
||||
"Audio" : "aif|aac|ape|flac|la|m4a|mid|midi|mp2|mp3|ogg|ra|raw|rm|wav|wma",
|
||||
"Compressed" : "7z|bin|cab|cbr|gz|gzip|iso|lha|lz|rar|tar|tgz|zip|zipx|zoo",
|
||||
"Database" : "csv|dat|db|dbf|json|ldb|mdb|myd|pdb|sql|tsv|wdb|wmdb|xlr|xls|xlsx|xml",
|
||||
"Development" : "asm|c|class|cls|cpp|cc|cs|cxx|cbp|cs|dba|fla|h|java|lua|pl|py|pyc|pyo|sh|sln|r|rb|vb",
|
||||
"Document" : "doc|docx|odt|ott|pages|pdf|rtf|tex|wpd|wps|wrd|wri",
|
||||
"Executable" : "apk|app|com|exe|gadget|lnk|msi",
|
||||
"Fonts" : "eot|fnt|fon|otf|ttf|woff",
|
||||
"Icons" : "ani|cur|icns|ico",
|
||||
"Images" : "bmp|gif|jpg|jpeg|jpe|jp2|pic|png|psd|tga|tif|tiff|wmf|webp",
|
||||
"Presentation" : "pps|ppt",
|
||||
"Published" : "chp|epub|lit|pub|ppp|fm|mobi",
|
||||
"Script" : "as|bat|cgi|cmd|jar|js|lua|scpt|scptd|sh|vbs|vb|wsf",
|
||||
"Styles" : "css|less|sass",
|
||||
"Text" : "info|log|md|markdown|nfo|tex|text|txt",
|
||||
"Vectors" : "awg|ai|eps|cdr|ps|svg",
|
||||
"Video" : "asf|avi|flv|m4v|mkv|mov|mp4|mpe|mpeg|mpg|ogg|rm|rv|swf|vob|wmv",
|
||||
"Web" : "asp|aspx|cer|cfm|htm|html|php|url|xhtml"
|
||||
'3D Image' : '3dm|3ds|dwg|max|obj',
|
||||
'Audio' : 'aif|aac|ape|flac|la|m4a|mid|midi|mp2|mp3|ogg|ra|raw|rm|wav|wma',
|
||||
'Compressed' : '7z|bin|cab|cbr|gz|gzip|iso|lha|lz|rar|tar|tgz|zip|zipx|zoo',
|
||||
'Database' : 'csv|dat|db|dbf|json|ldb|mdb|myd|pdb|sql|tsv|wdb|wmdb|xlr|xls|xlsx|xml',
|
||||
'Development' : 'asm|c|class|cls|cpp|cc|cs|cxx|cbp|cs|dba|fla|h|java|lua|pl|py|pyc|pyo|sh|sln|r|rb|vb',
|
||||
'Document' : 'doc|docx|odt|ott|pages|pdf|rtf|tex|wpd|wps|wrd|wri',
|
||||
'Executable' : 'apk|app|com|exe|gadget|lnk|msi',
|
||||
'Fonts' : 'eot|fnt|fon|otf|ttf|woff',
|
||||
'Icons' : 'ani|cur|icns|ico',
|
||||
'Images' : 'bmp|gif|jpg|jpeg|jpe|jp2|pic|png|psd|tga|tif|tiff|wmf|webp',
|
||||
'Presentation' : 'pps|ppt',
|
||||
'Published' : 'chp|epub|lit|pub|ppp|fm|mobi',
|
||||
'Script' : 'as|bat|cgi|cmd|jar|js|lua|scpt|scptd|sh|vbs|vb|wsf',
|
||||
'Styles' : 'css|less|sass',
|
||||
'Text' : 'info|log|md|markdown|nfo|tex|text|txt',
|
||||
'Vectors' : 'awg|ai|eps|cdr|ps|svg',
|
||||
'Video' : 'asf|avi|flv|m4v|mkv|mov|mp4|mpe|mpeg|mpg|ogg|rm|rv|swf|vob|wmv',
|
||||
'Web' : 'asp|aspx|cer|cfm|htm|html|php|url|xhtml'
|
||||
}
|
||||
};
|
||||
|
||||
@ -48,9 +48,9 @@
|
||||
m = $.tablesorter.fileTypes.matching,
|
||||
types = $.tablesorter.fileTypes.equivalents;
|
||||
if (!m) {
|
||||
// make a string to "quick" match the existing equivalents
|
||||
// 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;
|
||||
|
@ -3,7 +3,7 @@
|
||||
Globalize.locale( 'xx' ) prior to initializing tablesorter! */
|
||||
/*jshint jquery:true */
|
||||
;( function( $ ) {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
/*! jQuery Globalize date parser (https://github.com/jquery/globalize#date-module) */
|
||||
/* demo: http://jsfiddle.net/Mottie/0j18Lw8r/ */
|
||||
|
@ -1,28 +1,28 @@
|
||||
/*! Parser: ignoreArticles - updated 9/15/2014 (v2.17.8) *//*
|
||||
* This parser will remove "The", "A" and "An" from the beginning of a book
|
||||
* This parser will remove 'The', 'A' and 'An' from the beginning of a book
|
||||
* or movie title, so it sorts by the second word or number
|
||||
* Demo: http://jsfiddle.net/Mottie/abkNM/5/
|
||||
*/
|
||||
/*jshint browser: true, jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter;
|
||||
var ts = $.tablesorter;
|
||||
|
||||
// basic list from http://en.wikipedia.org/wiki/Article_%28grammar%29
|
||||
ts.ignoreArticles = {
|
||||
"en" : "the, a, an",
|
||||
"de" : "der, die, das, des, dem, den, ein, eine, einer, eines, einem, einen",
|
||||
"nl" : "de, het, de, een",
|
||||
"es" : "el, la, lo, los, las, un, una, unos, unas",
|
||||
"pt" : "o, a, os, as, um, uma, uns, umas",
|
||||
"fr" : "le, la, l'_, les, un, une, des",
|
||||
"it" : "il, lo, la, l'_, i, gli, le, un', uno, una, un",
|
||||
"hu" : "a, az, egy"
|
||||
'en' : 'the, a, an',
|
||||
'de' : 'der, die, das, des, dem, den, ein, eine, einer, eines, einem, einen',
|
||||
'nl' : 'de, het, de, een',
|
||||
'es' : 'el, la, lo, los, las, un, una, unos, unas',
|
||||
'pt' : 'o, a, os, as, um, uma, uns, umas',
|
||||
'fr' : 'le, la, l\'_, les, un, une, des',
|
||||
'it' : 'il, lo, la, l\'_, i, gli, le, un\', uno, una, un',
|
||||
'hu' : 'a, az, egy'
|
||||
};
|
||||
|
||||
// To add a custom parser, define:
|
||||
// $.tablesorter.ignoreArticles['xx'] = "A, B, C";
|
||||
// $.tablesorter.ignoreArticles['xx'] = 'A, B, C';
|
||||
// and then set the language id 'xx' in the headers option
|
||||
// ignoreArticles : 'xx'
|
||||
|
||||
@ -40,11 +40,11 @@ var ts = $.tablesorter;
|
||||
if (!c.headers) { c.headers = {}; }
|
||||
if (!c.headers[cellIndex]) { c.headers[cellIndex] = {}; }
|
||||
lang = ts.getData( c.$headers.eq(cellIndex), ts.getColumnData( table, c.headers, cellIndex ), 'ignoreArticles' );
|
||||
art = (ts.ignoreArticles[lang] || "the, a, an" ) + "";
|
||||
c.headers[cellIndex].ignoreArticlesRegex = new RegExp('^(' + $.trim( art.split(/\s*\,\s*/).join('\\s|') + "\\s" ).replace("_\\s","") + ')', 'i');
|
||||
art = (ts.ignoreArticles[lang] || 'the, a, an' ) + '';
|
||||
c.headers[cellIndex].ignoreArticlesRegex = new RegExp('^(' + $.trim( art.split(/\s*\,\s*/).join('\\s|') + '\\s' ).replace('_\\s', '') + ')', 'i');
|
||||
// exception regex stored in c.headers[cellIndex].ignoreArticlesRegex2
|
||||
ignore = ts.getData( c.$headers.eq(cellIndex), ts.getColumnData( table, c.headers, cellIndex ), 'ignoreArticlesExcept' );
|
||||
c.headers[cellIndex].ignoreArticlesRegex2 = ignore !== '' ? new RegExp('^(' + ignore.replace(/\s/g, "\\s") + ')', 'i') : '';
|
||||
c.headers[cellIndex].ignoreArticlesRegex2 = ignore !== '' ? new RegExp('^(' + ignore.replace(/\s/g, '\\s') + ')', 'i') : '';
|
||||
}
|
||||
art = c.headers[cellIndex].ignoreArticlesRegex;
|
||||
if (art.test(str)) {
|
||||
|
@ -2,10 +2,10 @@
|
||||
/* alt attribute parser for jQuery 1.7+ & tablesorter 2.7.11+ */
|
||||
/*jshint jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "image",
|
||||
id: 'image',
|
||||
is: function(){
|
||||
return false;
|
||||
},
|
||||
@ -13,7 +13,7 @@
|
||||
return $(cell).find('img').attr(table.config.imgAttr || 'alt') || s;
|
||||
},
|
||||
parsed : true, // filter widget flag
|
||||
type: "text"
|
||||
type: 'text'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
/*jshint browser: true, jquery:true, unused:false */
|
||||
;( function( $ ) {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var updateServer = function( event, $table, $input ) {
|
||||
// do something here to update your server, if needed
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
/*jshint jquery:true */
|
||||
;( function( $ ) {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var prefixes = {
|
||||
// 'prefix' : [ base 10, base 2 ]
|
||||
@ -23,7 +23,7 @@
|
||||
'h|hecto' : [ 1e2, 1e2 ],
|
||||
'da|deka' : [ 1e1, 1e1 ],
|
||||
'd|deci' : [ 1e-1, 1e-1 ],
|
||||
'c|centi' : [ 1e-2, 1e-2],
|
||||
'c|centi' : [ 1e-2, 1e-2 ],
|
||||
'm|milli' : [ 1e-3, 1e-3 ],
|
||||
'µ|micro' : [ 1e-6, 1e-6 ],
|
||||
'n|nano' : [ 1e-9, 1e-9 ],
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
/*jshint jquery:true */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
// Change language of the named numbers as needed
|
||||
var named = {
|
||||
@ -99,7 +99,7 @@
|
||||
};
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: "namedNumbers",
|
||||
id: 'namedNumbers',
|
||||
is: function () {
|
||||
return false;
|
||||
},
|
||||
@ -116,7 +116,7 @@
|
||||
// make sure to let zero get parsed, so check hasOwnProperty
|
||||
return result || named.numbers.hasOwnProperty( str ) ? result : $.tablesorter.formatFloat( str || '', table );
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
|
@ -69,7 +69,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 hex ? expandedAddress : expandedAddress.replace(/:/g, '');
|
||||
},
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
/*jshint jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
// allow lower case roman numerals, since lists use i, ii, iii, etc.
|
||||
var validator = /^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/i,
|
||||
@ -34,7 +34,7 @@
|
||||
|
||||
return num;
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
@ -75,7 +75,7 @@
|
||||
|
||||
return num ? s.replace(orig, num) : s;
|
||||
},
|
||||
type: "text"
|
||||
type: 'text'
|
||||
});
|
||||
|
||||
$.tablesorter.addParser({
|
||||
@ -111,7 +111,7 @@
|
||||
|
||||
return num ? num : s;
|
||||
},
|
||||
type: "numeric"
|
||||
type: 'numeric'
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -5,10 +5,10 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var ts = $.tablesorter;
|
||||
'use strict';
|
||||
var ts = $.tablesorter;
|
||||
|
||||
ts.alignChar = {
|
||||
ts.alignChar = {
|
||||
|
||||
init : function(table, c, wo) {
|
||||
c.$headers.filter('[' + wo.alignChar_charAttrib + ']').each(function(){
|
||||
@ -40,8 +40,8 @@ ts.alignChar = {
|
||||
for (rowIndex = 0; rowIndex < len; rowIndex++) {
|
||||
// set up to work with modified cache v2.16.0+
|
||||
$row = rows.row ? rows.row[rowIndex] : rows.normalized[rowIndex][c.columns].$row;
|
||||
val = $row.find('td').eq(v.column).text().replace(/[ ]/g, "\u00a0");
|
||||
// count how many "align" characters are in the string
|
||||
val = $row.find('td').eq(v.column).text().replace(/[ ]/g, '\u00a0');
|
||||
// count how many 'align' characters are in the string
|
||||
count = (val.match( v.regex ) || []).length;
|
||||
// set alignment @ alignIndex (one-based index)
|
||||
if (count > 0 && v.alignIndex > 0) {
|
||||
@ -70,8 +70,8 @@ ts.alignChar = {
|
||||
}
|
||||
|
||||
// find widest segments
|
||||
wLeft = ($.extend([], left)).sort(function(a,b){ return b.length - a.length; })[0];
|
||||
wRight = ($.extend([], right)).sort(function(a,b){ return b.length - a.length; })[0];
|
||||
wLeft = ($.extend([], left)).sort(function(a, b){ return b.length - a.length; })[0];
|
||||
wRight = ($.extend([], right)).sort(function(a, b){ return b.length - a.length; })[0];
|
||||
// calculate percentage widths
|
||||
v.width = v.width || ( Math.floor(wLeft.length / (wLeft.length + wRight.length) * 100) + v.adjust );
|
||||
wLeft = 'min-width:' + v.width + '%';
|
||||
@ -93,6 +93,7 @@ ts.alignChar = {
|
||||
wo.alignChar_initialized = true;
|
||||
|
||||
},
|
||||
|
||||
remove: function(table, c, column){
|
||||
if ($.isEmptyObject(c.cache)) { return; }
|
||||
var tbodyIndex, rowIndex, len, rows, $row, $cell;
|
||||
@ -106,9 +107,9 @@ ts.alignChar = {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id: 'alignChar',
|
||||
priority: 100,
|
||||
options: {
|
||||
@ -141,6 +142,6 @@ ts.addWidget({
|
||||
});
|
||||
wo.alignChar_initialized = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
@ -5,8 +5,8 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var ts = $.tablesorter = $.tablesorter || {},
|
||||
'use strict';
|
||||
var ts = $.tablesorter = $.tablesorter || {},
|
||||
|
||||
// build a table from data (requires existing <table> tag)
|
||||
// data.header contains an array of header titles
|
||||
@ -40,7 +40,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
||||
// valid JSON!
|
||||
return bt.object( table, d, wo );
|
||||
}
|
||||
} catch(ignore) {}
|
||||
} catch (ignore) {}
|
||||
// fall through in case it's a csv string
|
||||
}
|
||||
// Array
|
||||
@ -105,7 +105,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
||||
|
||||
// *** CSV only options ***
|
||||
build_csvStartLine : 0, // line within the csv to start adding to table
|
||||
build_csvSeparator : ",", // csv separator
|
||||
build_csvSeparator : ',', // csv separator
|
||||
|
||||
// *** build object options ***
|
||||
build_objectRowKey : 'rows', // object key containing table rows
|
||||
@ -225,7 +225,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
||||
var c, h,
|
||||
csv = wo.build_type === 'csv' || typeof data === 'string',
|
||||
$t = $(table),
|
||||
lines = csv ? data.replace('\r','').split('\n') : data,
|
||||
lines = csv ? data.replace('\r', '').split('\n') : data,
|
||||
len = lines.length,
|
||||
printedLines = 0,
|
||||
infooter = false,
|
||||
@ -276,13 +276,13 @@ var ts = $.tablesorter = $.tablesorter || {},
|
||||
// CSV Parser by Brian Huisman (http://www.greywyvern.com/?post=258)
|
||||
bt.splitCSV = function(str, sep) {
|
||||
var x, tl,
|
||||
thisCSV = $.trim(str).split(sep = sep || ",");
|
||||
thisCSV = $.trim(str).split(sep = sep || ',');
|
||||
for ( x = thisCSV.length - 1; x >= 0; x-- ) {
|
||||
if ( thisCSV[x].replace(/\"\s+$/, '"').charAt(thisCSV[x].length - 1) === '"' ) {
|
||||
if ( (tl = thisCSV[x].replace(/^\s+\"/, '"')).length > 1 && tl.charAt(0) === '"' ) {
|
||||
thisCSV[x] = thisCSV[x].replace(/^\s*"|"\s*$/g, '').replace(/""/g, '"');
|
||||
} else if (x) {
|
||||
thisCSV.splice(x - 1, 2, [thisCSV[x - 1], thisCSV[x]].join(sep));
|
||||
thisCSV.splice(x - 1, 2, [ thisCSV[x - 1], thisCSV[x] ].join(sep));
|
||||
} else {
|
||||
thisCSV = thisCSV.shift().split(sep).concat(thisCSV);
|
||||
}
|
||||
@ -304,7 +304,7 @@ var ts = $.tablesorter = $.tablesorter || {},
|
||||
bt.buildComplete(table, wo);
|
||||
};
|
||||
|
||||
/* ==== Object example ====
|
||||
/* ==== Object example ====
|
||||
data : {
|
||||
headers : [
|
||||
[
|
||||
@ -345,9 +345,9 @@ var ts = $.tablesorter = $.tablesorter || {},
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
*/
|
||||
bt.object = function(table, data, wo) {
|
||||
// "rows"
|
||||
// 'rows'
|
||||
var j, l, t, $c, $t, $tb, $tr,
|
||||
c = table.config,
|
||||
kh = wo.build_objectHeaderKey,
|
||||
|
@ -32,7 +32,7 @@
|
||||
.off(wo.chart_event)
|
||||
.on(wo.chart_event, function() {
|
||||
if (this.hasInitialized) {
|
||||
// refresh "c" variable in case options are updated dynamically
|
||||
// refresh 'c' variable in case options are updated dynamically
|
||||
var c = this.config;
|
||||
chart.getCols(c, c.widgetOptions);
|
||||
chart.getData(c, c.widgetOptions);
|
||||
@ -258,7 +258,7 @@
|
||||
// Set the label column
|
||||
chart_labelCol: 0,
|
||||
// data sort, should always be first row, might want [[0,1]]
|
||||
chart_sort: [[0,0]],
|
||||
chart_sort: [ [ 0, 0 ] ],
|
||||
// event to trigger get updated data
|
||||
chart_event: 'chartData'
|
||||
},
|
||||
|
@ -5,11 +5,11 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter,
|
||||
namespace = '.tscolsel',
|
||||
tsColSel = ts.columnSelector = {
|
||||
var ts = $.tablesorter,
|
||||
namespace = '.tscolsel',
|
||||
tsColSel = ts.columnSelector = {
|
||||
|
||||
queryAll : '@media only all { [columns] { display: none; } } ',
|
||||
queryBreak : '@media all and (min-width: [size]) { [columns] { display: table-cell; } } ',
|
||||
@ -60,7 +60,7 @@ tsColSel = ts.columnSelector = {
|
||||
if (opt && c.selector.$container.length) {
|
||||
if (isArry) {
|
||||
// make sure array contains numbers
|
||||
$.each(opt, function(i,v){
|
||||
$.each(opt, function(i, v){
|
||||
opt[i] = parseInt(v, 10);
|
||||
});
|
||||
for (i = 0; i < c.columns; i++) {
|
||||
@ -89,7 +89,7 @@ tsColSel = ts.columnSelector = {
|
||||
state = useStorage ? ts.storage( table, 'tablesorter-columnSelector-auto') : {};
|
||||
|
||||
// initial states
|
||||
colSel.auto = $.isEmptyObject(state) || $.type(state.auto) !== "boolean" ? wo.columnSelector_mediaqueryState : state.auto;
|
||||
colSel.auto = $.isEmptyObject(state) || $.type(state.auto) !== 'boolean' ? wo.columnSelector_mediaqueryState : state.auto;
|
||||
colSel.states = [];
|
||||
colSel.$column = [];
|
||||
colSel.$wrapper = [];
|
||||
@ -103,15 +103,15 @@ tsColSel = ts.columnSelector = {
|
||||
state = ts.getData(this, c.headers[colId], 'columnSelector');
|
||||
|
||||
// if this column not hidable at all
|
||||
// include getData check (includes "columnSelector-false" class, data attribute, etc)
|
||||
// include getData check (includes 'columnSelector-false' class, data attribute, etc)
|
||||
if ( isNaN(priority) && priority.length > 0 || state === 'disable' ||
|
||||
( wo.columnSelector_columns[colId] && wo.columnSelector_columns[colId] === 'disable') ) {
|
||||
return true; // goto next
|
||||
}
|
||||
|
||||
// set default state; storage takes priority
|
||||
colSel.states[colId] = saved && typeof(saved[colId]) !== 'undefined' ?
|
||||
saved[colId] : typeof(wo.columnSelector_columns[colId]) !== 'undefined' ?
|
||||
colSel.states[colId] = saved && typeof saved[colId] !== 'undefined' ?
|
||||
saved[colId] : typeof wo.columnSelector_columns[colId] !== 'undefined' ?
|
||||
wo.columnSelector_columns[colId] : (state === 'true' || state !== 'false');
|
||||
colSel.$column[colId] = $(this);
|
||||
|
||||
@ -309,10 +309,10 @@ tsColSel = ts.columnSelector = {
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
id: "columnSelector",
|
||||
ts.addWidget({
|
||||
id: 'columnSelector',
|
||||
priority: 10,
|
||||
options: {
|
||||
// target the column selector markup
|
||||
@ -361,6 +361,6 @@ ts.addWidget({
|
||||
c.$table.off('updateAll' + namespace + ' update' + namespace);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*! Widget: columns */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
ts.addWidget({
|
||||
id: "columns",
|
||||
ts.addWidget({
|
||||
id: 'columns',
|
||||
priority: 30,
|
||||
options : {
|
||||
columns : [ "primary", "secondary", "tertiary" ]
|
||||
columns : [ 'primary', 'secondary', 'tertiary' ]
|
||||
},
|
||||
format: function(table, c, wo) {
|
||||
var $tbody, tbodyIndex, $rows, rows, $row, $cells, remove, indx,
|
||||
@ -16,7 +16,7 @@ ts.addWidget({
|
||||
sortList = c.sortList,
|
||||
len = sortList.length,
|
||||
// removed c.widgetColumns support
|
||||
css = wo && wo.columns || [ "primary", "secondary", "tertiary" ],
|
||||
css = wo && wo.columns || [ 'primary', 'secondary', 'tertiary' ],
|
||||
last = css.length - 1;
|
||||
remove = css.join(' ');
|
||||
// check if there is a sort (on initialization there may not be one)
|
||||
@ -45,7 +45,7 @@ ts.addWidget({
|
||||
ts.processTbody(table, $tbody, false);
|
||||
}
|
||||
// add classes to thead and tfoot
|
||||
rows = wo.columns_thead !== false ? ['thead tr'] : [];
|
||||
rows = wo.columns_thead !== false ? [ 'thead tr' ] : [];
|
||||
if (wo.columns_tfoot !== false) {
|
||||
rows.push('tfoot tr');
|
||||
}
|
||||
@ -62,7 +62,7 @@ ts.addWidget({
|
||||
remove: function(table, c, wo) {
|
||||
var tbodyIndex, $tbody,
|
||||
$tbodies = c.$tbodies,
|
||||
remove = (wo.columns || [ "primary", "secondary", "tertiary" ]).join(' ');
|
||||
remove = (wo.columns || [ 'primary', 'secondary', 'tertiary' ]).join(' ');
|
||||
c.$headers.removeClass(remove);
|
||||
c.$table.children('tfoot').children('tr').children('th, td').removeClass(remove);
|
||||
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
|
||||
@ -73,6 +73,6 @@ ts.addWidget({
|
||||
ts.processTbody(table, $tbody, false); // restore tbody
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -7,7 +7,7 @@
|
||||
;( function( $ ){
|
||||
'use strict';
|
||||
|
||||
var tse = $.tablesorter.editable = {
|
||||
var tse = $.tablesorter.editable = {
|
||||
namespace : '.tseditable',
|
||||
// last edited class name
|
||||
lastEdited: 'tseditable-last-edited-cell',
|
||||
@ -70,7 +70,7 @@ var tse = $.tablesorter.editable = {
|
||||
}
|
||||
if ( !wo.editable_columnsArray ) {
|
||||
wo.editable_columnsArray = colIndex;
|
||||
wo.editable_columnsArray.sort(function(a,b){ return a - b; });
|
||||
wo.editable_columnsArray.sort(function(a, b){ return a - b; });
|
||||
}
|
||||
return cols;
|
||||
},
|
||||
@ -197,7 +197,7 @@ var tse = $.tablesorter.editable = {
|
||||
validate = wo.editable_validate;
|
||||
valid = txt;
|
||||
|
||||
if ( typeof( validate ) === 'function' ) {
|
||||
if ( typeof validate === 'function' ) {
|
||||
valid = validate( txt, $this.data( 'original' ), column, $this );
|
||||
} else if ( typeof ( validate = $.tablesorter.getColumnData( c.table, validate, column ) ) === 'function' ) {
|
||||
valid = validate( txt, $this.data( 'original' ), column, $this );
|
||||
@ -254,7 +254,7 @@ var tse = $.tablesorter.editable = {
|
||||
.prop( 'contenteditable', false );
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
$.tablesorter.addWidget({
|
||||
id: 'editable',
|
||||
|
@ -8,15 +8,14 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter || {},
|
||||
var ts = $.tablesorter || {},
|
||||
|
||||
// compare option selector class name (jQuery selector)
|
||||
compareSelect = '.compare-select',
|
||||
// compare option selector class name (jQuery selector)
|
||||
compareSelect = '.compare-select',
|
||||
|
||||
|
||||
tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
|
||||
addCompare: function($cell, indx, options){
|
||||
if (options.compare && $.isArray(options.compare) && options.compare.length > 1) {
|
||||
@ -135,7 +134,7 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
// update slider from hidden input, in case of saved filters
|
||||
c.$table.bind('filterFomatterUpdate', function(){
|
||||
var val = tsff.updateCompare($cell, $input, o)[0] || o.value;
|
||||
$cell.find('.number').val( ((val || '') + '').replace(/[><=]/g,'') );
|
||||
$cell.find('.number').val( ((val || '') + '').replace(/[><=]/g, '') );
|
||||
updateNumber(false, true);
|
||||
ts.filter.formatterUpdated($cell, indx);
|
||||
});
|
||||
@ -207,14 +206,14 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
updateRange = function(v, delayed, notrigger){
|
||||
/*jshint eqeqeq:false */
|
||||
// hidden input changes may include compare symbols
|
||||
v = ( typeof v === "undefined" ? $input.val() : v ).toString().replace(/[<>=]/g,'') || o.value;
|
||||
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) || '',
|
||||
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
|
||||
.val( ( compare ? compare + v : ( v == o.min ? '' : ( o.exactMatch ? '=' : '' ) + v ) ) )
|
||||
//( val == o.min ? '' : val + (o.exactMatch ? '=' : ''))
|
||||
// ( val == o.min ? '' : val + (o.exactMatch ? '=' : ''))
|
||||
.trigger( notrigger ? '' : 'search', searchType ).end()
|
||||
.find('.range').val(v);
|
||||
// or add current value to the header cell, if desired
|
||||
@ -326,8 +325,8 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
$shcell = [],
|
||||
c = $cell.closest('table')[0].config,
|
||||
|
||||
updateColor = function(v, notrigger){
|
||||
v = ( typeof v === "undefined" ? $input.val() : v ).toString().replace('=','') || o.value;
|
||||
updateColor = function(v, notrigger) {
|
||||
v = ( typeof v === 'undefined' ? $input.val() : v ).toString().replace('=', '') || o.value;
|
||||
var chkd = true,
|
||||
t = ' (' + v + ')';
|
||||
if (o.addToggle) {
|
||||
@ -424,6 +423,6 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
return colorSupported ? $cell.find('input[type="hidden"]') : $('<input type="search">');
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -10,14 +10,14 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter || {},
|
||||
var ts = $.tablesorter || {},
|
||||
|
||||
// compare option selector class name (jQuery selector)
|
||||
compareSelect = '.compare-select',
|
||||
// compare option selector class name (jQuery selector)
|
||||
compareSelect = '.compare-select',
|
||||
|
||||
tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
|
||||
addCompare: function($cell, indx, options){
|
||||
if (options.compare && $.isArray(options.compare) && options.compare.length > 1) {
|
||||
@ -81,7 +81,7 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
updateSpinner = function(ui, notrigger) {
|
||||
var chkd = true, state,
|
||||
// ui is not undefined on create
|
||||
v = ui && ui.value && ts.formatFloat((ui.value + '').replace(/[><=]/g,'')) ||
|
||||
v = ui && ui.value && ts.formatFloat((ui.value + '').replace(/[><=]/g, '')) ||
|
||||
$cell.find('.spinner').val() || o.value,
|
||||
compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '',
|
||||
searchType = ui && typeof ui.delayed === 'boolean' ? ui.delayed : c.$table[0].hasInitialized ? o.delayed || '' : true;
|
||||
@ -223,7 +223,7 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
min : 0,
|
||||
max : 100,
|
||||
step : 1,
|
||||
range : "min"
|
||||
range : 'min'
|
||||
}, sliderDef ),
|
||||
c = $cell.closest('table')[0].config,
|
||||
// Add a hidden input to hold the range values
|
||||
@ -238,7 +238,7 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
// this function updates the hidden input and adds the current values to the header cell text
|
||||
updateSlider = function(ui, notrigger) {
|
||||
// ui is not undefined on create
|
||||
var v = typeof ui !== "undefined" ? ts.formatFloat((ui.value + '').replace(/[><=]/g,'')) || o.value : o.value,
|
||||
var v = typeof ui !== 'undefined' ? ts.formatFloat((ui.value + '').replace(/[><=]/g, '')) || o.value : o.value,
|
||||
val = o.compare ? v : v === o.min ? o.allText : v,
|
||||
compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '',
|
||||
result = compare + val,
|
||||
@ -359,7 +359,7 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
valueToHeader : false,
|
||||
// include ANY jQuery UI spinner options below
|
||||
// except value, since this one is range specific)
|
||||
values : [0, 100],
|
||||
values : [ 0, 100 ],
|
||||
min : 0,
|
||||
max : 100,
|
||||
range : true
|
||||
@ -390,7 +390,7 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
result = val[0] + ' - ' + val[1],
|
||||
// make range an empty string if entire range is covered so the filter row will hide (if set)
|
||||
range = val[0] === o.min && val[1] === o.max ? '' : result,
|
||||
searchType = ui && typeof ui.delayed === 'boolean' ? ui.delayed : c.$table[0].hasInitialized ? o.delayed || '': true;
|
||||
searchType = ui && typeof ui.delayed === 'boolean' ? ui.delayed : c.$table[0].hasInitialized ? o.delayed || '' : true;
|
||||
if (o.valueToHeader) {
|
||||
// add range indication to the header cell above (if not using the css method)!
|
||||
$cell.closest('thead').find('th[data-column=' + indx + ']').find('.currange').html(' (' + result + ')');
|
||||
@ -438,7 +438,7 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
updateUiRange(ui);
|
||||
if (typeof o.oldslide === 'function') { o.oldslide(event, ui); }
|
||||
};
|
||||
$('<div class="range range' + indx +'"/>')
|
||||
$('<div class="range range' + indx + '"/>')
|
||||
.appendTo($cell)
|
||||
.slider(o);
|
||||
|
||||
@ -515,7 +515,7 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
var date, query,
|
||||
getdate = $date.datepicker('getDate') || '',
|
||||
compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '',
|
||||
searchType = c.$table[0].hasInitialized ? o.delayed || '': true;
|
||||
searchType = c.$table[0].hasInitialized ? o.delayed || '' : true;
|
||||
$date.datepicker('setDate', (getdate === '' ? '' : getdate) || null);
|
||||
if (getdate === '') { notrigger = false; }
|
||||
date = $date.datepicker('getDate');
|
||||
@ -624,8 +624,8 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
endOfDay : true,
|
||||
textFrom : 'from',
|
||||
textTo : 'to',
|
||||
from : '', // defaultDate "from" input
|
||||
to : '', // defaultDate "to" input
|
||||
from : '', // defaultDate 'from' input
|
||||
to : '', // defaultDate 'to' input
|
||||
// include ANY jQuery UI spinner options below
|
||||
changeMonth : true,
|
||||
changeYear : true,
|
||||
@ -759,6 +759,6 @@ tsff = ts.filterFormatter = $.extend( {}, ts.filterFormatter, {
|
||||
return $input.val( o.from ? ( o.to ? o.from + ' - ' + o.to : '>=' + o.from ) : (o.to ? '<=' + o.to : '') );
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,19 +4,19 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter || {};
|
||||
ts.filterFormatter = ts.filterFormatter || {};
|
||||
var ts = $.tablesorter || {};
|
||||
ts.filterFormatter = ts.filterFormatter || {};
|
||||
|
||||
/************************\
|
||||
/************************\
|
||||
Select2 Filter Formatter
|
||||
\************************/
|
||||
ts.filterFormatter.select2 = function($cell, indx, select2Def) {
|
||||
\************************/
|
||||
ts.filterFormatter.select2 = function($cell, indx, select2Def) {
|
||||
var o = $.extend({
|
||||
// select2 filter formatter options
|
||||
cellText : '', // Text (wrapped in a label element)
|
||||
match : true, // adds "filter-match" to header
|
||||
match : true, // adds 'filter-match' to header
|
||||
value : '',
|
||||
// include ANY select2 options below
|
||||
multiple : true,
|
||||
@ -73,7 +73,7 @@ ts.filterFormatter.select2 = function($cell, indx, select2Def) {
|
||||
data = [];
|
||||
arry = ts.filter.getOptionSource(c.$table[0], indx, onlyAvail) || [];
|
||||
// build select2 data option
|
||||
$.each(arry, function(i,v){
|
||||
$.each(arry, function(i, v){
|
||||
data.push({id: v, text: v});
|
||||
});
|
||||
o.data = data;
|
||||
@ -110,7 +110,7 @@ ts.filterFormatter.select2 = function($cell, indx, select2Def) {
|
||||
c.$table.bind('filterFomatterUpdate', function(){
|
||||
// value = '/(^x$|^y$)/' => 'x,y'
|
||||
var val = c.$table.data('lastSearch')[indx] || '';
|
||||
val = val.replace(/^\/\(\^?/,'').replace(/\$\|\^/g, '|').replace(/\$?\)\/$/g,'').split('|');
|
||||
val = val.replace(/^\/\(\^?/, '').replace(/\$\|\^/g, '|').replace(/\$?\)\/$/g, '').split('|');
|
||||
$cell.find('.select2').select2('val', val);
|
||||
updateSelect2();
|
||||
ts.filter.formatterUpdated($cell, indx);
|
||||
@ -144,6 +144,6 @@ ts.filterFormatter.select2 = function($cell, indx, select2Def) {
|
||||
|
||||
updateSelect2();
|
||||
return $input;
|
||||
};
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*! Widget: filter, insideRange filter type - updated 2/23/2015 (v2.21.0) */
|
||||
;(function($){
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
// Add insideRange filter type
|
||||
// ============================
|
||||
|
@ -3,18 +3,18 @@
|
||||
* by Rob Garrison
|
||||
*/
|
||||
;( function ( $ ) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
tscss = ts.css;
|
||||
|
||||
$.extend( tscss, {
|
||||
$.extend( tscss, {
|
||||
filterRow : 'tablesorter-filter-row',
|
||||
filter : 'tablesorter-filter',
|
||||
filterDisabled : 'disabled',
|
||||
filterRowHide : 'hideme'
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id: 'filter',
|
||||
priority: 50,
|
||||
options : {
|
||||
@ -43,7 +43,7 @@ ts.addWidget({
|
||||
filter_selectSource : null, // include a function to return an array of values to be added to the column filter select
|
||||
filter_startsWith : false, // if true, filter start from the beginning of the cell contents
|
||||
filter_useParsedData : false, // filter all data using parsed content
|
||||
filter_serversideFiltering : false, // if true, server-side filtering should be performed because client-side filtering will be disabled, but the ui and events will still be used.
|
||||
filter_serversideFiltering : false, // if true, must perform server-side filtering b/c client-side filtering is disabled, but the ui and events will still be used.
|
||||
filter_defaultAttrib : 'data-value', // data attribute in the header cell that contains the default filter value
|
||||
filter_selectSourceSeparator : '|' // filter_selectSource array text left of the separator is added to the option value, right into the option text
|
||||
},
|
||||
@ -74,9 +74,9 @@ ts.addWidget({
|
||||
$( document ).undelegate( wo.filter_reset, 'click.tsfilter' );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.filter = {
|
||||
ts.filter = {
|
||||
|
||||
// regex used in filter 'check' functions - not for general use and not documented
|
||||
regex: {
|
||||
@ -350,7 +350,7 @@ ts.filter = {
|
||||
filtered : new RegExp( wo.filter_filteredRow ),
|
||||
alreadyFiltered : new RegExp( '(\\s+(' + ts.language.or + '|-|' + ts.language.to + ')\\s+)', 'i' ),
|
||||
toTest : new RegExp( '\\s+(-|' + ts.language.to + ')\\s+', 'i' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)' ,'gi' ),
|
||||
toSplit : new RegExp( '(?:\\s+(?:-|' + ts.language.to + ')\\s+)', 'gi' ),
|
||||
andTest : new RegExp( '\\s+(' + ts.language.and + '|&&)\\s+', 'i' ),
|
||||
andSplit : new RegExp( '(?:\\s+(?:' + ts.language.and + '|&&)\\s+)', 'gi' ),
|
||||
orSplit : new RegExp( '(?:\\s+(?:' + ts.language.or + ')\\s+|\\|)', 'gi' ),
|
||||
@ -785,7 +785,7 @@ ts.filter = {
|
||||
c.lastSearch = [];
|
||||
}
|
||||
if ( wo.filter_initialized ) {
|
||||
c.$table.trigger( 'filterStart', [filters] );
|
||||
c.$table.trigger( 'filterStart', [ filters ] );
|
||||
}
|
||||
if ( c.showProcessing ) {
|
||||
// give it time for the processing icon to kick in
|
||||
@ -1015,7 +1015,7 @@ ts.filter = {
|
||||
// in case select filter option has a different value vs text 'a - z|A through Z'
|
||||
ffxn = wo.filter_columnFilters ?
|
||||
c.$filters.add( c.$externalFilters )
|
||||
.filter( '[data-column="'+ columnIndex + '"]' )
|
||||
.filter( '[data-column="' + columnIndex + '"]' )
|
||||
.find( 'select option:selected' )
|
||||
.attr( 'data-function-name' ) || '' : '';
|
||||
// replace accents - see #357
|
||||
@ -1375,7 +1375,7 @@ ts.filter = {
|
||||
if ( $.isFunction( cts ) ) {
|
||||
// custom OVERALL text sorter
|
||||
return cts( x, y, true, column, table );
|
||||
} else if ( typeof( cts ) === 'object' && cts.hasOwnProperty( column ) ) {
|
||||
} else if ( typeof cts === 'object' && cts.hasOwnProperty( column ) ) {
|
||||
// custom text sorter for a SPECIFIC COLUMN
|
||||
return cts[column]( x, y, true, column, table );
|
||||
} else if ( ts.sortNatural ) {
|
||||
@ -1517,9 +1517,9 @@ ts.filter = {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
var i, $filters, $column, cols,
|
||||
filters = false,
|
||||
c = table ? $( table )[0].config : '',
|
||||
@ -1590,9 +1590,9 @@ ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
|
||||
filters = false;
|
||||
}
|
||||
return filters;
|
||||
};
|
||||
};
|
||||
|
||||
ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
var c = table ? $( table )[0].config : '',
|
||||
valid = ts.getFilters( table, true, filter, skipFirst );
|
||||
if ( c && apply ) {
|
||||
@ -1603,6 +1603,6 @@ ts.setFilters = function( table, filter, apply, skipFirst ) {
|
||||
c.$table.trigger( 'filterFomatterUpdate' );
|
||||
}
|
||||
return !!valid;
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery );
|
||||
|
@ -5,7 +5,7 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
'use strict';
|
||||
'use strict';
|
||||
var ts = $.tablesorter;
|
||||
|
||||
ts.formatter = {
|
||||
|
@ -5,20 +5,20 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var ts = $.tablesorter;
|
||||
'use strict';
|
||||
var ts = $.tablesorter;
|
||||
|
||||
ts.grouping = {
|
||||
ts.grouping = {
|
||||
|
||||
types : {
|
||||
number : function(c, $column, txt, num, group){
|
||||
var value, word;
|
||||
if (num > 1 && txt !== '') {
|
||||
if ($column.hasClass(ts.css.sortAsc)) {
|
||||
value = Math.floor(parseFloat(txt)/num) * num;
|
||||
value = Math.floor(parseFloat(txt) / num) * num;
|
||||
return value > parseFloat(group || 0) ? value : parseFloat(group || 0);
|
||||
} else {
|
||||
value = Math.ceil(parseFloat(txt)/num) * num;
|
||||
value = Math.ceil(parseFloat(txt) / num) * num;
|
||||
return value < parseFloat(group || num) - value ? parseFloat(group || num) - value : value;
|
||||
}
|
||||
} else {
|
||||
@ -70,10 +70,10 @@ ts.grouping = {
|
||||
wo.group_currentGroup = ''; // save current groups
|
||||
wo.group_currentGroups = {};
|
||||
|
||||
// group class finds "group-{word/separator/letter/number/date/false}-{optional:#/year/month/day/week/time}"
|
||||
// group class finds 'group-{word/separator/letter/number/date/false}-{optional:#/year/month/day/week/time}'
|
||||
groupClass = (c.$headerIndexed[column].attr('class') || '').match(/(group-\w+(-\w+)?)/g);
|
||||
// grouping = [ 'group', '{word/separator/letter/number/date/false}', '{#/year/month/day/week/time}' ]
|
||||
grouping = groupClass ? groupClass[0].split('-') : ['group','letter',1]; // default to letter 1
|
||||
grouping = groupClass ? groupClass[0].split('-') : [ 'group', 'letter', 1 ]; // default to letter 1
|
||||
|
||||
// save current grouping
|
||||
if (wo.group_collapsible && wo.group_saveGroups && ts.storage) {
|
||||
@ -104,7 +104,7 @@ ts.grouping = {
|
||||
// show range if number > 1
|
||||
if (grouping[1] === 'number' && grouping[2] > 1 && currentGroup !== '') {
|
||||
currentGroup += ' - ' + (parseInt(currentGroup, 10) +
|
||||
((parseInt(grouping[2],10) - 1) * (c.$headerIndexed[column].hasClass(ts.css.sortAsc) ? 1 : -1)));
|
||||
((parseInt(grouping[2], 10) - 1) * (c.$headerIndexed[column].hasClass(ts.css.sortAsc) ? 1 : -1)));
|
||||
}
|
||||
if ($.isFunction(wo.group_formatter)) {
|
||||
currentGroup = wo.group_formatter((currentGroup || '').toString(), column, table, c, wo) || currentGroup;
|
||||
@ -165,7 +165,7 @@ ts.grouping = {
|
||||
$this = $(this),
|
||||
name = $this.find('.group-name').text().toLowerCase();
|
||||
// use shift-click to toggle ALL groups
|
||||
if (event.shiftKey && (event.type === 'click' || event.type ==='keyup')) {
|
||||
if (event.shiftKey && (event.type === 'click' || event.type === 'keyup')) {
|
||||
$this.siblings('.group-header').trigger('toggleGroup');
|
||||
}
|
||||
$this.toggleClass('collapsed');
|
||||
@ -205,9 +205,9 @@ ts.grouping = {
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id: 'group',
|
||||
priority: 100,
|
||||
options: {
|
||||
@ -215,7 +215,7 @@ ts.addWidget({
|
||||
group_collapsed : false, // start with all groups collapsed
|
||||
group_saveGroups : true, // remember collapsed groups
|
||||
group_saveReset : null, // element to clear saved collapsed groups
|
||||
group_count : ' ({num})', // if not false, the "{num}" string is replaced with the number of rows in the group
|
||||
group_count : ' ({num})', // if not false, the '{num}' string is replaced with the number of rows in the group
|
||||
group_separator : '-', // group name separator; used when group-separator-# class is used.
|
||||
group_formatter : null, // function(txt, column, table, c, wo) { return txt; }
|
||||
group_callback : null, // function($cell, $rows, column, table){}, callback allowing modification of the group header labels
|
||||
@ -227,7 +227,7 @@ ts.addWidget({
|
||||
group_months : [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
|
||||
group_week : [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
|
||||
group_time : [ 'AM', 'PM' ],
|
||||
// this function is used when "group-date" is set to create the date string
|
||||
// this function is used when 'group-date' is set to create the date string
|
||||
// you can just return date, date.toLocaleString(), date.toLocaleDateString() or d.toLocaleTimeString()
|
||||
// reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#Conversion_getter
|
||||
group_dateString : function(date) { return date.toLocaleString(); }
|
||||
@ -245,6 +245,6 @@ ts.addWidget({
|
||||
.find('.group-hidden').removeClass('group-hidden').end()
|
||||
.find('tr.group-header').remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -5,14 +5,14 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var ts = $.tablesorter;
|
||||
'use strict';
|
||||
var ts = $.tablesorter;
|
||||
|
||||
ts.addWidget({
|
||||
id: 'headerTitles',
|
||||
options: {
|
||||
// use aria-label text
|
||||
// e.g. "First Name: Ascending sort applied, activate to apply a descending sort"
|
||||
// e.g. 'First Name: Ascending sort applied, activate to apply a descending sort'
|
||||
headerTitle_useAria : false,
|
||||
// add tooltip class
|
||||
headerTitle_tooltip : '',
|
||||
|
@ -5,7 +5,7 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter,
|
||||
|
||||
@ -28,10 +28,10 @@
|
||||
arry = $cells.not($el).map(function(){
|
||||
$t = $(this);
|
||||
txt = $t.attr(c.textAttribute);
|
||||
if (typeof txt === "undefined") {
|
||||
if (typeof txt === 'undefined') {
|
||||
txt = this.textContent || $t.text();
|
||||
}
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table) || 0;
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ''), table) || 0;
|
||||
return isNaN(txt) ? 0 : txt;
|
||||
}).get();
|
||||
}
|
||||
@ -57,15 +57,15 @@
|
||||
mathAbove = $t.filter('[' + dataAttrib + '^=above]').length;
|
||||
// ignore filtered rows & rows with data-math="ignore" (and starting row)
|
||||
if ( ( !$rows.eq(i).hasClass(filtered) && $rows.eq(i).not('[' + dataAttrib + '=ignore]').length && i !== len ) || mathAbove && i !== len ) {
|
||||
// stop calculating "above", when encountering another "above"
|
||||
// stop calculating 'above', when encountering another 'above'
|
||||
if (mathAbove) {
|
||||
i = 0;
|
||||
} else if ($t.length) {
|
||||
txt = $t.attr(c.textAttribute);
|
||||
if (typeof txt === "undefined") {
|
||||
if (typeof txt === 'undefined') {
|
||||
txt = $t[0].textContent || $t.text();
|
||||
}
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table) || 0;
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ''), table) || 0;
|
||||
arry.push(isNaN(txt) ? 0 : txt);
|
||||
}
|
||||
}
|
||||
@ -76,11 +76,11 @@
|
||||
$t = $(this).children().filter('[data-column=' + cIndex + ']');
|
||||
if (!$(this).hasClass(filtered) && $t.not('[' + dataAttrib + '^=above],[' + dataAttrib + '^=col]').length && !$t.is($el)) {
|
||||
txt = $t.attr(c.textAttribute);
|
||||
if (typeof txt === "undefined") {
|
||||
if (typeof txt === 'undefined') {
|
||||
txt = ($t[0] ? $t[0].textContent : '') || $t.text();
|
||||
}
|
||||
// isNaN('') => false
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table) || 0;
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ''), table) || 0;
|
||||
arry.push(isNaN(txt) ? 0 : txt);
|
||||
}
|
||||
});
|
||||
@ -102,10 +102,10 @@
|
||||
col = parseInt( $t.attr('data-column'), 10);
|
||||
if (!$t.filter('[' + dataAttrib + ']').length && $.inArray(col, wo.math_ignore) < 0) {
|
||||
txt = $t.attr(c.textAttribute);
|
||||
if (typeof txt === "undefined") {
|
||||
if (typeof txt === 'undefined') {
|
||||
txt = ($t[0] ? $t[0].textContent : '') || $t.text();
|
||||
}
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ""), table) || 0;
|
||||
txt = ts.formatFloat(txt.replace(/[^\w,. \-()]/g, ''), table) || 0;
|
||||
arry.push(isNaN(txt) ? 0 : txt);
|
||||
}
|
||||
});
|
||||
@ -133,8 +133,8 @@
|
||||
$mathCells = c.$table.find('.' + c.cssInfoBlock + ', tfoot').find('[' + dataAttrib + ']');
|
||||
math.mathType( table, wo, $mathCells, wo.math_priority, dataAttrib );
|
||||
|
||||
// find the "all" total
|
||||
math.mathType( table, wo, c.$table.find('[' + dataAttrib + '^=all]'), ['all'], dataAttrib );
|
||||
// find the 'all' total
|
||||
math.mathType( table, wo, c.$table.find('[' + dataAttrib + '^=all]'), [ 'all' ], dataAttrib );
|
||||
|
||||
wo.math_isUpdating = true;
|
||||
c.$table.trigger('update');
|
||||
@ -153,8 +153,8 @@
|
||||
$cells.filter('[' + dataAttrib + '^=' + type + ']').each(function(){
|
||||
$t = $(this);
|
||||
formula = ($t.attr(dataAttrib) || '').replace(type + '-', '');
|
||||
arry = (type === "row") ? math.getRow(table, wo, $t, dataAttrib) :
|
||||
(type === "all") ? getAll : math.getColumn(table, wo, $t, type, dataAttrib);
|
||||
arry = (type === 'row') ? math.getRow(table, wo, $t, dataAttrib) :
|
||||
(type === 'all') ? getAll : math.getColumn(table, wo, $t, type, dataAttrib);
|
||||
if (eq[formula]) {
|
||||
t = eq[formula](arry);
|
||||
if (table.config.debug && console && console.log) {
|
||||
@ -232,7 +232,7 @@
|
||||
|
||||
// search for separator for grp & decimal, anything not digit, not +/- sign, not #.
|
||||
result = m.match( /[^\d\-\+#]/g );
|
||||
decimal = ( result && result[result.length-1] ) || '.'; // treat the right most symbol as decimal
|
||||
decimal = ( result && result[result.length - 1] ) || '.'; // treat the right most symbol as decimal
|
||||
group = ( result && result[1] && result[0] ) || ','; // treat the left most symbol as group separator
|
||||
|
||||
// split the decimal for the format string if any.
|
||||
@ -282,7 +282,7 @@
|
||||
v[0] = str;
|
||||
}
|
||||
|
||||
v[1] = ( m[1] && v[1] ) ? decimal + v[1] : "";
|
||||
v[1] = ( m[1] && v[1] ) ? decimal + v[1] : '';
|
||||
// put back any negation, combine integer and fraction, and add back prefix & suffix
|
||||
return prefix + ( ( isNegative ? '-' : '' ) + v[0] + v[1] ) + suffix;
|
||||
};
|
||||
@ -304,7 +304,7 @@
|
||||
},
|
||||
median : function(arry) {
|
||||
// https://gist.github.com/caseyjustus/1166258
|
||||
arry.sort( function(a,b){ return a - b; } );
|
||||
arry.sort( function(a, b){ return a - b; } );
|
||||
var half = Math.floor( arry.length / 2 );
|
||||
return (arry.length % 2) ? arry[half] : ( arry[half - 1] + arry[half] ) / 2.0;
|
||||
},
|
||||
@ -314,12 +314,12 @@
|
||||
var i, el,
|
||||
modeMap = {},
|
||||
maxCount = 1,
|
||||
modes = [arry[0]];
|
||||
modes = [ arry[0] ];
|
||||
for (i = 0; i < arry.length; i++) {
|
||||
el = arry[i];
|
||||
modeMap[el] = modeMap[el] ? modeMap[el] + 1 : 1;
|
||||
if ( modeMap[el] > maxCount ) {
|
||||
modes = [el];
|
||||
modes = [ el ];
|
||||
maxCount = modeMap[el];
|
||||
} else if (modeMap[el] === maxCount) {
|
||||
modes.push(el);
|
||||
@ -327,7 +327,7 @@
|
||||
}
|
||||
}
|
||||
// returns arry of modes if there is a tie
|
||||
return modes.sort( function(a,b){ return a - b; } );
|
||||
return modes.sort( function(a, b){ return a - b; } );
|
||||
},
|
||||
max : function(arry) {
|
||||
return Math.max.apply( Math, arry );
|
||||
@ -336,7 +336,7 @@
|
||||
return Math.min.apply( Math, arry );
|
||||
},
|
||||
range: function(arry) {
|
||||
var v = arry.sort(function(a,b){ return a - b; });
|
||||
var v = arry.sort(function(a, b){ return a - b; });
|
||||
return v[ arry.length - 1 ] - v[0];
|
||||
},
|
||||
// common variance equation
|
||||
@ -374,7 +374,7 @@
|
||||
// add new widget called repeatHeaders
|
||||
// ************************************
|
||||
ts.addWidget({
|
||||
id: "math",
|
||||
id: 'math',
|
||||
priority: 100,
|
||||
options: {
|
||||
math_data : 'math',
|
||||
@ -384,7 +384,7 @@
|
||||
math_mask : '#,##0.00',
|
||||
// complete executed after each fucntion
|
||||
math_complete : null, // function($cell, wo, result, value, arry){ return result; },
|
||||
// order of calculation; "all" is last
|
||||
// order of calculation; 'all' is last
|
||||
math_priority : [ 'row', 'above', 'col' ],
|
||||
// template for or just prepend the mask prefix & suffix with this HTML
|
||||
// e.g. '<span class="red">{content}</span>'
|
||||
|
@ -7,11 +7,11 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter,
|
||||
var ts = $.tablesorter,
|
||||
|
||||
output = ts.output = {
|
||||
output = ts.output = {
|
||||
|
||||
event : 'outputTable',
|
||||
|
||||
@ -34,7 +34,7 @@ output = ts.output = {
|
||||
.on(output.event, function( e ) {
|
||||
e.stopPropagation();
|
||||
// explicitly use table.config.widgetOptions because we want
|
||||
// the most up-to-date values; not the "wo" from initialization
|
||||
// the most up-to-date values; not the 'wo' from initialization
|
||||
output.process(c, c.widgetOptions);
|
||||
});
|
||||
},
|
||||
@ -199,7 +199,7 @@ output = ts.output = {
|
||||
rowLen = tmpRow.length;
|
||||
for (rowIndex = 0; rowIndex < rowLen; rowIndex++) {
|
||||
// remove any blank rows
|
||||
tmp = ( tmpRow[rowIndex] || [] ).join('').replace(/\"/g,'');
|
||||
tmp = ( tmpRow[rowIndex] || [] ).join('').replace(/\"/g, '');
|
||||
if ( ( tmpRow[rowIndex] || [] ).length > 0 && tmp !== '' ) {
|
||||
csvData[csvData.length] = outputArray ? tmpRow[rowIndex] : tmpRow[rowIndex].join(wo.output_separator);
|
||||
}
|
||||
@ -319,7 +319,7 @@ output = ts.output = {
|
||||
|
||||
// fallback to force file download (whether supported by server).
|
||||
// not sure if this actually works in IE9 and older...
|
||||
window.open( wo.output_encoding + encodeURIComponent(data) + '?download' , '_self');
|
||||
window.open( wo.output_encoding + encodeURIComponent(data) + '?download', '_self');
|
||||
return true;
|
||||
|
||||
},
|
||||
@ -328,12 +328,12 @@ output = ts.output = {
|
||||
c.$table.off(output.event);
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
id: "output",
|
||||
ts.addWidget({
|
||||
id: 'output',
|
||||
options: {
|
||||
output_separator : ',', // set to "json", "array" or any separator
|
||||
output_separator : ',', // set to 'json', 'array' or any separator
|
||||
output_ignoreColumns : [], // columns to ignore [0, 1,... ] (zero-based index)
|
||||
output_hiddenColumns : false, // include hidden columns in the output
|
||||
output_includeFooter : false, // include footer rows in the output
|
||||
@ -366,6 +366,6 @@ ts.addWidget({
|
||||
output.remove(c);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,12 +4,12 @@
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var tsp,
|
||||
'use strict';
|
||||
var tsp,
|
||||
ts = $.tablesorter;
|
||||
|
||||
ts.addWidget({
|
||||
id: "pager",
|
||||
ts.addWidget({
|
||||
id: 'pager',
|
||||
priority: 55, // load pager after filter widget
|
||||
options : {
|
||||
// output default: '{page}/{totalPages}'
|
||||
@ -35,7 +35,7 @@ ts.addWidget({
|
||||
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
||||
pager_savePages: true,
|
||||
|
||||
//defines custom storage key
|
||||
// defines custom storage key
|
||||
pager_storageKey: 'tablesorter-pager',
|
||||
|
||||
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
|
||||
@ -51,12 +51,12 @@ ts.addWidget({
|
||||
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
|
||||
pager_removeRows: false, // removing rows in larger tables speeds up the sort
|
||||
|
||||
// use this format: "http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}"
|
||||
// use this format: 'http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}'
|
||||
// where {page} is replaced by the page number, {size} is replaced by the number of records to show,
|
||||
// {sortList:col} adds the sortList to the url into a "col" array, and {filterList:fcol} adds
|
||||
// the filterList to the url into an "fcol" array.
|
||||
// So a sortList = [[2,0],[3,0]] becomes "&col[2]=0&col[3]=0" in the url
|
||||
// and a filterList = [[2,Blue],[3,13]] becomes "&fcol[2]=Blue&fcol[3]=13" in the url
|
||||
// {sortList:col} adds the sortList to the url into a 'col' array, and {filterList:fcol} adds
|
||||
// the filterList to the url into an 'fcol' array.
|
||||
// So a sortList = [[2,0],[3,0]] becomes '&col[2]=0&col[3]=0' in the url
|
||||
// and a filterList = [[2,Blue],[3,13]] becomes '&fcol[2]=Blue&fcol[3]=13' in the url
|
||||
pager_ajaxUrl: null,
|
||||
|
||||
// modify the url after all processing has been applied
|
||||
@ -89,7 +89,7 @@ ts.addWidget({
|
||||
pager_css: {
|
||||
container : 'tablesorter-pager',
|
||||
errorRow : 'tablesorter-errorRow', // error information row (don't include period at beginning)
|
||||
disabled : 'disabled' // class added to arrows @ extremes (i.e. prev/first arrows "disabled" on first page)
|
||||
disabled : 'disabled' // class added to arrows @ extremes (i.e. prev/first arrows 'disabled' on first page)
|
||||
},
|
||||
|
||||
// jQuery selectors
|
||||
@ -100,8 +100,8 @@ ts.addWidget({
|
||||
next : '.next', // next page arrow
|
||||
last : '.last', // go to last page arrow
|
||||
gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
||||
pageDisplay : '.pagedisplay', // location of where the "output" is displayed
|
||||
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option
|
||||
pageDisplay : '.pagedisplay', // location of where the 'output' is displayed
|
||||
pageSize : '.pagesize' // page size selector - select dropdown that sets the 'size' option
|
||||
}
|
||||
},
|
||||
init: function(table){
|
||||
@ -117,10 +117,10 @@ ts.addWidget({
|
||||
remove: function(table, c, wo, refreshing){
|
||||
tsp.destroyPager(table, c, refreshing);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* pager widget functions */
|
||||
tsp = ts.pager = {
|
||||
/* pager widget functions */
|
||||
tsp = ts.pager = {
|
||||
|
||||
init: function(table) {
|
||||
// check if tablesorter has initialized
|
||||
@ -189,7 +189,7 @@ tsp = ts.pager = {
|
||||
p.ajaxObject = wo.pager_ajaxObject; // $.extend({}, wo.pager_ajaxObject );
|
||||
p.ajaxObject.url = wo.pager_ajaxUrl;
|
||||
|
||||
if ( typeof(wo.pager_ajaxUrl) === 'string' ) {
|
||||
if ( typeof wo.pager_ajaxUrl === 'string' ) {
|
||||
// ajax pager; interact with database
|
||||
p.ajax = true;
|
||||
// When filtering with ajax, allow only custom filtering function, disable default filtering since it will be done server side.
|
||||
@ -199,7 +199,7 @@ tsp = ts.pager = {
|
||||
} else {
|
||||
p.ajax = false;
|
||||
// Regular pager; all rows stored in memory
|
||||
c.$table.trigger('appendCache', [{}, true]);
|
||||
c.$table.trigger('appendCache', [ {}, true ]);
|
||||
}
|
||||
|
||||
},
|
||||
@ -292,13 +292,13 @@ tsp = ts.pager = {
|
||||
c.$table.trigger('applyWidgets');
|
||||
tsp.updatePageDisplay(table, c);
|
||||
})
|
||||
.on('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e,v){
|
||||
.on('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e, v){
|
||||
e.stopPropagation();
|
||||
tsp.setPageSize(table, parseInt(v, 10) || p.setSize || 10, c);
|
||||
tsp.hideRows(table, c);
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
})
|
||||
.on('pageSet pagerUpdate '.split(' ').join(namespace + ' '), function(e,v){
|
||||
.on('pageSet pagerUpdate '.split(' ').join(namespace + ' '), function(e, v){
|
||||
e.stopPropagation();
|
||||
// force pager refresh
|
||||
if (e.type === 'pagerUpdate') {
|
||||
@ -325,7 +325,7 @@ tsp = ts.pager = {
|
||||
ts.log('Pager: >> Container not found');
|
||||
}
|
||||
p.$container.find(ctrls.join(','))
|
||||
.attr("tabindex", 0)
|
||||
.attr('tabindex', 0)
|
||||
.off('click' + namespace)
|
||||
.on('click' + namespace, function(e){
|
||||
e.stopPropagation();
|
||||
@ -419,7 +419,7 @@ tsp = ts.pager = {
|
||||
sz = p.size || p.setSize || 10; // don't allow dividing by zero
|
||||
if (wo.pager_countChildRows) { t.push(c.cssChildRow); }
|
||||
p.$size.add(p.$goto).removeClass(wo.pager_css.disabled).removeAttr('disabled').attr('aria-disabled', 'false');
|
||||
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for "pageSize" method
|
||||
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for 'pageSize' method
|
||||
c.totalRows = p.totalRows;
|
||||
tsp.calcFilters(table, c);
|
||||
c.filteredRows = p.filteredRows;
|
||||
@ -433,13 +433,13 @@ tsp = ts.pager = {
|
||||
// form the output string (can now get a new output string from the server)
|
||||
s = ( p.ajaxData && p.ajaxData.output ? p.ajaxData.output || wo.pager_output : wo.pager_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){
|
||||
var len, indx,
|
||||
str = m.replace(/[{}\s]/g,''),
|
||||
str = m.replace(/[{}\s]/g, ''),
|
||||
extra = str.split(':'),
|
||||
data = p.ajaxData,
|
||||
// return zero for default page/row numbers
|
||||
@ -466,7 +466,7 @@ tsp = ts.pager = {
|
||||
// rebind startRow/page inputs
|
||||
$out.find('.ts-startRow, .ts-page').off('change' + namespace).on('change' + namespace, function(){
|
||||
var v = $(this).val(),
|
||||
pg = $(this).hasClass('ts-startRow') ? Math.floor( v/p.size ) + 1 : v;
|
||||
pg = $(this).hasClass('ts-startRow') ? Math.floor( v / p.size ) + 1 : v;
|
||||
c.$table.trigger('pageSet' + namespace, [ pg ]);
|
||||
});
|
||||
}
|
||||
@ -500,7 +500,7 @@ tsp = ts.pager = {
|
||||
current_page = p.page + 1,
|
||||
start_page = skip_set_size,
|
||||
end_page = pg - skip_set_size,
|
||||
option_pages = [1],
|
||||
option_pages = [ 1 ],
|
||||
// construct default options pages array
|
||||
option_pages_start_page = (large_collection) ? skip_set_size : 1;
|
||||
|
||||
@ -545,7 +545,7 @@ tsp = ts.pager = {
|
||||
option_pages = $.grep(option_pages, function(value, indx) {
|
||||
return $.inArray(value, option_pages) === indx;
|
||||
})
|
||||
.sort(function(a,b) { return a - b; });
|
||||
.sort(function(a, b) { return a - b; });
|
||||
|
||||
return option_pages;
|
||||
},
|
||||
@ -747,7 +747,7 @@ tsp = ts.pager = {
|
||||
p.initializing = false;
|
||||
// update display without triggering pager complete... before updating cache
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
$table.trigger('updateCache', [function(){
|
||||
$table.trigger('updateCache', [ function(){
|
||||
if (p.initialized) {
|
||||
// apply widgets after table has rendered & after a delay to prevent
|
||||
// multiple applyWidget blocking code from blocking this trigger
|
||||
@ -761,7 +761,7 @@ tsp = ts.pager = {
|
||||
tsp.updatePageDisplay(table, c);
|
||||
}, 0);
|
||||
}
|
||||
}]);
|
||||
} ]);
|
||||
}
|
||||
if (!p.initialized) {
|
||||
c.$table.trigger('applyWidgets');
|
||||
@ -808,8 +808,8 @@ tsp = ts.pager = {
|
||||
p = c.pager,
|
||||
wo = c.widgetOptions,
|
||||
url = (wo.pager_ajaxUrl) ? wo.pager_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); })
|
||||
// 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(/\{size\}/g, p.size) : '',
|
||||
sortList = c.sortList,
|
||||
filterList = p.currentFilters || $(table).data('lastSearch') || [],
|
||||
@ -822,7 +822,7 @@ tsp = ts.pager = {
|
||||
for (indx = 0; indx < len; indx++) {
|
||||
arry.push(sortCol + '[' + sortList[indx][0] + ']=' + sortList[indx][1]);
|
||||
}
|
||||
// if the arry is empty, just add the col parameter... "&{sortList:col}" becomes "&col"
|
||||
// if the arry is empty, just add the col parameter... '&{sortList:col}' becomes '&col'
|
||||
url = url.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g, arry.length ? arry.join('&') : sortCol );
|
||||
arry = [];
|
||||
}
|
||||
@ -834,7 +834,7 @@ tsp = ts.pager = {
|
||||
arry.push(filterCol + '[' + indx + ']=' + encodeURIComponent(filterList[indx]));
|
||||
}
|
||||
}
|
||||
// if the arry is empty, just add the fcol parameter... "&{filterList:fcol}" becomes "&fcol"
|
||||
// if the arry is empty, just add the fcol parameter... '&{filterList:fcol}' becomes '&fcol'
|
||||
url = url.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g, arry.length ? arry.join('&') : filterCol );
|
||||
p.currentFilters = filterList;
|
||||
}
|
||||
@ -947,7 +947,7 @@ tsp = ts.pager = {
|
||||
},
|
||||
|
||||
// updateCache if delayInit: true
|
||||
// this is normally done by "appendToTable" function in the tablesorter core AFTER a sort
|
||||
// this is normally done by 'appendToTable' function in the tablesorter core AFTER a sort
|
||||
updateCache: function(table) {
|
||||
var c = table.config,
|
||||
p = c.pager;
|
||||
@ -963,7 +963,7 @@ tsp = ts.pager = {
|
||||
c.rowsCopy = rows;
|
||||
tsp.moveToPage(table, p, true);
|
||||
// clear out last search to force an update
|
||||
p.last.currentFilters = [' '];
|
||||
p.last.currentFilters = [ ' ' ];
|
||||
}
|
||||
} ]);
|
||||
},
|
||||
@ -985,7 +985,7 @@ tsp = ts.pager = {
|
||||
if ( p.page < 0 ) { p.page = 0; }
|
||||
if ( p.page > ( pg - 1 ) && pg !== 0 ) { p.page = pg - 1; }
|
||||
|
||||
// fixes issue where one current filter is [] and the other is ['','',''],
|
||||
// fixes issue where one current filter is [] and the other is [ '', '', '' ],
|
||||
// making the next if comparison think the filters as different. Fixes #202.
|
||||
l.currentFilters = (l.currentFilters || []).join('') === '' ? [] : l.currentFilters;
|
||||
p.currentFilters = (p.currentFilters || []).join('') === '' ? [] : p.currentFilters;
|
||||
@ -1128,10 +1128,10 @@ tsp = ts.pager = {
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
// see #486
|
||||
ts.showError = function( table, message ) {
|
||||
// see #486
|
||||
ts.showError = function( table, message ) {
|
||||
var index, $row, c, wo, errorRow,
|
||||
$table = $( table ),
|
||||
len = $table.length;
|
||||
@ -1157,6 +1157,6 @@ ts.showError = function( table, message ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -4,11 +4,11 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter,
|
||||
var ts = $.tablesorter,
|
||||
|
||||
printTable = ts.printTable = {
|
||||
printTable = ts.printTable = {
|
||||
|
||||
event : 'printTable',
|
||||
basicStyle : 'table, tr, td, th { border : solid 1px black; border-collapse : collapse; } td, th { padding: 2px; }',
|
||||
@ -18,7 +18,7 @@ printTable = ts.printTable = {
|
||||
.unbind(printTable.event)
|
||||
.bind(printTable.event, function(){
|
||||
// explicitly use table.config.widgetOptions because we want
|
||||
// the most up-to-date values; not the "wo" from initialization
|
||||
// the most up-to-date values; not the 'wo' from initialization
|
||||
printTable.process(c, c.widgetOptions);
|
||||
});
|
||||
},
|
||||
@ -39,7 +39,7 @@ printTable = ts.printTable = {
|
||||
});
|
||||
|
||||
// === rows ===
|
||||
// Assume "visible" means rows hidden by the pager (rows set to "display:none")
|
||||
// Assume 'visible' means rows hidden by the pager (rows set to 'display:none')
|
||||
// or hidden by a class name which is added to the wo.print_extraCSS definition
|
||||
if (/a/i.test(wo.print_rows)) {
|
||||
// force show of all rows
|
||||
@ -51,7 +51,7 @@ printTable = ts.printTable = {
|
||||
|
||||
// === columns ===
|
||||
// columnSelector -> c.selector.$style
|
||||
// Assume "visible" means hidden columns have a "display:none" style, or a class name
|
||||
// Assume 'visible' means hidden columns have a 'display:none' style, or a class name
|
||||
// add the definition to the wo.print_extraCSS option
|
||||
if (/s/i.test(wo.print_columns) && c.selector && c.widgets.indexOf('columnSelector') >= 0) {
|
||||
// show selected (visible) columns; make a copy of the columnSelector widget css (not media queries)
|
||||
@ -92,12 +92,12 @@ printTable = ts.printTable = {
|
||||
c.$table.off(printTable.event);
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id: 'print',
|
||||
options: {
|
||||
print_title : '', // this option > caption > table id > "table"
|
||||
print_title : '', // this option > caption > table id > 'table'
|
||||
print_dataAttrib : 'data-name', // header attrib containing modified header name
|
||||
print_rows : 'filtered', // (a)ll, (v)isible or (f)iltered
|
||||
print_columns : 'selected', // (a)ll or (s)elected (if columnSelector widget is added)
|
||||
@ -118,6 +118,6 @@ ts.addWidget({
|
||||
printTable.remove(c);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -50,11 +50,11 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter,
|
||||
var ts = $.tablesorter,
|
||||
|
||||
tablereflow = {
|
||||
tablereflow = {
|
||||
// simple reflow
|
||||
// add data-attribute to each cell which shows when media query is active
|
||||
// this widget DOES NOT WORK on a table with multiple thead rows
|
||||
@ -112,7 +112,7 @@ tablereflow = {
|
||||
}
|
||||
headers.push( txt );
|
||||
}
|
||||
// include "remove-me" class so these additional elements are removed before updating
|
||||
// include 'remove-me' class so these additional elements are removed before updating
|
||||
txt = '<b class="' + c.selectorRemove.slice(1) + ' ' + wo.reflow2_labelClass;
|
||||
c.$tbodies.children().each(function(){
|
||||
$tbody = ts.processTbody(table, $(this), true);
|
||||
@ -134,10 +134,10 @@ tablereflow = {
|
||||
remove2 : function(table, c, wo) {
|
||||
c.$table.removeClass(wo.reflow2_className);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
id: "reflow",
|
||||
ts.addWidget({
|
||||
id: 'reflow',
|
||||
options: {
|
||||
// class name added to make it responsive (class name within media query)
|
||||
reflow_className : 'ui-table-reflow',
|
||||
@ -152,10 +152,10 @@ ts.addWidget({
|
||||
remove: function(table, c, wo){
|
||||
tablereflow.remove(table, c, wo);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
id: "reflow2",
|
||||
ts.addWidget({
|
||||
id: 'reflow2',
|
||||
options: {
|
||||
// class name added to make it responsive (class name within media query)
|
||||
reflow2_className : 'ui-table-reflow',
|
||||
@ -174,7 +174,6 @@ ts.addWidget({
|
||||
remove: function(table, c, wo){
|
||||
tablereflow.remove2(table, c, wo);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -1,18 +1,18 @@
|
||||
/*! Widget: resizable - updated 6/26/2015 (v2.22.2) */
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;(function ($, window) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
resizableContainer : 'tablesorter-resizable-container',
|
||||
resizableHandle : 'tablesorter-resizable-handle',
|
||||
resizableNoSelect : 'tablesorter-disableSelection',
|
||||
resizableStorage : 'tablesorter-resizable'
|
||||
});
|
||||
});
|
||||
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
// Add extra scroller css
|
||||
$(function(){
|
||||
var s = '<style>' +
|
||||
'body.' + ts.css.resizableNoSelect + ' { -ms-user-select: none; -moz-user-select: -moz-none;' +
|
||||
'-khtml-user-select: none; -webkit-user-select: none; user-select: none; }' +
|
||||
@ -22,9 +22,9 @@ $(function(){
|
||||
'top: 1px; cursor: ew-resize; z-index: 3; user-select: none; -moz-user-select: none; }' +
|
||||
'</style>';
|
||||
$(s).appendTo('body');
|
||||
});
|
||||
});
|
||||
|
||||
ts.resizable = {
|
||||
ts.resizable = {
|
||||
init : function( c, wo ) {
|
||||
if ( c.$table.hasClass( 'hasResizable' ) ) { return; }
|
||||
c.$table.addClass( 'hasResizable' );
|
||||
@ -35,7 +35,7 @@ ts.resizable = {
|
||||
marginTop = parseInt( $table.css( 'margin-top' ), 10 ),
|
||||
|
||||
// internal variables
|
||||
vars = wo.resizable_ = {
|
||||
vars = wo.resizable_vars = {
|
||||
useStorage : ts.storage && wo.resizable !== false,
|
||||
$wrap : $parent,
|
||||
mouseXPosition : 0,
|
||||
@ -57,7 +57,7 @@ ts.resizable = {
|
||||
vars.fullWidth = Math.abs( $parent.width() - vars.tableWidth ) < 20;
|
||||
|
||||
/*
|
||||
// Hacky method to determine if table width is set to "auto"
|
||||
// Hacky method to determine if table width is set to 'auto'
|
||||
// http://stackoverflow.com/a/20892048/145346
|
||||
if ( !vars.fullWidth ) {
|
||||
tmp = $table.width();
|
||||
@ -77,7 +77,7 @@ ts.resizable = {
|
||||
tmp = ts.storage( c.table, 'tablesorter-table-resized-width' ) || 'auto';
|
||||
ts.resizable.setWidth( $table, tmp, true );
|
||||
}
|
||||
wo.resizable_.storedSizes = storedSizes = ( vars.useStorage ?
|
||||
wo.resizable_vars.storedSizes = storedSizes = ( vars.useStorage ?
|
||||
ts.storage( c.table, ts.css.resizableStorage ) :
|
||||
[] ) || [];
|
||||
ts.resizable.setWidths( c, wo, storedSizes );
|
||||
@ -111,7 +111,7 @@ ts.resizable = {
|
||||
updateStoredSizes : function( c, wo ) {
|
||||
var column, $header,
|
||||
len = c.columns,
|
||||
vars = wo.resizable_;
|
||||
vars = wo.resizable_vars;
|
||||
vars.storedSizes = [];
|
||||
for ( column = 0; column < len; column++ ) {
|
||||
$header = c.$headerIndexed[ column ];
|
||||
@ -130,7 +130,7 @@ ts.resizable = {
|
||||
|
||||
setWidths : function( c, wo, storedSizes ) {
|
||||
var column, $temp,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$extra = $( c.namespace + '_extra_headers' ),
|
||||
$col = c.$table.children( 'colgroup' ).children( 'col' );
|
||||
storedSizes = storedSizes || vars.storedSizes || [];
|
||||
@ -190,7 +190,7 @@ ts.resizable = {
|
||||
// prevent text selection while dragging resize bar
|
||||
toggleTextSelection : function( c, toggle ) {
|
||||
var namespace = c.namespace + 'tsresize';
|
||||
c.widgetOptions.resizable_.disabled = toggle;
|
||||
c.widgetOptions.resizable_vars.disabled = toggle;
|
||||
$( 'body' ).toggleClass( ts.css.resizableNoSelect, toggle );
|
||||
if ( toggle ) {
|
||||
$( 'body' )
|
||||
@ -208,7 +208,7 @@ ts.resizable = {
|
||||
wo.$resizable_container.children().bind( 'mousedown', function( event ) {
|
||||
// save header cell and mouse position
|
||||
var column,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$extras = $( c.namespace + '_extra_headers' ),
|
||||
$header = $( event.target ).data( 'header' );
|
||||
|
||||
@ -232,7 +232,7 @@ ts.resizable = {
|
||||
|
||||
$( document )
|
||||
.bind( 'mousemove' + namespace, function( event ) {
|
||||
var vars = wo.resizable_;
|
||||
var vars = wo.resizable_vars;
|
||||
// ignore mousemove if no mousedown
|
||||
if ( !vars.disabled || vars.mouseXPosition === 0 || !vars.$target ) { return; }
|
||||
if ( wo.resizable_throttle ) {
|
||||
@ -245,7 +245,7 @@ ts.resizable = {
|
||||
}
|
||||
})
|
||||
.bind( 'mouseup' + namespace, function() {
|
||||
if (!wo.resizable_.disabled) { return; }
|
||||
if (!wo.resizable_vars.disabled) { return; }
|
||||
ts.resizable.toggleTextSelection( c, false );
|
||||
ts.resizable.stopResize( c, wo );
|
||||
ts.resizable.setHandlePosition( c, wo );
|
||||
@ -265,21 +265,21 @@ ts.resizable = {
|
||||
.add( $( c.namespace + '_extra_table' ).find( 'thead:first' ) )
|
||||
.bind( 'contextmenu' + namespace, function() {
|
||||
// $.isEmptyObject() needs jQuery 1.4+; allow right click if already reset
|
||||
var allowClick = wo.resizable_.storedSizes.length === 0;
|
||||
var allowClick = wo.resizable_vars.storedSizes.length === 0;
|
||||
ts.resizableReset( c.table );
|
||||
ts.resizable.setHandlePosition( c, wo );
|
||||
wo.resizable_.storedSizes = [];
|
||||
wo.resizable_vars.storedSizes = [];
|
||||
return allowClick;
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
mouseMove : function( c, wo, event ) {
|
||||
if ( wo.resizable_.mouseXPosition === 0 || !wo.resizable_.$target ) { return; }
|
||||
if ( wo.resizable_vars.mouseXPosition === 0 || !wo.resizable_vars.$target ) { return; }
|
||||
// resize columns
|
||||
var column,
|
||||
total = 0,
|
||||
vars = wo.resizable_,
|
||||
vars = wo.resizable_vars,
|
||||
$next = vars.$next,
|
||||
tar = vars.storedSizes[ vars.target ],
|
||||
leftEdge = event.pageX - vars.mouseXPosition;
|
||||
@ -311,7 +311,7 @@ ts.resizable = {
|
||||
},
|
||||
|
||||
stopResize : function( c, wo ) {
|
||||
var vars = wo.resizable_;
|
||||
var vars = wo.resizable_vars;
|
||||
ts.resizable.updateStoredSizes( c, wo );
|
||||
if ( vars.useStorage ) {
|
||||
// save all column widths
|
||||
@ -323,13 +323,13 @@ ts.resizable = {
|
||||
// will update stickyHeaders, just in case, see #912
|
||||
c.$table.trigger('stickyHeadersUpdate');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// this widget saves the column widths if
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: "resizable",
|
||||
// this widget saves the column widths if
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'resizable',
|
||||
priority: 40,
|
||||
options: {
|
||||
resizable : true, // save column widths to storage
|
||||
@ -347,7 +347,8 @@ ts.addWidget({
|
||||
var namespace = c.namespace + 'tsresize';
|
||||
c.$table.add( $( c.namespace + '_extra_table' ) )
|
||||
.removeClass('hasResizable')
|
||||
.children( 'thead' ).unbind( 'contextmenu' + namespace );
|
||||
.children( 'thead' )
|
||||
.unbind( 'contextmenu' + namespace );
|
||||
|
||||
wo.$resizable_container.remove();
|
||||
ts.resizable.toggleTextSelection( c, false );
|
||||
@ -355,14 +356,14 @@ ts.addWidget({
|
||||
$( document ).unbind( 'mousemove' + namespace + ' mouseup' + namespace );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ts.resizableReset = function( table, refreshing ) {
|
||||
ts.resizableReset = function( table, refreshing ) {
|
||||
$( table ).each(function(){
|
||||
var index, $t,
|
||||
c = this.config,
|
||||
wo = c && c.widgetOptions,
|
||||
vars = wo.resizable_;
|
||||
vars = wo.resizable_vars;
|
||||
if ( table && c && c.$headerIndexed.length ) {
|
||||
// restore the initial table width
|
||||
if ( vars.overflow && vars.tableWidth ) {
|
||||
@ -388,6 +389,6 @@ ts.resizableReset = function( table, refreshing ) {
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery, window );
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*! Widget: saveSort */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
// this widget saves the last sort only if the
|
||||
// saveSort widget option is true AND the
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
// this widget saves the last sort only if the
|
||||
// saveSort widget option is true AND the
|
||||
// $.tablesorter.storage function is included
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'saveSort',
|
||||
priority: 20,
|
||||
options: {
|
||||
@ -21,7 +21,7 @@ ts.addWidget({
|
||||
var stored, time,
|
||||
$table = c.$table,
|
||||
saveSort = wo.saveSort !== false, // make saveSort active/inactive; default to true
|
||||
sortList = { "sortList" : c.sortList };
|
||||
sortList = { 'sortList' : c.sortList };
|
||||
if (c.debug) {
|
||||
time = new Date();
|
||||
}
|
||||
@ -54,7 +54,7 @@ ts.addWidget({
|
||||
c.sortList = sortList;
|
||||
} else if (table.hasInitialized && sortList && sortList.length > 0) {
|
||||
// update sort change
|
||||
$table.trigger('sorton', [sortList]);
|
||||
$table.trigger('sorton', [ sortList ]);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -63,6 +63,6 @@ ts.addWidget({
|
||||
// clear storage
|
||||
if (ts.storage) { ts.storage( table, 'tablesorter-savesort', '' ); }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -33,12 +33,12 @@
|
||||
*/
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
;( function( $, window ) {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter,
|
||||
var ts = $.tablesorter,
|
||||
tscss = ts.css;
|
||||
|
||||
$.extend( ts.css, {
|
||||
$.extend( ts.css, {
|
||||
scrollerWrap : 'tablesorter-scroller',
|
||||
scrollerHeader : 'tablesorter-scroller-header',
|
||||
scrollerTable : 'tablesorter-scroller-table',
|
||||
@ -53,11 +53,11 @@ $.extend( ts.css, {
|
||||
scrollerAddedHeight : 'tablesorter-scroller-added-height',
|
||||
scrollerHack : 'tablesorter-scroller-scrollbar-hack',
|
||||
// class name on table cannot start with 'tablesorter-' or the
|
||||
// suffix "scroller-rtl" will match as a theme name
|
||||
// suffix 'scroller-rtl' will match as a theme name
|
||||
scrollerRtl : 'ts-scroller-rtl'
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id : 'scroller',
|
||||
priority : 60, // run after the filter widget
|
||||
options : {
|
||||
@ -86,20 +86,20 @@ ts.addWidget({
|
||||
remove : function( table, c, wo ) {
|
||||
ts.scroller.remove( c, wo );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* Add window resizeEnd event */
|
||||
ts.window_resize = function() {
|
||||
/* Add window resizeEnd event */
|
||||
ts.window_resize = function() {
|
||||
if ( ts.timer_resize ) {
|
||||
clearTimeout( ts.timer_resize );
|
||||
}
|
||||
ts.timer_resize = setTimeout( function() {
|
||||
$( window ).trigger( 'resizeEnd' );
|
||||
}, 250 );
|
||||
};
|
||||
};
|
||||
|
||||
// Add extra scroller css
|
||||
$( function() {
|
||||
// Add extra scroller css
|
||||
$( function() {
|
||||
var style = '<style>' +
|
||||
/* overall wrapper & table section wrappers */
|
||||
'.' + tscss.scrollerWrap + ' { position: relative; overflow: hidden; }' +
|
||||
@ -124,7 +124,7 @@ $( function() {
|
||||
'.' + tscss.scrollerFixed + ' > div { pointer-events: all; }' +
|
||||
'.' + tscss.scrollerWrap + ' .' + tscss.scrollerFixed + ' { position: absolute; top: 0; z-index: 1; left: 0 } ' +
|
||||
'.' + tscss.scrollerWrap + ' .' + tscss.scrollerFixed + '.' + tscss.scrollerRtl + ' { left: auto; right: 0 } ' +
|
||||
/* add horizontal scroll bar; set to "auto", see #135 */
|
||||
/* add horizontal scroll bar; set to 'auto', see #135 */
|
||||
'.' + tscss.scrollerWrap + '.' + tscss.scrollerHasFix + ' > .' + tscss.scrollerTable + ' { overflow: auto; }' +
|
||||
/* need to position the tbody & tfoot absolutely to hide the scrollbar & move the footer
|
||||
below the horizontal scrollbar */
|
||||
@ -138,9 +138,9 @@ $( function() {
|
||||
' { position: absolute; top: 0; bottom: 0; z-index: 2; left: 0; right: 0; } ' +
|
||||
'</style>';
|
||||
$( style ).appendTo( 'body' );
|
||||
});
|
||||
});
|
||||
|
||||
ts.scroller = {
|
||||
ts.scroller = {
|
||||
|
||||
// Ugh.. Firefox misbehaves, so it needs to be detected
|
||||
isFirefox : navigator.userAgent.toLowerCase().indexOf( 'firefox' ) > -1,
|
||||
@ -911,6 +911,6 @@ ts.scroller = {
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
})( jQuery, window );
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*! Widget: sort2Hash - updated 7/21/2015 (v2.22.4) */
|
||||
;( function( $ ) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
s2h = {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {},
|
||||
s2h = {
|
||||
init : function( c, wo ) {
|
||||
var hasSaveSort = ts.hasWidget( c.table, 'saveSort' ),
|
||||
sort = s2h.getSort( c, wo );
|
||||
@ -103,9 +103,9 @@ s2h = {
|
||||
'&' + s2h.getTableId( c, wo ) + '=' + encodeURI( sort );
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id: 'sort2Hash',
|
||||
priority: 30, // after saveSort
|
||||
options: {
|
||||
@ -123,6 +123,6 @@ ts.addWidget({
|
||||
remove: function(table, c) {
|
||||
c.$table.off( 'sortEnd.sort2hash' );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
@ -5,10 +5,10 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;( function( $ ) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter;
|
||||
'use strict';
|
||||
var ts = $.tablesorter;
|
||||
|
||||
ts.sortTbodies = {
|
||||
ts.sortTbodies = {
|
||||
init: function( c, wo ) {
|
||||
|
||||
var index, rows, txt, max, $rows,
|
||||
@ -146,7 +146,7 @@ ts.sortTbodies = {
|
||||
return $tbodyA.attr( 'data-ts-original-order' ) - $tbodyB.attr( 'data-ts-original-order' );
|
||||
});
|
||||
|
||||
ts.sortTbodies.restoreTbodies ( c, wo, $tbodies );
|
||||
ts.sortTbodies.restoreTbodies( c, wo, $tbodies );
|
||||
wo.sortTbody_busy = false;
|
||||
}
|
||||
}
|
||||
@ -201,9 +201,9 @@ ts.sortTbodies = {
|
||||
$table.show();
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
id: 'sortTbody',
|
||||
// priority < 50 (filter widget), so c.$tbodies has the correct elements
|
||||
priority: 40,
|
||||
@ -223,6 +223,6 @@ ts.addWidget({
|
||||
c.serverSideSorting = wo.sortTbody_original_serverSideSorting;
|
||||
c.cssInfoBlock = wo.sortTbody_original_cssInfoBlock;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})( jQuery );
|
||||
|
@ -12,14 +12,14 @@
|
||||
/*jshint browser:true, jquery:true, unused:false */
|
||||
/*global jQuery: false */
|
||||
;(function($){
|
||||
"use strict";
|
||||
var ts = $.tablesorter,
|
||||
'use strict';
|
||||
var ts = $.tablesorter,
|
||||
|
||||
// add/refresh row indexes
|
||||
addIndexes = function(table){
|
||||
// add/refresh row indexes
|
||||
addIndexes = function(table){
|
||||
var $tr, wo, v, indx, rows,
|
||||
c = table.config;
|
||||
// "Index" the static rows, saving their current (starting) position in the
|
||||
// 'Index' the static rows, saving their current (starting) position in the
|
||||
// table inside a data() param on the <tr> element itself for later use.
|
||||
if (c) {
|
||||
wo = c.widgetOptions;
|
||||
@ -29,10 +29,10 @@ addIndexes = function(table){
|
||||
$tr.filter(wo.staticRow_class).each(function() {
|
||||
$tr = $(this);
|
||||
indx = $tr.data(wo.staticRow_index);
|
||||
if (typeof indx !== "undefined") {
|
||||
if (typeof indx !== 'undefined') {
|
||||
v = parseFloat(indx);
|
||||
// percentage of total rows
|
||||
indx = (/%/.test(indx)) ? Math.round(v/100 * rows) : v;
|
||||
indx = (/%/.test(indx)) ? Math.round(v / 100 * rows) : v;
|
||||
} else {
|
||||
indx = $tr.index();
|
||||
}
|
||||
@ -41,9 +41,9 @@ addIndexes = function(table){
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ts.addWidget({
|
||||
ts.addWidget({
|
||||
// Give the new Widget an ID to be used in the tablesorter() call, as follows:
|
||||
// $('#myElement').tablesorter({ widgets: ['zebra', 'staticRow'] });
|
||||
id: 'staticRow',
|
||||
@ -67,7 +67,7 @@ ts.addWidget({
|
||||
},
|
||||
|
||||
format: function(table, c, wo) {
|
||||
// Loop thru static rows, moving them to their original "indexed" position,
|
||||
// Loop thru static rows, moving them to their original 'indexed' position,
|
||||
// & repeat until no more re-shuffling is needed
|
||||
var targetIndex, $thisRow, indx, numRows, $tbody, hasShuffled, $rows, max;
|
||||
|
||||
@ -116,6 +116,6 @@ ts.addWidget({
|
||||
c.$table.unbind( ('updateComplete.tsstaticrows ' + wo.staticRow_event).replace(/\s+/g, ' ') );
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
@ -3,18 +3,18 @@
|
||||
* by Rob Garrison
|
||||
*/
|
||||
;(function ($, window) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
sticky : 'tablesorter-stickyHeader', // stickyHeader
|
||||
stickyVis : 'tablesorter-sticky-visible',
|
||||
stickyHide: 'tablesorter-sticky-hidden',
|
||||
stickyWrap: 'tablesorter-sticky-wrapper'
|
||||
});
|
||||
});
|
||||
|
||||
// Add a resize event to table headers
|
||||
ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
// Add a resize event to table headers
|
||||
ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
table = $(table)[0]; // make sure we're using a dom element
|
||||
if ( !table.config ) { return; }
|
||||
var defaults = {
|
||||
@ -30,7 +30,7 @@ ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
headers = [];
|
||||
for ( index = 0; index < len; index++ ) {
|
||||
$header = c.$headers.eq( index );
|
||||
sizes = $header.data( 'savedSizes' ) || [ 0,0 ]; // fixes #394
|
||||
sizes = $header.data( 'savedSizes' ) || [ 0, 0 ]; // fixes #394
|
||||
width = $header[0].offsetWidth;
|
||||
height = $header[0].offsetHeight;
|
||||
if ( width !== sizes[0] || height !== sizes[1] ) {
|
||||
@ -53,14 +53,14 @@ ts.addHeaderResizeEvent = function(table, disable, settings) {
|
||||
if (wo.resize_flag) { return; }
|
||||
checkSizes();
|
||||
}, options.timer);
|
||||
};
|
||||
};
|
||||
|
||||
// Sticky headers based on this awesome article:
|
||||
// http://css-tricks.com/13465-persistent-headers/
|
||||
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: "stickyHeaders",
|
||||
// Sticky headers based on this awesome article:
|
||||
// http://css-tricks.com/13465-persistent-headers/
|
||||
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
||||
// **************************
|
||||
ts.addWidget({
|
||||
id: 'stickyHeaders',
|
||||
priority: 60, // sticky widget must be initialized after the filter widget!
|
||||
options: {
|
||||
stickyHeaders : '', // extra class name added to the sticky header row
|
||||
@ -70,7 +70,7 @@ ts.addWidget({
|
||||
stickyHeaders_offset : 0, // number or jquery selector targeting the position:fixed element
|
||||
stickyHeaders_filteredToTop: true, // scroll table top into view after filtering
|
||||
stickyHeaders_cloneId : '-sticky', // added to table ID, if it exists
|
||||
stickyHeaders_addResizeEvent : true, // trigger "resize" event on headers
|
||||
stickyHeaders_addResizeEvent : true, // trigger 'resize' event on headers
|
||||
stickyHeaders_includeCaption : true, // if false and a caption exist, it won't be included in the sticky header
|
||||
stickyHeaders_zIndex : 2 // The zIndex of the stickyHeaders, allows the user to adjust this to their needs
|
||||
},
|
||||
@ -283,6 +283,6 @@ ts.addWidget({
|
||||
.unbind( ('scroll resize '.split(' ').join(namespace)).replace(/\s+/g, ' ') );
|
||||
ts.addHeaderResizeEvent(table, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, window);
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*! Widget: storage - updated 3/26/2015 (v2.21.3) */
|
||||
;(function ($, window, document) {
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var ts = $.tablesorter || {};
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
var ts = $.tablesorter || {};
|
||||
// *** Store data in local storage, with a cookie fallback ***
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
if you need it, then include https://github.com/douglascrockford/JSON-js
|
||||
|
||||
$.parseJSON is not available is jQuery versions older than 1.4.1, using older
|
||||
@ -20,9 +20,9 @@ var ts = $.tablesorter || {};
|
||||
v = $.tablesorter.storage(table, 'tablesorter-mywidget');
|
||||
// val may be empty, so also check for your data
|
||||
val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
|
||||
alert(val); // "data1" if saved, or "" if not
|
||||
*/
|
||||
ts.storage = function(table, key, value, options) {
|
||||
alert(val); // 'data1' if saved, or '' if not
|
||||
*/
|
||||
ts.storage = function(table, key, value, options) {
|
||||
table = $(table)[0];
|
||||
var cookieIndex, cookies, date,
|
||||
hasStorage = false,
|
||||
@ -32,12 +32,12 @@ ts.storage = function(table, key, value, options) {
|
||||
storageType = ( options && options.useSessionStorage ) || ( wo && wo.storage_useSessionStorage ) ?
|
||||
'sessionStorage' : 'localStorage',
|
||||
$table = $(table),
|
||||
// id from (1) options ID, (2) table "data-table-group" attribute, (3) widgetOptions.storage_tableId,
|
||||
// id from (1) options ID, (2) table 'data-table-group' attribute, (3) widgetOptions.storage_tableId,
|
||||
// (4) table ID, then (5) table index
|
||||
id = options && options.id ||
|
||||
$table.attr( options && options.group || wo && wo.storage_group || 'data-table-group') ||
|
||||
wo && wo.storage_tableId || table.id || $('.tablesorter').index( $table ),
|
||||
// url from (1) options url, (2) table "data-table-page" attribute, (3) widgetOptions.storage_fixedUrl,
|
||||
// url from (1) options url, (2) table 'data-table-page' attribute, (3) widgetOptions.storage_fixedUrl,
|
||||
// (4) table.config.fixedUrl (deprecated), then (5) window location path
|
||||
url = options && options.url ||
|
||||
$table.attr(options && options.page || wo && wo.storage_page || 'data-table-page') ||
|
||||
@ -48,7 +48,7 @@ ts.storage = function(table, key, value, options) {
|
||||
window[storageType].setItem('_tmptest', 'temp');
|
||||
hasStorage = true;
|
||||
window[storageType].removeItem('_tmptest');
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
if (c && c.debug) {
|
||||
ts.log( storageType + ' is not supported in this browser' );
|
||||
}
|
||||
@ -79,11 +79,11 @@ ts.storage = function(table, key, value, options) {
|
||||
} else {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (31536e+6)); // 365 days
|
||||
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g,'\"') + '; expires=' + date.toGMTString() + '; path=/';
|
||||
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g, '\"') + '; expires=' + date.toGMTString() + '; path=/';
|
||||
}
|
||||
} else {
|
||||
return values && values[url] ? values[url][id] : '';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
})(jQuery, window, document);
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*! Widget: uitheme - updated 3/26/2015 (v2.21.3) */
|
||||
;(function ($) {
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
'use strict';
|
||||
var ts = $.tablesorter || {};
|
||||
|
||||
ts.themes = {
|
||||
ts.themes = {
|
||||
'bootstrap' : {
|
||||
table : 'table table-bordered table-striped',
|
||||
caption : 'caption',
|
||||
@ -15,7 +15,7 @@ ts.themes = {
|
||||
active : '', // applied when column is sorted
|
||||
hover : '', // custom css required - a defined bootstrap style may not override other classes
|
||||
// icon class names
|
||||
icons : '', // add "icon-white" to make them white; this icon class is added to the <i> in the header
|
||||
icons : '', // add 'icon-white' to make them white; this icon class is added to the <i> in the header
|
||||
iconSortNone : 'bootstrap-icon-unsorted', // class name added to icon when column is not sorted
|
||||
iconSortAsc : 'icon-chevron-up glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort
|
||||
iconSortDesc : 'icon-chevron-down glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort
|
||||
@ -46,14 +46,14 @@ ts.themes = {
|
||||
even : 'ui-widget-content', // even row zebra striping
|
||||
odd : 'ui-state-default' // odd row zebra striping
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.extend(ts.css, {
|
||||
$.extend(ts.css, {
|
||||
wrapper : 'tablesorter-wrapper' // ui theme & resizable
|
||||
});
|
||||
});
|
||||
|
||||
ts.addWidget({
|
||||
id: "uitheme",
|
||||
ts.addWidget({
|
||||
id: 'uitheme',
|
||||
priority: 10,
|
||||
format: function(table, c, wo) {
|
||||
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
||||
@ -75,7 +75,7 @@ ts.addWidget({
|
||||
if (hasOldTheme) {
|
||||
wo.zebra[0] = $.trim( ' ' + wo.zebra[0].replace(' ' + oldtheme.even, '') );
|
||||
wo.zebra[1] = $.trim( ' ' + wo.zebra[1].replace(' ' + oldtheme.odd, '') );
|
||||
c.$tbodies.children().removeClass( [oldtheme.even, oldtheme.odd].join(' ') );
|
||||
c.$tbodies.children().removeClass( [ oldtheme.even, oldtheme.odd ].join(' ') );
|
||||
}
|
||||
// update zebra stripes
|
||||
if (themes.even) { wo.zebra[0] += ' ' + themes.even; }
|
||||
@ -100,7 +100,7 @@ ts.addWidget({
|
||||
}
|
||||
// update header classes
|
||||
$headers
|
||||
.removeClass( (hasOldTheme ? [oldtheme.header, oldtheme.hover, oldremove].join(' ') : '') || '' )
|
||||
.removeClass( (hasOldTheme ? [ oldtheme.header, oldtheme.hover, oldremove ].join(' ') : '') || '' )
|
||||
.addClass(themes.header)
|
||||
.not('.sorter-false')
|
||||
.unbind('mouseenter.tsuitheme mouseleave.tsuitheme')
|
||||
@ -120,7 +120,7 @@ ts.addWidget({
|
||||
// if c.cssIcon is '', then no <i> is added to the header
|
||||
$headers
|
||||
.find('.' + ts.css.icon)
|
||||
.removeClass(hasOldTheme ? [oldtheme.icons, oldIconRmv].join(' ') : '')
|
||||
.removeClass(hasOldTheme ? [ oldtheme.icons, oldIconRmv ].join(' ') : '')
|
||||
.addClass(themes.icons || '');
|
||||
}
|
||||
if ($table.hasClass('hasFilters')) {
|
||||
@ -146,10 +146,10 @@ ts.addWidget({
|
||||
hdr = themes.sortNone;
|
||||
icon = themes.iconSortNone;
|
||||
if ($h.hasClass(ts.css.sortAsc)) {
|
||||
hdr = [themes.sortAsc, themes.active].join(' ');
|
||||
hdr = [ themes.sortAsc, themes.active ].join(' ');
|
||||
icon = themes.iconSortAsc;
|
||||
} else if ($h.hasClass(ts.css.sortDesc)) {
|
||||
hdr = [themes.sortDesc, themes.active].join(' ');
|
||||
hdr = [ themes.sortDesc, themes.active ].join(' ');
|
||||
icon = themes.iconSortDesc;
|
||||
}
|
||||
$header.addClass(hdr);
|
||||
@ -158,7 +158,7 @@ ts.addWidget({
|
||||
}
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.benchmark("Applying " + theme + " theme", time);
|
||||
ts.benchmark('Applying ' + theme + ' theme', time);
|
||||
}
|
||||
},
|
||||
remove: function(table, c, wo, refreshing) {
|
||||
@ -180,6 +180,6 @@ ts.addWidget({
|
||||
.removeClass(themes.filterRow);
|
||||
$headers.find('.' + ts.css.icon).removeClass(themes.icons + ' ' + iconRmv);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
0
jscs.errors.txt
Normal file
0
jscs.errors.txt
Normal file
@ -75,6 +75,7 @@
|
||||
"grunt-contrib-qunit": "^0.5.2",
|
||||
"grunt-contrib-uglify": "^0.7.0",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt-jscs": "^1.8.0",
|
||||
"grunt-string-replace": "^1.0.0"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user