summaryrefslogtreecommitdiffstats
path: root/jquery.tablesorter.widgets.js
diff options
context:
space:
mode:
Diffstat (limited to 'jquery.tablesorter.widgets.js')
-rw-r--r--jquery.tablesorter.widgets.js3175
1 files changed, 1 insertions, 3174 deletions
diff --git a/jquery.tablesorter.widgets.js b/jquery.tablesorter.widgets.js
index 5955f8c..3822a7e 100644
--- a/jquery.tablesorter.widgets.js
+++ b/jquery.tablesorter.widgets.js
@@ -6,3177 +6,4 @@
*/
/*! tablesorter (FORK) - updated 2018-11-20 (v2.31.1)*/
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
-(function(factory){if (typeof define === 'function' && define.amd){define(['jquery'], factory);} else if (typeof module === 'object' && typeof module.exports === 'object'){module.exports = factory(require('jquery'));} else {factory(jQuery);}}(function(jQuery) {
-/*! Widget: storage - updated 2018-03-18 (v2.30.0) */
-/*global JSON:false */
-;(function ($, window, document) {
- 'use strict';
-
- var ts = $.tablesorter || {};
-
- // update defaults for validator; these values must be falsy!
- $.extend(true, ts.defaults, {
- fixedUrl: '',
- widgetOptions: {
- storage_fixedUrl: '',
- storage_group: '',
- storage_page: '',
- storage_storageType: '',
- storage_tableId: '',
- storage_useSessionStorage: ''
- }
- });
-
- // *** 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
- versions will only allow storing information for one page at a time
-
- // *** Save data (JSON format only) ***
- // val must be valid JSON... use http://jsonlint.com/ to ensure it is valid
- var val = { "mywidget" : "data1" }; // valid JSON uses double quotes
- // $.tablesorter.storage(table, key, val);
- $.tablesorter.storage(table, 'tablesorter-mywidget', val);
-
- // *** Get data: $.tablesorter.storage(table, key); ***
- 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) {
- table = $(table)[0];
- var cookieIndex, cookies, date,
- hasStorage = false,
- values = {},
- c = table.config,
- wo = c && c.widgetOptions,
- debug = ts.debug(c, 'storage'),
- storageType = (
- ( options && options.storageType ) || ( wo && wo.storage_storageType )
- ).toString().charAt(0).toLowerCase(),
- // deprecating "useSessionStorage"; any storageType setting overrides it
- session = storageType ? '' :
- ( options && options.useSessionStorage ) || ( wo && wo.storage_useSessionStorage ),
- $table = $(table),
- // 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,
- // (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') ||
- wo && wo.storage_fixedUrl || c && c.fixedUrl || window.location.pathname;
-
- // skip if using cookies
- if (storageType !== 'c') {
- storageType = (storageType === 's' || session) ? 'sessionStorage' : 'localStorage';
- // https://gist.github.com/paulirish/5558557
- if (storageType in window) {
- try {
- window[storageType].setItem('_tmptest', 'temp');
- hasStorage = true;
- window[storageType].removeItem('_tmptest');
- } catch (error) {
- console.warn( storageType + ' is not supported in this browser' );
- }
- }
- }
- if (debug) {
- console.log('Storage >> Using', hasStorage ? storageType : 'cookies');
- }
- // *** get value ***
- if ($.parseJSON) {
- if (hasStorage) {
- values = $.parseJSON( window[storageType][key] || 'null' ) || {};
- } else {
- // old browser, using cookies
- cookies = document.cookie.split(/[;\s|=]/);
- // add one to get from the key to the value
- cookieIndex = $.inArray(key, cookies) + 1;
- values = (cookieIndex !== 0) ? $.parseJSON(cookies[cookieIndex] || 'null') || {} : {};
- }
- }
- // allow value to be an empty string too
- if (typeof value !== 'undefined' && window.JSON && JSON.hasOwnProperty('stringify')) {
- // add unique identifiers = url pathname > table ID/index on page > data
- if (!values[url]) {
- values[url] = {};
- }
- values[url][id] = value;
- // *** set value ***
- if (hasStorage) {
- window[storageType][key] = JSON.stringify(values);
- } else {
- date = new Date();
- date.setTime(date.getTime() + (31536e+6)); // 365 days
- 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 2018-03-18 (v2.30.0) */
-;(function ($) {
- 'use strict';
- var ts = $.tablesorter || {};
-
- ts.themes = {
- 'bootstrap' : {
- table : 'table table-bordered table-striped',
- caption : 'caption',
- // header class names
- header : 'bootstrap-header', // give the header a gradient background (theme.bootstrap_2.css)
- sortNone : '',
- sortAsc : '',
- sortDesc : '',
- active : '', // applied when column is sorted
- hover : '', // custom css required - a defined bootstrap style may not override other classes
- // icon class names
- icons : '', // add 'bootstrap-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 : 'glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort
- iconSortDesc : 'glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort
- filterRow : '', // filter row class
- footerRow : '',
- footerCells : '',
- even : '', // even row zebra striping
- odd : '' // odd row zebra striping
- },
- 'jui' : {
- table : 'ui-widget ui-widget-content ui-corner-all', // table classes
- caption : 'ui-widget-content',
- // header class names
- header : 'ui-widget-header ui-corner-all ui-state-default', // header classes
- sortNone : '',
- sortAsc : '',
- sortDesc : '',
- active : 'ui-state-active', // applied when column is sorted
- hover : 'ui-state-hover', // hover class
- // icon class names
- icons : 'ui-icon', // icon class added to the <i> in the header
- iconSortNone : 'ui-icon-carat-2-n-s ui-icon-caret-2-n-s', // class name added to icon when column is not sorted
- iconSortAsc : 'ui-icon-carat-1-n ui-icon-caret-1-n', // class name added to icon when column has ascending sort
- iconSortDesc : 'ui-icon-carat-1-s ui-icon-caret-1-s', // class name added to icon when column has descending sort
- filterRow : '',
- footerRow : '',
- footerCells : '',
- even : 'ui-widget-content', // even row zebra striping
- odd : 'ui-state-default' // odd row zebra striping
- }
- };
-
- $.extend(ts.css, {
- wrapper : 'tablesorter-wrapper' // ui theme & resizable
- });
-
- ts.addWidget({
- id: 'uitheme',
- priority: 10,
- format: function(table, c, wo) {
- var i, tmp, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
- themesAll = ts.themes,
- $table = c.$table.add( $( c.namespace + '_extra_table' ) ),
- $headers = c.$headers.add( $( c.namespace + '_extra_headers' ) ),
- theme = c.theme || 'jui',
- themes = themesAll[theme] || {},
- remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
- iconRmv = $.trim( [ themes.iconSortNone, themes.iconSortDesc, themes.iconSortAsc ].join( ' ' ) ),
- debug = ts.debug(c, 'uitheme');
- if (debug) { time = new Date(); }
- // initialization code - run once
- if (!$table.hasClass('tablesorter-' + theme) || c.theme !== c.appliedTheme || !wo.uitheme_applied) {
- wo.uitheme_applied = true;
- oldtheme = themesAll[c.appliedTheme] || {};
- hasOldTheme = !$.isEmptyObject(oldtheme);
- oldremove = hasOldTheme ? [ oldtheme.sortNone, oldtheme.sortDesc, oldtheme.sortAsc, oldtheme.active ].join( ' ' ) : '';
- oldIconRmv = hasOldTheme ? [ oldtheme.iconSortNone, oldtheme.iconSortDesc, oldtheme.iconSortAsc ].join( ' ' ) : '';
- 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(' ') );
- }
- // update zebra stripes
- if (themes.even) { wo.zebra[0] += ' ' + themes.even; }
- if (themes.odd) { wo.zebra[1] += ' ' + themes.odd; }
- // add caption style
- $table.children('caption')
- .removeClass(oldtheme.caption || '')
- .addClass(themes.caption);
- // add table/footer class names
- $tfoot = $table
- // remove other selected themes
- .removeClass( (c.appliedTheme ? 'tablesorter-' + (c.appliedTheme || '') : '') + ' ' + (oldtheme.table || '') )
- .addClass('tablesorter-' + theme + ' ' + (themes.table || '')) // add theme widget class name
- .children('tfoot');
- c.appliedTheme = c.theme;
-
- if ($tfoot.length) {
- $tfoot
- // if oldtheme.footerRow or oldtheme.footerCells are undefined, all class names are removed
- .children('tr').removeClass(oldtheme.footerRow || '').addClass(themes.footerRow)
- .children('th, td').removeClass(oldtheme.footerCells || '').addClass(themes.footerCells);
- }
- // update header classes
- $headers
- .removeClass( (hasOldTheme ? [ oldtheme.header, oldtheme.hover, oldremove ].join(' ') : '') || '' )
- .addClass(themes.header)
- .not('.sorter-false')
- .unbind('mouseenter.tsuitheme mouseleave.tsuitheme')
- .bind('mouseenter.tsuitheme mouseleave.tsuitheme', function(event) {
- // toggleClass with switch added in jQuery 1.3
- $(this)[ event.type === 'mouseenter' ? 'addClass' : 'removeClass' ](themes.hover || '');
- });
-
- $headers.each(function() {
- var $this = $(this);
- if (!$this.find('.' + ts.css.wrapper).length) {
- // Firefox needs this inner div to position the icon & resizer correctly
- $this.wrapInner('<div class="' + ts.css.wrapper + '" style="position:relative;height:100%;width:100%"></div>');
- }
- });
- if (c.cssIcon) {
- // if c.cssIcon is '', then no <i> is added to the header
- $headers
- .find('.' + ts.css.icon)
- .removeClass(hasOldTheme ? [ oldtheme.icons, oldIconRmv ].join(' ') : '')
- .addClass(themes.icons || '');
- }
- // filter widget initializes after uitheme
- if (ts.hasWidget( c.table, 'filter' )) {
- tmp = function() {
- $table.children('thead').children('.' + ts.css.filterRow)
- .removeClass(hasOldTheme ? oldtheme.filterRow || '' : '')
- .addClass(themes.filterRow || '');
- };
- if (wo.filter_initialized) {
- tmp();
- } else {
- $table.one('filterInit', function() {
- tmp();
- });
- }
- }
- }
- for (i = 0; i < c.columns; i++) {
- $header = c.$headers
- .add($(c.namespace + '_extra_headers'))
- .not('.sorter-false')
- .filter('[data-column="' + i + '"]');
- $icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $();
- $h = $headers.not('.sorter-false').filter('[data-column="' + i + '"]:last');
- if ($h.length) {
- $header.removeClass(remove);
- $icon.removeClass(iconRmv);
- if ($h[0].sortDisabled) {
- // no sort arrows for disabled columns!
- $icon.removeClass(themes.icons || '');
- } else {
- hdr = themes.sortNone;
- icon = themes.iconSortNone;
- if ($h.hasClass(ts.css.sortAsc)) {
- hdr = [ themes.sortAsc, themes.active ].join(' ');
- icon = themes.iconSortAsc;
- } else if ($h.hasClass(ts.css.sortDesc)) {
- hdr = [ themes.sortDesc, themes.active ].join(' ');
- icon = themes.iconSortDesc;
- }
- $header.addClass(hdr);
- $icon.addClass(icon || '');
- }
- }
- }
- if (debug) {
- console.log('uitheme >> Applied ' + theme + ' theme' + ts.benchmark(time));
- }
- },
- remove: function(table, c, wo, refreshing) {
- if (!wo.uitheme_applied) { return; }
- var $table = c.$table,
- theme = c.appliedTheme || 'jui',
- themes = ts.themes[ theme ] || ts.themes.jui,
- $headers = $table.children('thead').children(),
- remove = themes.sortNone + ' ' + themes.sortDesc + ' ' + themes.sortAsc,
- iconRmv = themes.iconSortNone + ' ' + themes.iconSortDesc + ' ' + themes.iconSortAsc;
- $table.removeClass('tablesorter-' + theme + ' ' + themes.table);
- wo.uitheme_applied = false;
- if (refreshing) { return; }
- $table.find(ts.css.header).removeClass(themes.header);
- $headers
- .unbind('mouseenter.tsuitheme mouseleave.tsuitheme') // remove hover
- .removeClass(themes.hover + ' ' + remove + ' ' + themes.active)
- .filter('.' + ts.css.filterRow)
- .removeClass(themes.filterRow);
- $headers.find('.' + ts.css.icon).removeClass(themes.icons + ' ' + iconRmv);
- }
- });
-
-})(jQuery);
-
-/*! Widget: columns - updated 5/24/2017 (v2.28.11) */
-;(function ($) {
- 'use strict';
- var ts = $.tablesorter || {};
-
- ts.addWidget({
- id: 'columns',
- priority: 65,
- options : {
- columns : [ 'primary', 'secondary', 'tertiary' ]
- },
- format: function(table, c, wo) {
- var $tbody, tbodyIndex, $rows, rows, $row, $cells, remove, indx,
- $table = c.$table,
- $tbodies = c.$tbodies,
- sortList = c.sortList,
- len = sortList.length,
- // removed c.widgetColumns support
- 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)
- for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
- $tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true); // detach tbody
- $rows = $tbody.children('tr');
- // loop through the visible rows
- $rows.each(function() {
- $row = $(this);
- if (this.style.display !== 'none') {
- // remove all columns class names
- $cells = $row.children().removeClass(remove);
- // add appropriate column class names
- if (sortList && sortList[0]) {
- // primary sort column class
- $cells.eq(sortList[0][0]).addClass(css[0]);
- if (len > 1) {
- for (indx = 1; indx < len; indx++) {
- // secondary, tertiary, etc sort column classes
- $cells.eq(sortList[indx][0]).addClass( css[indx] || css[last] );
- }
- }
- }
- }
- });
- ts.processTbody(table, $tbody, false);
- }
- // add classes to thead and tfoot
- rows = wo.columns_thead !== false ? [ 'thead tr' ] : [];
- if (wo.columns_tfoot !== false) {
- rows.push('tfoot tr');
- }
- if (rows.length) {
- $rows = $table.find( rows.join(',') ).children().removeClass(remove);
- if (len) {
- for (indx = 0; indx < len; indx++) {
- // add primary. secondary, tertiary, etc sort column classes
- $rows.filter('[data-column="' + sortList[indx][0] + '"]').addClass(css[indx] || css[last]);
- }
- }
- }
- },
- remove: function(table, c, wo) {
- var tbodyIndex, $tbody,
- $tbodies = c.$tbodies,
- 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++ ) {
- $tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true); // remove tbody
- $tbody.children('tr').each(function() {
- $(this).children().removeClass(remove);
- });
- ts.processTbody(table, $tbody, false); // restore tbody
- }
- }
- });
-
-})(jQuery);
-
-/*! Widget: filter - updated 2018-03-18 (v2.30.0) *//*
- * Requires tablesorter v2.8+ and jQuery 1.7+
- * by Rob Garrison
- */
-;( function ( $ ) {
- 'use strict';
- var tsf, tsfRegex,
- ts = $.tablesorter || {},
- tscss = ts.css,
- tskeyCodes = ts.keyCodes;
-
- $.extend( tscss, {
- filterRow : 'tablesorter-filter-row',
- filter : 'tablesorter-filter',
- filterDisabled : 'disabled',
- filterRowHide : 'hideme'
- });
-
- $.extend( tskeyCodes, {
- backSpace : 8,
- escape : 27,
- space : 32,
- left : 37,
- down : 40
- });
-
- ts.addWidget({
- id: 'filter',
- priority: 50,
- options : {
- filter_cellFilter : '', // css class name added to the filter cell ( string or array )
- filter_childRows : false, // if true, filter includes child row content in the search
- filter_childByColumn : false, // ( filter_childRows must be true ) if true = search child rows by column; false = search all child row text grouped
- filter_childWithSibs : true, // if true, include matching child row siblings
- filter_columnAnyMatch: true, // if true, allows using '#:{query}' in AnyMatch searches ( column:query )
- filter_columnFilters : true, // if true, a filter will be added to the top of each table column
- filter_cssFilter : '', // css class name added to the filter row & each input in the row ( tablesorter-filter is ALWAYS added )
- filter_defaultAttrib : 'data-value', // data attribute in the header cell that contains the default filter value
- filter_defaultFilter : {}, // add a default column filter type '~{query}' to make fuzzy searches default; '{q1} AND {q2}' to make all searches use a logical AND.
- filter_excludeFilter : {}, // filters to exclude, per column
- filter_external : '', // jQuery selector string ( or jQuery object ) of external filters
- filter_filteredRow : 'filtered', // class added to filtered rows; define in css with "display:none" to hide the filtered-out rows
- filter_filterLabel : 'Filter "{{label}}" column by...', // Aria-label added to filter input/select; see #1495
- filter_formatter : null, // add custom filter elements to the filter row
- filter_functions : null, // add custom filter functions using this option
- filter_hideEmpty : true, // hide filter row when table is empty
- filter_hideFilters : false, // collapse filter row when mouse leaves the area
- filter_ignoreCase : true, // if true, make all searches case-insensitive
- filter_liveSearch : true, // if true, search column content while the user types ( with a delay )
- filter_matchType : { 'input': 'exact', 'select': 'exact' }, // global query settings ('exact' or 'match'); overridden by "filter-match" or "filter-exact" class
- filter_onlyAvail : 'filter-onlyAvail', // a header with a select dropdown & this class name will only show available ( visible ) options within the drop down
- filter_placeholder : { search : '', select : '' }, // default placeholder text ( overridden by any header 'data-placeholder' setting )
- filter_reset : null, // jQuery selector string of an element used to reset the filters
- filter_resetOnEsc : true, // Reset filter input when the user presses escape - normalized across browsers
- filter_saveFilters : false, // Use the $.tablesorter.storage utility to save the most recent filters
- filter_searchDelay : 300, // typing delay in milliseconds before starting a search
- filter_searchFiltered: true, // allow searching through already filtered rows in special circumstances; will speed up searching in large tables if true
- filter_selectSource : null, // include a function to return an array of values to be added to the column filter select
- filter_selectSourceSeparator : '|', // filter_selectSource array text left of the separator is added to the option value, right into the option text
- 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_startsWith : false, // if true, filter start from the beginning of the cell contents
- filter_useParsedData : false // filter all data using parsed content
- },
- format: function( table, c, wo ) {
- if ( !c.$table.hasClass( 'hasFilters' ) ) {
- tsf.init( table, c, wo );
- }
- },
- remove: function( table, c, wo, refreshing ) {
- var tbodyIndex, $tbody,
- $table = c.$table,
- $tbodies = c.$tbodies,
- events = (
- 'addRows updateCell update updateRows updateComplete appendCache filterReset ' +
- 'filterAndSortReset filterFomatterUpdate filterEnd search stickyHeadersInit '
- ).split( ' ' ).join( c.namespace + 'filter ' );
- $table
- .removeClass( 'hasFilters' )
- // add filter namespace to all BUT search
- .unbind( events.replace( ts.regex.spaces, ' ' ) )
- // remove the filter row even if refreshing, because the column might have been moved
- .find( '.' + tscss.filterRow ).remove();
- wo.filter_initialized = false;
- if ( refreshing ) { return; }
- for ( tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
- $tbody = ts.processTbody( table, $tbodies.eq( tbodyIndex ), true ); // remove tbody
- $tbody.children().removeClass( wo.filter_filteredRow ).show();
- ts.processTbody( table, $tbody, false ); // restore tbody
- }
- if ( wo.filter_reset ) {
- $( document ).undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' );
- }
- }
- });
-
- tsf = ts.filter = {
-
- // regex used in filter 'check' functions - not for general use and not documented
- regex: {
- regex : /^\/((?:\\\/|[^\/])+)\/([migyu]{0,5})?$/, // regex to test for regex
- child : /tablesorter-childRow/, // child row class name; this gets updated in the script
- filtered : /filtered/, // filtered (hidden) row class name; updated in the script
- type : /undefined|number/, // check type
- exact : /(^[\"\'=]+)|([\"\'=]+$)/g, // exact match (allow '==')
- operators : /[<>=]/g, // replace operators
- query : '(q|query)', // replace filter queries
- wild01 : /\?/g, // wild card match 0 or 1
- wild0More : /\*/g, // wild care match 0 or more
- quote : /\"/g,
- isNeg1 : /(>=?\s*-\d)/,
- isNeg2 : /(<=?\s*\d)/
- },
- // function( c, data ) { }
- // c = table.config
- // data.$row = jQuery object of the row currently being processed
- // data.$cells = jQuery object of all cells within the current row
- // data.filters = array of filters for all columns ( some may be undefined )
- // data.filter = filter for the current column
- // data.iFilter = same as data.filter, except lowercase ( if wo.filter_ignoreCase is true )
- // data.exact = table cell text ( or parsed data if column parser enabled; may be a number & not a string )
- // data.iExact = same as data.exact, except lowercase ( if wo.filter_ignoreCase is true; may be a number & not a string )
- // data.cache = table cell text from cache, so it has been parsed ( & in all lower case if c.ignoreCase is true )
- // data.cacheArray = An array of parsed content from each table cell in the row being processed
- // data.index = column index; table = table element ( DOM )
- // data.parsed = array ( by column ) of boolean values ( from filter_useParsedData or 'filter-parsed' class )
- types: {
- or : function( c, data, vars ) {
- // look for "|", but not if it is inside of a regular expression
- if ( ( tsfRegex.orTest.test( data.iFilter ) || tsfRegex.orSplit.test( data.filter ) ) &&
- // this test for regex has potential to slow down the overall search
- !tsfRegex.regex.test( data.filter ) ) {
- var indx, filterMatched, query, regex,
- // duplicate data but split filter
- data2 = $.extend( {}, data ),
- filter = data.filter.split( tsfRegex.orSplit ),
- iFilter = data.iFilter.split( tsfRegex.orSplit ),
- len = filter.length;
- for ( indx = 0; indx < len; indx++ ) {
- data2.nestedFilters = true;
- data2.filter = '' + ( tsf.parseFilter( c, filter[ indx ], data ) || '' );
- data2.iFilter = '' + ( tsf.parseFilter( c, iFilter[ indx ], data ) || '' );
- query = '(' + ( tsf.parseFilter( c, data2.filter, data ) || '' ) + ')';
- try {
- // use try/catch, because query may not be a valid regex if "|" is contained within a partial regex search,
- // e.g "/(Alex|Aar" -> Uncaught SyntaxError: Invalid regular expression: /(/(Alex)/: Unterminated group
- regex = new RegExp( data.isMatch ? query : '^' + query + '$', c.widgetOptions.filter_ignoreCase ? 'i' : '' );
- // filterMatched = data2.filter === '' && indx > 0 ? true
- // look for an exact match with the 'or' unless the 'filter-match' class is found
- filterMatched = regex.test( data2.exact ) || tsf.processTypes( c, data2, vars );
- if ( filterMatched ) {
- return filterMatched;
- }
- } catch ( error ) {
- return null;
- }
- }
- // may be null from processing types
- return filterMatched || false;
- }
- return null;
- },
- // Look for an AND or && operator ( logical and )
- and : function( c, data, vars ) {
- if ( tsfRegex.andTest.test( data.filter ) ) {
- var indx, filterMatched, result, query, regex,
- // duplicate data but split filter
- data2 = $.extend( {}, data ),
- filter = data.filter.split( tsfRegex.andSplit ),
- iFilter = data.iFilter.split( tsfRegex.andSplit ),
- len = filter.length;
- for ( indx = 0; indx < len; indx++ ) {
- data2.nestedFilters = true;
- data2.filter = '' + ( tsf.parseFilter( c, filter[ indx ], data ) || '' );
- data2.iFilter = '' + ( tsf.parseFilter( c, iFilter[ indx ], data ) || '' );
- query = ( '(' + ( tsf.parseFilter( c, data2.filter, data ) || '' ) + ')' )
- // replace wild cards since /(a*)/i will match anything
- .replace( tsfRegex.wild01, '\\S{1}' ).replace( tsfRegex.wild0More, '\\S*' );
- try {
- // use try/catch just in case RegExp is invalid
- regex = new RegExp( data.isMatch ? query : '^' + query + '$', c.widgetOptions.filter_ignoreCase ? 'i' : '' );
- // look for an exact match with the 'and' unless the 'filter-match' class is found
- result = ( regex.test( data2.exact ) || tsf.processTypes( c, data2, vars ) );
- if ( indx === 0 ) {
- filterMatched = result;
- } else {
- filterMatched = filterMatched && result;
- }
- } catch ( error ) {
- return null;
- }
- }
- // may be null from processing types
- return filterMatched || false;
- }
- return null;
- },
- // Look for regex
- regex: function( c, data ) {
- if ( tsfRegex.regex.test( data.filter ) ) {
- var matches,
- // cache regex per column for optimal speed
- regex = data.filter_regexCache[ data.index ] || tsfRegex.regex.exec( data.filter ),
- isRegex = regex instanceof RegExp;
- try {
- if ( !isRegex ) {
- // force case insensitive search if ignoreCase option set?
- // if ( c.ignoreCase && !regex[2] ) { regex[2] = 'i'; }
- data.filter_regexCache[ data.index ] = regex = new RegExp( regex[1], regex[2] );
- }
- matches = regex.test( data.exact );
- } catch ( error ) {
- matches = false;
- }
- return matches;
- }
- return null;
- },
- // Look for operators >, >=, < or <=
- operators: function( c, data ) {
- // ignore empty strings... because '' < 10 is true
- if ( tsfRegex.operTest.test( data.iFilter ) && data.iExact !== '' ) {
- var cachedValue, result, txt,
- table = c.table,
- parsed = data.parsed[ data.index ],
- query = ts.formatFloat( data.iFilter.replace( tsfRegex.operators, '' ), table ),
- parser = c.parsers[ data.index ] || {},
- savedSearch = query;
- // parse filter value in case we're comparing numbers ( dates )
- if ( parsed || parser.type === 'numeric' ) {
- txt = $.trim( '' + data.iFilter.replace( tsfRegex.operators, '' ) );
- result = tsf.parseFilter( c, txt, data, true );
- query = ( typeof result === 'number' && result !== '' && !isNaN( result ) ) ? result : query;
- }
- // iExact may be numeric - see issue #149;
- // check if cached is defined, because sometimes j goes out of range? ( numeric columns )
- if ( ( parsed || parser.type === 'numeric' ) && !isNaN( query ) &&
- typeof data.cache !== 'undefined' ) {
- cachedValue = data.cache;
- } else {
- txt = isNaN( data.iExact ) ? data.iExact.replace( ts.regex.nondigit, '' ) : data.iExact;
- cachedValue = ts.formatFloat( txt, table );
- }
- if ( tsfRegex.gtTest.test( data.iFilter ) ) {
- result = tsfRegex.gteTest.test( data.iFilter ) ? cachedValue >= query : cachedValue > query;
- } else if ( tsfRegex.ltTest.test( data.iFilter ) ) {
- result = tsfRegex.lteTest.test( data.iFilter ) ? cachedValue <= query : cachedValue < query;
- }
- // keep showing all rows if nothing follows the operator
- if ( !result && savedSearch === '' ) {
- result = true;
- }
- return result;
- }
- return null;
- },
- // Look for a not match
- notMatch: function( c, data ) {
- if ( tsfRegex.notTest.test( data.iFilter ) ) {
- var indx,
- txt = data.iFilter.replace( '!', '' ),
- filter = tsf.parseFilter( c, txt, data ) || '';
- if ( tsfRegex.exact.test( filter ) ) {
- // look for exact not matches - see #628
- filter = filter.replace( tsfRegex.exact, '' );
- return filter === '' ? true : $.trim( filter ) !== data.iExact;
- } else {
- indx = data.iExact.search( $.trim( filter ) );
- return filter === '' ? true :
- // return true if not found
- data.anyMatch ? indx < 0 :
- // return false if found
- !( c.widgetOptions.filter_startsWith ? indx === 0 : indx >= 0 );
- }
- }
- return null;
- },
- // Look for quotes or equals to get an exact match; ignore type since iExact could be numeric
- exact: function( c, data ) {
- /*jshint eqeqeq:false */
- if ( tsfRegex.exact.test( data.iFilter ) ) {
- var txt = data.iFilter.replace( tsfRegex.exact, '' ),
- filter = tsf.parseFilter( c, txt, data ) || '';
- // eslint-disable-next-line eqeqeq
- return data.anyMatch ? $.inArray( filter, data.rowArray ) >= 0 : filter == data.iExact;
- }
- return null;
- },
- // Look for a range ( using ' to ' or ' - ' ) - see issue #166; thanks matzhu!
- range : function( c, data ) {
- if ( tsfRegex.toTest.test( data.iFilter ) ) {
- var result, tmp, range1, range2,
- table = c.table,
- index = data.index,
- parsed = data.parsed[index],
- // make sure the dash is for a range and not indicating a negative number
- query = data.iFilter.split( tsfRegex.toSplit );
-
- tmp = query[0].replace( ts.regex.nondigit, '' ) || '';
- range1 = ts.formatFloat( tsf.parseFilter( c, tmp, data ), table );
- tmp = query[1].replace( ts.regex.nondigit, '' ) || '';
- range2 = ts.formatFloat( tsf.parseFilter( c, tmp, data ), table );
- // parse filter value in case we're comparing numbers ( dates )
- if ( parsed || c.parsers[ index ].type === 'numeric' ) {
- result = c.parsers[ index ].format( '' + query[0], table, c.$headers.eq( index ), index );
- range1 = ( result !== '' && !isNaN( result ) ) ? result : range1;
- result = c.parsers[ index ].format( '' + query[1], table, c.$headers.eq( index ), index );
- range2 = ( result !== '' && !isNaN( result ) ) ? result : range2;
- }
- if ( ( parsed || c.parsers[ index ].type === 'numeric' ) && !isNaN( range1 ) && !isNaN( range2 ) ) {
- result = data.cache;
- } else {
- tmp = isNaN( data.iExact ) ? data.iExact.replace( ts.regex.nondigit, '' ) : data.iExact;
- result = ts.formatFloat( tmp, table );
- }
- if ( range1 > range2 ) {
- tmp = range1; range1 = range2; range2 = tmp; // swap
- }
- return ( result >= range1 && result <= range2 ) || ( range1 === '' || range2 === '' );
- }
- return null;
- },
- // Look for wild card: ? = single, * = multiple, or | = logical OR
- wild : function( c, data ) {
- if ( tsfRegex.wildOrTest.test( data.iFilter ) ) {
- var query = '' + ( tsf.parseFilter( c, data.iFilter, data ) || '' );
- // look for an exact match with the 'or' unless the 'filter-match' class is found
- if ( !tsfRegex.wildTest.test( query ) && data.nestedFilters ) {
- query = data.isMatch ? query : '^(' + query + ')$';
- }
- // parsing the filter may not work properly when using wildcards =/
- try {
- return new RegExp(
- query.replace( tsfRegex.wild01, '\\S{1}' ).replace( tsfRegex.wild0More, '\\S*' ),
- c.widgetOptions.filter_ignoreCase ? 'i' : ''
- )
- .test( data.exact );
- } catch ( error ) {
- return null;
- }
- }
- return null;
- },
- // fuzzy text search; modified from https://github.com/mattyork/fuzzy ( MIT license )
- fuzzy: function( c, data ) {
- if ( tsfRegex.fuzzyTest.test( data.iFilter ) ) {
- var indx,
- patternIndx = 0,
- len = data.iExact.length,
- txt = data.iFilter.slice( 1 ),
- pattern = tsf.parseFilter( c, txt, data ) || '';
- for ( indx = 0; indx < len; indx++ ) {
- if ( data.iExact[ indx ] === pattern[ patternIndx ] ) {
- patternIndx += 1;
- }
- }
- return patternIndx === pattern.length;
- }
- return null;
- }
- },
- init: function( table ) {
- // filter language options
- ts.language = $.extend( true, {}, {
- to : 'to',
- or : 'or',
- and : 'and'
- }, ts.language );
-
- var options, string, txt, $header, column, val, fxn, noSelect,
- c = table.config,
- wo = c.widgetOptions,
- processStr = function(prefix, str, suffix) {
- str = str.trim();
- // don't include prefix/suffix if str is empty
- return str === '' ? '' : (prefix || '') + str + (suffix || '');
- };
- c.$table.addClass( 'hasFilters' );
- c.lastSearch = [];
-
- // define timers so using clearTimeout won't cause an undefined error
- wo.filter_searchTimer = null;
- wo.filter_initTimer = null;
- wo.filter_formatterCount = 0;
- wo.filter_formatterInit = [];
- wo.filter_anyColumnSelector = '[data-column="all"],[data-column="any"]';
- wo.filter_multipleColumnSelector = '[data-column*="-"],[data-column*=","]';
-
- val = '\\{' + tsfRegex.query + '\\}';
- $.extend( tsfRegex, {
- child : new RegExp( c.cssChildRow ),
- filtered : new RegExp( wo.filter_filteredRow ),
- alreadyFiltered : new RegExp( '(\\s+(-' + processStr('|', ts.language.or) + processStr('|', ts.language.to) + ')\\s+)', 'i' ),
- toTest : new RegExp( '\\s+(-' + processStr('|', ts.language.to) + ')\\s+', 'i' ),
- toSplit : new RegExp( '(?:\\s+(?:-' + processStr('|', ts.language.to) + ')\\s+)', 'gi' ),
- andTest : new RegExp( '\\s+(' + processStr('', ts.language.and, '|') + '&&)\\s+', 'i' ),
- andSplit : new RegExp( '(?:\\s+(?:' + processStr('', ts.language.and, '|') + '&&)\\s+)', 'gi' ),
- orTest : new RegExp( '(\\|' + processStr('|\\s+', ts.language.or, '\\s+') + ')', 'i' ),
- orSplit : new RegExp( '(?:\\|' + processStr('|\\s+(?:', ts.language.or, ')\\s+') + ')', 'gi' ),
- iQuery : new RegExp( val, 'i' ),
- igQuery : new RegExp( val, 'ig' ),
- operTest : /^[<>]=?/,
- gtTest : />/,
- gteTest : />=/,
- ltTest : /</,
- lteTest : /<=/,
- notTest : /^\!/,
- wildOrTest : /[\?\*\|]/,
- wildTest : /\?\*/,
- fuzzyTest : /^~/,
- exactTest : /[=\"\|!]/
- });
-
- // don't build filter row if columnFilters is false or all columns are set to 'filter-false'
- // see issue #156
- val = c.$headers.filter( '.filter-false, .parser-false' ).length;
- if ( wo.filter_columnFilters !== false && val !== c.$headers.length ) {
- // build filter row
- tsf.buildRow( table, c, wo );
- }
-
- txt = 'addRows updateCell update updateRows updateComplete appendCache filterReset ' +
- 'filterAndSortReset filterResetSaved filterEnd search '.split( ' ' ).join( c.namespace + 'filter ' );
- c.$table.bind( txt, function( event, filter ) {
- val = wo.filter_hideEmpty &&
- $.isEmptyObject( c.cache ) &&
- !( c.delayInit && event.type === 'appendCache' );
- // hide filter row using the 'filtered' class name
- c.$table.find( '.' + tscss.filterRow ).toggleClass( wo.filter_filteredRow, val ); // fixes #450
- if ( !/(search|filter)/.test( event.type ) ) {
- event.stopPropagation();
- tsf.buildDefault( table, true );
- }
- // Add filterAndSortReset - see #1361
- if ( event.type === 'filterReset' || event.type === 'filterAndSortReset' ) {
- c.$table.find( '.' + tscss.filter ).add( wo.filter_$externalFilters ).val( '' );
- if ( event.type === 'filterAndSortReset' ) {
- ts.sortReset( this.config, function() {
- tsf.searching( table, [] );
- });
- } else {
- tsf.searching( table, [] );
- }
- } else if ( event.type === 'filterResetSaved' ) {
- ts.storage( table, 'tablesorter-filters', '' );
- } else if ( event.type === 'filterEnd' ) {
- tsf.buildDefault( table, true );
- } else {
- // send false argument to force a new search; otherwise if the filter hasn't changed,
- // it will return
- filter = event.type === 'search' ? filter :
- event.type === 'updateComplete' ? c.$table.data( 'lastSearch' ) : '';
- if ( /(update|add)/.test( event.type ) && event.type !== 'updateComplete' ) {
- // force a new search since content has changed
- c.lastCombinedFilter = null;
- c.lastSearch = [];
- // update filterFormatters after update (& small delay) - Fixes #1237
- setTimeout(function() {
- c.$table.triggerHandler( 'filterFomatterUpdate' );
- }, 100);
- }
- // pass true ( skipFirst ) to prevent the tablesorter.setFilters function from skipping the first
- // input ensures all inputs are updated when a search is triggered on the table
- // $( 'table' ).trigger( 'search', [...] );
- tsf.searching( table, filter, true );
- }
- return false;
- });
-
- // reset button/link
- if ( wo.filter_reset ) {
- if ( wo.filter_reset instanceof $ ) {
- // reset contains a jQuery object, bind to it
- wo.filter_reset.click( function() {
- c.$table.triggerHandler( 'filterReset' );
- });
- } else if ( $( wo.filter_reset ).length ) {
- // reset is a jQuery selector, use event delegation
- $( document )
- .undelegate( wo.filter_reset, 'click' + c.namespace + 'filter' )
- .delegate( wo.filter_reset, 'click' + c.namespace + 'filter', function() {
- // trigger a reset event, so other functions ( filter_formatter ) know when to reset
- c.$table.triggerHandler( 'filterReset' );
- });
- }
- }
- if ( wo.filter_functions ) {
- for ( column = 0; column < c.columns; column++ ) {
- fxn = ts.getColumnData( table, wo.filter_functions, column );
- if ( fxn ) {
- // remove 'filter-select' from header otherwise the options added here are replaced with
- // all options
- $header = c.$headerIndexed[ column ].removeClass( 'filter-select' );
- // don't build select if 'filter-false' or 'parser-false' set
- noSelect = !( $header.hasClass( 'filter-false' ) || $header.hasClass( 'parser-false' ) );
- options = '';
- if ( fxn === true && noSelect ) {
- tsf.buildSelect( table, column );
- } else if ( typeof fxn === 'object' && noSelect ) {
- // add custom drop down list
- for ( string in fxn ) {
- if ( typeof string === 'string' ) {
- options += options === '' ?
- '<option value="">' +
- ( $header.data( 'placeholder' ) ||
- $header.attr( 'data-placeholder' ) ||
- wo.filter_placeholder.select ||
- ''
- ) +
- '</option>' : '';
- val = string;
- txt = string;
- if ( string.indexOf( wo.filter_selectSourceSeparator ) >= 0 ) {
- val = string.split( wo.filter_selectSourceSeparator );
- txt = val[1];
- val = val[0];
- }
- options += '<option ' +
- ( txt === val ? '' : 'data-function-name="' + string + '" ' ) +
- 'value="' + val + '">' + txt + '</option>';
- }
- }
- c.$table
- .find( 'thead' )
- .find( 'select.' + tscss.filter + '[data-column="' + column + '"]' )
- .append( options );
- txt = wo.filter_selectSource;
- fxn = typeof txt === 'function' ? true : ts.getColumnData( table, txt, column );
- if ( fxn ) {
- // updating so the extra options are appended
- tsf.buildSelect( c.table, column, '', true, $header.hasClass( wo.filter_onlyAvail ) );
- }
- }
- }
- }
- }
- // not really updating, but if the column has both the 'filter-select' class &
- // filter_functions set to true, it would append the same options twice.
- tsf.buildDefault( table, true );
-
- tsf.bindSearch( table, c.$table.find( '.' + tscss.filter ), true );
- if ( wo.filter_external ) {
- tsf.bindSearch( table, wo.filter_external );
- }
-
- if ( wo.filter_hideFilters ) {
- tsf.hideFilters( c );
- }
-
- // show processing icon
- if ( c.showProcessing ) {
- txt = 'filterStart filterEnd '.split( ' ' ).join( c.namespace + 'filter-sp ' );
- c.$table
- .unbind( txt.replace( ts.regex.spaces, ' ' ) )
- .bind( txt, function( event, columns ) {
- // only add processing to certain columns to all columns
- $header = ( columns ) ?
- c.$table
- .find( '.' + tscss.header )
- .filter( '[data-column]' )
- .filter( function() {
- return columns[ $( this ).data( 'column' ) ] !== '';
- }) : '';
- ts.isProcessing( table, event.type === 'filterStart', columns ? $header : '' );
- });
- }
-
- // set filtered rows count ( intially unfiltered )
- c.filteredRows = c.totalRows;
-
- // add default values
- txt = 'tablesorter-initialized pagerBeforeInitialized '.split( ' ' ).join( c.namespace + 'filter ' );
- c.$table
- .unbind( txt.replace( ts.regex.spaces, ' ' ) )
- .bind( txt, function() {
- tsf.completeInit( this );
- });
- // if filter widget is added after pager has initialized; then set filter init flag
- if ( c.pager && c.pager.initialized && !wo.filter_initialized ) {
- c.$table.triggerHandler( 'filterFomatterUpdate' );
- setTimeout( function() {
- tsf.filterInitComplete( c );
- }, 100 );
- } else if ( !wo.filter_initialized ) {
- tsf.completeInit( table );
- }
- },
- completeInit: function( table ) {
- // redefine 'c' & 'wo' so they update properly inside this callback
- var c = table.config,
- wo = c.widgetOptions,
- filters = tsf.setDefaults( table, c, wo ) || [];
- if ( filters.length ) {
- // prevent delayInit from triggering a cache build if filters are empty
- if ( !( c.delayInit && filters.join( '' ) === '' ) ) {
- ts.setFilters( table, filters, true );
- }
- }
- c.$table.triggerHandler( 'filterFomatterUpdate' );
- // trigger init after setTimeout to prevent multiple filterStart/End/Init triggers
- setTimeout( function() {
- if ( !wo.filter_initialized ) {
- tsf.filterInitComplete( c );
- }
- }, 100 );
- },
-
- // $cell parameter, but not the config, is passed to the filter_formatters,
- // so we have to work with it instead
- formatterUpdated: function( $cell, column ) {
- // prevent error if $cell is undefined - see #1056
- var $table = $cell && $cell.closest( 'table' );
- var config = $table.length && $table[0].config,
- wo = config && config.widgetOptions;
- if ( wo && !wo.filter_initialized ) {
- // add updates by column since this function
- // may be called numerous times before initialization
- wo.filter_formatterInit[ column ] = 1;
- }
- },
- filterInitComplete: function( c ) {
- var indx, len,
- wo = c.widgetOptions,
- count = 0,
- completed = function() {
- wo.filter_initialized = true;
- // update lastSearch - it gets cleared often
- c.lastSearch = c.$table.data( 'lastSearch' );
- c.$table.triggerHandler( 'filterInit', c );
- tsf.findRows( c.table, c.lastSearch || [] );
- if (ts.debug(c, 'filter')) {
- console.log('Filter >> Widget initialized');
- }
- };
- if ( $.isEmptyObject( wo.filter_formatter ) ) {
- completed();
- } else {
- len = wo.filter_formatterInit.length;
- for ( indx = 0; indx < len; indx++ ) {
- if ( wo.filter_formatterInit[ indx ] === 1 ) {
- count++;
- }
- }
- clearTimeout( wo.filter_initTimer );
- if ( !wo.filter_initialized && count === wo.filter_formatterCount ) {
- // filter widget initialized
- completed();
- } else if ( !wo.filter_initialized ) {
- // fall back in case a filter_formatter doesn't call
- // $.tablesorter.filter.formatterUpdated( $cell, column ), and the count is off
- wo.filter_initTimer = setTimeout( function() {
- completed();
- }, 500 );
- }
- }
- },
- // encode or decode filters for storage; see #1026
- processFilters: function( filters, encode ) {
- var indx,
- // fixes #1237; previously returning an encoded "filters" value
- result = [],
- mode = encode ? encodeURIComponent : decodeURIComponent,
- len = filters.length;
- for ( indx = 0; indx < len; indx++ ) {
- if ( filters[ indx ] ) {
- result[ indx ] = mode( filters[ indx ] );
- }
- }
- return result;
- },
- setDefaults: function( table, c, wo ) {
- var isArray, saved, indx, col, $filters,
- // get current ( default ) filters
- filters = ts.getFilters( table ) || [];
- if ( wo.filter_saveFilters && ts.storage ) {
- saved = ts.storage( table, 'tablesorter-filters' ) || [];
- isArray = $.isArray( saved );
- // make sure we're not just getting an empty array
- if ( !( isArray && saved.join( '' ) === '' || !isArray ) ) {
- filters = tsf.processFilters( saved );
- }
- }
- // if no filters saved, then check default settings
- if ( filters.join( '' ) === '' ) {
- // allow adding default setting to external filters
- $filters = c.$headers.add( wo.filter_$externalFilters )
- .filter( '[' + wo.filter_defaultAttrib + ']' );
- for ( indx = 0; indx <= c.columns; indx++ ) {
- // include data-column='all' external filters
- col = indx === c.columns ? 'all' : indx;
- filters[ indx ] = $filters
- .filter( '[data-column="' + col + '"]' )
- .attr( wo.filter_defaultAttrib ) || filters[indx] || '';
- }
- }
- c.$table.data( 'lastSearch', filters );
- return filters;
- },
- parseFilter: function( c, filter, data, parsed ) {
- return parsed || data.parsed[ data.index ] ?
- c.parsers[ data.index ].format( filter, c.table, [], data.index ) :
- filter;
- },
- buildRow: function( table, c, wo ) {
- var $filter, col, column, $header, makeSelect, disabled, name, ffxn, tmp,
- // c.columns defined in computeThIndexes()
- cellFilter = wo.filter_cellFilter,
- columns = c.columns,
- arry = $.isArray( cellFilter ),
- buildFilter = '<tr role="search" class="' + tscss.filterRow + ' ' + c.cssIgnoreRow + '">';
- for ( column = 0; column < columns; column++ ) {
- if ( c.$headerIndexed[ column ].length ) {
- // account for entire column set with colspan. See #1047
- tmp = c.$headerIndexed[ column ] && c.$headerIndexed[ column ][0].colSpan || 0;
- if ( tmp > 1 ) {
- buildFilter += '<td data-column="' + column + '-' + ( column + tmp - 1 ) + '" colspan="' + tmp + '"';
- } else {
- buildFilter += '<td data-column="' + column + '"';
- }
- if ( arry ) {
- buildFilter += ( cellFilter[ column ] ? ' class="' + cellFilter[ column ] + '"' : '' );
- } else {
- buildFilter += ( cellFilter !== '' ? ' class="' + cellFilter + '"' : '' );
- }
- buildFilter += '></td>';
- }
- }
- c.$filters = $( buildFilter += '</tr>' )
- .appendTo( c.$table.children( 'thead' ).eq( 0 ) )
- .children( 'td' );
- // build each filter input
- for ( column = 0; column < columns; column++ ) {
- disabled = false;
- // assuming last cell of a column is the main column
- $header = c.$headerIndexed[ column ];
- if ( $header && $header.length ) {
- // $filter = c.$filters.filter( '[data-column="' + column + '"]' );
- $filter = tsf.getColumnElm( c, c.$filters, column );
- ffxn = ts.getColumnData( table, wo.filter_functions, column );
- makeSelect = ( wo.filter_functions && ffxn && typeof ffxn !== 'function' ) ||
- $header.hasClass( 'filter-select' );
- // get data from jQuery data, metadata, headers option or header class name
- col = ts.getColumnData( table, c.headers, column );
- disabled = ts.getData( $header[0], col, 'filter' ) === 'false' ||
- ts.getData( $header[0], col, 'parser' ) === 'false';
-
- if ( makeSelect ) {
- buildFilter = $( '<select>' ).appendTo( $filter );
- } else {
- ffxn = ts.getColumnData( table, wo.filter_formatter, column );
- if ( ffxn ) {
- wo.filter_formatterCount++;
- buildFilter = ffxn( $filter, column );
- // no element returned, so lets go find it
- if ( buildFilter && buildFilter.length === 0 ) {
- buildFilter = $filter.children( 'input' );
- }
- // element not in DOM, so lets attach it
- if ( buildFilter && ( buildFilter.parent().length === 0 ||
- ( buildFilter.parent().length && buildFilter.parent()[0] !== $filter[0] ) ) ) {
- $filter.append( buildFilter );
- }
- } else {
- buildFilter = $( '<input type="search">' ).appendTo( $filter );
- }
- if ( buildFilter ) {
- tmp = $header.data( 'placeholder' ) ||
- $header.attr( 'data-placeholder' ) ||
- wo.filter_placeholder.search || '';
- buildFilter.attr( 'placeholder', tmp );
- }
- }
- if ( buildFilter ) {
- // add filter class name
- name = ( $.isArray( wo.filter_cssFilter ) ?
- ( typeof wo.filter_cssFilter[column] !== 'undefined' ? wo.filter_cssFilter[column] || '' : '' ) :
- wo.filter_cssFilter ) || '';
- // copy data-column from table cell (it will include colspan)
- buildFilter.addClass( tscss.filter + ' ' + name );
- name = wo.filter_filterLabel;
- tmp = name.match(/{{([^}]+?)}}/g);
- if (!tmp) {
- tmp = [ '{{label}}' ];
- }
- $.each(tmp, function(indx, attr) {
- var regex = new RegExp(attr, 'g'),
- data = $header.attr('data-' + attr.replace(/{{|}}/g, '')),
- text = typeof data === 'undefined' ? $header.text() : data;
- name = name.replace( regex, $.trim( text ) );
- });
- buildFilter.attr({
- 'data-column': $filter.attr( 'data-column' ),
- 'aria-label': name
- });
- if ( disabled ) {
- buildFilter.attr( 'placeholder', '' ).addClass( tscss.filterDisabled )[0].disabled = true;
- }
- }
- }
- }
- },
- bindSearch: function( table, $el, internal ) {
- table = $( table )[0];
- $el = $( $el ); // allow passing a selector string
- if ( !$el.length ) { return; }
- var tmp,
- c = table.config,
- wo = c.widgetOptions,
- namespace = c.namespace + 'filter',
- $ext = wo.filter_$externalFilters;
- if ( internal !== true ) {
- // save anyMatch element
- tmp = wo.filter_anyColumnSelector + ',' + wo.filter_multipleColumnSelector;
- wo.filter_$anyMatch = $el.filter( tmp );
- if ( $ext && $ext.length ) {
- wo.filter_$externalFilters = wo.filter_$externalFilters.add( $el );
- } else {
- wo.filter_$externalFilters = $el;
- }
- // update values ( external filters added after table initialization )
- ts.setFilters( table, c.$table.data( 'lastSearch' ) || [], internal === false );
- }
- // unbind events
- tmp = ( 'keypress keyup keydown search change input '.split( ' ' ).join( namespace + ' ' ) );
- $el
- // use data attribute instead of jQuery data since the head is cloned without including
- // the data/binding
- .attr( 'data-lastSearchTime', new Date().getTime() )
- .unbind( tmp.replace( ts.regex.spaces, ' ' ) )
- .bind( 'keydown' + namespace, function( event ) {
- if ( event.which === tskeyCodes.escape && !table.config.widgetOptions.filter_resetOnEsc ) {
- // prevent keypress event
- return false;
- }
- })
- .bind( 'keyup' + namespace, function( event ) {
- wo = table.config.widgetOptions; // make sure "wo" isn't cached
- var column = parseInt( $( this ).attr( 'data-column' ), 10 ),
- liveSearch = typeof wo.filter_liveSearch === 'boolean' ? wo.filter_liveSearch :
- ts.getColumnData( table, wo.filter_liveSearch, column );
- if ( typeof liveSearch === 'undefined' ) {
- liveSearch = wo.filter_liveSearch.fallback || false;
- }
- $( this ).attr( 'data-lastSearchTime', new Date().getTime() );
- // emulate what webkit does.... escape clears the filter
- if ( event.which === tskeyCodes.escape ) {
- // make sure to restore the last value on escape
- this.value = wo.filter_resetOnEsc ? '' : c.lastSearch[column];
- // don't return if the search value is empty ( all rows need to be revealed )
- } else if ( this.value !== '' && (
- // liveSearch can contain a min value length; ignore arrow and meta keys, but allow backspace
- ( typeof liveSearch === 'number' && this.value.length < liveSearch ) ||
- // let return & backspace continue on, but ignore arrows & non-valid characters
- ( event.which !== tskeyCodes.enter && event.which !== tskeyCodes.backSpace &&
- ( event.which < tskeyCodes.space || ( event.which >= tskeyCodes.left && event.which <= tskeyCodes.down ) ) ) ) ) {
- return;
- // live search
- } else if ( liveSearch === false ) {
- if ( this.value !== '' && event.which !== tskeyCodes.enter ) {
- return;
- }
- }
- // change event = no delay; last true flag tells getFilters to skip newest timed input
- tsf.searching( table, true, true, column );
- })
- // include change for select - fixes #473
- .bind( 'search change keypress input blur '.split( ' ' ).join( namespace + ' ' ), function( event ) {
- // don't get cached data, in case data-column changes dynamically
- var column = parseInt( $( this ).attr( 'data-column' ), 10 ),
- eventType = event.type,
- liveSearch = typeof wo.filter_liveSearch === 'boolean' ?
- wo.filter_liveSearch :
- ts.getColumnData( table, wo.filter_liveSearch, column );
- if ( table.config.widgetOptions.filter_initialized &&
- // immediate search if user presses enter
- ( event.which === tskeyCodes.enter ||
- // immediate search if a "search" or "blur" is triggered on the input
- ( eventType === 'search' || eventType === 'blur' ) ||
- // change & input events must be ignored if liveSearch !== true
- ( eventType === 'change' || eventType === 'input' ) &&
- // prevent search if liveSearch is a number
- ( liveSearch === true || liveSearch !== true && event.target.nodeName !== 'INPUT' ) &&
- // don't allow 'change' or 'input' event to process if the input value
- // is the same - fixes #685
- this.value !== c.lastSearch[column]
- )
- ) {
- event.preventDefault();
- // init search with no delay
- $( this ).attr( 'data-lastSearchTime', new Date().getTime() );
- tsf.searching( table, eventType !== 'keypress', true, column );
- }
- });
- },
- searching: function( table, filter, skipFirst, column ) {
- var liveSearch,
- wo = table.config.widgetOptions;
- if (typeof column === 'undefined') {
- // no delay
- liveSearch = false;
- } else {
- liveSearch = typeof wo.filter_liveSearch === 'boolean' ?
- wo.filter_liveSearch :
- // get column setting, or set to fallback value, or default to false
- ts.getColumnData( table, wo.filter_liveSearch, column );
- if ( typeof liveSearch === 'undefined' ) {
- liveSearch = wo.filter_liveSearch.fallback || false;
- }
- }
- clearTimeout( wo.filter_searchTimer );
- if ( typeof filter === 'undefined' || filter === true ) {
- // delay filtering
- wo.filter_searchTimer = setTimeout( function() {
- tsf.checkFilters( table, filter, skipFirst );
- }, liveSearch ? wo.filter_searchDelay : 10 );
- } else {
- // skip delay
- tsf.checkFilters( table, filter, skipFirst );
- }
- },
- equalFilters: function (c, filter1, filter2) {
- var indx,
- f1 = [],
- f2 = [],
- len = c.columns + 1; // add one to include anyMatch filter
- filter1 = $.isArray(filter1) ? filter1 : [];
- filter2 = $.isArray(filter2) ? filter2 : [];
- for (indx = 0; indx < len; indx++) {
- f1[indx] = filter1[indx] || '';
- f2[indx] = filter2[indx] || '';
- }
- return f1.join(',') === f2.join(',');
- },
- checkFilters: function( table, filter, skipFirst ) {
- var c = table.config,
- wo = c.widgetOptions,
- filterArray = $.isArray( filter ),
- filters = ( filterArray ) ? filter : ts.getFilters( table, true ),
- currentFilters = filters || []; // current filter values
- // prevent errors if delay init is set
- if ( $.isEmptyObject( c.cache ) ) {
- // update cache if delayInit set & pager has initialized ( after user initiates a search )
- if ( c.delayInit && ( !c.pager || c.pager && c.pager.initialized ) ) {
- ts.updateCache( c, function() {
- tsf.checkFilters( table, false, skipFirst );
- });
- }
- return;
- }
- // add filter array back into inputs
- if ( filterArray ) {
- ts.setFilters( table, filters, false, skipFirst !== true );
- if ( !wo.filter_initialized ) {
- c.lastSearch = [];
- c.lastCombinedFilter = '';
- }
- }
- if ( wo.filter_hideFilters ) {
- // show/hide filter row as needed
- c.$table
- .find( '.' + tscss.filterRow )
- .triggerHandler( tsf.hideFiltersCheck( c ) ? 'mouseleave' : 'mouseenter' );
- }
- // return if the last search is the same; but filter === false when updating the search
- // see example-widget-filter.html filter toggle buttons
- if ( tsf.equalFilters(c, c.lastSearch, currentFilters) && filter !== false ) {
- return;
- } else if ( filter === false ) {
- // force filter refresh
- c.lastCombinedFilter = '';
- c.lastSearch = [];
- }
- // define filter inside it is false
- filters = filters || [];
- // convert filters to strings - see #1070
- filters = Array.prototype.map ?
- filters.map( String ) :
- // for IE8 & older browsers - maybe not the best method
- filters.join( '\ufffd' ).split( '\ufffd' );
-
- if ( wo.filter_initialized ) {
- c.$table.triggerHandler( 'filterStart', [ filters ] );
- }
- if ( c.showProcessing ) {
- // give it time for the processing icon to kick in
- setTimeout( function() {
- tsf.findRows( table, filters, currentFilters );
- return false;
- }, 30 );
- } else {
- tsf.findRows( table, filters, currentFilters );
- return false;
- }
- },
- hideFiltersCheck: function( c ) {
- if (typeof c.widgetOptions.filter_hideFilters === 'function') {
- var val = c.widgetOptions.filter_hideFilters( c );
- if (typeof val === 'boolean') {
- return val;
- }
- }
- return ts.getFilters( c.$table ).join( '' ) === '';
- },
- hideFilters: function( c, $table ) {
- var timer;
- ( $table || c.$table )
- .find( '.' + tscss.filterRow )
- .addClass( tscss.filterRowHide )
- .bind( 'mouseenter mouseleave', function( e ) {
- // save event object - http://bugs.jquery.com/ticket/12140
- var event = e,
- $row = $( this );
- clearTimeout( timer );
- timer = setTimeout( function() {
- if ( /enter|over/.test( event.type ) ) {
- $row.removeClass( tscss.filterRowHide );
- } else {
- // don't hide if input has focus
- // $( ':focus' ) needs jQuery 1.6+
- if ( $( document.activeElement ).closest( 'tr' )[0] !== $row[0] ) {
- // don't hide row if any filter has a value
- $row.toggleClass( tscss.filterRowHide, tsf.hideFiltersCheck( c ) );
- }
- }
- }, 200 );
- })
- .find( 'input, select' ).bind( 'focus blur', function( e ) {
- var event = e,
- $row = $( this ).closest( 'tr' );
- clearTimeout( timer );
- timer = setTimeout( function() {
- clearTimeout( timer );
- // don't hide row if any filter has a value
- $row.toggleClass( tscss.filterRowHide, tsf.hideFiltersCheck( c ) && event.type !== 'focus' );
- }, 200 );
- });
- },
- defaultFilter: function( filter, mask ) {
- if ( filter === '' ) { return filter; }
- var regex = tsfRegex.iQuery,
- maskLen = mask.match( tsfRegex.igQuery ).length,
- query = maskLen > 1 ? $.trim( filter ).split( /\s/ ) : [ $.trim( filter ) ],
- len = query.length - 1,
- indx = 0,
- val = mask;
- if ( len < 1 && maskLen > 1 ) {
- // only one 'word' in query but mask has >1 slots
- query[1] = query[0];
- }
- // replace all {query} with query words...
- // if query = 'Bob', then convert mask from '!{query}' to '!Bob'
- // if query = 'Bob Joe Frank', then convert mask '{q} OR {q}' to 'Bob OR Joe OR Frank'
- while ( regex.test( val ) ) {
- val = val.replace( regex, query[indx++] || '' );
- if ( regex.test( val ) && indx < len && ( query[indx] || '' ) !== '' ) {
- val = mask.replace( regex, val );
- }
- }
- return val;
- },
- getLatestSearch: function( $input ) {
- if ( $input ) {
- return $input.sort( function( a, b ) {
- return $( b ).attr( 'data-lastSearchTime' ) - $( a ).attr( 'data-lastSearchTime' );
- });
- }
- return $input || $();
- },
- findRange: function( c, val, ignoreRanges ) {
- // look for multiple columns '1-3,4-6,8' in data-column
- var temp, ranges, range, start, end, singles, i, indx, len,
- columns = [];
- if ( /^[0-9]+$/.test( val ) ) {
- // always return an array
- return [ parseInt( val, 10 ) ];
- }
- // process column range
- if ( !ignoreRanges && /-/.test( val ) ) {
- ranges = val.match( /(\d+)\s*-\s*(\d+)/g );
- len = ranges ? ranges.length : 0;
- for ( indx = 0; indx < len; indx++ ) {
- range = ranges[indx].split( /\s*-\s*/ );
- start = parseInt( range[0], 10 ) || 0;
- end = parseInt( range[1], 10 ) || ( c.columns - 1 );
- if ( start > end ) {
- temp = start; start = end; end = temp; // swap
- }
- if ( end >= c.columns ) {
- end = c.columns - 1;
- }
- for ( ; start <= end; start++ ) {
- columns[ columns.length ] = start;
- }
- // remove processed range from val
- val = val.replace( ranges[ indx ], '' );
- }
- }
- // process single columns
- if ( !ignoreRanges && /,/.test( val ) ) {
- singles = val.split( /\s*,\s*/ );
- len = singles.length;
- for ( i = 0; i < len; i++ ) {
- if ( singles[ i ] !== '' ) {
- indx = parseInt( singles[ i ], 10 );
- if ( indx < c.columns ) {
- columns[ columns.length ] = indx;
- }
- }
- }
- }
- // return all columns
- if ( !columns.length ) {
- for ( indx = 0; indx < c.columns; indx++ ) {
- columns[ columns.length ] = indx;
- }
- }
- return columns;
- },
- getColumnElm: function( c, $elements, column ) {
- // data-column may contain multiple columns '1-3,5-6,8'
- // replaces: c.$filters.filter( '[data-column="' + column + '"]' );
- return $elements.filter( function() {
- var cols = tsf.findRange( c, $( this ).attr( 'data-column' ) );
- return $.inArray( column, cols ) > -1;
- });
- },
- multipleColumns: function( c, $input ) {
- // look for multiple columns '1-3,4-6,8' in data-column
- var wo = c.widgetOptions,
- // only target 'all' column inputs on initialization
- // & don't target 'all' column inputs if they don't exist
- targets = wo.filter_initialized || !$input.filter( wo.filter_anyColumnSelector ).length,
- val = $.trim( tsf.getLatestSearch( $input ).attr( 'data-column' ) || '' );
- return tsf.findRange( c, val, !targets );
- },
- processTypes: function( c, data, vars ) {
- var ffxn,
- filterMatched = null,
- matches = null;
- for ( ffxn in tsf.types ) {
- if ( $.inArray( ffxn, vars.excludeMatch ) < 0 && matches === null ) {
- matches = tsf.types[ffxn]( c, data, vars );
- if ( matches !== null ) {
- data.matchedOn = ffxn;
- filterMatched = matches;
- }
- }
- }
- return filterMatched;
- },
- matchType: function( c, columnIndex ) {
- var isMatch,
- wo = c.widgetOptions,
- $el = c.$headerIndexed[ columnIndex ];
- // filter-exact > filter-match > filter_matchType for type
- if ( $el.hasClass( 'filter-exact' ) ) {
- isMatch = false;
- } else if ( $el.hasClass( 'filter-match' ) ) {
- isMatch = true;
- } else {
- // filter-select is not applied when filter_functions are used, so look for a select
- if ( wo.filter_columnFilters ) {
- $el = c.$filters
- .find( '.' + tscss.filter )
- .add( wo.filter_$externalFilters )
- .filter( '[data-column="' + columnIndex + '"]' );
- } else if ( wo.filter_$externalFilters ) {
- $el = wo.filter_$externalFilters.filter( '[data-column="' + columnIndex + '"]' );
- }
- isMatch = $el.length ?
- c.widgetOptions.filter_matchType[ ( $el[ 0 ].nodeName || '' ).toLowerCase() ] === 'match' :
- // default to exact, if no inputs found
- false;
- }
- return isMatch;
- },
- processRow: function( c, data, vars ) {
- var result, filterMatched,
- fxn, ffxn, txt,
- wo = c.widgetOptions,
- showRow = true,
- hasAnyMatchInput = wo.filter_$anyMatch && wo.filter_$anyMatch.length,
-
- // if wo.filter_$anyMatch data-column attribute is changed dynamically
- // we don't want to do an "anyMatch" search on one column using data
- // for the entire row - see #998
- columnIndex = wo.filter_$anyMatch && wo.filter_$anyMatch.length ?
- // look for multiple columns '1-3,4-6,8'
- tsf.multipleColumns( c, wo.filter_$anyMatch ) :
- [];
- data.$cells = data.$row.children();
- data.matchedOn = null;
- if ( data.anyMatchFlag && columnIndex.length > 1 || ( data.anyMatchFilter && !hasAnyMatchInput ) ) {
- data.anyMatch = true;
- data.isMatch = true;
- data.rowArray = data.$cells.map( function( i ) {
- if ( $.inArray( i, columnIndex ) > -1 || ( data.anyMatchFilter && !hasAnyMatchInput ) ) {
- if ( data.parsed[ i ] ) {
- txt = data.cacheArray[ i ];
- } else {
- txt = data.rawArray[ i ];
- txt = $.trim( wo.filter_ignoreCase ? txt.toLowerCase() : txt );
- if ( c.sortLocaleCompare ) {
- txt = ts.replaceAccents( txt );
- }
- }
- return txt;
- }
- }).get();
- data.filter = data.anyMatchFilter;
- data.iFilter = data.iAnyMatchFilter;
- data.exact = data.rowArray.join( ' ' );
- data.iExact = wo.filter_ignoreCase ? data.exact.toLowerCase() : data.exact;
- data.cache = data.cacheArray.slice( 0, -1 ).join( ' ' );
- vars.excludeMatch = vars.noAnyMatch;
- filterMatched = tsf.processTypes( c, data, vars );
- if ( filterMatched !== null ) {
- showRow = filterMatched;
- } else {
- if ( wo.filter_startsWith ) {
- showRow = false;
- // data.rowArray may not contain all columns
- columnIndex = Math.min( c.columns, data.rowArray.length );
- while ( !showRow && columnIndex > 0 ) {
- columnIndex--;
- showRow = showRow || data.rowArray[ columnIndex ].indexOf( data.iFilter ) === 0;
- }
- } else {
- showRow = ( data.iExact + data.childRowText ).indexOf( data.iFilter ) >= 0;
- }
- }
- data.anyMatch = false;
- // no other filters to process
- if ( data.filters.join( '' ) === data.filter ) {
- return showRow;
- }
- }
-
- for ( columnIndex = 0; columnIndex < c.columns; columnIndex++ ) {
- data.filter = data.filters[ columnIndex ];
- data.index = columnIndex;
-
- // filter types to exclude, per column
- vars.excludeMatch = vars.excludeFilter[ columnIndex ];
-
- // ignore if filter is empty or disabled
- if ( data.filter ) {
- data.cache = data.cacheArray[ columnIndex ];
- result = data.parsed[ columnIndex ] ? data.cache : data.rawArray[ columnIndex ] || '';
- data.exact = c.sortLocaleCompare ? ts.replaceAccents( result ) : result; // issue #405
- data.iExact = !tsfRegex.type.test( typeof data.exact ) && wo.filter_ignoreCase ?
- data.exact.toLowerCase() : data.exact;
- data.isMatch = tsf.matchType( c, columnIndex );
-
- result = showRow; // if showRow is true, show that row
-
- // in case select filter option has a different value vs text 'a - z|A through Z'
- ffxn = wo.filter_columnFilters ?
- c.$filters.add( wo.filter_$externalFilters )
- .filter( '[data-column="' + columnIndex + '"]' )
- .find( 'select option:selected' )
- .attr( 'data-function-name' ) || '' : '';
- // replace accents - see #357
- if ( c.sortLocaleCompare ) {
- data.filter = ts.replaceAccents( data.filter );
- }
-
- // replace column specific default filters - see #1088
- if ( wo.filter_defaultFilter && tsfRegex.iQuery.test( vars.defaultColFilter[ columnIndex ] ) ) {
- data.filter = tsf.defaultFilter( data.filter, vars.defaultColFilter[ columnIndex ] );
- }
-
- // data.iFilter = case insensitive ( if wo.filter_ignoreCase is true ),
- // data.filter = case sensitive
- data.iFilter = wo.filter_ignoreCase ? ( data.filter || '' ).toLowerCase() : data.filter;
- fxn = vars.functions[ columnIndex ];
- filterMatched = null;
- if ( fxn ) {
- if ( typeof fxn === 'function' ) {
- // filter callback( exact cell content, parser normalized content,
- // filter input value, column index, jQuery row object )
- filterMatched = fxn( data.exact, data.cache, data.filter, columnIndex, data.$row, c, data );
- } else if ( typeof fxn[ ffxn || data.filter ] === 'function' ) {
- // selector option function
- txt = ffxn || data.filter;
- filterMatched =
- fxn[ txt ]( data.exact, data.cache, data.filter, columnIndex, data.$row, c, data );
- }
- }
- if ( filterMatched === null ) {
- // cycle through the different filters
- // filters return a boolean or null if nothing matches
- filterMatched = tsf.processTypes( c, data, vars );
- // select with exact match; ignore "and" or "or" within the text; fixes #1486
- txt = fxn === true && (data.matchedOn === 'and' || data.matchedOn === 'or');
- if ( filterMatched !== null && !txt) {
- result = filterMatched;
- // Look for match, and add child row data for matching
- } else {
- // check fxn (filter-select in header) after filter types are checked
- // without this, the filter + jQuery UI selectmenu demo was breaking
- if ( fxn === true ) {
- // default selector uses exact match unless 'filter-match' class is found
- result = data.isMatch ?
- // data.iExact may be a number
- ( '' + data.iExact ).search( data.iFilter ) >= 0 :
- data.filter === data.exact;
- } else {
- txt = ( data.iExact + data.childRowText ).indexOf( tsf.parseFilter( c, data.iFilter, data ) );
- result = ( ( !wo.filter_startsWith && txt >= 0 ) || ( wo.filter_startsWith && txt === 0 ) );
- }
- }
- } else {
- result = filterMatched;
- }
- showRow = ( result ) ? showRow : false;
- }
- }
- return showRow;
- },
- findRows: function( table, filters, currentFilters ) {
- if (
- tsf.equalFilters(table.config, table.config.lastSearch, currentFilters) ||
- !table.config.widgetOptions.filter_initialized
- ) {
- return;
- }
- var len, norm_rows, rowData, $rows, $row, rowIndex, tbodyIndex, $tbody, columnIndex,
- isChild, childRow, lastSearch, showRow, showParent, time, val, indx,
- notFiltered, searchFiltered, query, injected, res, id, txt,
- storedFilters = $.extend( [], filters ),
- c = table.config,
- wo = c.widgetOptions,
- debug = ts.debug(c, 'filter'),
- // data object passed to filters; anyMatch is a flag for the filters
- data = {
- anyMatch: false,
- filters: filters,
- // regex filter type cache
- filter_regexCache : []
- },
- vars = {
- // anyMatch really screws up with these types of filters
- noAnyMatch: [ 'range', 'operators' ],
- // cache filter variables that use ts.getColumnData in the main loop
- functions : [],
- excludeFilter : [],
- defaultColFilter : [],
- defaultAnyFilter : ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || ''
- };
- // parse columns after formatter, in case the class is added at that point
- data.parsed = [];
- for ( columnIndex = 0; columnIndex < c.columns; columnIndex++ ) {
- data.parsed[ columnIndex ] = wo.filter_useParsedData ||
- // parser has a "parsed" parameter
- ( c.parsers && c.parsers[ columnIndex ] && c.parsers[ columnIndex ].parsed ||
- // getData may not return 'parsed' if other 'filter-' class names exist
- // ( e.g. <th class="filter-select filter-parsed"> )
- ts.getData && ts.getData( c.$headerIndexed[ columnIndex ],
- ts.getColumnData( table, c.headers, columnIndex ), 'filter' ) === 'parsed' ||
- c.$headerIndexed[ columnIndex ].hasClass( 'filter-parsed' ) );
-
- vars.functions[ columnIndex ] =
- ts.getColumnData( table, wo.filter_functions, columnIndex ) ||
- c.$headerIndexed[ columnIndex ].hasClass( 'filter-select' );
- vars.defaultColFilter[ columnIndex ] =
- ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '';
- vars.excludeFilter[ columnIndex ] =
- ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split( /\s+/ );
- }
-
- if ( debug ) {
- console.log( 'Filter >> Starting filter widget search', filters );
- time = new Date();
- }
- // filtered rows count
- c.filteredRows = 0;
- c.totalRows = 0;
- currentFilters = ( storedFilters || [] );
-
- for ( tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++ ) {
- $tbody = ts.processTbody( table, c.$tbodies.eq( tbodyIndex ), true );
- // skip child rows & widget added ( removable ) rows - fixes #448 thanks to @hempel!
- // $rows = $tbody.children( 'tr' ).not( c.selectorRemove );
- columnIndex = c.columns;
- // convert stored rows into a jQuery object
- norm_rows = c.cache[ tbodyIndex ].normalized;
- $rows = $( $.map( norm_rows, function( el ) {
- return el[ columnIndex ].$row.get();
- }) );
-
- if ( currentFilters.join('') === '' || wo.filter_serversideFiltering ) {
- $rows
- .removeClass( wo.filter_filteredRow )
- .not( '.' + c.cssChildRow )
- .css( 'display', '' );
- } else {
- // filter out child rows
- $rows = $rows.not( '.' + c.cssChildRow );
- len = $rows.length;
-
- if ( ( wo.filter_$anyMatch && wo.filter_$anyMatch.length ) ||
- typeof filters[c.columns] !== 'undefined' ) {
- data.anyMatchFlag = true;
- data.anyMatchFilter = '' + (
- filters[ c.columns ] ||
- wo.filter_$anyMatch && tsf.getLatestSearch( wo.filter_$anyMatch ).val() ||
- ''
- );
- if ( wo.filter_columnAnyMatch ) {
- // specific columns search
- query = data.anyMatchFilter.split( tsfRegex.andSplit );
- injected = false;
- for ( indx = 0; indx < query.length; indx++ ) {
- res = query[ indx ].split( ':' );
- if ( res.length > 1 ) {
- // make the column a one-based index ( non-developers start counting from one :P )
- if ( isNaN( res[0] ) ) {
- $.each( c.headerContent, function( i, txt ) {
- // multiple matches are possible
- if ( txt.toLowerCase().indexOf( res[0] ) > -1 ) {
- id = i;
- filters[ id ] = res[1];
- }
- });
- } else {
- id = parseInt( res[0], 10 ) - 1;
- }
- if ( id >= 0 && id < c.columns ) { // if id is an integer
- filters[ id ] = res[1];
- query.splice( indx, 1 );
- indx--;
- injected = true;
- }
- }
- }
- if ( injected ) {
- data.anyMatchFilter = query.join( ' && ' );
- }
- }
- }
-
- // optimize searching only through already filtered rows - see #313
- searchFiltered = wo.filter_searchFiltered;
- lastSearch = c.lastSearch || c.$table.data( 'lastSearch' ) || [];
- if ( searchFiltered ) {
- // cycle through all filters; include last ( columnIndex + 1 = match any column ). Fixes #669
- for ( indx = 0; indx < columnIndex + 1; indx++ ) {
- val = filters[indx] || '';
- // break out of loop if we've already determined not to search filtered rows
- if ( !searchFiltered ) { indx = columnIndex; }
- // search already filtered rows if...
- searchFiltered = searchFiltered && lastSearch.length &&
- // there are no changes from beginning of filter
- val.indexOf( lastSearch[indx] || '' ) === 0 &&
- // if there is NOT a logical 'or', or range ( 'to' or '-' ) in the string
- !tsfRegex.alreadyFiltered.test( val ) &&
- // if we are not doing exact matches, using '|' ( logical or ) or not '!'
- !tsfRegex.exactTest.test( val ) &&
- // don't search only filtered if the value is negative
- // ( '> -10' => '> -100' will ignore hidden rows )
- !( tsfRegex.isNeg1.test( val ) || tsfRegex.isNeg2.test( val ) ) &&
- // if filtering using a select without a 'filter-match' class ( exact match ) - fixes #593
- !( val !== '' && c.$filters && c.$filters.filter( '[data-column="' + indx + '"]' ).find( 'select' ).length &&
- !tsf.matchType( c, indx ) );
- }
- }
- notFiltered = $rows.not( '.' + wo.filter_filteredRow ).length;
- // can't search when all rows are hidden - this happens when looking for exact matches
- if ( searchFiltered && notFiltered === 0 ) { searchFiltered = false; }
- if ( debug ) {
- console.log( 'Filter >> Searching through ' +
- ( searchFiltered && notFiltered < len ? notFiltered : 'all' ) + ' rows' );
- }
- if ( data.anyMatchFlag ) {
- if ( c.sortLocaleCompare ) {
- // replace accents
- data.anyMatchFilter = ts.replaceAccents( data.anyMatchFilter );
- }
- if ( wo.filter_defaultFilter && tsfRegex.iQuery.test( vars.defaultAnyFilter ) ) {
- data.anyMatchFilter = tsf.defaultFilter( data.anyMatchFilter, vars.defaultAnyFilter );
- // clear search filtered flag because default filters are not saved to the last search
- searchFiltered = false;
- }
- // make iAnyMatchFilter lowercase unless both filter widget & core ignoreCase options are true
- // when c.ignoreCase is true, the cache contains all lower case data
- data.iAnyMatchFilter = !( wo.filter_ignoreCase && c.ignoreCase ) ?
- data.anyMatchFilter :
- data.anyMatchFilter.toLowerCase();
- }
-
- // loop through the rows
- for ( rowIndex = 0; rowIndex < len; rowIndex++ ) {
-
- txt = $rows[ rowIndex ].className;
- // the first row can never be a child row
- isChild = rowIndex && tsfRegex.child.test( txt );
- // skip child rows & already filtered rows
- if ( isChild || ( searchFiltered && tsfRegex.filtered.test( txt ) ) ) {
- continue;
- }
-
- data.$row = $rows.eq( rowIndex );
- data.rowIndex = rowIndex;
- data.cacheArray = norm_rows[ rowIndex ];
- rowData = data.cacheArray[ c.columns ];
- data.rawArray = rowData.raw;
- data.childRowText = '';
-
- if ( !wo.filter_childByColumn ) {
- txt = '';
- // child row cached text
- childRow = rowData.child;
- // so, if 'table.config.widgetOptions.filter_childRows' is true and there is
- // a match anywhere in the child row, then it will make the row visible
- // checked here so the option can be changed dynamically
- for ( indx = 0; indx < childRow.length; indx++ ) {
- txt += ' ' + childRow[indx].join( ' ' ) || '';
- }
- data.childRowText = wo.filter_childRows ?
- ( wo.filter_ignoreCase ? txt.toLowerCase() : txt ) :
- '';
- }
-
- showRow = false;
- showParent = tsf.processRow( c, data, vars );
- $row = rowData.$row;
-
- // don't pass reference to val
- val = showParent ? true : false;
- childRow = rowData.$row.filter( ':gt(0)' );
- if ( wo.filter_childRows && childRow.length ) {
- if ( wo.filter_childByColumn ) {
- if ( !wo.filter_childWithSibs ) {
- // hide all child rows
- childRow.addClass( wo.filter_filteredRow );
- // if only showing resulting child row, only include parent
- $row = $row.eq( 0 );
- }
- // cycle through each child row
- for ( indx = 0; indx < childRow.length; indx++ ) {
- data.$row = childRow.eq( indx );
- data.cacheArray = rowData.child[ indx ];
- data.rawArray = data.cacheArray;
- val = tsf.processRow( c, data, vars );
- // use OR comparison on child rows
- showRow = showRow || val;
- if ( !wo.filter_childWithSibs && val ) {
- childRow.eq( indx ).removeClass( wo.filter_filteredRow );
- }
- }
- }
- // keep parent row match even if no child matches... see #1020
- showRow = showRow || showParent;
- } else {
- showRow = val;
- }
- $row
- .toggleClass( wo.filter_filteredRow, !showRow )[0]
- .display = showRow ? '' : 'none';
- }
- }
- c.filteredRows += $rows.not( '.' + wo.filter_filteredRow ).length;
- c.totalRows += $rows.length;
- ts.processTbody( table, $tbody, false );
- }
- // lastCombinedFilter is no longer used internally
- c.lastCombinedFilter = storedFilters.join(''); // save last search
- // don't save 'filters' directly since it may have altered ( AnyMatch column searches )
- c.lastSearch = storedFilters;
- c.$table.data( 'lastSearch', storedFilters );
- if ( wo.filter_saveFilters && ts.storage ) {
- ts.storage( table, 'tablesorter-filters', tsf.processFilters( storedFilters, true ) );
- }
- if ( debug ) {
- console.log( 'Filter >> Completed search' + ts.benchmark(time) );
- }
- if ( wo.filter_initialized ) {
- c.$table.triggerHandler( 'filterBeforeEnd', c );
- c.$table.triggerHandler( 'filterEnd', c );
- }
- setTimeout( function() {
- ts.applyWidget( c.table ); // make sure zebra widget is applied
- }, 0 );
- },
- getOptionSource: function( table, column, onlyAvail ) {
- table = $( table )[0];
- var c = table.config,
- wo = c.widgetOptions,
- arry = false,
- source = wo.filter_selectSource,
- last = c.$table.data( 'lastSearch' ) || [],
- fxn = typeof source === 'function' ? true : ts.getColumnData( table, source, column );
-
- if ( onlyAvail && last[column] !== '' ) {
- onlyAvail = false;
- }
-
- // filter select source option
- if ( fxn === true ) {
- // OVERALL source
- arry = source( table, column, onlyAvail );
- } else if ( fxn instanceof $ || ( $.type( fxn ) === 'string' && fxn.indexOf( '</option>' ) >= 0 ) ) {
- // selectSource is a jQuery object or string of options
- return fxn;
- } else if ( $.isArray( fxn ) ) {
- arry = fxn;
- } else if ( $.type( source ) === 'object' && fxn ) {
- // custom select source function for a SPECIFIC COLUMN
- arry = fxn( table, column, onlyAvail );
- // abort - updating the selects from an external method
- if (arry === null) {
- return null;
- }
- }
- if ( arry === false ) {
- // fall back to original method
- arry = tsf.getOptions( table, column, onlyAvail );
- }
-
- return tsf.processOptions( table, column, arry );
-
- },
- processOptions: function( table, column, arry ) {
- if ( !$.isArray( arry ) ) {
- return false;
- }
- table = $( table )[0];
- var cts, txt, indx, len, parsedTxt, str,
- c = table.config,
- validColumn = typeof column !== 'undefined' && column !== null && column >= 0 && column < c.columns,
- direction = validColumn ? c.$headerIndexed[ column ].hasClass( 'filter-select-sort-desc' ) : false,
- parsed = [];
- // get unique elements and sort the list
- // if $.tablesorter.sortText exists ( not in the original tablesorter ),
- // then natural sort the list otherwise use a basic sort
- arry = $.grep( arry, function( value, indx ) {
- if ( value.text ) {
- return true;
- }
- return $.inArray( value, arry ) === indx;
- });
- if ( validColumn && c.$headerIndexed[ column ].hasClass( 'filter-select-nosort' ) ) {
- // unsorted select options
- return arry;
- } else {
- len = arry.length;
- // parse select option values
- for ( indx = 0; indx < len; indx++ ) {
- txt = arry[ indx ];
- // check for object
- str = txt.text ? txt.text : txt;
- // sortNatural breaks if you don't pass it strings
- parsedTxt = ( validColumn && c.parsers && c.parsers.length &&
- c.parsers[ column ].format( str, table, [], column ) || str ).toString();
- parsedTxt = c.widgetOptions.filter_ignoreCase ? parsedTxt.toLowerCase() : parsedTxt;
- // parse array data using set column parser; this DOES NOT pass the original
- // table cell to the parser format function
- if ( txt.text ) {
- txt.parsed = parsedTxt;
- parsed[ parsed.length ] = txt;
- } else {
- parsed[ parsed.length ] = {
- text : txt,
- // check parser length - fixes #934
- parsed : parsedTxt
- };
- }
- }
- // sort parsed select options
- cts = c.textSorter || '';
- parsed.sort( function( a, b ) {
- var x = direction ? b.parsed : a.parsed,
- y = direction ? a.parsed : b.parsed;
- if ( validColumn && typeof cts === 'function' ) {
- // custom OVERALL text sorter
- return cts( x, y, true, column, table );
- } else if ( validColumn && 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 ) {
- // fall back to natural sort
- return ts.sortNatural( x, y );
- }
- // using an older version! do a basic sort
- return true;
- });
- // rebuild arry from sorted parsed data
- arry = [];
- len = parsed.length;
- for ( indx = 0; indx < len; indx++ ) {
- arry[ arry.length ] = parsed[indx];
- }
- return arry;
- }
- },
- getOptions: function( table, column, onlyAvail ) {
- table = $( table )[0];
- var rowIndex, tbodyIndex, len, row, cache, indx, child, childLen,
- c = table.config,
- wo = c.widgetOptions,
- arry = [];
- for ( tbodyIndex = 0; tbodyIndex < c.$tbodies.length; tbodyIndex++ ) {
- cache = c.cache[tbodyIndex];
- len = c.cache[tbodyIndex].normalized.length;
- // loop through the rows
- for ( rowIndex = 0; rowIndex < len; rowIndex++ ) {
- // get cached row from cache.row ( old ) or row data object
- // ( new; last item in normalized array )
- row = cache.row ?
- cache.row[ rowIndex ] :
- cache.normalized[ rowIndex ][ c.columns ].$row[0];
- // check if has class filtered
- if ( onlyAvail && row.className.match( wo.filter_filteredRow ) ) {
- continue;
- }
- // get non-normalized cell content
- if ( wo.filter_useParsedData ||
- c.parsers[column].parsed ||
- c.$headerIndexed[column].hasClass( 'filter-parsed' ) ) {
- arry[ arry.length ] = '' + cache.normalized[ rowIndex ][ column ];
- // child row parsed data
- if ( wo.filter_childRows && wo.filter_childByColumn ) {
- childLen = cache.normalized[ rowIndex ][ c.columns ].$row.length - 1;
- for ( indx = 0; indx < childLen; indx++ ) {
- arry[ arry.length ] = '' + cache.normalized[ rowIndex ][ c.columns ].child[ indx ][ column ];
- }
- }
- } else {
- // get raw cached data instead of content directly from the cells
- arry[ arry.length ] = cache.normalized[ rowIndex ][ c.columns ].raw[ column ];
- // child row unparsed data
- if ( wo.filter_childRows && wo.filter_childByColumn ) {
- childLen = cache.normalized[ rowIndex ][ c.columns ].$row.length;
- for ( indx = 1; indx < childLen; indx++ ) {
- child = cache.normalized[ rowIndex ][ c.columns ].$row.eq( indx ).children().eq( column );
- arry[ arry.length ] = '' + ts.getElementText( c, child, column );
- }
- }
- }
- }
- }
- return arry;
- },
- buildSelect: function( table, column, arry, updating, onlyAvail ) {
- table = $( table )[0];
- column = parseInt( column, 10 );
- if ( !table.config.cache || $.isEmptyObject( table.config.cache ) ) {
- return;
- }
-
- var indx, val, txt, t, $filters, $filter, option,
- c = table.config,
- wo = c.widgetOptions,
- node = c.$headerIndexed[ column ],
- // t.data( 'placeholder' ) won't work in jQuery older than 1.4.3
- options = '<option value="">' +
- ( node.data( 'placeholder' ) ||
- node.attr( 'data-placeholder' ) ||
- wo.filter_placeholder.select || ''
- ) + '</option>',
- // Get curent filter value
- currentValue = c.$table
- .find( 'thead' )
- .find( 'select.' + tscss.filter + '[data-column="' + column + '"]' )
- .val();
-
- // nothing included in arry ( external source ), so get the options from
- // filter_selectSource or column data
- if ( typeof arry === 'undefined' || arry === '' ) {
- arry = tsf.getOptionSource( table, column, onlyAvail );
- // abort, selects are updated by an external method
- if (arry === null) {
- return;
- }
- }
-
- if ( $.isArray( arry ) ) {
- // build option list
- for ( indx = 0; indx < arry.length; indx++ ) {
- option = arry[ indx ];
- if ( option.text ) {
- // OBJECT!! add data-function-name in case the value is set in filter_functions
- option['data-function-name'] = typeof option.value === 'undefined' ? option.text : option.value;
-
- // support jQuery < v1.8, otherwise the below code could be shortened to
- // options += $( '<option>', option )[ 0 ].outerHTML;
- options += '<option';
- for ( val in option ) {
- if ( option.hasOwnProperty( val ) && val !== 'text' ) {
- options += ' ' + val + '="' + option[ val ].replace( tsfRegex.quote, '&quot;' ) + '"';
- }
- }
- if ( !option.value ) {
- options += ' value="' + option.text.replace( tsfRegex.quote, '&quot;' ) + '"';
- }
- options += '>' + option.text.replace( tsfRegex.quote, '&quot;' ) + '</option>';
- // above code is needed in jQuery < v1.8
-
- // make sure we don't turn an object into a string (objects without a "text" property)
- } else if ( '' + option !== '[object Object]' ) {
- txt = option = ( '' + option ).replace( tsfRegex.quote, '&quot;' );
- val = txt;
- // allow including a symbol in the selectSource array
- // 'a-z|A through Z' so that 'a-z' becomes the option value
- // and 'A through Z' becomes the option text
- if ( txt.indexOf( wo.filter_selectSourceSeparator ) >= 0 ) {
- t = txt.split( wo.filter_selectSourceSeparator );
- val = t[0];
- txt = t[1];
- }
- // replace quotes - fixes #242 & ignore empty strings
- // see http://stackoverflow.com/q/14990971/145346
- options += option !== '' ?
- '<option ' +
- ( val === txt ? '' : 'data-function-name="' + option + '" ' ) +
- 'value="' + val + '">' + txt +
- '</option>' : '';
- }
- }
- // clear arry so it doesn't get appended twice
- arry = [];
- }
-
- // update all selects in the same column ( clone thead in sticky headers &
- // any external selects ) - fixes 473
- $filters = ( c.$filters ? c.$filters : c.$table.children( 'thead' ) )
- .find( '.' + tscss.filter );
- if ( wo.filter_$externalFilters ) {
- $filters = $filters && $filters.length ?
- $filters.add( wo.filter_$externalFilters ) :
- wo.filter_$externalFilters;
- }
- $filter = $filters.filter( 'select[data-column="' + column + '"]' );
-
- // make sure there is a select there!
- if ( $filter.length ) {
- $filter[ updating ? 'html' : 'append' ]( options );
- if ( !$.isArray( arry ) ) {
- // append options if arry is provided externally as a string or jQuery object
- // options ( default value ) was already added
- $filter.append( arry ).val( currentValue );
- }
- $filter.val( currentValue );
- }
- },
- buildDefault: function( table, updating ) {
- var columnIndex, $header, noSelect,
- c = table.config,
- wo = c.widgetOptions,
- columns = c.columns;
- // build default select dropdown
- for ( columnIndex = 0; columnIndex < columns; columnIndex++ ) {
- $header = c.$headerIndexed[columnIndex];
- noSelect = !( $header.hasClass( 'filter-false' ) || $header.hasClass( 'parser-false' ) );
- // look for the filter-select class; build/update it if found
- if ( ( $header.hasClass( 'filter-select' ) ||
- ts.getColumnData( table, wo.filter_functions, columnIndex ) === true ) && noSelect ) {
- tsf.buildSelect( table, columnIndex, '', updating, $header.hasClass( wo.filter_onlyAvail ) );
- }
- }
- }
- };
-
- // filter regex variable
- tsfRegex = tsf.regex;
-
- ts.getFilters = function( table, getRaw, setFilters, skipFirst ) {
- var i, $filters, $column, cols,
- filters = [],
- c = table ? $( table )[0].config : '',
- wo = c ? c.widgetOptions : '';
- if ( ( getRaw !== true && wo && !wo.filter_columnFilters ) ||
- // setFilters called, but last search is exactly the same as the current
- // fixes issue #733 & #903 where calling update causes the input values to reset
- ( $.isArray(setFilters) && tsf.equalFilters(c, setFilters, c.lastSearch) )
- ) {
- return $( table ).data( 'lastSearch' ) || [];
- }
- if ( c ) {
- if ( c.$filters ) {
- $filters = c.$filters.find( '.' + tscss.filter );
- }
- if ( wo.filter_$externalFilters ) {
- $filters = $filters && $filters.length ?
- $filters.add( wo.filter_$externalFilters ) :
- wo.filter_$externalFilters;
- }
- if ( $filters && $filters.length ) {
- filters = setFilters || [];
- for ( i = 0; i < c.columns + 1; i++ ) {
- cols = ( i === c.columns ?
- // 'all' columns can now include a range or set of columms ( data-column='0-2,4,6-7' )
- wo.filter_anyColumnSelector + ',' + wo.filter_multipleColumnSelector :
- '[data-column="' + i + '"]' );
- $column = $filters.filter( cols );
- if ( $column.length ) {
- // move the latest search to the first slot in the array
- $column = tsf.getLatestSearch( $column );
- if ( $.isArray( setFilters ) ) {
- // skip first ( latest input ) to maintain cursor position while typing
- if ( skipFirst && $column.length > 1 ) {
- $column = $column.slice( 1 );
- }
- if ( i === c.columns ) {
- // prevent data-column='all' from filling data-column='0,1' ( etc )
- cols = $column.filter( wo.filter_anyColumnSelector );
- $column = cols.length ? cols : $column;
- }
- $column
- .val( setFilters[ i ] )
- // must include a namespace here; but not c.namespace + 'filter'?
- .trigger( 'change' + c.namespace );
- } else {
- filters[i] = $column.val() || '';
- // don't change the first... it will move the cursor
- if ( i === c.columns ) {
- // don't update range columns from 'all' setting
- $column
- .slice( 1 )
- .filter( '[data-column*="' + $column.attr( 'data-column' ) + '"]' )
- .val( filters[ i ] );
- } else {
- $column
- .slice( 1 )
- .val( filters[ i ] );
- }
- }
- // save any match input dynamically
- if ( i === c.columns && $column.length ) {
- wo.filter_$anyMatch = $column;
- }
- }
- }
- }
- }
- return filters;
- };
-
- ts.setFilters = function( table, filter, apply, skipFirst ) {
- var c = table ? $( table )[0].config : '',
- valid = ts.getFilters( table, true, filter, skipFirst );
- // default apply to "true"
- if ( typeof apply === 'undefined' ) {
- apply = true;
- }
- if ( c && apply ) {
- // ensure new set filters are applied, even if the search is the same
- c.lastCombinedFilter = null;
- c.lastSearch = [];
- tsf.searching( c.table, filter, skipFirst );
- c.$table.triggerHandler( 'filterFomatterUpdate' );
- }
- return valid.length !== 0;
- };
-
-})( jQuery );
-
-/*! Widget: stickyHeaders - updated 9/27/2017 (v2.29.0) *//*
- * Requires tablesorter v2.8+ and jQuery 1.4.3+
- * by Rob Garrison
- */
-;(function ($, window) {
- 'use strict';
- var ts = $.tablesorter || {};
-
- $.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) {
- table = $(table)[0]; // make sure we're using a dom element
- if ( !table.config ) { return; }
- var defaults = {
- timer : 250
- },
- options = $.extend({}, defaults, settings),
- c = table.config,
- wo = c.widgetOptions,
- checkSizes = function( triggerEvent ) {
- var index, headers, $header, sizes, width, height,
- len = c.$headers.length;
- wo.resize_flag = true;
- headers = [];
- for ( index = 0; index < len; index++ ) {
- $header = c.$headers.eq( index );
- sizes = $header.data( 'savedSizes' ) || [ 0, 0 ]; // fixes #394
- width = $header[0].offsetWidth;
- height = $header[0].offsetHeight;
- if ( width !== sizes[0] || height !== sizes[1] ) {
- $header.data( 'savedSizes', [ width, height ] );
- headers.push( $header[0] );
- }
- }
- if ( headers.length && triggerEvent !== false ) {
- c.$table.triggerHandler( 'resize', [ headers ] );
- }
- wo.resize_flag = false;
- };
- clearInterval(wo.resize_timer);
- if (disable) {
- wo.resize_flag = false;
- return false;
- }
- checkSizes( false );
- wo.resize_timer = setInterval(function() {
- if (wo.resize_flag) { return; }
- checkSizes();
- }, options.timer);
- };
-
- function getStickyOffset(c, wo) {
- var $el = isNaN(wo.stickyHeaders_offset) ? $(wo.stickyHeaders_offset) : [];
- return $el.length ?
- $el.height() || 0 :
- parseInt(wo.stickyHeaders_offset, 10) || 0;
- }
-
- // 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: 54, // sticky widget must be initialized after the filter & before pager widget!
- options: {
- stickyHeaders : '', // extra class name added to the sticky header row
- stickyHeaders_appendTo : null, // jQuery selector or object to phycially attach the sticky headers
- stickyHeaders_attachTo : null, // jQuery selector or object to attach scroll listener to (overridden by xScroll & yScroll settings)
- stickyHeaders_xScroll : null, // jQuery selector or object to monitor horizontal scroll position (defaults: xScroll > attachTo > window)
- stickyHeaders_yScroll : null, // jQuery selector or object to monitor vertical scroll position (defaults: yScroll > attachTo > window)
- 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_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
- },
- format: function(table, c, wo) {
- // filter widget doesn't initialize on an empty table. Fixes #449
- if ( c.$table.hasClass('hasStickyHeaders') || ($.inArray('filter', c.widgets) >= 0 && !c.$table.hasClass('hasFilters')) ) {
- return;
- }
- var index, len, $t,
- $table = c.$table,
- // add position: relative to attach element, hopefully it won't cause trouble.
- $attach = $(wo.stickyHeaders_attachTo || wo.stickyHeaders_appendTo),
- namespace = c.namespace + 'stickyheaders ',
- // element to watch for the scroll event
- $yScroll = $(wo.stickyHeaders_yScroll || wo.stickyHeaders_attachTo || window),
- $xScroll = $(wo.stickyHeaders_xScroll || wo.stickyHeaders_attachTo || window),
- $thead = $table.children('thead:first'),
- $header = $thead.children('tr').not('.sticky-false').children(),
- $tfoot = $table.children('tfoot'),
- stickyOffset = getStickyOffset(c, wo),
- // is this table nested? If so, find parent sticky header wrapper (div, not table)
- $nestedSticky = $table.parent().closest('.' + ts.css.table).hasClass('hasStickyHeaders') ?
- $table.parent().closest('table.tablesorter')[0].config.widgetOptions.$sticky.parent() : [],
- nestedStickyTop = $nestedSticky.length ? $nestedSticky.height() : 0,
- // clone table, then wrap to make sticky header
- $stickyTable = wo.$sticky = $table.clone()
- .addClass('containsStickyHeaders ' + ts.css.sticky + ' ' + wo.stickyHeaders + ' ' + c.namespace.slice(1) + '_extra_table' )
- .wrap('<div class="' + ts.css.stickyWrap + '">'),
- $stickyWrap = $stickyTable.parent()
- .addClass(ts.css.stickyHide)
- .css({
- position : $attach.length ? 'absolute' : 'fixed',
- padding : parseInt( $stickyTable.parent().parent().css('padding-left'), 10 ),
- top : stickyOffset + nestedStickyTop,
- left : 0,
- visibility : 'hidden',
- zIndex : wo.stickyHeaders_zIndex || 2
- }),
- $stickyThead = $stickyTable.children('thead:first'),
- $stickyCells,
- laststate = '',
- setWidth = function($orig, $clone) {
- var index, width, border, $cell, $this,
- $cells = $orig.filter(':visible'),
- len = $cells.length;
- for ( index = 0; index < len; index++ ) {
- $cell = $clone.filter(':visible').eq(index);
- $this = $cells.eq(index);
- // code from https://github.com/jmosbech/StickyTableHeaders
- if ($this.css('box-sizing') === 'border-box') {
- width = $this.outerWidth();
- } else {
- if ($cell.css('border-collapse') === 'collapse') {
- if (window.getComputedStyle) {
- width = parseFloat( window.getComputedStyle($this[0], null).width );
- } else {
- // ie8 only
- border = parseFloat( $this.css('border-width') );
- width = $this.outerWidth() - parseFloat( $this.css('padding-left') ) - parseFloat( $this.css('padding-right') ) - border;
- }
- } else {
- width = $this.width();
- }
- }
- $cell.css({
- 'width': width,
- 'min-width': width,
- 'max-width': width
- });
- }
- },
- getLeftPosition = function(yWindow) {
- if (yWindow === false && $nestedSticky.length) {
- return $table.position().left;
- }
- return $attach.length ?
- parseInt($attach.css('padding-left'), 10) || 0 :
- $table.offset().left - parseInt($table.css('margin-left'), 10) - $(window).scrollLeft();
- },
- resizeHeader = function() {
- $stickyWrap.css({
- left : getLeftPosition(),
- width: $table.outerWidth()
- });
- setWidth( $table, $stickyTable );
- setWidth( $header, $stickyCells );
- },
- scrollSticky = function( resizing ) {
- if (!$table.is(':visible')) { return; } // fixes #278
- // Detect nested tables - fixes #724
- nestedStickyTop = $nestedSticky.length ? $nestedSticky.offset().top - $yScroll.scrollTop() + $nestedSticky.height() : 0;
- var tmp,
- offset = $table.offset(),
- stickyOffset = getStickyOffset(c, wo),
- yWindow = $.isWindow( $yScroll[0] ), // $.isWindow needs jQuery 1.4.3
- yScroll = yWindow ?
- $yScroll.scrollTop() :
- // use parent sticky position if nested AND inside of a scrollable element - see #1512
- $nestedSticky.length ? parseInt($nestedSticky[0].style.top, 10) : $yScroll.offset().top,
- attachTop = $attach.length ? yScroll : $yScroll.scrollTop(),
- captionHeight = wo.stickyHeaders_includeCaption ? 0 : $table.children( 'caption' ).height() || 0,
- scrollTop = attachTop + stickyOffset + nestedStickyTop - captionHeight,
- tableHeight = $table.height() - ($stickyWrap.height() + ($tfoot.height() || 0)) - captionHeight,
- isVisible = ( scrollTop > offset.top ) && ( scrollTop < offset.top + tableHeight ) ? 'visible' : 'hidden',
- state = isVisible === 'visible' ? ts.css.stickyVis : ts.css.stickyHide,
- needsUpdating = !$stickyWrap.hasClass( state ),
- cssSettings = { visibility : isVisible };
- if ($attach.length) {
- // attached sticky headers always need updating
- needsUpdating = true;
- cssSettings.top = yWindow ? scrollTop - $attach.offset().top : $attach.scrollTop();
- }
- // adjust when scrolling horizontally - fixes issue #143
- tmp = getLeftPosition(yWindow);
- if (tmp !== parseInt($stickyWrap.css('left'), 10)) {
- needsUpdating = true;
- cssSettings.left = tmp;
- }
- cssSettings.top = ( cssSettings.top || 0 ) +
- // If nested AND inside of a scrollable element, only add parent sticky height
- (!yWindow && $nestedSticky.length ? $nestedSticky.height() : stickyOffset + nestedStickyTop);
- if (needsUpdating) {
- $stickyWrap
- .removeClass( ts.css.stickyVis + ' ' + ts.css.stickyHide )
- .addClass( state )
- .css(cssSettings);
- }
- if (isVisible !== laststate || resizing) {
- // make sure the column widths match
- resizeHeader();
- laststate = isVisible;
- }
- };
- // only add a position relative if a position isn't already defined
- if ($attach.length && !$attach.css('position')) {
- $attach.css('position', 'relative');
- }
- // fix clone ID, if it exists - fixes #271
- if ($stickyTable.attr('id')) { $stickyTable[0].id += wo.stickyHeaders_cloneId; }
- // clear out cloned table, except for sticky header
- // include caption & filter row (fixes #126 & #249) - don't remove cells to get correct cell indexing
- $stickyTable.find('> thead:gt(0), tr.sticky-false').hide();
- $stickyTable.find('> tbody, > tfoot').remove();
- $stickyTable.find('caption').toggle(wo.stickyHeaders_includeCaption);
- // issue #172 - find td/th in sticky header
- $stickyCells = $stickyThead.children().children();
- $stickyTable.css({ height:0, width:0, margin: 0 });
- // remove resizable block
- $stickyCells.find('.' + ts.css.resizer).remove();
- // update sticky header class names to match real header after sorting
- $table
- .addClass('hasStickyHeaders')
- .bind('pagerComplete' + namespace, function() {
- resizeHeader();
- });
-
- ts.bindEvents(table, $stickyThead.children().children('.' + ts.css.header));
-
- if (wo.stickyHeaders_appendTo) {
- $(wo.stickyHeaders_appendTo).append( $stickyWrap );
- } else {
- // add stickyheaders AFTER the table. If the table is selected by ID, the original one (first) will be returned.
- $table.after( $stickyWrap );
- }
-
- // onRenderHeader is defined, we need to do something about it (fixes #641)
- if (c.onRenderHeader) {
- $t = $stickyThead.children('tr').children();
- len = $t.length;
- for ( index = 0; index < len; index++ ) {
- // send second parameter
- c.onRenderHeader.apply( $t.eq( index ), [ index, c, $stickyTable ] );
- }
- }
- // make it sticky!
- $xScroll.add($yScroll)
- .unbind( ('scroll resize '.split(' ').join( namespace )).replace(/\s+/g, ' ') )
- .bind('scroll resize '.split(' ').join( namespace ), function( event ) {
- scrollSticky( event.type === 'resize' );
- });
- c.$table
- .unbind('stickyHeadersUpdate' + namespace)
- .bind('stickyHeadersUpdate' + namespace, function() {
- scrollSticky( true );
- });
-
- if (wo.stickyHeaders_addResizeEvent) {
- ts.addHeaderResizeEvent(table);
- }
-
- // look for filter widget
- if ($table.hasClass('hasFilters') && wo.filter_columnFilters) {
- // scroll table into view after filtering, if sticky header is active - #482
- $table.bind('filterEnd' + namespace, function() {
- // $(':focus') needs jQuery 1.6+
- var $td = $(document.activeElement).closest('td'),
- column = $td.parent().children().index($td);
- // only scroll if sticky header is active
- if ($stickyWrap.hasClass(ts.css.stickyVis) && wo.stickyHeaders_filteredToTop) {
- // scroll to original table (not sticky clone)
- window.scrollTo(0, $table.position().top);
- // give same input/select focus; check if c.$filters exists; fixes #594
- if (column >= 0 && c.$filters) {
- c.$filters.eq(column).find('a, select, input').filter(':visible').focus();
- }
- }
- });
- ts.filter.bindSearch( $table, $stickyCells.find('.' + ts.css.filter) );
- // support hideFilters
- if (wo.filter_hideFilters) {
- ts.filter.hideFilters(c, $stickyTable);
- }
- }
-
- // resize table (Firefox)
- if (wo.stickyHeaders_addResizeEvent) {
- $table.bind('resize' + c.namespace + 'stickyheaders', function() {
- resizeHeader();
- });
- }
-
- // make sure sticky is visible if page is partially scrolled
- scrollSticky( true );
- $table.triggerHandler('stickyHeadersInit');
-
- },
- remove: function(table, c, wo) {
- var namespace = c.namespace + 'stickyheaders ';
- c.$table
- .removeClass('hasStickyHeaders')
- .unbind( ('pagerComplete resize filterEnd stickyHeadersUpdate '.split(' ').join(namespace)).replace(/\s+/g, ' ') )
- .next('.' + ts.css.stickyWrap).remove();
- if (wo.$sticky && wo.$sticky.length) { wo.$sticky.remove(); } // remove cloned table
- $(window)
- .add(wo.stickyHeaders_xScroll)
- .add(wo.stickyHeaders_yScroll)
- .add(wo.stickyHeaders_attachTo)
- .unbind( ('scroll resize '.split(' ').join(namespace)).replace(/\s+/g, ' ') );
- ts.addHeaderResizeEvent(table, true);
- }
- });
-
-})(jQuery, window);
-
-/*! Widget: resizable - updated 2018-03-26 (v2.30.2) */
-/*jshint browser:true, jquery:true, unused:false */
-;(function ($, window) {
- 'use strict';
- var ts = $.tablesorter || {};
-
- $.extend(ts.css, {
- resizableContainer : 'tablesorter-resizable-container',
- resizableHandle : 'tablesorter-resizable-handle',
- resizableNoSelect : 'tablesorter-disableSelection',
- resizableStorage : 'tablesorter-resizable'
- });
-
- // 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; }' +
- '.' + ts.css.resizableContainer + ' { position: relative; height: 1px; }' +
- // make handle z-index > than stickyHeader z-index, so the handle stays above sticky header
- '.' + ts.css.resizableHandle + ' { position: absolute; display: inline-block; width: 8px;' +
- 'top: 1px; cursor: ew-resize; z-index: 3; user-select: none; -moz-user-select: none; }' +
- '</style>';
- $('head').append(s);
- });
-
- ts.resizable = {
- init : function( c, wo ) {
- if ( c.$table.hasClass( 'hasResizable' ) ) { return; }
- c.$table.addClass( 'hasResizable' );
-
- var noResize, $header, column, storedSizes, tmp,
- $table = c.$table,
- $parent = $table.parent(),
- marginTop = parseInt( $table.css( 'margin-top' ), 10 ),
-
- // internal variables
- vars = wo.resizable_vars = {
- useStorage : ts.storage && wo.resizable !== false,
- $wrap : $parent,
- mouseXPosition : 0,
- $target : null,
- $next : null,
- overflow : $parent.css('overflow') === 'auto' ||
- $parent.css('overflow') === 'scroll' ||
- $parent.css('overflow-x') === 'auto' ||
- $parent.css('overflow-x') === 'scroll',
- storedSizes : []
- };
-
- // set default widths
- ts.resizableReset( c.table, true );
-
- // now get measurements!
- vars.tableWidth = $table.width();
- // attempt to autodetect
- vars.fullWidth = Math.abs( $parent.width() - vars.tableWidth ) < 20;
-
- /*
- // Hacky method to determine if table width is set to 'auto'
- // http://stackoverflow.com/a/20892048/145346
- if ( !vars.fullWidth ) {
- tmp = $table.width();
- $header = $table.wrap('<span>').parent(); // temp variable
- storedSizes = parseInt( $table.css( 'margin-left' ), 10 ) || 0;
- $table.css( 'margin-left', storedSizes + 50 );
- vars.tableWidth = $header.width() > tmp ? 'auto' : tmp;
- $table.css( 'margin-left', storedSizes ? storedSizes : '' );
- $header = null;
- $table.unwrap('<span>');
- }
- */
-
- if ( vars.useStorage && vars.overflow ) {
- // save table width
- ts.storage( c.table, 'tablesorter-table-original-css-width', vars.tableWidth );
- tmp = ts.storage( c.table, 'tablesorter-table-resized-width' ) || 'auto';
- ts.resizable.setWidth( $table, tmp, true );
- }
- wo.resizable_vars.storedSizes = storedSizes = ( vars.useStorage ?
- ts.storage( c.table, ts.css.resizableStorage ) :
- [] ) || [];
- ts.resizable.setWidths( c, wo, storedSizes );
- ts.resizable.updateStoredSizes( c, wo );
-
- wo.$resizable_container = $( '<div class="' + ts.css.resizableContainer + '">' )
- .css({ top : marginTop })
- .insertBefore( $table );
- // add container
- for ( column = 0; column < c.columns; column++ ) {
- $header = c.$headerIndexed[ column ];
- tmp = ts.getColumnData( c.table, c.headers, column );
- noResize = ts.getData( $header, tmp, 'resizable' ) === 'false';
- if ( !noResize ) {
- $( '<div class="' + ts.css.resizableHandle + '">' )
- .appendTo( wo.$resizable_container )
- .attr({
- 'data-column' : column,
- 'unselectable' : 'on'
- })
- .data( 'header', $header )
- .bind( 'selectstart', false );
- }
- }
- ts.resizable.bindings( c, wo );
- },
-
- updateStoredSizes : function( c, wo ) {
- var column, $header,
- len = c.columns,
- vars = wo.resizable_vars;
- vars.storedSizes = [];
- for ( column = 0; column < len; column++ ) {
- $header = c.$headerIndexed[ column ];
- vars.storedSizes[ column ] = $header.is(':visible') ? $header.width() : 0;
- }
- },
-
- setWidth : function( $el, width, overflow ) {
- // overflow tables need min & max width set as well
- $el.css({
- 'width' : width,
- 'min-width' : overflow ? width : '',
- 'max-width' : overflow ? width : ''
- });
- },
-
- setWidths : function( c, wo, storedSizes ) {
- var column, $temp,
- vars = wo.resizable_vars,
- $extra = $( c.namespace + '_extra_headers' ),
- $col = c.$table.children( 'colgroup' ).children( 'col' );
- storedSizes = storedSizes || vars.storedSizes || [];
- // process only if table ID or url match
- if ( storedSizes.length ) {
- for ( column = 0; column < c.columns; column++ ) {
- // set saved resizable widths
- ts.resizable.setWidth( c.$headerIndexed[ column ], storedSizes[ column ], vars.overflow );
- if ( $extra.length ) {
- // stickyHeaders needs to modify min & max width as well
- $temp = $extra.eq( column ).add( $col.eq( column ) );
- ts.resizable.setWidth( $temp, storedSizes[ column ], vars.overflow );
- }
- }
- $temp = $( c.namespace + '_extra_table' );
- if ( $temp.length && !ts.hasWidget( c.table, 'scroller' ) ) {
- ts.resizable.setWidth( $temp, c.$table.outerWidth(), vars.overflow );
- }
- }
- },
-
- setHandlePosition : function( c, wo ) {
- var startPosition,
- tableHeight = c.$table.height(),
- $handles = wo.$resizable_container.children(),
- handleCenter = Math.floor( $handles.width() / 2 );
-
- if ( ts.hasWidget( c.table, 'scroller' ) ) {
- tableHeight = 0;
- c.$table.closest( '.' + ts.css.scrollerWrap ).children().each(function() {
- var $this = $(this);
- // center table has a max-height set
- tableHeight += $this.filter('[style*="height"]').length ? $this.height() : $this.children('table').height();
- });
- }
-
- if ( !wo.resizable_includeFooter && c.$table.children('tfoot').length ) {
- tableHeight -= c.$table.children('tfoot').height();
- }
- // subtract out table left position from resizable handles. Fixes #864
- // jQuery v3.3.0+ appears to include the start position with the $header.position().left; see #1544
- startPosition = parseFloat($.fn.jquery) >= 3.3 ? 0 : c.$table.position().left;
- $handles.each( function() {
- var $this = $(this),
- column = parseInt( $this.attr( 'data-column' ), 10 ),
- columns = c.columns - 1,
- $header = $this.data( 'header' );
- if ( !$header ) { return; } // see #859
- if (
- !$header.is(':visible') ||
- ( !wo.resizable_addLastColumn && ts.resizable.checkVisibleColumns(c, column) )
- ) {
- $this.hide();
- } else if ( column < columns || column === columns && wo.resizable_addLastColumn ) {
- $this.css({
- display: 'inline-block',
- height : tableHeight,
- left : $header.position().left - startPosition + $header.outerWidth() - handleCenter
- });
- }
- });
- },
-
- // Fixes #1485
- checkVisibleColumns: function( c, column ) {
- var i,
- len = 0;
- for ( i = column + 1; i < c.columns; i++ ) {
- len += c.$headerIndexed[i].is( ':visible' ) ? 1 : 0;
- }
- return len === 0;
- },
-
- // prevent text selection while dragging resize bar
- toggleTextSelection : function( c, wo, toggle ) {
- var namespace = c.namespace + 'tsresize';
- wo.resizable_vars.disabled = toggle;
- $( 'body' ).toggleClass( ts.css.resizableNoSelect, toggle );
- if ( toggle ) {
- $( 'body' )
- .attr( 'unselectable', 'on' )
- .bind( 'selectstart' + namespace, false );
- } else {
- $( 'body' )
- .removeAttr( 'unselectable' )
- .unbind( 'selectstart' + namespace );
- }
- },
-
- bindings : function( c, wo ) {
- var namespace = c.namespace + 'tsresize';
- wo.$resizable_container.children().bind( 'mousedown', function( event ) {
- // save header cell and mouse position
- var column,
- vars = wo.resizable_vars,
- $extras = $( c.namespace + '_extra_headers' ),
- $header = $( event.target ).data( 'header' );
-
- column = parseInt( $header.attr( 'data-column' ), 10 );
- vars.$target = $header = $header.add( $extras.filter('[data-column="' + column + '"]') );
- vars.target = column;
-
- // if table is not as wide as it's parent, then resize the table
- vars.$next = event.shiftKey || wo.resizable_targetLast ?
- $header.parent().children().not( '.resizable-false' ).filter( ':last' ) :
- $header.nextAll( ':not(.resizable-false)' ).eq( 0 );
-
- column = parseInt( vars.$next.attr( 'data-column' ), 10 );
- vars.$next = vars.$next.add( $extras.filter('[data-column="' + column + '"]') );
- vars.next = column;
-
- vars.mouseXPosition = event.pageX;
- ts.resizable.updateStoredSizes( c, wo );
- ts.resizable.toggleTextSelection(c, wo, true );
- });
-
- $( document )
- .bind( 'mousemove' + namespace, function( event ) {
- var vars = wo.resizable_vars;
- // ignore mousemove if no mousedown
- if ( !vars.disabled || vars.mouseXPosition === 0 || !vars.$target ) { return; }
- if ( wo.resizable_throttle ) {
- clearTimeout( vars.timer );
- vars.timer = setTimeout( function() {
- ts.resizable.mouseMove( c, wo, event );
- }, isNaN( wo.resizable_throttle ) ? 5 : wo.resizable_throttle );
- } else {
- ts.resizable.mouseMove( c, wo, event );
- }
- })
- .bind( 'mouseup' + namespace, function() {
- if (!wo.resizable_vars.disabled) { return; }
- ts.resizable.toggleTextSelection( c, wo, false );
- ts.resizable.stopResize( c, wo );
- ts.resizable.setHandlePosition( c, wo );
- });
-
- // resizeEnd event triggered by scroller widget
- $( window ).bind( 'resize' + namespace + ' resizeEnd' + namespace, function() {
- ts.resizable.setHandlePosition( c, wo );
- });
-
- // right click to reset columns to default widths
- c.$table
- .bind( 'columnUpdate pagerComplete resizableUpdate '.split( ' ' ).join( namespace + ' ' ), function() {
- ts.resizable.setHandlePosition( c, wo );
- })
- .bind( 'resizableReset' + namespace, function() {
- ts.resizableReset( c.table );
- })
- .find( 'thead:first' )
- .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_vars.storedSizes.length === 0;
- ts.resizableReset( c.table );
- ts.resizable.setHandlePosition( c, wo );
- wo.resizable_vars.storedSizes = [];
- return allowClick;
- });
-
- },
-
- mouseMove : function( c, wo, event ) {
- if ( wo.resizable_vars.mouseXPosition === 0 || !wo.resizable_vars.$target ) { return; }
- // resize columns
- var column,
- total = 0,
- vars = wo.resizable_vars,
- $next = vars.$next,
- tar = vars.storedSizes[ vars.target ],
- leftEdge = event.pageX - vars.mouseXPosition;
- if ( vars.overflow ) {
- if ( tar + leftEdge > 0 ) {
- vars.storedSizes[ vars.target ] += leftEdge;
- ts.resizable.setWidth( vars.$target, vars.storedSizes[ vars.target ], true );
- // update the entire table width
- for ( column = 0; column < c.columns; column++ ) {
- total += vars.storedSizes[ column ];
- }
- ts.resizable.setWidth( c.$table.add( $( c.namespace + '_extra_table' ) ), total );
- }
- if ( !$next.length ) {
- // if expanding right-most column, scroll the wrapper
- vars.$wrap[0].scrollLeft = c.$table.width();
- }
- } else if ( vars.fullWidth ) {
- vars.storedSizes[ vars.target ] += leftEdge;
- vars.storedSizes[ vars.next ] -= leftEdge;
- ts.resizable.setWidths( c, wo );
- } else {
- vars.storedSizes[ vars.target ] += leftEdge;
- ts.resizable.setWidths( c, wo );
- }
- vars.mouseXPosition = event.pageX;
- // dynamically update sticky header widths
- c.$table.triggerHandler('stickyHeadersUpdate');
- },
-
- stopResize : function( c, wo ) {
- var vars = wo.resizable_vars;
- ts.resizable.updateStoredSizes( c, wo );
- if ( vars.useStorage ) {
- // save all column widths
- ts.storage( c.table, ts.css.resizableStorage, vars.storedSizes );
- ts.storage( c.table, 'tablesorter-table-resized-width', c.$table.width() );
- }
- vars.mouseXPosition = 0;
- vars.$target = vars.$next = null;
- // will update stickyHeaders, just in case, see #912
- c.$table.triggerHandler('stickyHeadersUpdate');
- c.$table.triggerHandler('resizableComplete');
- }
- };
-
- // 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
- resizable_addLastColumn : false,
- resizable_includeFooter: true,
- resizable_widths : [],
- resizable_throttle : false, // set to true (5ms) or any number 0-10 range
- resizable_targetLast : false
- },
- init: function(table, thisWidget, c, wo) {
- ts.resizable.init( c, wo );
- },
- format: function( table, c, wo ) {
- ts.resizable.setHandlePosition( c, wo );
- },
- remove: function( table, c, wo, refreshing ) {
- if (wo.$resizable_container) {
- var namespace = c.namespace + 'tsresize';
- c.$table.add( $( c.namespace + '_extra_table' ) )
- .removeClass('hasResizable')
- .children( 'thead' )
- .unbind( 'contextmenu' + namespace );
-
- wo.$resizable_container.remove();
- ts.resizable.toggleTextSelection( c, wo, false );
- ts.resizableReset( table, refreshing );
- $( document ).unbind( 'mousemove' + namespace + ' mouseup' + namespace );
- }
- }
- });
-
- ts.resizableReset = function( table, refreshing ) {
- $( table ).each(function() {
- var index, $t,
- c = this.config,
- wo = c && c.widgetOptions,
- vars = wo.resizable_vars;
- if ( table && c && c.$headerIndexed.length ) {
- // restore the initial table width
- if ( vars.overflow && vars.tableWidth ) {
- ts.resizable.setWidth( c.$table, vars.tableWidth, true );
- if ( vars.useStorage ) {
- ts.storage( table, 'tablesorter-table-resized-width', vars.tableWidth );
- }
- }
- for ( index = 0; index < c.columns; index++ ) {
- $t = c.$headerIndexed[ index ];
- if ( wo.resizable_widths && wo.resizable_widths[ index ] ) {
- ts.resizable.setWidth( $t, wo.resizable_widths[ index ], vars.overflow );
- } else if ( !$t.hasClass( 'resizable-false' ) ) {
- // don't clear the width of any column that is not resizable
- ts.resizable.setWidth( $t, '', vars.overflow );
- }
- }
-
- // reset stickyHeader widths
- c.$table.triggerHandler( 'stickyHeadersUpdate' );
- if ( ts.storage && !refreshing ) {
- ts.storage( this, ts.css.resizableStorage, [] );
- }
- }
- });
- };
-
-})( jQuery, window );
-
-/*! Widget: saveSort - updated 2018-03-19 (v2.30.1) *//*
-* Requires tablesorter v2.16+
-* by Rob Garrison
-*/
-;(function ($) {
- 'use strict';
- var ts = $.tablesorter || {};
-
- function getStoredSortList(c) {
- var stored = ts.storage( c.table, 'tablesorter-savesort' );
- return (stored && stored.hasOwnProperty('sortList') && $.isArray(stored.sortList)) ? stored.sortList : [];
- }
-
- function sortListChanged(c, sortList) {
- return (sortList || getStoredSortList(c)).join(',') !== c.sortList.join(',');
- }
-
- // 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: {
- saveSort : true
- },
- init: function(table, thisWidget, c, wo) {
- // run widget format before all other widgets are applied to the table
- thisWidget.format(table, c, wo, true);
- },
- format: function(table, c, wo, init) {
- var time,
- $table = c.$table,
- saveSort = wo.saveSort !== false, // make saveSort active/inactive; default to true
- sortList = { 'sortList' : c.sortList },
- debug = ts.debug(c, 'saveSort');
- if (debug) {
- time = new Date();
- }
- if ($table.hasClass('hasSaveSort')) {
- if (saveSort && table.hasInitialized && ts.storage && sortListChanged(c)) {
- ts.storage( table, 'tablesorter-savesort', sortList );
- if (debug) {
- console.log('saveSort >> Saving last sort: ' + c.sortList + ts.benchmark(time));
- }
- }
- } else {
- // set table sort on initial run of the widget
- $table.addClass('hasSaveSort');
- sortList = '';
- // get data
- if (ts.storage) {
- sortList = getStoredSortList(c);
- if (debug) {
- console.log('saveSort >> Last sort loaded: "' + sortList + '"' + ts.benchmark(time));
- }
- $table.bind('saveSortReset', function(event) {
- event.stopPropagation();
- ts.storage( table, 'tablesorter-savesort', '' );
- });
- }
- // init is true when widget init is run, this will run this widget before all other widgets have initialized
- // this method allows using this widget in the original tablesorter plugin; but then it will run all widgets twice.
- if (init && sortList && sortList.length > 0) {
- c.sortList = sortList;
- } else if (table.hasInitialized && sortList && sortList.length > 0) {
- // update sort change
- if (sortListChanged(c, sortList)) {
- ts.sortOn(c, sortList);
- }
- }
- }
- },
- remove: function(table, c) {
- c.$table.removeClass('hasSaveSort');
- // clear storage
- if (ts.storage) { ts.storage( table, 'tablesorter-savesort', '' ); }
- }
- });
-
-})(jQuery);
-return jQuery.tablesorter;}));
+!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){return function(e,t,r){"use strict";var i=e.tablesorter||{};e.extend(!0,i.defaults,{fixedUrl:"",widgetOptions:{storage_fixedUrl:"",storage_group:"",storage_page:"",storage_storageType:"",storage_tableId:"",storage_useSessionStorage:""}}),i.storage=function(a,l,s,n){var o,c,d,f=!1,h={},u=(a=e(a)[0]).config,p=u&&u.widgetOptions,g=i.debug(u,"storage"),m=(n&&n.storageType||p&&p.storage_storageType).toString().charAt(0).toLowerCase(),b=m?"":n&&n.useSessionStorage||p&&p.storage_useSessionStorage,y=e(a),_=n&&n.id||y.attr(n&&n.group||p&&p.storage_group||"data-table-group")||p&&p.storage_tableId||a.id||e(".tablesorter").index(y),v=n&&n.url||y.attr(n&&n.page||p&&p.storage_page||"data-table-page")||p&&p.storage_fixedUrl||u&&u.fixedUrl||t.location.pathname;if("c"!==m&&(m="s"===m||b?"sessionStorage":"localStorage")in t)try{t[m].setItem("_tmptest","temp"),f=!0,t[m].removeItem("_tmptest")}catch(e){console.warn(m+" is not supported in this browser")}if(g&&console.log("Storage >> Using",f?m:"cookies"),e.parseJSON&&(f?h=e.parseJSON(t[m][l]||"null")||{}:(c=r.cookie.split(/[;\s|=]/),h=0!==(o=e.inArray(l,c)+1)&&e.parseJSON(c[o]||"null")||{})),void 0===s||!t.JSON||!JSON.hasOwnProperty("stringify"))return h&&h[v]?h[v][_]:"";h[v]||(h[v]={}),h[v][_]=s,f?t[m][l]=JSON.stringify(h):((d=new Date).setTime(d.getTime()+31536e6),r.cookie=l+"="+JSON.stringify(h).replace(/\"/g,'"')+"; expires="+d.toGMTString()+"; path=/")}}(e,window,document),function(e){"use strict";var t=e.tablesorter||{};t.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",sortNone:"",sortAsc:"",sortDesc:"",active:"",hover:"",icons:"",iconSortNone:"bootstrap-icon-unsorted",iconSortAsc:"glyphicon glyphicon-chevron-up",iconSortDesc:"glyphicon glyphicon-chevron-down",filterRow:"",footerRow:"",footerCells:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",caption:"ui-widget-content",header:"ui-widget-header ui-corner-all ui-state-default",sortNone:"",sortAsc:"",sortDesc:"",active:"ui-state-active",hover:"ui-state-hover",icons:"ui-icon",iconSortNone:"ui-icon-carat-2-n-s ui-icon-caret-2-n-s",iconSortAsc:"ui-icon-carat-1-n ui-icon-caret-1-n",iconSortDesc:"ui-icon-carat-1-s ui-icon-caret-1-s",filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",odd:"ui-state-default"}},e.extend(t.css,{wrapper:"tablesorter-wrapper"}),t.addWidget({id:"uitheme",priority:10,format:function(r,i,a){var l,s,n,o,c,d,f,h,u,p,g,m,b,y=t.themes,_=i.$table.add(e(i.namespace+"_extra_table")),v=i.$headers.add(e(i.namespace+"_extra_headers")),w=i.theme||"jui",x=y[w]||{},S=e.trim([x.sortNone,x.sortDesc,x.sortAsc,x.active].join(" ")),C=e.trim([x.iconSortNone,x.iconSortDesc,x.iconSortAsc].join(" ")),z=t.debug(i,"uitheme");for(z&&(c=new Date),_.hasClass("tablesorter-"+w)&&i.theme===i.appliedTheme&&a.uitheme_applied||(a.uitheme_applied=!0,p=y[i.appliedTheme]||{},g=(b=!e.isEmptyObject(p))?[p.sortNone,p.sortDesc,p.sortAsc,p.active].join(" "):"",m=b?[p.iconSortNone,p.iconSortDesc,p.iconSortAsc].join(" "):"",b&&(a.zebra[0]=e.trim(" "+a.zebra[0].replace(" "+p.even,"")),a.zebra[1]=e.trim(" "+a.zebra[1].replace(" "+p.odd,"")),i.$tbodies.children().removeClass([p.even,p.odd].join(" "))),x.even&&(a.zebra[0]+=" "+x.even),x.odd&&(a.zebra[1]+=" "+x.odd),_.children("caption").removeClass(p.caption||"").addClass(x.caption),h=_.removeClass((i.appliedTheme?"tablesorter-"+(i.appliedTheme||""):"")+" "+(p.table||"")).addClass("tablesorter-"+w+" "+(x.table||"")).children("tfoot"),i.appliedTheme=i.theme,h.length&&h.children("tr").removeClass(p.footerRow||"").addClass(x.footerRow).children("th, td").removeClass(p.footerCells||"").addClass(x.footerCells),v.removeClass((b?[p.header,p.hover,g].join(" "):"")||"").addClass(x.header).not(".sorter-false").unbind("mouseenter.tsuitheme mouseleave.tsuitheme").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(t){e(this)["mouseenter"===t.type?"addClass":"removeClass"](x.hover||"")}),v.each(function(){var r=e(this);r.find("."+t.css.wrapper).length||r.wrapInner('<div class="'+t.css.wrapper+'" style="position:relative;height:100%;width:100%"></div>')}),i.cssIcon&&v.find("."+t.css.icon).removeClass(b?[p.icons,m].join(" "):"").addClass(x.icons||""),t.hasWidget(i.table,"filter")&&(s=function(){_.children("thead").children("."+t.css.filterRow).removeClass(b&&p.filterRow||"").addClass(x.filterRow||"")},a.filter_initialized?s():_.one("filterInit",function(){s()}))),l=0;l<i.columns;l++)d=i.$headers.add(e(i.namespace+"_extra_headers")).not(".sorter-false").filter('[data-column="'+l+'"]'),f=t.css.icon?d.find("."+t.css.icon):e(),(u=v.not(".sorter-false").filter('[data-column="'+l+'"]:last')).length&&(d.removeClass(S),f.removeClass(C),u[0].sortDisabled?f.removeClass(x.icons||""):(n=x.sortNone,o=x.iconSortNone,u.hasClass(t.css.sortAsc)?(n=[x.sortAsc,x.active].join(" "),o=x.iconSortAsc):u.hasClass(t.css.sortDesc)&&(n=[x.sortDesc,x.active].join(" "),o=x.iconSortDesc),d.addClass(n),f.addClass(o||"")));z&&console.log("uitheme >> Applied "+w+" theme"+t.benchmark(c))},remove:function(e,r,i,a){if(i.uitheme_applied){var l=r.$table,s=r.appliedTheme||"jui",n=t.themes[s]||t.themes.jui,o=l.children("thead").children(),c=n.sortNone+" "+n.sortDesc+" "+n.sortAsc,d=n.iconSortNone+" "+n.iconSortDesc+" "+n.iconSortAsc;l.removeClass("tablesorter-"+s+" "+n.table),i.uitheme_applied=!1,a||(l.find(t.css.header).removeClass(n.header),o.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(n.hover+" "+c+" "+n.active).filter("."+t.css.filterRow).removeClass(n.filterRow),o.find("."+t.css.icon).removeClass(n.icons+" "+d))}}})}(e),function(e){"use strict";var t=e.tablesorter||{};t.addWidget({id:"columns",priority:65,options:{columns:["primary","secondary","tertiary"]},format:function(r,i,a){var l,s,n,o,c,d,f,h,u=i.$table,p=i.$tbodies,g=i.sortList,m=g.length,b=a&&a.columns||["primary","secondary","tertiary"],y=b.length-1;for(f=b.join(" "),s=0;s<p.length;s++)(n=(l=t.processTbody(r,p.eq(s),!0)).children("tr")).each(function(){if(c=e(this),"none"!==this.style.display&&(d=c.children().removeClass(f),g&&g[0]&&(d.eq(g[0][0]).addClass(b[0]),m>1)))for(h=1;h<m;h++)d.eq(g[h][0]).addClass(b[h]||b[y])}),t.processTbody(r,l,!1);if(o=!1!==a.columns_thead?["thead tr"]:[],!1!==a.columns_tfoot&&o.push("tfoot tr"),o.length&&(n=u.find(o.join(",")).children().removeClass(f),m))for(h=0;h<m;h++)n.filter('[data-column="'+g[h][0]+'"]').addClass(b[h]||b[y])},remove:function(r,i,a){var l,s,n=i.$tbodies,o=(a.columns||["primary","secondary","tertiary"]).join(" ");for(i.$headers.removeClass(o),i.$table.children("tfoot").children("tr").children("th, td").removeClass(o),l=0;l<n.length;l++)(s=t.processTbody(r,n.eq(l),!0)).children("tr").each(function(){e(this).children().removeClass(o)}),t.processTbody(r,s,!1)}})}(e),function(e){"use strict";var t,r,i=e.tablesorter||{},a=i.css,l=i.keyCodes;e.extend(a,{filterRow:"tablesorter-filter-row",filter:"tablesorter-filter",filterDisabled:"disabled",filterRowHide:"hideme"}),e.extend(l,{backSpace:8,escape:27,space:32,left:37,down:40}),i.addWidget({id:"filter",priority:50,options:{filter_cellFilter:"",filter_childRows:!1,filter_childByColumn:!1,filter_childWithSibs:!0,filter_columnAnyMatch:!0,filter_columnFilters:!0,filter_cssFilter:"",filter_defaultAttrib:"data-value",filter_defaultFilter:{},filter_excludeFilter:{},filter_external:"",filter_filteredRow:"filtered",filter_filterLabel:'Filter "{{label}}" column by...',filter_formatter:null,filter_functions:null,filter_hideEmpty:!0,filter_hideFilters:!1,filter_ignoreCase:!0,filter_liveSearch:!0,filter_matchType:{input:"exact",select:"exact"},filter_onlyAvail:"filter-onlyAvail",filter_placeholder:{search:"",select:""},filter_reset:null,filter_resetOnEsc:!0,filter_saveFilters:!1,filter_searchDelay:300,filter_searchFiltered:!0,filter_selectSource:null,filter_selectSourceSeparator:"|",filter_serversideFiltering:!1,filter_startsWith:!1,filter_useParsedData:!1},format:function(e,r,i){r.$table.hasClass("hasFilters")||t.init(e,r,i)},remove:function(t,r,l,s){var n,o,c=r.$table,d=r.$tbodies,f="addRows updateCell update updateRows updateComplete appendCache filterReset filterAndSortReset filterFomatterUpdate filterEnd search stickyHeadersInit ".split(" ").join(r.namespace+"filter ");if(c.removeClass("hasFilters").unbind(f.replace(i.regex.spaces," ")).find("."+a.filterRow).remove(),l.filter_initialized=!1,!s){for(n=0;n<d.length;n++)(o=i.processTbody(t,d.eq(n),!0)).children().removeClass(l.filter_filteredRow).show(),i.processTbody(t,o,!1);l.filter_reset&&e(document).undelegate(l.filter_reset,"click"+r.namespace+"filter")}}}),t=i.filter={regex:{regex:/^\/((?:\\\/|[^\/])+)\/([migyu]{0,5})?$/,child:/tablesorter-childRow/,filtered:/filtered/,type:/undefined|number/,exact:/(^[\"\'=]+)|([\"\'=]+$)/g,operators:/[<>=]/g,query:"(q|query)",wild01:/\?/g,wild0More:/\*/g,quote:/\"/g,isNeg1:/(>=?\s*-\d)/,isNeg2:/(<=?\s*\d)/},types:{or:function(i,a,l){if((r.orTest.test(a.iFilter)||r.orSplit.test(a.filter))&&!r.regex.test(a.filter)){var s,n,o,c=e.extend({},a),d=a.filter.split(r.orSplit),f=a.iFilter.split(r.orSplit),h=d.length;for(s=0;s<h;s++){c.nestedFilters=!0,c.filter=""+(t.parseFilter(i,d[s],a)||""),c.iFilter=""+(t.parseFilter(i,f[s],a)||""),o="("+(t.parseFilter(i,c.filter,a)||"")+")";try{if(n=new RegExp(a.isMatch?o:"^"+o+"$",i.widgetOptions.filter_ignoreCase?"i":"").test(c.exact)||t.processTypes(i,c,l))return n}catch(e){return null}}return n||!1}return null},and:function(i,a,l){if(r.andTest.test(a.filter)){var s,n,o,c,d=e.extend({},a),f=a.filter.split(r.andSplit),h=a.iFilter.split(r.andSplit),u=f.length;for(s=0;s<u;s++){d.nestedFilters=!0,d.filter=""+(t.parseFilter(i,f[s],a)||""),d.iFilter=""+(t.parseFilter(i,h[s],a)||""),c=("("+(t.parseFilter(i,d.filter,a)||"")+")").replace(r.wild01,"\\S{1}").replace(r.wild0More,"\\S*");try{o=new RegExp(a.isMatch?c:"^"+c+"$",i.widgetOptions.filter_ignoreCase?"i":"").test(d.exact)||t.processTypes(i,d,l),n=0===s?o:n&&o}catch(e){return null}}return n||!1}return null},regex:function(e,t){if(r.regex.test(t.filter)){var i,a=t.filter_regexCache[t.index]||r.regex.exec(t.filter),l=a instanceof RegExp;try{l||(t.filter_regexCache[t.index]=a=new RegExp(a[1],a[2])),i=a.test(t.exact)}catch(e){i=!1}return i}return null},operators:function(a,l){if(r.operTest.test(l.iFilter)&&""!==l.iExact){var s,n,o,c=a.table,d=l.parsed[l.index],f=i.formatFloat(l.iFilter.replace(r.operators,""),c),h=a.parsers[l.index]||{},u=f;return(d||"numeric"===h.type)&&(o=e.trim(""+l.iFilter.replace(r.operators,"")),f="number"!=typeof(n=t.parseFilter(a,o,l,!0))||""===n||isNaN(n)?f:n),!d&&"numeric"!==h.type||isNaN(f)||void 0===l.cache?(o=isNaN(l.iExact)?l.iExact.replace(i.regex.nondigit,""):l.iExact,s=i.formatFloat(o,c)):s=l.cache,r.gtTest.test(l.iFilter)?n=r.gteTest.test(l.iFilter)?s>=f:s>f:r.ltTest.test(l.iFilter)&&(n=r.lteTest.test(l.iFilter)?s<=f:s<f),n||""!==u||(n=!0),n}return null},notMatch:function(i,a){if(r.notTest.test(a.iFilter)){var l,s=a.iFilter.replace("!",""),n=t.parseFilter(i,s,a)||"";return r.exact.test(n)?""===(n=n.replace(r.exact,""))||e.trim(n)!==a.iExact:(l=a.iExact.search(e.trim(n)),""===n||(a.anyMatch?l<0:!(i.widgetOptions.filter_startsWith?0===l:l>=0)))}return null},exact:function(i,a){if(r.exact.test(a.iFilter)){var l=a.iFilter.replace(r.exact,""),s=t.parseFilter(i,l,a)||"";return a.anyMatch?e.inArray(s,a.rowArray)>=0:s==a.iExact}return null},range:function(e,a){if(r.toTest.test(a.iFilter)){var l,s,n,o,c=e.table,d=a.index,f=a.parsed[d],h=a.iFilter.split(r.toSplit);return s=h[0].replace(i.regex.nondigit,"")||"",n=i.formatFloat(t.parseFilter(e,s,a),c),s=h[1].replace(i.regex.nondigit,"")||"",o=i.formatFloat(t.parseFilter(e,s,a),c),(f||"numeric"===e.parsers[d].type)&&(n=""===(l=e.parsers[d].format(""+h[0],c,e.$headers.eq(d),d))||isNaN(l)?n:l,o=""===(l=e.parsers[d].format(""+h[1],c,e.$headers.eq(d),d))||isNaN(l)?o:l),!f&&"numeric"!==e.parsers[d].type||isNaN(n)||isNaN(o)?(s=isNaN(a.iExact)?a.iExact.replace(i.regex.nondigit,""):a.iExact,l=i.formatFloat(s,c)):l=a.cache,n>o&&(s=n,n=o,o=s),l>=n&&l<=o||""===n||""===o}return null},wild:function(e,i){if(r.wildOrTest.test(i.iFilter)){var a=""+(t.parseFilter(e,i.iFilter,i)||"");!r.wildTest.test(a)&&i.nestedFilters&&(a=i.isMatch?a:"^("+a+")$");try{return new RegExp(a.replace(r.wild01,"\\S{1}").replace(r.wild0More,"\\S*"),e.widgetOptions.filter_ignoreCase?"i":"").test(i.exact)}catch(e){return null}}return null},fuzzy:function(e,i){if(r.fuzzyTest.test(i.iFilter)){var a,l=0,s=i.iExact.length,n=i.iFilter.slice(1),o=t.parseFilter(e,n,i)||"";for(a=0;a<s;a++)i.iExact[a]===o[l]&&(l+=1);return l===o.length}return null}},init:function(l){i.language=e.extend(!0,{},{to:"to",or:"or",and:"and"},i.language);var s,n,o,c,d,f,h,u,p=l.config,g=p.widgetOptions,m=function(e,t,r){return""===(t=t.trim())?"":(e||"")+t+(r||"")};if(p.$table.addClass("hasFilters"),p.lastSearch=[],g.filter_searchTimer=null,g.filter_initTimer=null,g.filter_formatterCount=0,g.filter_formatterInit=[],g.filter_anyColumnSelector='[data-column="all"],[data-column="any"]',g.filter_multipleColumnSelector='[data-column*="-"],[data-column*=","]',f="\\{"+r.query+"\\}",e.extend(r,{child:new RegExp(p.cssChildRow),filtered:new RegExp(g.filter_filteredRow),alreadyFiltered:new RegExp("(\\s+(-"+m("|",i.language.or)+m("|",i.language.to)+")\\s+)","i"),toTest:new RegExp("\\s+(-"+m("|",i.language.to)+")\\s+","i"),toSplit:new RegExp("(?:\\s+(?:-"+m("|",i.language.to)+")\\s+)","gi"),andTest:new RegExp("\\s+("+m("",i.language.and,"|")+"&&)\\s+","i"),andSplit:new RegExp("(?:\\s+(?:"+m("",i.language.and,"|")+"&&)\\s+)","gi"),orTest:new RegExp("(\\|"+m("|\\s+",i.language.or,"\\s+")+")","i"),orSplit:new RegExp("(?:\\|"+m("|\\s+(?:",i.language.or,")\\s+")+")","gi"),iQuery:new RegExp(f,"i"),igQuery:new RegExp(f,"ig"),operTest:/^[<>]=?/,gtTest:/>/,gteTest:/>=/,ltTest:/</,lteTest:/<=/,notTest:/^\!/,wildOrTest:/[\?\*\|]/,wildTest:/\?\*/,fuzzyTest:/^~/,exactTest:/[=\"\|!]/}),f=p.$headers.filter(".filter-false, .parser-false").length,!1!==g.filter_columnFilters&&f!==p.$headers.length&&t.buildRow(l,p,g),o="addRows updateCell update updateRows updateComplete appendCache filterReset "+"filterAndSortReset filterResetSaved filterEnd search ".split(" ").join(p.namespace+"filter "),p.$table.bind(o,function(r,s){return f=g.filter_hideEmpty&&e.isEmptyObject(p.cache)&&!(p.delayInit&&"appendCache"===r.type),p.$table.find("."+a.filterRow).toggleClass(g.filter_filteredRow,f),/(search|filter)/.test(r.type)||(r.stopPropagation(),t.buildDefault(l,!0)),"filterReset"===r.type||"filterAndSortReset"===r.type?(p.$table.find("."+a.filter).add(g.filter_$externalFilters).val(""),"filterAndSortReset"===r.type?i.sortReset(this.config,function(){t.searching(l,[])}):t.searching(l,[])):"filterResetSaved"===r.type?i.storage(l,"tablesorter-filters",""):"filterEnd"===r.type?t.buildDefault(l,!0):(s="search"===r.type?s:"updateComplete"===r.type?p.$table.data("lastSearch"):"",/(update|add)/.test(r.type)&&"updateComplete"!==r.type&&(p.lastCombinedFilter=null,p.lastSearch=[],setTimeout(function(){p.$table.triggerHandler("filterFomatterUpdate")},100)),t.searching(l,s,!0)),!1}),g.filter_reset&&(g.filter_reset instanceof e?g.filter_reset.click(function(){p.$table.triggerHandler("filterReset")}):e(g.filter_reset).length&&e(document).undelegate(g.filter_reset,"click"+p.namespace+"filter").delegate(g.filter_reset,"click"+p.namespace+"filter",function(){p.$table.triggerHandler("filterReset")})),g.filter_functions)for(d=0;d<p.columns;d++)if(h=i.getColumnData(l,g.filter_functions,d))if(u=!((c=p.$headerIndexed[d].removeClass("filter-select")).hasClass("filter-false")||c.hasClass("parser-false")),s="",!0===h&&u)t.buildSelect(l,d);else if("object"==typeof h&&u){for(n in h)"string"==typeof n&&(s+=""===s?'<option value="">'+(c.data("placeholder")||c.attr("data-placeholder")||g.filter_placeholder.select||"")+"</option>":"",f=n,o=n,n.indexOf(g.filter_selectSourceSeparator)>=0&&(o=(f=n.split(g.filter_selectSourceSeparator))[1],f=f[0]),s+="<option "+(o===f?"":'data-function-name="'+n+'" ')+'value="'+f+'">'+o+"</option>");p.$table.find("thead").find("select."+a.filter+'[data-column="'+d+'"]').append(s),(h="function"==typeof(o=g.filter_selectSource)||i.getColumnData(l,o,d))&&t.buildSelect(p.table,d,"",!0,c.hasClass(g.filter_onlyAvail))}t.buildDefault(l,!0),t.bindSearch(l,p.$table.find("."+a.filter),!0),g.filter_external&&t.bindSearch(l,g.filter_external),g.filter_hideFilters&&t.hideFilters(p),p.showProcessing&&(o="filterStart filterEnd ".split(" ").join(p.namespace+"filter-sp "),p.$table.unbind(o.replace(i.regex.spaces," ")).bind(o,function(t,r){c=r?p.$table.find("."+a.header).filter("[data-column]").filter(function(){return""!==r[e(this).data("column")]}):"",i.isProcessing(l,"filterStart"===t.type,r?c:"")})),p.filteredRows=p.totalRows,o="tablesorter-initialized pagerBeforeInitialized ".split(" ").join(p.namespace+"filter "),p.$table.unbind(o.replace(i.regex.spaces," ")).bind(o,function(){t.completeInit(this)}),p.pager&&p.pager.initialized&&!g.filter_initialized?(p.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){t.filterInitComplete(p)},100)):g.filter_initialized||t.completeInit(l)},completeInit:function(e){var r=e.config,a=r.widgetOptions,l=t.setDefaults(e,r,a)||[];l.length&&(r.delayInit&&""===l.join("")||i.setFilters(e,l,!0)),r.$table.triggerHandler("filterFomatterUpdate"),setTimeout(function(){a.filter_initialized||t.filterInitComplete(r)},100)},formatterUpdated:function(e,t){var r=e&&e.closest("table"),i=r.length&&r[0].config,a=i&&i.widgetOptions;a&&!a.filter_initialized&&(a.filter_formatterInit[t]=1)},filterInitComplete:function(r){var a,l,s=r.widgetOptions,n=0,o=function(){s.filter_initialized=!0,r.lastSearch=r.$table.data("lastSearch"),r.$table.triggerHandler("filterInit",r),t.findRows(r.table,r.lastSearch||[]),i.debug(r,"filter")&&console.log("Filter >> Widget initialized")};if(e.isEmptyObject(s.filter_formatter))o();else{for(l=s.filter_formatterInit.length,a=0;a<l;a++)1===s.filter_formatterInit[a]&&n++;clearTimeout(s.filter_initTimer),s.filter_initialized||n!==s.filter_formatterCount?s.filter_initialized||(s.filter_initTimer=setTimeout(function(){o()},500)):o()}},processFilters:function(e,t){var r,i=[],a=t?encodeURIComponent:decodeURIComponent,l=e.length;for(r=0;r<l;r++)e[r]&&(i[r]=a(e[r]));return i},setDefaults:function(r,a,l){var s,n,o,c,d,f=i.getFilters(r)||[];if(l.filter_saveFilters&&i.storage&&(n=i.storage(r,"tablesorter-filters")||[],(s=e.isArray(n))&&""===n.join("")||!s||(f=t.processFilters(n))),""===f.join(""))for(d=a.$headers.add(l.filter_$externalFilters).filter("["+l.filter_defaultAttrib+"]"),o=0;o<=a.columns;o++)c=o===a.columns?"all":o,f[o]=d.filter('[data-column="'+c+'"]').attr(l.filter_defaultAttrib)||f[o]||"";return a.$table.data("lastSearch",f),f},parseFilter:function(e,t,r,i){return i||r.parsed[r.index]?e.parsers[r.index].format(t,e.table,[],r.index):t},buildRow:function(r,l,s){var n,o,c,d,f,h,u,p,g,m=s.filter_cellFilter,b=l.columns,y=e.isArray(m),_='<tr role="search" class="'+a.filterRow+" "+l.cssIgnoreRow+'">';for(c=0;c<b;c++)l.$headerIndexed[c].length&&(_+=(g=l.$headerIndexed[c]&&l.$headerIndexed[c][0].colSpan||0)>1?'<td data-column="'+c+"-"+(c+g-1)+'" colspan="'+g+'"':'<td data-column="'+c+'"',_+=y?m[c]?' class="'+m[c]+'"':"":""!==m?' class="'+m+'"':"",_+="></td>");for(l.$filters=e(_+="</tr>").appendTo(l.$table.children("thead").eq(0)).children("td"),c=0;c<b;c++)h=!1,(d=l.$headerIndexed[c])&&d.length&&(n=t.getColumnElm(l,l.$filters,c),p=i.getColumnData(r,s.filter_functions,c),f=s.filter_functions&&p&&"function"!=typeof p||d.hasClass("filter-select"),o=i.getColumnData(r,l.headers,c),h="false"===i.getData(d[0],o,"filter")||"false"===i.getData(d[0],o,"parser"),f?_=e("<select>").appendTo(n):((p=i.getColumnData(r,s.filter_formatter,c))?(s.filter_formatterCount++,(_=p(n,c))&&0===_.length&&(_=n.children("input")),_&&(0===_.parent().length||_.parent().length&&_.parent()[0]!==n[0])&&n.append(_)):_=e('<input type="search">').appendTo(n),_&&(g=d.data("placeholder")||d.attr("data-placeholder")||s.filter_placeholder.search||"",_.attr("placeholder",g))),_&&(u=(e.isArray(s.filter_cssFilter)?void 0!==s.filter_cssFilter[c]&&s.filter_cssFilter[c]||"":s.filter_cssFilter)||"",_.addClass(a.filter+" "+u),(g=(u=s.filter_filterLabel).match(/{{([^}]+?)}}/g))||(g=["{{label}}"]),e.each(g,function(t,r){var i=new RegExp(r,"g"),a=d.attr("data-"+r.replace(/{{|}}/g,"")),l=void 0===a?d.text():a;u=u.replace(i,e.trim(l))}),_.attr({"data-column":n.attr("data-column"),"aria-label":u}),h&&(_.attr("placeholder","").addClass(a.filterDisabled)[0].disabled=!0)))},bindSearch:function(r,a,s){if(r=e(r)[0],(a=e(a)).length){var n,o=r.config,c=o.widgetOptions,d=o.namespace+"filter",f=c.filter_$externalFilters;!0!==s&&(n=c.filter_anyColumnSelector+","+c.filter_multipleColumnSelector,c.filter_$anyMatch=a.filter(n),f&&f.length?c.filter_$externalFilters=c.filter_$externalFilters.add(a):c.filter_$externalFilters=a,i.setFilters(r,o.$table.data("lastSearch")||[],!1===s)),n="keypress keyup keydown search change input ".split(" ").join(d+" "),a.attr("data-lastSearchTime",(new Date).getTime()).unbind(n.replace(i.regex.spaces," ")).bind("keydown"+d,function(e){if(e.which===l.escape&&!r.config.widgetOptions.filter_resetOnEsc)return!1}).bind("keyup"+d,function(a){c=r.config.widgetOptions;var s=parseInt(e(this).attr("data-column"),10),n="boolean"==typeof c.filter_liveSearch?c.filter_liveSearch:i.getColumnData(r,c.filter_liveSearch,s);if(void 0===n&&(n=c.filter_liveSearch.fallback||!1),e(this).attr("data-lastSearchTime",(new Date).getTime()),a.which===l.escape)this.value=c.filter_resetOnEsc?"":o.lastSearch[s];else{if(""!==this.value&&("number"==typeof n&&this.value.length<n||a.which!==l.enter&&a.which!==l.backSpace&&(a.which<l.space||a.which>=l.left&&a.which<=l.down)))return;if(!1===n&&""!==this.value&&a.which!==l.enter)return}t.searching(r,!0,!0,s)}).bind("search change keypress input blur ".split(" ").join(d+" "),function(a){var s=parseInt(e(this).attr("data-column"),10),n=a.type,d="boolean"==typeof c.filter_liveSearch?c.filter_liveSearch:i.getColumnData(r,c.filter_liveSearch,s);!r.config.widgetOptions.filter_initialized||a.which!==l.enter&&"search"!==n&&"blur"!==n&&("change"!==n&&"input"!==n||!0!==d&&(!0===d||"INPUT"===a.target.nodeName)||this.value===o.lastSearch[s])||(a.preventDefault(),e(this).attr("data-lastSearchTime",(new Date).getTime()),t.searching(r,"keypress"!==n,!0,s))})}},searching:function(e,r,a,l){var s,n=e.config.widgetOptions;void 0===l?s=!1:void 0===(s="boolean"==typeof n.filter_liveSearch?n.filter_liveSearch:i.getColumnData(e,n.filter_liveSearch,l))&&(s=n.filter_liveSearch.fallback||!1),clearTimeout(n.filter_searchTimer),void 0===r||!0===r?n.filter_searchTimer=setTimeout(function(){t.checkFilters(e,r,a)},s?n.filter_searchDelay:10):t.checkFilters(e,r,a)},equalFilters:function(t,r,i){var a,l=[],s=[],n=t.columns+1;for(r=e.isArray(r)?r:[],i=e.isArray(i)?i:[],a=0;a<n;a++)l[a]=r[a]||"",s[a]=i[a]||"";return l.join(",")===s.join(",")},checkFilters:function(r,l,s){var n=r.config,o=n.widgetOptions,c=e.isArray(l),d=c?l:i.getFilters(r,!0),f=d||[];if(e.isEmptyObject(n.cache))n.delayInit&&(!n.pager||n.pager&&n.pager.initialized)&&i.updateCache(n,function(){t.checkFilters(r,!1,s)});else if(c&&(i.setFilters(r,d,!1,!0!==s),o.filter_initialized||(n.lastSearch=[],n.lastCombinedFilter="")),o.filter_hideFilters&&n.$table.find("."+a.filterRow).triggerHandler(t.hideFiltersCheck(n)?"mouseleave":"mouseenter"),!t.equalFilters(n,n.lastSearch,f)||!1===l){if(!1===l&&(n.lastCombinedFilter="",n.lastSearch=[]),d=d||[],d=Array.prototype.map?d.map(String):d.join("�").split("�"),o.filter_initialized&&n.$table.triggerHandler("filterStart",[d]),!n.showProcessing)return t.findRows(r,d,f),!1;setTimeout(function(){return t.findRows(r,d,f),!1},30)}},hideFiltersCheck:function(e){if("function"==typeof e.widgetOptions.filter_hideFilters){var t=e.widgetOptions.filter_hideFilters(e);if("boolean"==typeof t)return t}return""===i.getFilters(e.$table).join("")},hideFilters:function(r,i){var l;(i||r.$table).find("."+a.filterRow).addClass(a.filterRowHide).bind("mouseenter mouseleave",function(i){var s=i,n=e(this);clearTimeout(l),l=setTimeout(function(){/enter|over/.test(s.type)?n.removeClass(a.filterRowHide):e(document.activeElement).closest("tr")[0]!==n[0]&&n.toggleClass(a.filterRowHide,t.hideFiltersCheck(r))},200)}).find("input, select").bind("focus blur",function(i){var s=i,n=e(this).closest("tr");clearTimeout(l),l=setTimeout(function(){clearTimeout(l),n.toggleClass(a.filterRowHide,t.hideFiltersCheck(r)&&"focus"!==s.type)},200)})},defaultFilter:function(t,i){if(""===t)return t;var a=r.iQuery,l=i.match(r.igQuery).length,s=l>1?e.trim(t).split(/\s/):[e.trim(t)],n=s.length-1,o=0,c=i;for(n<1&&l>1&&(s[1]=s[0]);a.test(c);)c=c.replace(a,s[o++]||""),a.test(c)&&o<n&&""!==(s[o]||"")&&(c=i.replace(a,c));return c},getLatestSearch:function(t){return t?t.sort(function(t,r){return e(r).attr("data-lastSearchTime")-e(t).attr("data-lastSearchTime")}):t||e()},findRange:function(e,t,r){var i,a,l,s,n,o,c,d,f,h=[];if(/^[0-9]+$/.test(t))return[parseInt(t,10)];if(!r&&/-/.test(t))for(f=(a=t.match(/(\d+)\s*-\s*(\d+)/g))?a.length:0,d=0;d<f;d++){for(l=a[d].split(/\s*-\s*/),(s=parseInt(l[0],10)||0)>(n=parseInt(l[1],10)||e.columns-1)&&(i=s,s=n,n=i),n>=e.columns&&(n=e.columns-1);s<=n;s++)h[h.length]=s;t=t.replace(a[d],"")}if(!r&&/,/.test(t))for(f=(o=t.split(/\s*,\s*/)).length,c=0;c<f;c++)""!==o[c]&&(d=parseInt(o[c],10))<e.columns&&(h[h.length]=d);if(!h.length)for(d=0;d<e.columns;d++)h[h.length]=d;return h},getColumnElm:function(r,i,a){return i.filter(function(){var i=t.findRange(r,e(this).attr("data-column"));return e.inArray(a,i)>-1})},multipleColumns:function(r,i){var a=r.widgetOptions,l=a.filter_initialized||!i.filter(a.filter_anyColumnSelector).length,s=e.trim(t.getLatestSearch(i).attr("data-column")||"");return t.findRange(r,s,!l)},processTypes:function(r,i,a){var l,s=null,n=null;for(l in t.types)e.inArray(l,a.excludeMatch)<0&&null===n&&null!==(n=t.types[l](r,i,a))&&(i.matchedOn=l,s=n);return s},matchType:function(e,t){var r,i=e.widgetOptions,l=e.$headerIndexed[t];return l.hasClass("filter-exact")?r=!1:l.hasClass("filter-match")?r=!0:(i.filter_columnFilters?l=e.$filters.find("."+a.filter).add(i.filter_$externalFilters).filter('[data-column="'+t+'"]'):i.filter_$externalFilters&&(l=i.filter_$externalFilters.filter('[data-column="'+t+'"]')),r=!!l.length&&"match"===e.widgetOptions.filter_matchType[(l[0].nodeName||"").toLowerCase()]),r},processRow:function(a,l,s){var n,o,c,d,f,h=a.widgetOptions,u=!0,p=h.filter_$anyMatch&&h.filter_$anyMatch.length,g=h.filter_$anyMatch&&h.filter_$anyMatch.length?t.multipleColumns(a,h.filter_$anyMatch):[];if(l.$cells=l.$row.children(),l.matchedOn=null,l.anyMatchFlag&&g.length>1||l.anyMatchFilter&&!p){if(l.anyMatch=!0,l.isMatch=!0,l.rowArray=l.$cells.map(function(t){if(e.inArray(t,g)>-1||l.anyMatchFilter&&!p)return l.parsed[t]?f=l.cacheArray[t]:(f=l.rawArray[t],f=e.trim(h.filter_ignoreCase?f.toLowerCase():f),a.sortLocaleCompare&&(f=i.replaceAccents(f))),f}).get(),l.filter=l.anyMatchFilter,l.iFilter=l.iAnyMatchFilter,l.exact=l.rowArray.join(" "),l.iExact=h.filter_ignoreCase?l.exact.toLowerCase():l.exact,l.cache=l.cacheArray.slice(0,-1).join(" "),s.excludeMatch=s.noAnyMatch,null!==(o=t.processTypes(a,l,s)))u=o;else if(h.filter_startsWith)for(u=!1,g=Math.min(a.columns,l.rowArray.length);!u&&g>0;)g--,u=u||0===l.rowArray[g].indexOf(l.iFilter);else u=(l.iExact+l.childRowText).indexOf(l.iFilter)>=0;if(l.anyMatch=!1,l.filters.join("")===l.filter)return u}for(g=0;g<a.columns;g++)l.filter=l.filters[g],l.index=g,s.excludeMatch=s.excludeFilter[g],l.filter&&(l.cache=l.cacheArray[g],n=l.parsed[g]?l.cache:l.rawArray[g]||"",l.exact=a.sortLocaleCompare?i.replaceAccents(n):n,l.iExact=!r.type.test(typeof l.exact)&&h.filter_ignoreCase?l.exact.toLowerCase():l.exact,l.isMatch=t.matchType(a,g),n=u,d=h.filter_columnFilters&&a.$filters.add(h.filter_$externalFilters).filter('[data-column="'+g+'"]').find("select option:selected").attr("data-function-name")||"",a.sortLocaleCompare&&(l.filter=i.replaceAccents(l.filter)),h.filter_defaultFilter&&r.iQuery.test(s.defaultColFilter[g])&&(l.filter=t.defaultFilter(l.filter,s.defaultColFilter[g])),l.iFilter=h.filter_ignoreCase?(l.filter||"").toLowerCase():l.filter,o=null,(c=s.functions[g])&&("function"==typeof c?o=c(l.exact,l.cache,l.filter,g,l.$row,a,l):"function"==typeof c[d||l.filter]&&(o=c[f=d||l.filter](l.exact,l.cache,l.filter,g,l.$row,a,l))),null===o?(o=t.processTypes(a,l,s),f=!0===c&&("and"===l.matchedOn||"or"===l.matchedOn),null===o||f?!0===c?n=l.isMatch?(""+l.iExact).search(l.iFilter)>=0:l.filter===l.exact:(f=(l.iExact+l.childRowText).indexOf(t.parseFilter(a,l.iFilter,l)),n=!h.filter_startsWith&&f>=0||h.filter_startsWith&&0===f):n=o):n=o,u=!!n&&u);return u},findRows:function(a,l,s){if(!t.equalFilters(a.config,a.config.lastSearch,s)&&a.config.widgetOptions.filter_initialized){var n,o,c,d,f,h,u,p,g,m,b,y,_,v,w,x,S,C,z,$,F,R,T,k=e.extend([],l),H=a.config,A=H.widgetOptions,I=i.debug(H,"filter"),O={anyMatch:!1,filters:l,filter_regexCache:[]},E={noAnyMatch:["range","operators"],functions:[],excludeFilter:[],defaultColFilter:[],defaultAnyFilter:i.getColumnData(a,A.filter_defaultFilter,H.columns,!0)||""};for(O.parsed=[],g=0;g<H.columns;g++)O.parsed[g]=A.filter_useParsedData||H.parsers&&H.parsers[g]&&H.parsers[g].parsed||i.getData&&"parsed"===i.getData(H.$headerIndexed[g],i.getColumnData(a,H.headers,g),"filter")||H.$headerIndexed[g].hasClass("filter-parsed"),E.functions[g]=i.getColumnData(a,A.filter_functions,g)||H.$headerIndexed[g].hasClass("filter-select"),E.defaultColFilter[g]=i.getColumnData(a,A.filter_defaultFilter,g)||"",E.excludeFilter[g]=(i.getColumnData(a,A.filter_excludeFilter,g,!0)||"").split(/\s+/);for(I&&(console.log("Filter >> Starting filter widget search",l),v=new Date),H.filteredRows=0,H.totalRows=0,s=k||[],u=0;u<H.$tbodies.length;u++){if(p=i.processTbody(a,H.$tbodies.eq(u),!0),g=H.columns,o=H.cache[u].normalized,d=e(e.map(o,function(e){return e[g].$row.get()})),""===s.join("")||A.filter_serversideFiltering)d.removeClass(A.filter_filteredRow).not("."+H.cssChildRow).css("display","");else{if(n=(d=d.not("."+H.cssChildRow)).length,(A.filter_$anyMatch&&A.filter_$anyMatch.length||void 0!==l[H.columns])&&(O.anyMatchFlag=!0,O.anyMatchFilter=""+(l[H.columns]||A.filter_$anyMatch&&t.getLatestSearch(A.filter_$anyMatch).val()||""),A.filter_columnAnyMatch)){for(z=O.anyMatchFilter.split(r.andSplit),$=!1,x=0;x<z.length;x++)(F=z[x].split(":")).length>1&&(isNaN(F[0])?e.each(H.headerContent,function(e,t){t.toLowerCase().indexOf(F[0])>-1&&(l[R=e]=F[1])}):R=parseInt(F[0],10)-1,R>=0&&R<H.columns&&(l[R]=F[1],z.splice(x,1),x--,$=!0));$&&(O.anyMatchFilter=z.join(" && "))}if(C=A.filter_searchFiltered,b=H.lastSearch||H.$table.data("lastSearch")||[],C)for(x=0;x<g+1;x++)w=l[x]||"",C||(x=g),C=C&&b.length&&0===w.indexOf(b[x]||"")&&!r.alreadyFiltered.test(w)&&!r.exactTest.test(w)&&!(r.isNeg1.test(w)||r.isNeg2.test(w))&&!(""!==w&&H.$filters&&H.$filters.filter('[data-column="'+x+'"]').find("select").length&&!t.matchType(H,x));for(S=d.not("."+A.filter_filteredRow).length,C&&0===S&&(C=!1),I&&console.log("Filter >> Searching through "+(C&&S<n?S:"all")+" rows"),O.anyMatchFlag&&(H.sortLocaleCompare&&(O.anyMatchFilter=i.replaceAccents(O.anyMatchFilter)),A.filter_defaultFilter&&r.iQuery.test(E.defaultAnyFilter)&&(O.anyMatchFilter=t.defaultFilter(O.anyMatchFilter,E.defaultAnyFilter),C=!1),O.iAnyMatchFilter=A.filter_ignoreCase&&H.ignoreCase?O.anyMatchFilter.toLowerCase():O.anyMatchFilter),h=0;h<n;h++)if(T=d[h].className,!(h&&r.child.test(T)||C&&r.filtered.test(T))){if(O.$row=d.eq(h),O.rowIndex=h,O.cacheArray=o[h],c=O.cacheArray[H.columns],O.rawArray=c.raw,O.childRowText="",!A.filter_childByColumn){for(T="",m=c.child,x=0;x<m.length;x++)T+=" "+m[x].join(" ")||"";O.childRowText=A.filter_childRows?A.filter_ignoreCase?T.toLowerCase():T:""}if(y=!1,_=t.processRow(H,O,E),f=c.$row,w=!!_,m=c.$row.filter(":gt(0)"),A.filter_childRows&&m.length){if(A.filter_childByColumn)for(A.filter_childWithSibs||(m.addClass(A.filter_filteredRow),f=f.eq(0)),x=0;x<m.length;x++)O.$row=m.eq(x),O.cacheArray=c.child[x],O.rawArray=O.cacheArray,w=t.processRow(H,O,E),y=y||w,!A.filter_childWithSibs&&w&&m.eq(x).removeClass(A.filter_filteredRow);y=y||_}else y=w;f.toggleClass(A.filter_filteredRow,!y)[0].display=y?"":"none"}}H.filteredRows+=d.not("."+A.filter_filteredRow).length,H.totalRows+=d.length,i.processTbody(a,p,!1)}H.lastCombinedFilter=k.join(""),H.lastSearch=k,H.$table.data("lastSearch",k),A.filter_saveFilters&&i.storage&&i.storage(a,"tablesorter-filters",t.processFilters(k,!0)),I&&console.log("Filter >> Completed search"+i.benchmark(v)),A.filter_initialized&&(H.$table.triggerHandler("filterBeforeEnd",H),H.$table.triggerHandler("filterEnd",H)),setTimeout(function(){i.applyWidget(H.table)},0)}},getOptionSource:function(r,a,l){var s=(r=e(r)[0]).config,n=!1,o=s.widgetOptions.filter_selectSource,c=s.$table.data("lastSearch")||[],d="function"==typeof o||i.getColumnData(r,o,a);if(l&&""!==c[a]&&(l=!1),!0===d)n=o(r,a,l);else{if(d instanceof e||"string"===e.type(d)&&d.indexOf("</option>")>=0)return d;if(e.isArray(d))n=d;else if("object"===e.type(o)&&d&&null===(n=d(r,a,l)))return null}return!1===n&&(n=t.getOptions(r,a,l)),t.processOptions(r,a,n)},processOptions:function(t,r,a){if(!e.isArray(a))return!1;var l,s,n,o,c,d,f=(t=e(t)[0]).config,h=null!=r&&r>=0&&r<f.columns,u=!!h&&f.$headerIndexed[r].hasClass("filter-select-sort-desc"),p=[];if(a=e.grep(a,function(t,r){return!!t.text||e.inArray(t,a)===r}),h&&f.$headerIndexed[r].hasClass("filter-select-nosort"))return a;for(o=a.length,n=0;n<o;n++)d=(s=a[n]).text?s.text:s,c=(h&&f.parsers&&f.parsers.length&&f.parsers[r].format(d,t,[],r)||d).toString(),c=f.widgetOptions.filter_ignoreCase?c.toLowerCase():c,s.text?(s.parsed=c,p[p.length]=s):p[p.length]={text:s,parsed:c};for(l=f.textSorter||"",p.sort(function(e,a){var s=u?a.parsed:e.parsed,n=u?e.parsed:a.parsed;return h&&"function"==typeof l?l(s,n,!0,r,t):h&&"object"==typeof l&&l.hasOwnProperty(r)?l[r](s,n,!0,r,t):!i.sortNatural||i.sortNatural(s,n)}),a=[],o=p.length,n=0;n<o;n++)a[a.length]=p[n];return a},getOptions:function(t,r,a){var l,s,n,o,c,d,f,h,u=(t=e(t)[0]).config,p=u.widgetOptions,g=[];for(s=0;s<u.$tbodies.length;s++)for(c=u.cache[s],n=u.cache[s].normalized.length,l=0;l<n;l++)if(o=c.row?c.row[l]:c.normalized[l][u.columns].$row[0],!a||!o.className.match(p.filter_filteredRow))if(p.filter_useParsedData||u.parsers[r].parsed||u.$headerIndexed[r].hasClass("filter-parsed")){if(g[g.length]=""+c.normalized[l][r],p.filter_childRows&&p.filter_childByColumn)for(h=c.normalized[l][u.columns].$row.length-1,d=0;d<h;d++)g[g.length]=""+c.normalized[l][u.columns].child[d][r]}else if(g[g.length]=c.normalized[l][u.columns].raw[r],p.filter_childRows&&p.filter_childByColumn)for(h=c.normalized[l][u.columns].$row.length,d=1;d<h;d++)f=c.normalized[l][u.columns].$row.eq(d).children().eq(r),g[g.length]=""+i.getElementText(u,f,r);return g},buildSelect:function(i,l,s,n,o){if(i=e(i)[0],l=parseInt(l,10),i.config.cache&&!e.isEmptyObject(i.config.cache)){var c,d,f,h,u,p,g,m=i.config,b=m.widgetOptions,y=m.$headerIndexed[l],_='<option value="">'+(y.data("placeholder")||y.attr("data-placeholder")||b.filter_placeholder.select||"")+"</option>",v=m.$table.find("thead").find("select."+a.filter+'[data-column="'+l+'"]').val();if(void 0!==s&&""!==s||null!==(s=t.getOptionSource(i,l,o))){if(e.isArray(s)){for(c=0;c<s.length;c++)if((g=s[c]).text){for(d in g["data-function-name"]=void 0===g.value?g.text:g.value,_+="<option",g)g.hasOwnProperty(d)&&"text"!==d&&(_+=" "+d+'="'+g[d].replace(r.quote,"&quot;")+'"');g.value||(_+=' value="'+g.text.replace(r.quote,"&quot;")+'"'),_+=">"+g.text.replace(r.quote,"&quot;")+"</option>"}else""+g!="[object Object]"&&(d=f=g=(""+g).replace(r.quote,"&quot;"),f.indexOf(b.filter_selectSourceSeparator)>=0&&(d=(h=f.split(b.filter_selectSourceSeparator))[0],f=h[1]),_+=""!==g?"<option "+(d===f?"":'data-function-name="'+g+'" ')+'value="'+d+'">'+f+"</option>":"");s=[]}u=(m.$filters?m.$filters:m.$table.children("thead")).find("."+a.filter),b.filter_$externalFilters&&(u=u&&u.length?u.add(b.filter_$externalFilters):b.filter_$externalFilters),(p=u.filter('select[data-column="'+l+'"]')).length&&(p[n?"html":"append"](_),e.isArray(s)||p.append(s).val(v),p.val(v))}}},buildDefault:function(e,r){var a,l,s,n=e.config,o=n.widgetOptions,c=n.columns;for(a=0;a<c;a++)s=!((l=n.$headerIndexed[a]).hasClass("filter-false")||l.hasClass("parser-false")),(l.hasClass("filter-select")||!0===i.getColumnData(e,o.filter_functions,a))&&s&&t.buildSelect(e,a,"",r,l.hasClass(o.filter_onlyAvail))}},r=t.regex,i.getFilters=function(r,i,l,s){var n,o,c,d,f=[],h=r?e(r)[0].config:"",u=h?h.widgetOptions:"";if(!0!==i&&u&&!u.filter_columnFilters||e.isArray(l)&&t.equalFilters(h,l,h.lastSearch))return e(r).data("lastSearch")||[];if(h&&(h.$filters&&(o=h.$filters.find("."+a.filter)),u.filter_$externalFilters&&(o=o&&o.length?o.add(u.filter_$externalFilters):u.filter_$externalFilters),o&&o.length))for(f=l||[],n=0;n<h.columns+1;n++)d=n===h.columns?u.filter_anyColumnSelector+","+u.filter_multipleColumnSelector:'[data-column="'+n+'"]',(c=o.filter(d)).length&&(c=t.getLatestSearch(c),e.isArray(l)?(s&&c.length>1&&(c=c.slice(1)),n===h.columns&&(d=c.filter(u.filter_anyColumnSelector),c=d.length?d:c),c.val(l[n]).trigger("change"+h.namespace)):(f[n]=c.val()||"",n===h.columns?c.slice(1).filter('[data-column*="'+c.attr("data-column")+'"]').val(f[n]):c.slice(1).val(f[n])),n===h.columns&&c.length&&(u.filter_$anyMatch=c));return f},i.setFilters=function(r,a,l,s){var n=r?e(r)[0].config:"",o=i.getFilters(r,!0,a,s);return void 0===l&&(l=!0),n&&l&&(n.lastCombinedFilter=null,n.lastSearch=[],t.searching(n.table,a,s),n.$table.triggerHandler("filterFomatterUpdate")),0!==o.length}}(e),function(e,t){"use strict";var r=e.tablesorter||{};function i(t,r){var i=isNaN(r.stickyHeaders_offset)?e(r.stickyHeaders_offset):[];return i.length?i.height()||0:parseInt(r.stickyHeaders_offset,10)||0}e.extend(r.css,{sticky:"tablesorter-stickyHeader",stickyVis:"tablesorter-sticky-visible",stickyHide:"tablesorter-sticky-hidden",stickyWrap:"tablesorter-sticky-wrapper"}),r.addHeaderResizeEvent=function(t,r,i){if((t=e(t)[0]).config){var a=e.extend({},{timer:250},i),l=t.config,s=l.widgetOptions,n=function(e){var t,r,i,a,n,o,c=l.$headers.length;for(s.resize_flag=!0,r=[],t=0;t<c;t++)a=(i=l.$headers.eq(t)).data("savedSizes")||[0,0],n=i[0].offsetWidth,o=i[0].offsetHeight,n===a[0]&&o===a[1]||(i.data("savedSizes",[n,o]),r.push(i[0]));r.length&&!1!==e&&l.$table.triggerHandler("resize",[r]),s.resize_flag=!1};if(clearInterval(s.resize_timer),r)return s.resize_flag=!1,!1;n(!1),s.resize_timer=setInterval(function(){s.resize_flag||n()},a.timer)}},r.addWidget({id:"stickyHeaders",priority:54,options:{stickyHeaders:"",stickyHeaders_appendTo:null,stickyHeaders_attachTo:null,stickyHeaders_xScroll:null,stickyHeaders_yScroll:null,stickyHeaders_offset:0,stickyHeaders_filteredToTop:!0,stickyHeaders_cloneId:"-sticky",stickyHeaders_addResizeEvent:!0,stickyHeaders_includeCaption:!0,stickyHeaders_zIndex:2},format:function(a,l,s){if(!(l.$table.hasClass("hasStickyHeaders")||e.inArray("filter",l.widgets)>=0&&!l.$table.hasClass("hasFilters"))){var n,o,c,d,f=l.$table,h=e(s.stickyHeaders_attachTo||s.stickyHeaders_appendTo),u=l.namespace+"stickyheaders ",p=e(s.stickyHeaders_yScroll||s.stickyHeaders_attachTo||t),g=e(s.stickyHeaders_xScroll||s.stickyHeaders_attachTo||t),m=f.children("thead:first").children("tr").not(".sticky-false").children(),b=f.children("tfoot"),y=i(0,s),_=f.parent().closest("."+r.css.table).hasClass("hasStickyHeaders")?f.parent().closest("table.tablesorter")[0].config.widgetOptions.$sticky.parent():[],v=_.length?_.height():0,w=s.$sticky=f.clone().addClass("containsStickyHeaders "+r.css.sticky+" "+s.stickyHeaders+" "+l.namespace.slice(1)+"_extra_table").wrap('<div class="'+r.css.stickyWrap+'">'),x=w.parent().addClass(r.css.stickyHide).css({position:h.length?"absolute":"fixed",padding:parseInt(w.parent().parent().css("padding-left"),10),top:y+v,left:0,visibility:"hidden",zIndex:s.stickyHeaders_zIndex||2}),S=w.children("thead:first"),C="",z=function(e,r){var i,a,l,s,n,o=e.filter(":visible"),c=o.length;for(i=0;i<c;i++)s=r.filter(":visible").eq(i),"border-box"===(n=o.eq(i)).css("box-sizing")?a=n.outerWidth():"collapse"===s.css("border-collapse")?t.getComputedStyle?a=parseFloat(t.getComputedStyle(n[0],null).width):(l=parseFloat(n.css("border-width")),a=n.outerWidth()-parseFloat(n.css("padding-left"))-parseFloat(n.css("padding-right"))-l):a=n.width(),s.css({width:a,"min-width":a,"max-width":a})},$=function(r){return!1===r&&_.length?f.position().left:h.length?parseInt(h.css("padding-left"),10)||0:f.offset().left-parseInt(f.css("margin-left"),10)-e(t).scrollLeft()},F=function(){x.css({left:$(),width:f.outerWidth()}),z(f,w),z(m,d)},R=function(t){if(f.is(":visible")){v=_.length?_.offset().top-p.scrollTop()+_.height():0;var a,l=f.offset(),n=i(0,s),o=e.isWindow(p[0]),c=o?p.scrollTop():_.length?parseInt(_[0].style.top,10):p.offset().top,d=h.length?c:p.scrollTop(),u=s.stickyHeaders_includeCaption?0:f.children("caption").height()||0,g=d+n+v-u,m=f.height()-(x.height()+(b.height()||0))-u,y=g>l.top&&g<l.top+m?"visible":"hidden",w="visible"===y?r.css.stickyVis:r.css.stickyHide,S=!x.hasClass(w),z={visibility:y};h.length&&(S=!0,z.top=o?g-h.offset().top:h.scrollTop()),(a=$(o))!==parseInt(x.css("left"),10)&&(S=!0,z.left=a),z.top=(z.top||0)+(!o&&_.length?_.height():n+v),S&&x.removeClass(r.css.stickyVis+" "+r.css.stickyHide).addClass(w).css(z),(y!==C||t)&&(F(),C=y)}};if(h.length&&!h.css("position")&&h.css("position","relative"),w.attr("id")&&(w[0].id+=s.stickyHeaders_cloneId),w.find("> thead:gt(0), tr.sticky-false").hide(),w.find("> tbody, > tfoot").remove(),w.find("caption").toggle(s.stickyHeaders_includeCaption),d=S.children().children(),w.css({height:0,width:0,margin:0}),d.find("."+r.css.resizer).remove(),f.addClass("hasStickyHeaders").bind("pagerComplete"+u,function(){F()}),r.bindEvents(a,S.children().children("."+r.css.header)),s.stickyHeaders_appendTo?e(s.stickyHeaders_appendTo).append(x):f.after(x),l.onRenderHeader)for(o=(c=S.children("tr").children()).length,n=0;n<o;n++)l.onRenderHeader.apply(c.eq(n),[n,l,w]);g.add(p).unbind("scroll resize ".split(" ").join(u).replace(/\s+/g," ")).bind("scroll resize ".split(" ").join(u),function(e){R("resize"===e.type)}),l.$table.unbind("stickyHeadersUpdate"+u).bind("stickyHeadersUpdate"+u,function(){R(!0)}),s.stickyHeaders_addResizeEvent&&r.addHeaderResizeEvent(a),f.hasClass("hasFilters")&&s.filter_columnFilters&&(f.bind("filterEnd"+u,function(){var i=e(document.activeElement).closest("td"),a=i.parent().children().index(i);x.hasClass(r.css.stickyVis)&&s.stickyHeaders_filteredToTop&&(t.scrollTo(0,f.position().top),a>=0&&l.$filters&&l.$filters.eq(a).find("a, select, input").filter(":visible").focus())}),r.filter.bindSearch(f,d.find("."+r.css.filter)),s.filter_hideFilters&&r.filter.hideFilters(l,w)),s.stickyHeaders_addResizeEvent&&f.bind("resize"+l.namespace+"stickyheaders",function(){F()}),R(!0),f.triggerHandler("stickyHeadersInit")}},remove:function(i,a,l){var s=a.namespace+"stickyheaders ";a.$table.removeClass("hasStickyHeaders").unbind("pagerComplete resize filterEnd stickyHeadersUpdate ".split(" ").join(s).replace(/\s+/g," ")).next("."+r.css.stickyWrap).remove(),l.$sticky&&l.$sticky.length&&l.$sticky.remove(),e(t).add(l.stickyHeaders_xScroll).add(l.stickyHeaders_yScroll).add(l.stickyHeaders_attachTo).unbind("scroll resize ".split(" ").join(s).replace(/\s+/g," ")),r.addHeaderResizeEvent(i,!0)}})}(e,window),function(e,t){"use strict";var r=e.tablesorter||{};e.extend(r.css,{resizableContainer:"tablesorter-resizable-container",resizableHandle:"tablesorter-resizable-handle",resizableNoSelect:"tablesorter-disableSelection",resizableStorage:"tablesorter-resizable"}),e(function(){var t="<style>body."+r.css.resizableNoSelect+" { -ms-user-select: none; -moz-user-select: -moz-none;-khtml-user-select: none; -webkit-user-select: none; user-select: none; }."+r.css.resizableContainer+" { position: relative; height: 1px; }."+r.css.resizableHandle+" { position: absolute; display: inline-block; width: 8px;top: 1px; cursor: ew-resize; z-index: 3; user-select: none; -moz-user-select: none; }</style>";e("head").append(t)}),r.resizable={init:function(t,i){if(!t.$table.hasClass("hasResizable")){t.$table.addClass("hasResizable");var a,l,s,n,o=t.$table,c=o.parent(),d=parseInt(o.css("margin-top"),10),f=i.resizable_vars={useStorage:r.storage&&!1!==i.resizable,$wrap:c,mouseXPosition:0,$target:null,$next:null,overflow:"auto"===c.css("overflow")||"scroll"===c.css("overflow")||"auto"===c.css("overflow-x")||"scroll"===c.css("overflow-x"),storedSizes:[]};for(r.resizableReset(t.table,!0),f.tableWidth=o.width(),f.fullWidth=Math.abs(c.width()-f.tableWidth)<20,f.useStorage&&f.overflow&&(r.storage(t.table,"tablesorter-table-original-css-width",f.tableWidth),n=r.storage(t.table,"tablesorter-table-resized-width")||"auto",r.resizable.setWidth(o,n,!0)),i.resizable_vars.storedSizes=s=(f.useStorage?r.storage(t.table,r.css.resizableStorage):[])||[],r.resizable.setWidths(t,i,s),r.resizable.updateStoredSizes(t,i),i.$resizable_container=e('<div class="'+r.css.resizableContainer+'">').css({top:d}).insertBefore(o),l=0;l<t.columns;l++)a=t.$headerIndexed[l],n=r.getColumnData(t.table,t.headers,l),"false"===r.getData(a,n,"resizable")||e('<div class="'+r.css.resizableHandle+'">').appendTo(i.$resizable_container).attr({"data-column":l,unselectable:"on"}).data("header",a).bind("selectstart",!1);r.resizable.bindings(t,i)}},updateStoredSizes:function(e,t){var r,i,a=e.columns,l=t.resizable_vars;for(l.storedSizes=[],r=0;r<a;r++)i=e.$headerIndexed[r],l.storedSizes[r]=i.is(":visible")?i.width():0},setWidth:function(e,t,r){e.css({width:t,"min-width":r?t:"","max-width":r?t:""})},setWidths:function(t,i,a){var l,s,n=i.resizable_vars,o=e(t.namespace+"_extra_headers"),c=t.$table.children("colgroup").children("col");if((a=a||n.storedSizes||[]).length){for(l=0;l<t.columns;l++)r.resizable.setWidth(t.$headerIndexed[l],a[l],n.overflow),o.length&&(s=o.eq(l).add(c.eq(l)),r.resizable.setWidth(s,a[l],n.overflow));(s=e(t.namespace+"_extra_table")).length&&!r.hasWidget(t.table,"scroller")&&r.resizable.setWidth(s,t.$table.outerWidth(),n.overflow)}},setHandlePosition:function(t,i){var a,l=t.$table.height(),s=i.$resizable_container.children(),n=Math.floor(s.width()/2);r.hasWidget(t.table,"scroller")&&(l=0,t.$table.closest("."+r.css.scrollerWrap).children().each(function(){var t=e(this);l+=t.filter('[style*="height"]').length?t.height():t.children("table").height()})),!i.resizable_includeFooter&&t.$table.children("tfoot").length&&(l-=t.$table.children("tfoot").height()),a=parseFloat(e.fn.jquery)>=3.3?0:t.$table.position().left,s.each(function(){var s=e(this),o=parseInt(s.attr("data-column"),10),c=t.columns-1,d=s.data("header");d&&(!d.is(":visible")||!i.resizable_addLastColumn&&r.resizable.checkVisibleColumns(t,o)?s.hide():(o<c||o===c&&i.resizable_addLastColumn)&&s.css({display:"inline-block",height:l,left:d.position().left-a+d.outerWidth()-n}))})},checkVisibleColumns:function(e,t){var r,i=0;for(r=t+1;r<e.columns;r++)i+=e.$headerIndexed[r].is(":visible")?1:0;return 0===i},toggleTextSelection:function(t,i,a){var l=t.namespace+"tsresize";i.resizable_vars.disabled=a,e("body").toggleClass(r.css.resizableNoSelect,a),a?e("body").attr("unselectable","on").bind("selectstart"+l,!1):e("body").removeAttr("unselectable").unbind("selectstart"+l)},bindings:function(i,a){var l=i.namespace+"tsresize";a.$resizable_container.children().bind("mousedown",function(t){var l,s=a.resizable_vars,n=e(i.namespace+"_extra_headers"),o=e(t.target).data("header");l=parseInt(o.attr("data-column"),10),s.$target=o=o.add(n.filter('[data-column="'+l+'"]')),s.target=l,s.$next=t.shiftKey||a.resizable_targetLast?o.parent().children().not(".resizable-false").filter(":last"):o.nextAll(":not(.resizable-false)").eq(0),l=parseInt(s.$next.attr("data-column"),10),s.$next=s.$next.add(n.filter('[data-column="'+l+'"]')),s.next=l,s.mouseXPosition=t.pageX,r.resizable.updateStoredSizes(i,a),r.resizable.toggleTextSelection(i,a,!0)}),e(document).bind("mousemove"+l,function(e){var t=a.resizable_vars;t.disabled&&0!==t.mouseXPosition&&t.$target&&(a.resizable_throttle?(clearTimeout(t.timer),t.timer=setTimeout(function(){r.resizable.mouseMove(i,a,e)},isNaN(a.resizable_throttle)?5:a.resizable_throttle)):r.resizable.mouseMove(i,a,e))}).bind("mouseup"+l,function(){a.resizable_vars.disabled&&(r.resizable.toggleTextSelection(i,a,!1),r.resizable.stopResize(i,a),r.resizable.setHandlePosition(i,a))}),e(t).bind("resize"+l+" resizeEnd"+l,function(){r.resizable.setHandlePosition(i,a)}),i.$table.bind("columnUpdate pagerComplete resizableUpdate ".split(" ").join(l+" "),function(){r.resizable.setHandlePosition(i,a)}).bind("resizableReset"+l,function(){r.resizableReset(i.table)}).find("thead:first").add(e(i.namespace+"_extra_table").find("thead:first")).bind("contextmenu"+l,function(){var e=0===a.resizable_vars.storedSizes.length;return r.resizableReset(i.table),r.resizable.setHandlePosition(i,a),a.resizable_vars.storedSizes=[],e})},mouseMove:function(t,i,a){if(0!==i.resizable_vars.mouseXPosition&&i.resizable_vars.$target){var l,s=0,n=i.resizable_vars,o=n.$next,c=n.storedSizes[n.target],d=a.pageX-n.mouseXPosition;if(n.overflow){if(c+d>0){for(n.storedSizes[n.target]+=d,r.resizable.setWidth(n.$target,n.storedSizes[n.target],!0),l=0;l<t.columns;l++)s+=n.storedSizes[l];r.resizable.setWidth(t.$table.add(e(t.namespace+"_extra_table")),s)}o.length||(n.$wrap[0].scrollLeft=t.$table.width())}else n.fullWidth?(n.storedSizes[n.target]+=d,n.storedSizes[n.next]-=d,r.resizable.setWidths(t,i)):(n.storedSizes[n.target]+=d,r.resizable.setWidths(t,i));n.mouseXPosition=a.pageX,t.$table.triggerHandler("stickyHeadersUpdate")}},stopResize:function(e,t){var i=t.resizable_vars;r.resizable.updateStoredSizes(e,t),i.useStorage&&(r.storage(e.table,r.css.resizableStorage,i.storedSizes),r.storage(e.table,"tablesorter-table-resized-width",e.$table.width())),i.mouseXPosition=0,i.$target=i.$next=null,e.$table.triggerHandler("stickyHeadersUpdate"),e.$table.triggerHandler("resizableComplete")}},r.addWidget({id:"resizable",priority:40,options:{resizable:!0,resizable_addLastColumn:!1,resizable_includeFooter:!0,resizable_widths:[],resizable_throttle:!1,resizable_targetLast:!1},init:function(e,t,i,a){r.resizable.init(i,a)},format:function(e,t,i){r.resizable.setHandlePosition(t,i)},remove:function(t,i,a,l){if(a.$resizable_container){var s=i.namespace+"tsresize";i.$table.add(e(i.namespace+"_extra_table")).removeClass("hasResizable").children("thead").unbind("contextmenu"+s),a.$resizable_container.remove(),r.resizable.toggleTextSelection(i,a,!1),r.resizableReset(t,l),e(document).unbind("mousemove"+s+" mouseup"+s)}}}),r.resizableReset=function(t,i){e(t).each(function(){var e,a,l=this.config,s=l&&l.widgetOptions,n=s.resizable_vars;if(t&&l&&l.$headerIndexed.length){for(n.overflow&&n.tableWidth&&(r.resizable.setWidth(l.$table,n.tableWidth,!0),n.useStorage&&r.storage(t,"tablesorter-table-resized-width",n.tableWidth)),e=0;e<l.columns;e++)a=l.$headerIndexed[e],s.resizable_widths&&s.resizable_widths[e]?r.resizable.setWidth(a,s.resizable_widths[e],n.overflow):a.hasClass("resizable-false")||r.resizable.setWidth(a,"",n.overflow);l.$table.triggerHandler("stickyHeadersUpdate"),r.storage&&!i&&r.storage(this,r.css.resizableStorage,[])}})}}(e,window),function(e){"use strict";var t=e.tablesorter||{};function r(r){var i=t.storage(r.table,"tablesorter-savesort");return i&&i.hasOwnProperty("sortList")&&e.isArray(i.sortList)?i.sortList:[]}function i(e,t){return(t||r(e)).join(",")!==e.sortList.join(",")}t.addWidget({id:"saveSort",priority:20,options:{saveSort:!0},init:function(e,t,r,i){t.format(e,r,i,!0)},format:function(e,a,l,s){var n,o=a.$table,c=!1!==l.saveSort,d={sortList:a.sortList},f=t.debug(a,"saveSort");f&&(n=new Date),o.hasClass("hasSaveSort")?c&&e.hasInitialized&&t.storage&&i(a)&&(t.storage(e,"tablesorter-savesort",d),f&&console.log("saveSort >> Saving last sort: "+a.sortList+t.benchmark(n))):(o.addClass("hasSaveSort"),d="",t.storage&&(d=r(a),f&&console.log('saveSort >> Last sort loaded: "'+d+'"'+t.benchmark(n)),o.bind("saveSortReset",function(r){r.stopPropagation(),t.storage(e,"tablesorter-savesort","")})),s&&d&&d.length>0?a.sortList=d:e.hasInitialized&&d&&d.length>0&&i(a,d)&&t.sortOn(a,d))},remove:function(e,r){r.$table.removeClass("hasSaveSort"),t.storage&&t.storage(e,"tablesorter-savesort","")}})}(e),e.tablesorter});