diff --git a/README.md b/README.md index 91b02ca9..9e0fef0c 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,140 @@ tablesorter can successfully parse and sort many types of data including linked View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Change). +#### Version 2.15.0 (1/25/2014) + +* Core + * Add accessibility attributes to tablesorter (aria). + * Make header's `bindEvent` function public to allow easier binding to cloned table headers. + * Add an unsorted header class name option `cssNone` (empty string by default) and now all unsorted headers will have a class name of `tablesorter-headerUnSorted` applied; updated destroy method to remove header unsorted class name. + * Ensure only "updateRow" is triggered within the pager plugin to prevent issues with Proptype.js, see [issue #217](https://github.com/Mottie/tablesorter/issues/217). + * Clean up all public API functions to accept `table` as either a DOM element or a jQuery table object. + * The log will now display console errors and/or warnings based on those key words. + * Consolidated all default class names used by the plugin within `$.tablesorter.css` - these are class names that are not set by the options. + +* Docs + * Organize the examples section to make it easier to find the desired sort demo. + * Add associated tablesorter option (with link) with the appropriate examples. + * Add a "Custom parsers" section instead of lumping it in with the widgets. + * Add a "Work-in-progress" section for some beta demos. + * Add indicators to show which widgets are contained within the `jquery.tablesorter.widgets.js` file. + * Add an "API" section which gives details on how to use tablesorters available public variables & functions in both the core and widgets. + * Colorize the left border of code blocks to differentiate HTML, CSS and javascript. + * Update & consolidate jQuery UI accordion code. + * Miscellaneous demo fixes. + +* Parsers + * The "shortDate" parser now works properly with header colspans. Fixes [issue #474](https://github.com/Mottie/tablesorter/issues/474). + * The "currency" parser will now properly detect currencies which include a plus or minus sign. + * The "checkbox" parser (contained in the `parser-input-select.js` file) will now toggle a class name of `checked-#` (`#` is the column index) on the row. + * A new `parsed` parameter has been added to the parser code block. + * This parameter is set with a boolean value (i.e. `true` or `false`), to signal the filter widget to only search through parsed data when `true`. + * All parsers within the "parser-input-select.js" file now include a `parsed:true` parameter. + * The [parsers](http://mottie.github.io/tablesorter/docs/example-parsers.html) and [parsers-advanced](http://mottie.github.io/tablesorter/docs/example-parsers-advanced.html) demos have been updated to reflect this addition. + +* css Sticky headers widget: + * Add `cssStickyHeaders_zIndex` option. Fixes [issue #466](https://github.com/Mottie/tablesorter/issues/466). + * Browser will now scroll to table top after filtering. Fixes [issue #482](https://github.com/Mottie/tablesorter/issues/482). + +* Column selector widget (new!) + * This widget can make a table responsive. It uses similar parameters as those used by jQuery mobile to set priorities for hiding columns (uses "data-priority" attribute). + * The column priorities range from 1 to 6, with 1 having the highest priority. As the browser window shrinks, lower priority (higher numbers) columns will be hidden first until all numbered priority columns are hidden. + * Any named data-priority, other than the numbers 1 - 6, (e.g. "critical" or "persistent") will be treated as a column which *will not be included* in the column selector. + * With the addition of some basic selector markup and css, this widget will also allow selecting (hiding or showing) table columns. + * Popups can also be targetted for addition of these selectors; [the demo](http://mottie.github.io/tablesorter/docs/example-widget-column-selector.html) includes a Bootstrap popover sample. + * Css selectors are used to hide/show columns for optimal speed and therefore will not work in IE8 and older browsers. + * jQuery version 1.7+ and tablesorter verison 2.8+ are needed for this widget to work properly. + * Check out the [demo](http://mottie.github.io/tablesorter/docs/example-widget-column-selector.html) with more details on how to setup this widget! + +* Editable widget + * Refresh other widgets after a cell has been edited. Fixes [issue #487](https://github.com/Mottie/tablesorter/issues/487). + +* Filter widget: + * Make operator match higher priority than exact matching. Fixes [issue #465](https://github.com/Mottie/tablesorter/issues/465). + * Fix " OR " is now matched case insensitive. + * The `filter_cssFilter` option can now contain an array of class names to be applied to each filter input; added in addition to the "tablesorter-filter" class name. + * Start filter values are now preserved. Fixes [issue #452](https://github.com/Mottie/tablesorter/issues/452). + * Filter formatter demo: Update jQuery UI & stylesheet - fixes UI spinner. + * Fix child rows always visible when filtering. + * Update beta demo - [select2 external table filters demo](http://mottie.github.io/tablesorter/beta-testing/example-external-filters-using-select2.html), thanks to [mohitmayank](https://github.com/mohitmayank); see [pull request #469](https://github.com/Mottie/tablesorter/pull/469). + * Add `filter_hideEmpty` option + * Set this option to false to always show the filter row. + * By default, the filter row is completely hidden when no rows exist within the tbody (previous behavior) + * Fixes [issue #450](https://github.com/Mottie/tablesorter/issues/450) + * Rewrite filter match any column code + * Removed `filter_anyMatch` option - sorry about not deprecating this first! + * Added a `filter_external` option which is set to a jQuery selector string of inputs, outside of the table, to be used for searching table content. + * External inputs must have a `data-column="x"` attribute where `"x"` is the associated column to filter; `"x"` can also be set as `"any"` to match any column. + * All filters, internal and external, now automatically update and be used with the `$.tablesorter.getFilters` and `$.tablesorter.setFilters` functions. + * Please refer to the documentation for the [`filter_external` option](http://mottie.github.io/tablesorter/docs/index.html#widget-filter-external) for more details. + * Also check out the updated [filter widget external option](http://mottie.github.io/tablesorter/docs/example-widget-filter-any-match.html) and [filter widget external inputs](http://mottie.github.io/tablesorter/docs/example-widget-filter-external-inputs.html) demos. + * This fixes issues [#114](https://github.com/Mottie/tablesorter/issues/114), [#370](https://github.com/Mottie/tablesorter/issues/370), [#471](https://github.com/Mottie/tablesorter/issues/471) and [#490](https://github.com/Mottie/tablesorter/issues/490). + * Parsers with a `parsed: true` flag will now automatically force the filter widget to only search through parsed data instead of actual table cell data + * This is needed specifically for parsers of input, textarea and select elements. + * All parsers within the "parser-input-select.js" file have been updated with this parameter. + * This flag is essentially does the same thing as adding a class name of `filter-parsed` to the column header, or `filter: "parsed"` setting to the [`headers` option](http://mottie.github.io/tablesorter/docs/#headers). + +* Filter Formatter (Filter widget extension): + * These updated filter widget functions are not completely backward compatible with older versions of the filter widget. Please update both! + * Added `compare` & `selected` options: + * These options allow the adding of a comparison operator selector to the cell (e.g. `>`, `>=`, `<`, `<=`, etc). + * If any `cellText` is included, it is now wrapped in a label with a class name of "compare-select-label" and "compare-select-label#" (where "#" is the column index). + * The selector has a class name of "compare-select" and "compare-select#" (where "#" is the column index) + * Whichever type of input that is added to the cell is then wrapped in a div with class "compare-select-wrapper" and "compare-select-wrapper#" (where "#" is the column index). + * These class names allow styling of an individual filter to keep elements in line, or however you wish to style it. + * Filter reset now sets these filters to their default values, not an empty string. + * Updated to now properly restore saved filters. + * Added `endOfDay` option for jQuery UI Datepicker. + * When `true` search dates will include all times from the date chosen when a comparison is made of dates "less than" the set date. + * Example 1: if a table entry has a date of "Jan 14, 2014 11:23 AM" and the filter search is set to `<= 1/14/2014`, the table entry will be included in the search; the default set time would otherwise be "1/14/2014 00:00:00" and not include the entry from "11:23 AM". So, the `endOfDay` option sets the time to "23:59:59". + * Example 2: if searching for one specific date, this option will now search for all times within that day. For example, searching for `=1/20/2014`, and the results will include dates from 1/20/2014 00:00:00 to 1/20/2014 23:59:59. + * When comparing dates greater than the set date, the time will be set to midnight; so this option will not be applied. + * Example 3: in two date inputs, the `endOfDay` time is only applied to the "to" input; search for `1/20/2014 - 1/20/2014` + * This option is available in both the comparison (one input) and range (two inputs; "to" date input only) date pickers. + * Fixes [issue #325](https://github.com/Mottie/tablesorter/issues/325) and [issue #430](https://github.com/Mottie/tablesorter/issues/430). + +* Group widget: + * Attempt to fix ajax issue. See [issue #437](https://github.com/Mottie/tablesorter/issues/437). + * Combining group widget with pager should now work properly. Fixes [isse #437](https://github.com/Mottie/tablesorter/issues/437). + * The widget will now find the correct header cell when multiple thead rows are present. + +* Pager (plugin & widget): + * Fixed pager issues with empty tables + * When existing rows are removed from the table, the pager display will no properly update to show zero total rows. + * When starting from an empty table and content is added, all widgets are refreshed + * When updating the table via an update method, the filter search will now be applied properly. + * Fixes issues [#426](https://github.com/Mottie/tablesorter/issues/426) & [#455](https://github.com/Mottie/tablesorter/issues/455) + * Correct page calculation. Fixes [issue #468](https://github.com/Mottie/tablesorter/issues/468). + * Added custom storage keys. Thanks to [eire1130](https://github.com/eire1130); see [pull request #480](https://github.com/Mottie/tablesorter/pull/480) & [issue #481](https://github.com/Mottie/tablesorter/issues/481). + * Added a public show error function `$.tablesorter.showError( table, message );` + * Pass this function the table DOM element or jQuery object in `table` + * The message can either be a string with a message ("table refuses to cooperate") + * or, the message can be an HTML string of an entire table row (`'yeah, instead of showing your data... I am taking a nap'`) + * If the message is blank, all error rows are removed + * Fulfills [issue #486](https://github.com/Mottie/tablesorter/issues/486) + * Please note that this function was added to both the pager widget & pager plugin; In the next major release, this function will be separate from both, and can be included in the build. + * All theme files included a minor update with this change. + * Added accessibility attributes to the pager. + * Fix jsHint warnings. + +* Resizable widget + * Fix reported js error. + * The resizable reset function `$.tablesorter.resizableReset(table);` now accepts jQuery objects. + +* Sticky headers widget + * Select boxes work again within sticky headers. Fixes [issue #473](https://github.com/Mottie/tablesorter/issues/473). + * Browser will scroll to table top after filtering. + * This only occurs if the sticky header is active and after a filter is applied. + * Fixes [issue #482](https://github.com/Mottie/tablesorter/issues/482). + * Use core's new `bindEvents` public function to bind events to cloned sticky header. + * Fix sticky header alignment within `attachTo` elements. + +* Miscellaneous + * Update all Bootstrap demos to use the latest version (v3.0.3). Thanks [themilkman](https://github.com/themilkman)! + * Update all demo pages that use jQuery UI accordion with the newest version. Also added a clickable anchor to each accordion header. + * Consolidate default class names within `$.tablesorter.css` for the filter, resizer and stickyHeaders widgets. + * Renamed component.json to bower.json + #### Version 2.14.5 (12/16/2013) * Pager @@ -119,93 +253,3 @@ View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Chan * Grouping widget * Invalid group class now fails silently. * Fixes [issue #438](https://github.com/Mottie/tablesorter/issues/438). - -#### Version 2.14.1 (11/22/2013) - -* Filter widget - * External inputs bound using the filter `bindSearch` function now clear on the "filterReset" event. - * Replace `Array.indexOf()` due to IE8. -* Pager (plugin & widget) - * Replace `Array.indexOf()` due to IE8. Fixes [issue #388](https://github.com/Mottie/tablesorter/issues/388). -* Themes - * Non-sortables headers now show the default cursor - * Fix Dropbox theme to work properly within the sticky header demo - * Fix Ice theme to include a top border in the sticky header demo - * Tweaked sticky header widget to better align columns in Firefox & adjust caption to hide border edges. - * See the [sticky header demo](http://mottie.github.io/tablesorter/docs/example-widget-sticky-header.html) to see these changes. - * Fixes [#407](https://github.com/Mottie/tablesorter/issues/407). -* Documentation - * Update FAQ page to include information on the zebra widget not always working. - * Update demos to use Bootstrap 3.0.2. - * Add search instructions to the wiki documentation pages. - * Add link to FAQ & search instructions on the main documenation page. -* Add associated core version number to pager addon & widget, main widget file and filter formatter file. - -#### Version 2.14.0 (11/19/2013) - -**Core** -* Changed sorting algorithms: - * Due to problems with sorting multiple columns improperly sorting algorithms again include code to sort empty cells. - * Internal sorting again has separate ascending and descending functions; but the previous `$.tablesorter.sortNatural` (ascending only), `$.tablesorter.sortNumeric` (ascending only) and `$.tablesorter.sortText` (ascending only) functions are still available. - * Custom text & numeric sort functions, added via `textSorter` and `numberSorter` options now require you to return the sort in the correct direction. - * Custom sort functions no longer have empty cells automatically handled for you. - * Fixes [issue #419](https://github.com/Mottie/tablesorter/issues/419). -* Added `sortStable` option which when `true` will sort exactly equal items by placing them in their original unsorted order (or, perform a [stable sort](http://en.wikipedia.org/wiki/Stable_sort#Stability)). -* Removed double icon class names. -* Added `tabIndex` option - * When `true`, a tabindex is added to the headers for keyboard accessibility; this was previously always applied - * When `false`, table headers will not be included when tabbing through the page - * Fulfills [issue #415](https://github.com/Mottie/tablesorter/issues/415). - -**Filter widget** -* Setting a filter to build a select no longer causes an error. Fixes [issue #421](https://github.com/Mottie/tablesorter/issues/421). -* Added `filter_saveFilters` option - * When `true`, this option saves the current filters using the storage utility (local storage with cookie fallback). - * This option is set to `false` by default. - * See [issue #388](https://github.com/Mottie/tablesorter/issues/388). -* Allow multiple external filter inputs - * The `$.tablesorter.filter.bindSearch( $table, $external )` function now allows binding searches using the built-in functioning. - * The bind search function will unbind any previously bound `keyup` and `search` event listeners on the `$external` elements. - * External inputs must not have a `tablesorter-filter` class to distinguish them from internal filters. - * If not using the `filter_anyMatch` option, external filters can be set to target specific columns by including a `data-column` attribute. - * See the new [filter external inputs demo](http://mottie.github.io/tablesorter/docs/example-widget-filter-external-inputs.html). -* Filter reset button clicks will again trigger a `filterReset` event. Fixes [issue #423](https://github.com/Mottie/tablesorter/issues/423). - -**Grouping widget** -* Merged in fix for grouping widget + filter widget + child row widget. - * Updated demo with multi-child column styling. - * Thanks [Xamamule](https://github.com/Xamamule) in [pull #414](https://github.com/Mottie/tablesorter/pull/414)! - * This also fixes [issue #422](https://github.com/Mottie/tablesorter/issues/422). -* Renamed variables & cleanup -* Added `group_dateString` function to format the date string for `group-date` header class name. - -**Zebra widget** -* Now skips removable rows added by other widgets, more specifically, it skips rows with a `remove-me` class name (set by the `selectorRemove` option). - -**Docs updates** -* Added a side menu with search to the main document page. - * The main documentation page now uses Bootstrap for some styles. - * Search includes a count with clear search, previous result and next result buttons. - * Search options included to find letters or whole words only, and choose if the search is case sensitive, or not. - * The advantage of this search over the browser's built-in search (Ctrl-F) is that this search will find text within the hidden content - * Indexing of the search results may not always be in order, i.e. "10/10" may not always be the lowest result on the page due to nested elements. - * Sorry, IE7 and older users, the search works but but is really slow. And the side menu styling leaves much to be desired (using Bootstrap). -* jQuery UI theme selector updates. See [issue #407](https://github.com/Mottie/tablesorter/issues/407). -* Updated typos & css in various demos -* Added Utility options section for options used by parsers, storage utility and pager ajax data. -* Added removed options section. - * This applies to pager options available in the original version of tablesorter which are no longer supported. - * Fixes [issue #416](https://github.com/Mottie/tablesorter/issues/416). -* Added `kbd` styling for better visualization of keyboard keys. - -**Other** -* Renamed variables within the [pager custom control demo](http://mottie.github.io/tablesorter/beta-testing/example-pager-custom-controls.html) (still in beta) -* Renamed variables within default widgets file - * Utilities: storage, addHeaderResizeEvent,, resizableReset - * Widgets: columns, resizable, stickyHeaders, uitheme, saveSort -* Updated parser-date-two-digit-year.js to allow changing the date range - * Set a different date range by adding a value to `table.config.dateRange`. - * Instructions added to main documents under utility options -* Storage utility (`$.tablesorter.storage`) now accepts a jQuery object as well as a DOM object of the table - * `$.tablesorter.storage( $('#mytable'), 'myvariable', 'YAY' );`, or - * `$.tablesorter.storage( $('#mytable')[0], 'myvariable', 'YAY' );` diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 7750973c..20ca3ecb 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -1,6 +1,6 @@ /*! * tablesorter pager plugin - * updated 1/21/2014 (v2.15.0) + * updated 2/19/2014 (v2.15.0) */ /*jshint browser:true, jquery:true, unused:false */ ;(function($) { @@ -240,7 +240,7 @@ // process data if ( typeof(p.ajaxProcessing) === "function" ) { // ajaxProcessing result: [ total, rows, headers ] - var i, j, hsh, $f, $sh, t, th, d, l, $err, rr_count, + var i, j, hsh, $f, $sh, t, th, d, l, rr_count, c = table.config, $t = c.$table, tds = '', diff --git a/addons/pager/jquery.tablesorter.pager.min.js b/addons/pager/jquery.tablesorter.pager.min.js index 8fb41413..b7f2f240 100644 --- a/addons/pager/jquery.tablesorter.pager.min.js +++ b/addons/pager/jquery.tablesorter.pager.min.js @@ -1 +1,2 @@ -!function(e){"use strict";var t=e.tablesorter;e.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(e,t){return t},ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,savePages:!0,storageKey:"tablesorter-pager",fixedHeight:!1,countChildRows:!1,removeRows:!1,cssFirst:".first",cssPrev:".prev",cssNext:".next",cssLast:".last",cssGoto:".gotoPage",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssErrorRow:"tablesorter-errorRow",cssDisabled:"disabled",totalRows:0,totalPages:0,filteredRows:0,filteredPages:0,ajaxCounter:0,currentFilters:[],startRow:0,endRow:0,$size:null,last:{}};var a=this,s=function(e,t){var a="addClass",s="removeClass",i=e.cssDisabled,r=!!t,o=Math.min(e.totalPages,e.filteredPages);e.updateArrows&&(e.$container.find(e.cssFirst+","+e.cssPrev)[r||0===e.page?a:s](i),e.$container.find(e.cssNext+","+e.cssLast)[r||e.page===o-1||0===e.totalPages?a:s](i))},i=function(e,a,i){var r,o,n,g,l=e.config,d=l.$table.hasClass("hasFilters")&&!a.ajaxUrl,c=(l.widgetOptions&&l.widgetOptions.filter_filteredRow||"filtered")+","+l.selectorRemove+(a.countChildRows?"":",."+l.cssChildRow),p=a.size||10;if(a.totalPages=Math.ceil(a.totalRows/p),a.filteredRows=d?l.$tbodies.eq(0).children("tr").not("."+c).length:a.totalRows,a.filteredPages=d?Math.ceil(a.filteredRows/p)||1:a.totalPages,Math.min(a.totalPages,a.filteredPages)>=0&&(c=a.size*a.page>a.filteredRows,a.startRow=c?1:0===a.filteredRows?0:a.size*a.page+1,a.page=c?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),g=a.$container.find(a.cssPageDisplay),n=(a.ajaxData&&a.ajaxData.output?a.ajaxData.output||a.output:a.output).replace(/\{page([\-+]\d+)?\}/gi,function(e,t){return a.totalPages?a.page+(t?parseInt(t,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(e){var t=e.replace(/[{}\s]/g,""),s=t.split(":"),i=a.ajaxData,r=/(rows?|pages?)$/i.test(t)?0:"";return s.length>1&&i&&i[s[0]]?i[s[0]][s[1]]:a[t]||(i?i[t]:r)||r}),g.length&&(g["INPUT"===g[0].tagName?"val":"html"](n),a.$goto.length))){for(c="",o=Math.min(a.totalPages,a.filteredPages),r=1;o>=r;r++)c+="";a.$goto.html(c).val(a.page+1)}s(a),a.initialized&&i!==!1&&(l.$table.trigger("pagerComplete",a),a.savePages&&t.storage&&t.storage(e,a.storageKey,{page:a.page,size:a.size}))},r=function(t,a){var s,i,r=t.config,o=r.$tbodies.eq(0);a.fixedHeight&&(o.find("tr.pagerSavedHeightSpacer").remove(),i=e.data(t,"pagerSavedHeight"),i&&(s=i-o.height(),s>5&&e.data(t,"pagerLastSize")===a.size&&o.children("tr:visible").length')))},o=function(t,a){var s=t.config.$tbodies.eq(0);s.find("tr.pagerSavedHeightSpacer").remove(),e.data(t,"pagerSavedHeight",s.height()),r(t,a),e.data(t,"pagerLastSize",a.size)},n=function(e,t){if(!t.ajaxUrl){var a,s=e.config,i=s.$tbodies.eq(0).children(),r=i.length,o=t.page*t.size,n=o+t.size,g=s.widgetOptions&&s.widgetOptions.filter_filteredRow||"filtered",l=0;for(a=0;r>a;a++)i[a].className.match(g)||(i[a].style.display=l>=o&&n>l?"":"none",l+=i[a].className.match(s.cssChildRow+"|"+s.selectorRemove.slice(1))&&!t.countChildRows?0:1)}},g=function(t,a){a.size=parseInt(a.$size.val(),10)||a.size,e.data(t,"pagerLastSize",a.size),s(a),a.removeRows||(n(t,a),e(t).bind("sortEnd.pager filterEnd.pager",function(){n(t,a)}))},l=function(a,s,o,n,g){if("function"==typeof o.ajaxProcessing){var l,d,c,p,f,u,h,b,z,w,P,j=s.config,v=j.$table,x="",R=o.ajaxProcessing(a,s)||[0,[]],m=v.find("thead th").length;if(v.find("thead tr."+o.cssErrorRow).remove(),g)j.debug&&t.log("Ajax Error",n,g),w=e(''+(0===n.status?"Not connected, verify Network":404===n.status?"Requested page not found [404]":500===n.status?"Internal Server Error [500]":"parsererror"===g?"Requested JSON parse failed":"timeout"===g?"Time out error":"abort"===g?"Ajax Request aborted":"Uncaught error: "+n.statusText+" ["+n.status+"]")+"").click(function(){e(this).remove()}).appendTo(v.find("thead:first")),j.$tbodies.eq(0).empty();else{if(e.isArray(R)?(u=isNaN(R[0])&&!isNaN(R[1]),P=R[u?1:0],o.totalRows=isNaN(P)?o.totalRows||0:P,b=0===o.totalRows?[""]:R[u?0:1]||[],h=R[2]):(o.ajaxData=R,o.totalRows=R.total,h=R.headers,b=R.rows),z=b.length,b instanceof jQuery)j.$tbodies.eq(0).empty().append(b);else if(z){for(l=0;z>l;l++){for(x+="",d=0;d"+b[l][d]+"";x+=""}o.processAjaxOnInit?j.$tbodies.eq(0).html(x):o.processAjaxOnInit=!0}h&&h.length===m&&(c=v.hasClass("hasStickyHeaders"),f=c?j.widgetOptions.$sticky.children("thead:first").children().children():"",p=v.find("tfoot tr:first").children(),j.$headers.filter("th").each(function(a){var s,i=e(this);i.find("."+t.css.icon).length?(s=i.find("."+t.css.icon).clone(!0),i.find(".tablesorter-header-inner").html(h[a]).append(s),c&&f.length&&(s=f.eq(a).find("."+t.css.icon).clone(!0),f.eq(a).find(".tablesorter-header-inner").html(h[a]).append(s))):(i.find(".tablesorter-header-inner").html(h[a]),c&&f.length&&f.eq(a).find(".tablesorter-header-inner").html(h[a])),p.eq(a).html(h[a])}))}j.showProcessing&&t.isProcessing(s),o.last.totalPages=o.totalPages=Math.ceil(o.totalRows/(o.size||10)),o.last.currentFilters=o.currentFilters,o.last.sortList=(j.sortList||[]).join(","),i(s,o),r(s,o),v.trigger("applyWidgets"),v.trigger("updateRow",[!1,function(){o.initialized&&(v.trigger("updateComplete"),v.trigger("pagerChange",o))}])}o.initialized||(o.initialized=!0,e(s).trigger("pagerInitialized",o))},d=function(a,s){var i,r=c(a,s),o=e(document),n=a.config;""!==r&&(n.showProcessing&&t.isProcessing(a,!0),o.bind("ajaxError.pager",function(e,t,i,r){l(null,a,s,t,r),o.unbind("ajaxError.pager")}),i=++s.ajaxCounter,s.ajaxObject.url=r,s.ajaxObject.success=function(e){id)){if(o.page>=o.totalPages&&z(a,o),o.isDisabled=!1,o.initialized&&e(a).trigger("pagerChange",o),o.removeRows){for(p>s.length&&(p=s.length),t.clearTableBody(a),l=t.processTbody(a,a.config.$tbodies.eq(0),!0),g=c;p>g;g++)l.append(s[g]);t.processTbody(a,l,!1)}else n(a,o);i(a,o),o.isDisabled||r(a,o),e(a).trigger("applyWidgets")}},f=function(a,i){i.ajax?s(i,!0):(i.isDisabled=!0,e.data(a,"pagerLastPage",i.page),e.data(a,"pagerLastSize",i.size),i.page=0,i.size=i.totalRows,i.totalPages=1,e(a).addClass("pagerDisabled").find("tr.pagerSavedHeightSpacer").remove(),p(a,a.config.rowsCopy,i),a.config.debug&&t.log("pager disabled")),i.$size.add(i.$goto).each(function(){e(this).addClass(i.cssDisabled)[0].disabled=!0})},u=function(a,s,i){if(!s.isDisabled){var r=a.config,o=s.last,n=Math.min(s.totalPages,s.filteredPages);s.page<0&&(s.page=0),s.page>n-1&&0!==n&&(s.page=n-1),(o.page!==s.page||o.size!==s.size||o.totalPages!==s.totalPages||(o.currentFilters||[]).join(",")!==(s.currentFilters||[]).join(",")||o.sortList!==(r.sortList||[]).join(","))&&(r.debug&&t.log("Pager changing to page "+s.page),s.last={page:s.page,size:s.size,sortList:(r.sortList||[]).join(","),totalPages:s.totalPages,currentFilters:s.currentFilters||[]},s.ajax?d(a,s):s.ajax||p(a,a.config.rowsCopy,s),e.data(a,"pagerLastPage",s.page),s.initialized&&i!==!1&&(r.$table.trigger("pageMoved",s),r.$table.trigger("applyWidgets")))}},h=function(t,a,s){s.size=a||s.size||10,s.$size.val(s.size),e.data(t,"pagerLastPage",s.page),e.data(t,"pagerLastSize",s.size),s.totalPages=Math.ceil(s.totalRows/s.size),u(t,s)},b=function(e,t){t.page=0,u(e,t)},z=function(e,t){t.page=Math.min(t.totalPages,t.filteredPages)-1,u(e,t)},w=function(e,t){t.page++,t.page>=Math.min(t.totalPages,t.filteredPages)-1&&(t.page=Math.min(t.totalPages,t.filteredPages)-1),u(e,t)},P=function(e,t){t.page--,t.page<=0&&(t.page=0),u(e,t)},j=function(a,s){f(a,s),s.$container.hide(),a.config.appender=null,s.initialized=!1,e(a).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager"),t.storage&&t.storage(a,s.storageKey,"")},v=function(a,s,i){var o=s.$size.removeClass(s.cssDisabled).removeAttr("disabled");s.$goto.removeClass(s.cssDisabled).removeAttr("disabled"),s.isDisabled=!1,s.page=e.data(a,"pagerLastPage")||s.page||0,s.size=e.data(a,"pagerLastSize")||parseInt(o.find("option[selected]").val(),10)||s.size||10,o.val(s.size),s.totalPages=Math.ceil(Math.min(s.totalRows,s.filteredRows)/s.size),i&&(e(a).trigger("updateRow"),h(a,s.size,s),g(a,s),r(a,s),a.config.debug&&t.log("pager enabled"))};a.appender=function(t,a){var s=t.config,i=s.pager;i.ajax||(s.rowsCopy=a,i.totalRows=i.countChildRows?s.$tbodies.eq(0).children().length:a.length,i.size=e.data(t,"pagerLastSize")||i.size||10,i.totalPages=Math.ceil(i.totalRows/i.size),p(t,a,i))},a.construct=function(s){return this.each(function(){if(this.config&&this.hasInitialized){var l,d,c,p=this,x=p.config,R=x.pager=e.extend({},e.tablesorterPager.defaults,s),m=x.$table,$=R.$container=e(R.container).addClass("tablesorter-pager").show();x.debug&&t.log("Pager initializing"),R.oldAjaxSuccess=R.oldAjaxSuccess||R.ajaxObject.success,x.appender=a.appender,t.filter&&e.inArray("filter",x.widgets)>=0&&(R.currentFilters=x.$table.data("lastSearch")||t.filter.setDefaults(p,x,x.widgetOptions)||[],t.setFilters(p,R.currentFilters,!1)),R.savePages&&t.storage&&(l=t.storage(p,R.storageKey)||{},R.page=isNaN(l.page)?R.page:l.page,R.size=(isNaN(l.size)?R.size:l.size)||10,e.data(p,"pagerLastSize",R.size)),m.unbind("filterStart filterEnd sortEnd disable enable destroy update updateRows updateAll addRows pageSize ".split(" ").join(".pager ")).bind("filterStart.pager",function(e,t){R.currentFilters=t,R.page=0}).bind("filterEnd.pager sortEnd.pager",function(){R.initialized&&(u(p,R,!1),i(p,R,!1),r(p,R))}).bind("disable.pager",function(e){e.stopPropagation(),f(p,R)}).bind("enable.pager",function(e){e.stopPropagation(),v(p,R,!0)}).bind("destroy.pager",function(e){e.stopPropagation(),j(p,R)}).bind("update updateRows updateAll addRows ".split(" ").join(".pager "),function(e){e.stopPropagation(),n(p,R)}).bind("pageSize.pager",function(e,t){e.stopPropagation(),h(p,parseInt(t,10)||10,R),n(p,R),i(p,R,!1),R.$size.length&&R.$size.val(R.size)}).bind("pageSet.pager",function(e,t){e.stopPropagation(),R.page=(parseInt(t,10)||1)-1,R.$goto.length&&R.$goto.val(R.size),u(p,R),i(p,R,!1)}),d=[R.cssFirst,R.cssPrev,R.cssNext,R.cssLast],c=[b,P,w,z],$.find(d.join(",")).unbind("click.pager").bind("click.pager",function(t){t.stopPropagation();var a,s=e(this),i=d.length;if(!s.hasClass(R.cssDisabled))for(a=0;i>a;a++)if(s.is(d[a])){c[a](p,R);break}}),R.$goto=$.find(R.cssGoto),R.$goto.length&&R.$goto.unbind("change").bind("change",function(){R.page=e(this).val()-1,u(p,R),i(p,R,!1)}),R.$size=$.find(R.cssPageSize),R.$size.length&&R.$size.unbind("change.pager").bind("change.pager",function(){return R.$size.val(e(this).val()),e(this).hasClass(R.cssDisabled)||(h(p,parseInt(e(this).val(),10),R),o(p,R)),!1}),R.initialized=!1,m.trigger("pagerBeforeInitialized",R),v(p,R,!1),"string"==typeof R.ajaxUrl?(R.ajax=!0,x.widgetOptions.filter_serversideFiltering=!0,x.serverSideSorting=!0,u(p,R)):(R.ajax=!1,e(this).trigger("appendCache",!0),g(p,R)),o(p,R),R.ajax||(R.initialized=!0,e(p).trigger("pagerInitialized",R))}})}}}),e.fn.extend({tablesorterPager:e.tablesorterPager.construct})}(jQuery); \ No newline at end of file +/* tablesorter pager plugin updated 2/19/2014 (v2.15.0) */ +;(function(h){var k=h.tablesorter;h.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(b,a){return a},ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(b){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,savePages:!0,storageKey:"tablesorter-pager",fixedHeight:!1,countChildRows:!1,removeRows:!1,cssFirst:".first",cssPrev:".prev",cssNext:".next",cssLast:".last",cssGoto:".gotoPage", cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssErrorRow:"tablesorter-errorRow",cssDisabled:"disabled",totalRows:0,totalPages:0,filteredRows:0,filteredPages:0,ajaxCounter:0,currentFilters:[],startRow:0,endRow:0,$size:null,last:{}};var u=this,l=function(b,a){var e=b.cssDisabled,d=!!a,f=d||0===b.page,g=Math.min(b.totalPages,b.filteredPages),d=d||b.page===g-1||0===b.totalPages;b.updateArrows&&(b.$container.find(b.cssFirst+","+b.cssPrev)[f?"addClass":"removeClass"](e).attr("aria-disabled",f), b.$container.find(b.cssNext+","+b.cssLast)[d?"addClass":"removeClass"](e).attr("aria-disabled",d))},q=function(b,a,e){var d,f,g,c=b.config;d=c.$table.hasClass("hasFilters")&&!a.ajaxUrl;g=(c.widgetOptions&&c.widgetOptions.filter_filteredRow||"filtered")+","+c.selectorRemove+(a.countChildRows?"":",."+c.cssChildRow);f=a.size||10;a.totalPages=Math.ceil(a.totalRows/f);a.filteredRows=d?c.$tbodies.eq(0).children("tr").not("."+g).length:a.totalRows;a.filteredPages=d?Math.ceil(a.filteredRows/f)||1:a.totalPages; if(0<=Math.min(a.totalPages,a.filteredPages)&&(g=a.size*a.page>a.filteredRows,a.startRow=g?1:0===a.filteredRows?0:a.size*a.page+1,a.page=g?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),d=a.$container.find(a.cssPageDisplay),g=(a.ajaxData&&a.ajaxData.output?a.ajaxData.output||a.output:a.output).replace(/\{page([\-+]\d+)?\}/gi,function(b,c){return a.totalPages?a.page+(c?parseInt(c,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(b){b=b.replace(/[{}\s]/g,"");var c=b.split(":"), d=a.ajaxData,e=/(rows?|pages?)$/i.test(b)?0:"";return 1"+d+"";a.$goto.html(g).val(a.page+1)}l(a);a.initialized&&!1!==e&&(c.$table.trigger("pagerComplete",a),a.savePages&&k.storage&&k.storage(b,a.storageKey,{page:a.page,size:a.size}))},s=function(b,a){var e,d=b.config,f=d.$tbodies.eq(0);a.fixedHeight&& (f.find("tr.pagerSavedHeightSpacer").remove(),e=h.data(b,"pagerSavedHeight"))&&(e-=f.height(),5'))},z=function(b,a){var e=b.config.$tbodies.eq(0);e.find("tr.pagerSavedHeightSpacer").remove();h.data(b,"pagerSavedHeight",e.height());s(b,a);h.data(b,"pagerLastSize",a.size)},t=function(b,a){if(!a.ajaxUrl){var e, d=b.config,f=d.$tbodies.eq(0).children(),g=f.length,c=a.page*a.size,h=c+a.size,k=d.widgetOptions&&d.widgetOptions.filter_filteredRow||"filtered",p=0;for(e=0;e=c&&p";for(f=0;f"+d[g][f]+"";l+=""}e.processAjaxOnInit?r.$tbodies.eq(0).html(l): e.processAjaxOnInit=!0}p&&p.length===b&&(m=(c=n.hasClass("hasStickyHeaders"))?r.widgetOptions.$sticky.children("thead:first").children().children():"",y=n.find("tfoot tr:first").children(),r.$headers.filter("th").each(function(a){var b=h(this),d;b.find("."+k.css.icon).length?(d=b.find("."+k.css.icon).clone(!0),b.find(".tablesorter-header-inner").html(p[a]).append(d),c&&m.length&&(d=m.eq(a).find("."+k.css.icon).clone(!0),m.eq(a).find(".tablesorter-header-inner").html(p[a]).append(d))):(b.find(".tablesorter-header-inner").html(p[a]), c&&m.length&&m.eq(a).find(".tablesorter-header-inner").html(p[a]));y.eq(a).html(p[a])}))}r.showProcessing&&k.isProcessing(a);e.last.totalPages=e.totalPages=Math.ceil(e.totalRows/(e.size||10));e.last.currentFilters=e.currentFilters;e.last.sortList=(r.sortList||[]).join(",");q(a,e);s(a,e);n.trigger("applyWidgets");n.trigger("updateRows",[!1,function(){e.initialized&&(n.trigger("updateComplete"),n.trigger("pagerChange",e))}])}e.initialized||(e.initialized=!0,h(a).trigger("pagerInitialized",e))},G=function(b, a){var e=F(b,a),d=h(document),f,g=b.config;""!==e&&(g.showProcessing&&k.isProcessing(b,!0),d.bind("ajaxError.pager",function(c,e,f,g){B(null,b,a,e,g);d.unbind("ajaxError.pager")}),f=++a.ajaxCounter,a.ajaxObject.url=e,a.ajaxObject.success=function(c){f(a&&a.length||0))){e.page>=e.totalPages&&C(b,e);e.isDisabled=!1;e.initialized&&h(b).trigger("pagerChange",e);if(e.removeRows){g>a.length&&(g=a.length);k.clearTableBody(b);for(f=k.processTbody(b,b.config.$tbodies.eq(0),!0);da.page&&(a.page=0);a.page>g-1&&0!==g&&(a.page=g-1);if(f.page!==a.page||f.size!==a.size||f.totalPages!==a.totalPages||(f.currentFilters||[]).join(",")!==(a.currentFilters||[]).join(",")||f.sortList!==(d.sortList||[]).join(","))d.debug&&k.log("Pager changing to page "+a.page),a.last={page:a.page,size:a.size,sortList:(d.sortList||[]).join(","),totalPages:a.totalPages,currentFilters:a.currentFilters|| []},a.ajax?G(b,a):a.ajax||w(b,b.config.rowsCopy,a),h.data(b,"pagerLastPage",a.page),a.initialized&&!1!==e&&(d.$table.trigger("pageMoved",a),d.$table.trigger("applyWidgets"))}},x=function(b,a,e){e.size=a||e.size||10;e.$size.val(e.size);h.data(b,"pagerLastPage",e.page);h.data(b,"pagerLastSize",e.size);e.totalPages=Math.ceil(e.totalRows/e.size);n(b,e)},H=function(b,a){a.page=0;n(b,a)},C=function(b,a){a.page=Math.min(a.totalPages,a.filteredPages)-1;n(b,a)},I=function(b,a){a.page++;a.page>=Math.min(a.totalPages, a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)-1);n(b,a)},J=function(b,a){a.page--;0>=a.page&&(a.page=0);n(b,a)},E=function(b,a,e){var d,f=b.config;a.$size.add(a.$goto).removeClass(a.cssDisabled).removeAttr("disabled").attr("aria-disabled","false");a.isDisabled=!1;a.page=h.data(b,"pagerLastPage")||a.page||0;a.size=h.data(b,"pagerLastSize")||parseInt(a.$size.find("option[selected]").val(),10)||a.size||10;a.$size.val(a.size);a.totalPages=Math.ceil(Math.min(a.totalRows,a.filteredRows)/ a.size);b.id&&(d=b.id+"_pager_info",a.$container.find(a.cssPageDisplay).attr("id",d),f.$table.attr("aria-describedby",d));e&&(f.$table.trigger("updateRows"),x(b,a.size,a),A(b,a),s(b,a),f.debug&&k.log("pager enabled"))};u.appender=function(b,a){var e=b.config,d=e.pager;d.ajax||(e.rowsCopy=a,d.totalRows=d.countChildRows?e.$tbodies.eq(0).children().length:a.length,d.size=h.data(b,"pagerLastSize")||d.size||10,d.totalPages=Math.ceil(d.totalRows/d.size),w(b,a,d),q(b,d,!1))};u.construct=function(b){return this.each(function(){if(this.config&& this.hasInitialized){var a,e,d,f=this,g=f.config,c=g.pager=h.extend({},h.tablesorterPager.defaults,b),l=g.$table,m=c.$container=h(c.container).addClass("tablesorter-pager").show();g.debug&&k.log("Pager initializing");c.oldAjaxSuccess=c.oldAjaxSuccess||c.ajaxObject.success;g.appender=u.appender;k.filter&&0<=h.inArray("filter",g.widgets)&&(c.currentFilters=g.$table.data("lastSearch")||k.filter.setDefaults(f,g,g.widgetOptions)||[],k.setFilters(f,c.currentFilters,!1));c.savePages&&k.storage&&(a=k.storage(f, c.storageKey)||{},c.page=isNaN(a.page)?c.page:a.page,c.size=(isNaN(a.size)?c.size:a.size)||10,h.data(f,"pagerLastSize",c.size));l.unbind("filterStart filterEnd sortEnd disable enable destroy update updateRows updateAll addRows pageSize ".split(" ").join(".pager ")).bind("filterStart.pager",function(a,b){c.currentFilters=b;c.page=0}).bind("filterEnd.pager sortEnd.pager",function(){c.initialized&&(n(f,c,!1),q(f,c,!1),s(f,c))}).bind("disable.pager",function(a){a.stopPropagation();D(f,c)}).bind("enable.pager", function(a){a.stopPropagation();E(f,c,!0)}).bind("destroy.pager",function(a){a.stopPropagation();D(f,c);c.$container.hide();f.config.appender=null;c.initialized=!1;h(f).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager");k.storage&&k.storage(f,c.storageKey,"")}).bind("update.pager updateRows.pager updateAll.pager addRows.pager ",function(a){a.stopPropagation();t(f,c)}).bind("pageSize.pager",function(a,b){a.stopPropagation();x(f,parseInt(b,10)||10,c);t(f,c);q(f,c,!1);c.$size.length&& c.$size.val(c.size)}).bind("pageSet.pager",function(a,b){a.stopPropagation();c.page=(parseInt(b,10)||1)-1;c.$goto.length&&c.$goto.val(c.size);n(f,c);q(f,c,!1)});e=[c.cssFirst,c.cssPrev,c.cssNext,c.cssLast];d=[H,J,I,C];m.find(e.join(",")).attr("tabindex",0).unbind("click.pager").bind("click.pager",function(a){a.stopPropagation();var b=h(this),g=e.length;if(!b.hasClass(c.cssDisabled))for(a=0;a/.test(l)?h(l):h(''+l+"")).click(function(){h(this).remove()}).appendTo(k.$table.find("thead:first")).addClass(s+ " "+k.selectorRemove.replace(/^[.#]/,"")).attr({role:"alert","aria-live":"assertive"}))})};h.fn.extend({tablesorterPager:h.tablesorterPager.construct})})(jQuery); diff --git a/bower.json b/bower.json index 5bf5b96b..e9a133ee 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tablesorter", - "version": "2.14.5", + "version": "2.15.0", "dependencies": { "jquery": ">=1.2.6" } diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index a4225c86..8be48aea 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -1,5 +1,5 @@ /**! -* TableSorter 2.14.5 - Client-side table sorting with ease! +* TableSorter 2.15.0 - Client-side table sorting with ease! * @requires jQuery v1.2.6+ * * Copyright (c) 2007 Christian Bach @@ -24,7 +24,7 @@ var ts = this; - ts.version = "2.14.5"; + ts.version = "2.15.0"; ts.parsers = []; ts.widgets = []; diff --git a/js/jquery.tablesorter.min.js b/js/jquery.tablesorter.min.js index 2eba0a3b..312aef80 100644 --- a/js/jquery.tablesorter.min.js +++ b/js/jquery.tablesorter.min.js @@ -1,5 +1,5 @@ /*! -* TableSorter 2.14.4 min - Client-side table sorting with ease! +* TableSorter 2.15.0 min - Client-side table sorting with ease! * Copyright (c) 2007 Christian Bach */ -!function(g){g.extend({tablesorter:new function(){function c(){var a=1':"";m.$headers=g(a).find(m.selectorHeaders).each(function(a){h= g(this);d=m.headers[a];m.headerContent[a]=g(this).html();l=m.headerTemplate.replace(/\{content\}/g,g(this).html()).replace(/\{icon\}/g,n);m.onRenderTemplate&&(e=m.onRenderTemplate.apply(h,[a,l]))&&"string"===typeof e&&(l=e);g(this).html('
'+l+"
");m.onRenderHeader&&m.onRenderHeader.apply(h,[a]);this.column=b[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=C(f.getData(h,d,"sortInitialOrder")||m.sortInitialOrder)?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder= !1;x=f.getData(h,d,"lockedOrder")||!1;"undefined"!==typeof x&&!1!==x&&(this.order=this.lockedOrder=C(x)?[1,1,1]:[0,0,0]);h.addClass(f.css.header+" "+m.cssHeader);m.headerList[a]=this;h.parent().addClass(f.css.headerRow+" "+m.cssHeaderRow);m.tabIndex&&h.attr("tabindex",0)});F(a);m.debug&&(r("Built headers:",k),c(m.$headers))}function B(a,b,d){var h=a.config;h.$table.find(h.selectorRemove).remove();s(a);w(a);G(h.$table,b,d)}function F(a){var b,d=a.config;d.$headers.each(function(a,e){b="false"===f.getData(e, d.headers[a],"sorter");e.sortDisabled=b;g(e)[b?"addClass":"removeClass"]("sorter-false")})}function H(a){var b,d,h,e=a.config,n=e.sortList,l=[f.css.sortAsc+" "+e.cssAsc,f.css.sortDesc+" "+e.cssDesc],c=g(a).find("tfoot tr").children().removeClass(l.join(" "));e.$headers.removeClass(l.join(" "));h=n.length;for(b=0;b"),d=g(a).width();g(a.tBodies[0]).find("tr:first").children("td:visible").each(function(){b.append(g("").css("width",parseInt(g(this).width()/d*1E3,10)/10+"%"))});g(a).prepend(b)}}function M(a,b){var d,h,e,n=a.config,c=b||n.sortList;n.sortList=[];g.each(c,function(a,b){d=[parseInt(b[0],10),parseInt(b[1],10)];if(e=n.$headers[d[0]])n.sortList.push(d), h=g.inArray(d[1],e.order),e.count=0<=h?h:d[1]%(n.sortReset?3:2)})}function N(a,b){return a&&a[b]?a[b].type||"":""}function O(a,b,d){var h,e,n,c=a.config,x=!d[c.sortMultiSortKey],k=g(a);k.trigger("sortStart",a);b.count=d[c.sortResetKey]?2:(b.count+1)%(c.sortReset?3:2);c.sortRestart&&(e=b,c.$headers.each(function(){this===e||!x&&g(this).is("."+f.css.sortDesc+",."+f.css.sortAsc)||(this.count=-1)}));e=b.column;if(x){c.sortList=[];if(null!==c.sortForce)for(h=c.sortForce,d=0;dh&&(c.sortList.push([e,h]),1h&&(c.sortList.push([e,h]),1 thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me", debug:!1,headerList:[],empties:{},strings:{},parsers:[]};f.css={table:"tablesorter",childRow:"tablesorter-childRow",header:"tablesorter-header",headerRow:"tablesorter-headerRow",icon:"tablesorter-icon",info:"tablesorter-infoOnly",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc"};f.log=c;f.benchmark=r;f.construct=function(a){return this.each(function(){var b=g.extend(!0,{},f.defaults,a);!this.hasInitialized&&f.buildTable&&"TABLE"!==this.tagName&& f.buildTable(this,b);f.setup(this,b)})};f.setup=function(a,b){if(!a||!a.tHead||0===a.tBodies.length||!0===a.hasInitialized)return b.debug?c("stopping initialization! No table, thead, tbody or tablesorter has already been initialized"):"";var d="",h=g(a),e=g.metadata;a.hasInitialized=!1;a.isProcessing=!0;a.config=b;g.data(a,"tablesorter",b);b.debug&&g.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===g("x")[0].textContent;b.supportsDataObject=function(a){a[0]=parseInt(a[0], 10);return 1'), d=g.fn.detach?b.detach():b.remove();d=g(a).find("span.tablesorter-savemyplace");b.insertAfter(d);d.remove();a.isProcessing=!1};f.clearTableBody=function(a){g(a)[0].config.$tbodies.empty()};f.restoreHeaders=function(a){var b=a.config;b.$table.find(b.selectorHeaders).each(function(a){g(this).find(".tablesorter-header-inner").length&&g(this).html(b.headerContent[a])})};f.destroy=function(a,b,d){a=g(a)[0];if(a.hasInitialized){f.refreshWidgets(a,!0,!0);var c=g(a),e=a.config,n=c.find("thead:first"),l=n.find("tr."+ f.css.headerRow).removeClass(f.css.headerRow+" "+e.cssHeaderRow),k=c.find("tfoot:first > tr").children("th, td");n.find("tr").not(l).remove();c.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd ".split(" ").join(".tablesorter "));e.$headers.add(k).removeClass([f.css.header,e.cssHeader,e.cssAsc,e.cssDesc,f.css.sortAsc,f.css.sortDesc].join(" ")).removeAttr("data-column"); l.find(e.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter keypress.tablesorter");f.restoreHeaders(a);!1!==b&&c.removeClass(f.css.table+" "+e.tableClass+" tablesorter-"+e.theme);a.hasInitialized=!1;"function"===typeof d&&d(a)}};f.regex={chunk:/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,hex:/^0x[0-9a-f]+$/i};f.sortNatural=function(a,b){if(a===b)return 0;var d,c,e,g,l,k;c=f.regex;if(c.hex.test(b)){d=parseInt(a.match(c.hex),16);e=parseInt(b.match(c.hex), 16);if(de)return 1}d=a.replace(c.chunk,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");c=b.replace(c.chunk,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");k=Math.max(d.length,c.length);for(l=0;lg)return 1}return 0};f.sortNaturalAsc=function(a,b,d,c,e){if(a===b)return 0; d=e.string[e.empties[d]||e.emptyTo];return""===a&&0!==d?"boolean"===typeof d?d?-1:1:-d||-1:""===b&&0!==d?"boolean"===typeof d?d?1:-1:d||1:f.sortNatural(a,b)};f.sortNaturalDesc=function(a,b,d,c,e){if(a===b)return 0;d=e.string[e.empties[d]||e.emptyTo];return""===a&&0!==d?"boolean"===typeof d?d?-1:1:d||1:""===b&&0!==d?"boolean"===typeof d?d?1:-1:-d||-1:f.sortNatural(b,a)};f.sortText=function(a,b){return a>b?1:ag.inArray(l[h].id,k))&&(e.debug&& c("Refeshing widgets: Removing "+l[h].id),l[h].hasOwnProperty("remove")&&e.widgetInit[l[h].id]&&(l[h].remove(a,e,e.widgetOptions),e.widgetInit[l[h].id]=!1));!0!==d&&f.applyWidget(a,b)};f.getData=function(a,b,d){var c="";a=g(a);var e,f;if(!a.length)return"";e=g.metadata?a.metadata():!1;f=" "+(a.attr("class")||"");"undefined"!==typeof a.data(d)||"undefined"!==typeof a.data(d.toLowerCase())?c+=a.data(d)||a.data(d.toLowerCase()):e&&"undefined"!==typeof e[d]?c+=e[d]:b&&"undefined"!==typeof b[d]?c+=b[d]: " "!==f&&f.match(" "+d+"-")&&(c=f.match(RegExp("\\s"+d+"-([\\w-]+)"))[1]||"");return g.trim(c)};f.formatFloat=function(a,b){if("string"!==typeof a||""===a)return a;var c;a=(b&&b.config?!1!==b.config.usNumberFormat:"undefined"!==typeof b?b:1)?a.replace(/,/g,""):a.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(a)&&(a=a.replace(/^\s*\(([.\d]+)\)/,"-$1"));c=parseFloat(a);return isNaN(c)?g.trim(a):c};f.isDigit=function(a){return isNaN(a)?/^[\-+(]?\d+[)]?$/.test(a.toString().replace(/[,.'"\s]/g, "")):!0}}});var p=g.tablesorter;g.fn.extend({tablesorter:p.construct});p.addParser({id:"text",is:function(){return!0},format:function(c,r){var k=r.config;c&&(c=g.trim(k.ignoreCase?c.toLocaleLowerCase():c),c=k.sortLocaleCompare?p.replaceAccents(c):c);return c},type:"text"});p.addParser({id:"digit",is:function(c){return p.isDigit(c)},format:function(c,r){var k=p.formatFloat((c||"").replace(/[^\w,. \-()]/g,""),r);return c&&"number"===typeof k?k:c?g.trim(c&&r.config.ignoreCase?c.toLocaleLowerCase():c): c},type:"numeric"});p.addParser({id:"currency",is:function(c){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((c||"").replace(/[,. ]/g,""))},format:function(c,r){var k=p.formatFloat((c||"").replace(/[^\w,. \-()]/g,""),r);return c&&"number"===typeof k?k:c?g.trim(c&&r.config.ignoreCase?c.toLocaleLowerCase():c):c},type:"numeric"});p.addParser({id:"ipAddress",is:function(c){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(c)},format:function(c, g){var k,t=c?c.split("."):"",s="",w=t.length;for(k=0;kc.length},format:function(c,g){return c?p.formatFloat(c.replace(/%/g,""),g):c},type:"numeric"});p.addParser({id:"usLongDate",is:function(c){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(c)||/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i.test(c)},format:function(c,g){return c?p.formatFloat((new Date(c.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",g):c},type:"numeric"}); p.addParser({id:"shortDate",is:function(c){return/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/.test((c||"").replace(/\s+/g," ").replace(/[\-.,]/g,"/"))},format:function(c,g,k,t){if(c){k=g.config;var s=k.headerList[t];t=s.dateFormat||p.getData(s,k.headers[t],"dateFormat")||k.dateFormat;c=c.replace(/\s+/g," ").replace(/[\-.,]/g,"/");"mmddyyyy"===t?c=c.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===t?c=c.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/, "$3/$2/$1"):"yyyymmdd"===t&&(c=c.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"))}return c?p.formatFloat((new Date(c)).getTime()||"",g):c},type:"numeric"});p.addParser({id:"time",is:function(c){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(c)},format:function(c,g){return c?p.formatFloat((new Date("2000/01/01 "+c.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",g):c},type:"numeric"});p.addParser({id:"metadata",is:function(){return!1},format:function(c,p,k){c=p.config; c=c.parserMetadataName?c.parserMetadataName:"sortValue";return g(k).metadata()[c]},type:"numeric"});p.addWidget({id:"zebra",priority:90,format:function(c,r,k){var t,s,w,z,D,C,E=RegExp(r.cssChildRow,"i"),B=r.$tbodies;r.debug&&(D=new Date);for(c=0;c':"";l.$headers=g(a).find(l.selectorHeaders).each(function(a){h=g(this);c=l.headers[a];l.headerContent[a]=g(this).html();k=l.headerTemplate.replace(/\{content\}/g,g(this).html()).replace(/\{icon\}/g,w);l.onRenderTemplate&&(f=l.onRenderTemplate.apply(h,[a,k]))&&"string"===typeof f&&(k=f);g(this).html('
'+k+"
");l.onRenderHeader&&l.onRenderHeader.apply(h,[a]);this.column= b[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=C(e.getData(h,c,"sortInitialOrder")||l.sortInitialOrder)?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1;n=e.getData(h,c,"lockedOrder")||!1;"undefined"!==typeof n&&!1!==n&&(this.order=this.lockedOrder=C(n)?[1,1,1]:[0,0,0]);h.addClass(e.css.header+" "+l.cssHeader);l.headerList[a]=this;h.parent().addClass(e.css.headerRow+" "+l.cssHeaderRow).attr("role","row");l.tabIndex&&h.attr("tabindex",0)}).attr({scope:"col",role:"columnheader"});G(a);l.debug&& (u("Built headers:",q),d(l.$headers))}function B(a,b,c){var h=a.config;h.$table.find(h.selectorRemove).remove();t(a);v(a);H(h.$table,b,c)}function G(a){var b,c,h=a.config;h.$headers.each(function(f,d){c=g(d);b="false"===e.getData(d,h.headers[f],"sorter");d.sortDisabled=b;c[b?"addClass":"removeClass"]("sorter-false").attr("aria-disabled",""+b);a.id&&(b?c.removeAttr("aria-controls"):c.attr("aria-controls",a.id))})}function F(a){var b,c,h,f=a.config,d=f.sortList,k=e.css.sortNone+" "+f.cssNone,n=[e.css.sortAsc+ " "+f.cssAsc,e.css.sortDesc+" "+f.cssDesc],q=["ascending","descending"],l=g(a).find("tfoot tr").children().removeClass(n.join(" "));f.$headers.removeClass(n.join(" ")).addClass(k).attr("aria-sort","none");h=d.length;for(b=0;b"),c=g(a).width();g(a.tBodies[0]).find("tr:first").children("td:visible").each(function(){b.append(g("").css("width", parseInt(g(this).width()/c*1E3,10)/10+"%"))});g(a).prepend(b)}}function M(a,b){var c,h,f,e=a.config,d=b||e.sortList;e.sortList=[];g.each(d,function(a,b){c=[parseInt(b[0],10),parseInt(b[1],10)];if(f=e.$headers[c[0]])e.sortList.push(c),h=g.inArray(c[1],f.order),f.count=0<=h?h:c[1]%(e.sortReset?3:2)})}function N(a,b){return a&&a[b]?a[b].type||"":""}function O(a,b,c){var h,f,d,k=a.config,n=!c[k.sortMultiSortKey],q=g(a);q.trigger("sortStart",a);b.count=c[k.sortResetKey]?2:(b.count+1)%(k.sortReset?3:2); k.sortRestart&&(f=b,k.$headers.each(function(){this===f||!n&&g(this).is("."+e.css.sortDesc+",."+e.css.sortAsc)||(this.count=-1)}));f=b.column;if(n){k.sortList=[];if(null!==k.sortForce)for(h=k.sortForce,c=0;ch&&(k.sortList.push([f,h]),1h&&(k.sortList.push([f,h]),1 thead th, > thead td", selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};e.css={table:"tablesorter",childRow:"tablesorter-childRow",header:"tablesorter-header",headerRow:"tablesorter-headerRow",headerIn:"tablesorter-header-inner",icon:"tablesorter-icon",info:"tablesorter-infoOnly",processing:"tablesorter-processing",sortAsc:"tablesorter-headerAsc",sortDesc:"tablesorter-headerDesc",sortNone:"tablesorter-headerUnSorted"};e.language={sortAsc:"Ascending sort applied, ", sortDesc:"Descending sort applied, ",sortNone:"No sort applied, ",nextAsc:"activate to apply an ascending sort",nextDesc:"activate to apply a descending sort",nextNone:"activate to remove the sort"};e.log=d;e.benchmark=u;e.construct=function(a){return this.each(function(){var b=g.extend(!0,{},e.defaults,a);!this.hasInitialized&&e.buildTable&&"TABLE"!==this.tagName&&e.buildTable(this,b);e.setup(this,b)})};e.setup=function(a,b){if(!a||!a.tHead||0===a.tBodies.length||!0===a.hasInitialized)return b.debug? d("ERROR: stopping initialization! No table, thead, tbody or tablesorter has already been initialized"):"";var c="",h=g(a),f=g.metadata;a.hasInitialized=!1;a.isProcessing=!0;a.config=b;g.data(a,"tablesorter",b);b.debug&&g.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===g("x")[0].textContent;b.supportsDataObject=function(a){a[0]=parseInt(a[0],10);return 1'),c=g.fn.detach?b.detach():b.remove();c=g(a).find("span.tablesorter-savemyplace");b.insertAfter(c);c.remove();a.isProcessing=!1};e.clearTableBody=function(a){g(a)[0].config.$tbodies.empty()};e.bindEvents=function(a,b){a=g(a)[0];var c,h=a.config;b.find(h.selectorSort).add(b.filter(h.selectorSort)).unbind("mousedown.tablesorter mouseup.tablesorter sort.tablesorter keyup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter sort.tablesorter keyup.tablesorter", function(b,d){var e;e=b.type;if(!(1!==(b.which||b.button)&&!/sort|keyup/.test(e)||"keyup"===e&&13!==b.which||"mouseup"===e&&!0!==d&&250<(new Date).getTime()-c)){if("mousedown"===e)return c=(new Date).getTime(),"INPUT"===b.target.tagName?"":!h.cancelSelection;h.delayInit&&m(h.cache)&&v(a);e=/TH|TD/.test(this.tagName)?this:g(this).parents("th, td")[0];e.sortDisabled||O(a,e,b)}});h.cancelSelection&&b.attr("unselectable","on").bind("selectstart",!1).css({"user-select":"none",MozUserSelect:"none"})};e.restoreHeaders= function(a){var b=g(a)[0].config;b.$table.find(b.selectorHeaders).each(function(a){g(this).find("."+e.css.headerIn).length&&g(this).html(b.headerContent[a])})};e.destroy=function(a,b,c){a=g(a)[0];if(a.hasInitialized){e.refreshWidgets(a,!0,!0);var h=g(a),f=a.config,d=h.find("thead:first"),k=d.find("tr."+e.css.headerRow).removeClass(e.css.headerRow+" "+f.cssHeaderRow),n=h.find("tfoot:first > tr").children("th, td");d.find("tr").not(k).remove();h.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd ".split(" ").join(".tablesorter ")); f.$headers.add(n).removeClass([e.css.header,f.cssHeader,f.cssAsc,f.cssDesc,e.css.sortAsc,e.css.sortDesc,e.css.sortNone].join(" ")).removeAttr("data-column");k.find(f.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter keypress.tablesorter");e.restoreHeaders(a);!1!==b&&h.removeClass(e.css.table+" "+f.tableClass+" tablesorter-"+f.theme);a.hasInitialized=!1;"function"===typeof c&&c(a)}};e.regex={chunk:/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,hex:/^0x[0-9a-f]+$/i}; e.sortNatural=function(a,b){if(a===b)return 0;var c,h,f,d,g,n;h=e.regex;if(h.hex.test(b)){c=parseInt(a.match(h.hex),16);f=parseInt(b.match(h.hex),16);if(cf)return 1}c=a.replace(h.chunk,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");h=b.replace(h.chunk,"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");n=Math.max(c.length,h.length);for(g=0;gd)return 1}return 0};e.sortNaturalAsc=function(a,b,c,d,f){if(a===b)return 0;c=f.string[f.empties[c]||f.emptyTo];return""===a&&0!==c?"boolean"===typeof c?c?-1:1:-c||-1:""===b&&0!==c?"boolean"===typeof c?c?1:-1:c||1:e.sortNatural(a,b)};e.sortNaturalDesc=function(a,b,c,d,f){if(a===b)return 0;c=f.string[f.empties[c]||f.emptyTo];return""===a&&0!==c?"boolean"===typeof c?c?-1:1:c||1:""===b&&0!==c?"boolean"===typeof c?c?1:-1:-c||-1:e.sortNatural(b, a)};e.sortText=function(a,b){return a>b?1:ag.inArray(k[h].id,m))&&(f.debug&&d('Refeshing widgets: Removing "'+k[h].id+'"'),k[h].hasOwnProperty("remove")&&f.widgetInit[k[h].id]&&(k[h].remove(a,f,f.widgetOptions),f.widgetInit[k[h].id]=!1));!0!==c&&e.applyWidget(a,b)};e.getData=function(a,b,c){var d="";a=g(a);var f,e;if(!a.length)return"";f=g.metadata?a.metadata():!1;e=" "+(a.attr("class")||"");"undefined"!==typeof a.data(c)||"undefined"!==typeof a.data(c.toLowerCase())? d+=a.data(c)||a.data(c.toLowerCase()):f&&"undefined"!==typeof f[c]?d+=f[c]:b&&"undefined"!==typeof b[c]?d+=b[c]:" "!==e&&e.match(" "+c+"-")&&(d=e.match(RegExp("\\s"+c+"-([\\w-]+)"))[1]||"");return g.trim(d)};e.formatFloat=function(a,b){if("string"!==typeof a||""===a)return a;var c;a=(b&&b.config?!1!==b.config.usNumberFormat:"undefined"!==typeof b?b:1)?a.replace(/,/g,""):a.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(a)&&(a=a.replace(/^\s*\(([.\d]+)\)/,"-$1"));c=parseFloat(a);return isNaN(c)? g.trim(a):c};e.isDigit=function(a){return isNaN(a)?/^[\-+(]?\d+[)]?$/.test(a.toString().replace(/[,.'"\s]/g,"")):!0}}});var p=g.tablesorter;g.fn.extend({tablesorter:p.construct});p.addParser({id:"text",is:function(){return!0},format:function(d,u){var m=u.config;d&&(d=g.trim(m.ignoreCase?d.toLocaleLowerCase():d),d=m.sortLocaleCompare?p.replaceAccents(d):d);return d},type:"text"});p.addParser({id:"digit",is:function(d){return p.isDigit(d)},format:function(d,u){var m=p.formatFloat((d||"").replace(/[^\w,. \-()]/g, ""),u);return d&&"number"===typeof m?m:d?g.trim(d&&u.config.ignoreCase?d.toLocaleLowerCase():d):d},type:"numeric"});p.addParser({id:"currency",is:function(d){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((d||"").replace(/[+\-,. ]/g,""))},format:function(d,u){var m=p.formatFloat((d||"").replace(/[^\w,. \-()]/g,""),u);return d&&"number"===typeof m?m:d?g.trim(d&&u.config.ignoreCase?d.toLocaleLowerCase():d):d},type:"numeric"});p.addParser({id:"ipAddress", is:function(d){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(d)},format:function(d,g){var m,s=d?d.split("."):"",t="",v=s.length;for(m=0;md.length},format:function(d,g){return d?p.formatFloat(d.replace(/%/g,""),g):d},type:"numeric"});p.addParser({id:"usLongDate",is:function(d){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(d)||/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i.test(d)},format:function(d,g){return d?p.formatFloat((new Date(d.replace(/(\S)([AP]M)$/i, "$1 $2"))).getTime()||"",g):d},type:"numeric"});p.addParser({id:"shortDate",is:function(d){return/(^\d{1,2}[\/\s]\d{1,2}[\/\s]\d{4})|(^\d{4}[\/\s]\d{1,2}[\/\s]\d{1,2})/.test((d||"").replace(/\s+/g," ").replace(/[\-.,]/g,"/"))},format:function(d,g,m,s){if(d){m=g.config;var t=m.$headers.filter("[data-column="+s+"]:last");s=t.length&&t[0].dateFormat||p.getData(t,m.headers[s],"dateFormat")||m.dateFormat;d=d.replace(/\s+/g," ").replace(/[\-.,]/g,"/");"mmddyyyy"===s?d=d.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/, "$3/$1/$2"):"ddmmyyyy"===s?d=d.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$2/$1"):"yyyymmdd"===s&&(d=d.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"))}return d?p.formatFloat((new Date(d)).getTime()||"",g):d},type:"numeric"});p.addParser({id:"time",is:function(d){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(d)},format:function(d,g){return d?p.formatFloat((new Date("2000/01/01 "+d.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",g):d},type:"numeric"});p.addParser({id:"metadata", is:function(){return!1},format:function(d,p,m){d=p.config;d=d.parserMetadataName?d.parserMetadataName:"sortValue";return g(m).metadata()[d]},type:"numeric"});p.addWidget({id:"zebra",priority:90,format:function(d,u,m){var s,t,v,A,D,C,E=RegExp(u.cssChildRow,"i"),B=u.$tbodies;u.debug&&(D=new Date);for(d=0;d<=]/g,'')) || $cell.find('.spinner').val() || o.value, compare = ($.isArray(o.compare) ? $cell.find(compareSelect).val() || o.compare[ o.selected || 0] : o.compare) || '', - searchType = ui && typeof ui.delayed === 'boolean' ? ui.delayed : c.$table[0].hasInitialized ? o.delayed : true + searchType = ui && typeof ui.delayed === 'boolean' ? ui.delayed : c.$table[0].hasInitialized ? o.delayed : true; if (o.addToggle) { chkd = $cell.find('.toggle').is(':checked'); } @@ -507,7 +507,7 @@ tsff = ts.filterFormatter = { o.onClose(v); } }), - t, l, $shcell = [], + t, $shcell = [], c = $cell.closest('table')[0].config, // this function updates the hidden input @@ -712,8 +712,8 @@ tsff = ts.filterFormatter = { // date range if (/\s+-\s+/.test(val)){ - val = val.split(/\s+-\s+/) || [], - from = val[0] || '', + val = val.split(/\s+-\s+/) || []; + from = val[0] || ''; to = val[1] || ''; } else if (/>=/.test(val)) { // greater than date (to date empty) @@ -774,7 +774,7 @@ tsff = ts.filterFormatter = { $number = $('').appendTo($cell), // test if HTML5 number is supported - from Modernizr numberSupported = o.skipTest || $number.attr('type') === 'number' && $number.val() !== 'test', - l, $shcell = [], + $shcell = [], c = $cell.closest('table')[0].config, updateNumber = function(delayed, notrigger){ @@ -1074,7 +1074,7 @@ tsff = ts.filterFormatter = { (o.addToggle ? '
' : '') + '' + - (o.valueToHeader ? '' : '(#000000)') + '' + (o.valueToHeader ? '' : '(#000000)') + ''; $cell.html(t); // add span to header for the current color value - only works if the line in the updateColor() function is also un-commented out if (o.valueToHeader) { diff --git a/js/jquery.tablesorter.widgets-filter-formatter.min.js b/js/jquery.tablesorter.widgets-filter-formatter.min.js index 9d622bcc..cc38f892 100644 --- a/js/jquery.tablesorter.widgets-filter-formatter.min.js +++ b/js/jquery.tablesorter.widgets-filter-formatter.min.js @@ -1,6 +1,6 @@ -/*! Filter widget formatter functions - updated 11/9/2013 (v2.13.3) +/*! Filter widget formatter functions - updated 2/19/2014 (v2.15.0) * requires: tableSorter 2.7.7+ and jQuery 1.4.3+ * jQuery UI spinner, silder, range slider & datepicker (range) * HTML5 number (spinner), range slider & color selector */ -;(function(k){k.tablesorter=k.tablesorter||{};k.tablesorter.filterFormatter={uiSpinner:function(b,e,h){var a=k.extend({min:0,max:100,step:1,value:1,delayed:!0,addToggle:!0,disabled:!1,exactMatch:!0,compare:""},h);h=k('').appendTo(b).bind("change.tsfilter",function(){c({value:this.value,delayed:!1})});var d=[],l=b.closest("table")[0].config,c=function(f){var g=!0,c,e=f&&f.value&&k.tablesorter.formatFloat((f.value+"").replace(/[><=]/g,""))||b.find(".spinner").val()|| a.value;a.addToggle&&(g=b.find(".toggle").is(":checked"));c=a.disabled||!g?"disable":"enable";b.find(".filter").val(g?(a.compare?a.compare:a.exactMatch?"=":"")+e:"").trigger("search",f&&"boolean"===typeof f.delayed?f.delayed:a.delayed).end().find(".spinner").spinner(c).val(e);d.length&&(d.find(".spinner").spinner(c).val(e),a.addToggle&&(d.find(".toggle")[0].checked=g))};a.oldcreate=a.create;a.oldspin=a.spin;a.create=function(b,g){c();"function"===typeof a.oldcreate&&a.oldcreate(b,g)};a.spin=function(b, g){c(g);"function"===typeof a.oldspin&&a.oldspin(b,g)};a.addToggle&&k('
').appendTo(b).find(".toggle").bind("change",function(){c()});b.closest("thead").find("th[data-column="+e+"]").addClass("filter-parsed");k('').val(a.value).appendTo(b).spinner(a).bind("change keyup",function(){c()});l.$table.bind("stickyHeadersInit",function(){d= l.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(e).empty();a.addToggle&&k('
').appendTo(d).find(".toggle").bind("change",function(){b.find(".toggle")[0].checked=this.checked;c()});k('').val(a.value).appendTo(d).spinner(a).bind("change keyup",function(){b.find(".spinner").val(this.value);c()})}); l.$table.bind("filterReset",function(){a.addToggle&&(b.find(".toggle")[0].checked=!1);c()});c();return h},uiSlider:function(b,e,h){var a=k.extend({value:0,min:0,max:100,step:1,range:"min",delayed:!0,valueToHeader:!1,exactMatch:!0,compare:"",allText:"all"},h);h=k('').appendTo(b).bind("change.tsfilter",function(){c({value:this.value})});var d=[],l=b.closest("table")[0].config,c=function(f){var c="undefined"!==typeof f?k.tablesorter.formatFloat((f.value+"").replace(/[><=]/g, ""))||a.min:a.value,h=a.compare+(a.compare?c:c===a.min?a.allText:c);a.valueToHeader?b.closest("thead").find("th[data-column="+e+"]").find(".curvalue").html(" ("+h+")"):b.find(".ui-slider-handle").addClass("value-popup").attr("data-value",h);b.find(".filter").val(a.compare?a.compare+c:c===a.min?"":(a.exactMatch?"=":"")+c).trigger("search",f&&"boolean"===typeof f.delayed?f.delayed:a.delayed).end().find(".slider").slider("value",c);d.length&&(d.find(".slider").slider("value",c),a.valueToHeader?d.closest("thead").find("th[data-column="+ e+"]").find(".curvalue").html(" ("+h+")"):d.find(".ui-slider-handle").addClass("value-popup").attr("data-value",h))};b.closest("thead").find("th[data-column="+e+"]").addClass("filter-parsed");a.valueToHeader&&b.closest("thead").find("th[data-column="+e+"]").find(".tablesorter-header-inner").append('');a.oldcreate=a.create;a.oldslide=a.slide;a.create=function(b,d){c();"function"===typeof a.oldcreate&&a.oldcreate(b,d)};a.slide=function(b,d){c(d);"function"===typeof a.oldslide&& a.oldslide(b,d)};k('
').appendTo(b).slider(a);l.$table.bind("filterReset",function(){b.find(".slider").slider("value",a.value);c()});l.$table.bind("stickyHeadersInit",function(){d=l.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(e).empty();k('
').val(a.value).appendTo(d).slider(a).bind("change keyup",function(){b.find(".slider").val(this.value);c()})});return h},uiRange:function(b,e,h){var a=k.extend({values:[0,100], min:0,max:100,range:!0,delayed:!0,valueToHeader:!1},h);h=k('').appendTo(b).bind("change.tsfilter",function(){var b=this.value.split(" - ");""===this.value&&(b=[a.min,a.max]);b&&b[1]&&c({values:b,delay:!1})});var d=[],l=b.closest("table")[0].config,c=function(c){var g=c&&c.values||a.values,h=g[0]+" - "+g[1],m=g[0]===a.min&&g[1]===a.max?"":h;a.valueToHeader?b.closest("thead").find("th[data-column="+e+"]").find(".currange").html(" ("+h+")"):b.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value", g[0]).end().eq(1).attr("data-value",g[1]);b.find(".filter").val(m).trigger("search",c&&"boolean"===typeof c.delayed?c.delayed:a.delayed).end().find(".range").slider("values",g);d.length&&(d.find(".range").slider("values",g),a.valueToHeader?d.closest("thead").find("th[data-column="+e+"]").find(".currange").html(" ("+h+")"):d.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value",g[0]).end().eq(1).attr("data-value",g[1]))};b.closest("thead").find("th[data-column="+e+"]").addClass("filter-parsed"); a.valueToHeader&&b.closest("thead").find("th[data-column="+e+"]").find(".tablesorter-header-inner").append('');a.oldcreate=a.create;a.oldslide=a.slide;a.create=function(b,d){c();"function"===typeof a.oldcreate&&a.oldcreate(b,d)};a.slide=function(b,d){c(d);"function"===typeof a.oldslide&&a.oldslide(b,d)};k('
').appendTo(b).slider(a);l.$table.bind("filterReset",function(){b.find(".range").slider("values",a.values);c()});l.$table.bind("stickyHeadersInit", function(){d=l.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(e).empty();k('
').val(a.value).appendTo(d).slider(a).bind("change keyup",function(){b.find(".range").val(this.value);c()})});return h},uiDateCompare:function(b,e,h){var a=k.extend({defaultDate:"",cellText:"",changeMonth:!0,changeYear:!0,numberOfMonths:1,compare:"",compareOptions:!1},h);h=b.closest("thead").find("th[data-column="+e+"]");var d=k('').appendTo(b).bind("change.tsfilter", function(){var b=this.value;if(b)a.onClose(b)}),l,c,f=[],g=b.closest("table")[0].config,n=function(c){var d=(new Date(b.find(".date").datepicker("getDate"))).getTime();b.find(".compare").val(c);b.find(".dateCompare").val(c+d).trigger("search",a.delayed).end();f.length&&f.find(".compare").val(c)};h.addClass("filter-parsed");if(a.compareOptions){c='"; b.append(c).find(".compare").bind("change",function(){n(k(this).val())})}else a.cellText&&(c="",b.append(c));l='';k(l).appendTo(b);a.oldonClose=a.onClose;a.onClose=function(c,d){var g=(new Date(b.find(".date").datepicker("getDate"))).getTime()||"",e=b.find(".compare").val()||a.compare;b.find(".dateCompare").val(e+g).trigger("search").end().find(".date").datepicker("setDate", c);f.length&&f.find(".date").datepicker("setDate",c);"function"===typeof a.oldonClose&&a.oldonClose(c,d)};b.find(".date").datepicker(a);a.filterDate&&b.find(".date").datepicker("setDate",a.filterDate);g.$table.bind("filterReset",function(){b.find(".date").val("").datepicker("option","currentText","");f.length&&f.find(".date").val("").datepicker("option","currentText","")});g.$table.bind("stickyHeadersInit",function(){f=g.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(e).empty(); a.compareOptions?f.append(c).find(".compare").bind("change",function(){n(k(this).val())}):a.cellText&&f.append(c);f.append(l).find(".date").datepicker(a)});return d.val(a.defaultDate?a.defaultDate:"")},uiDatepicker:function(b,e,h){var a=k.extend({from:"",to:"",textFrom:"from",textTo:"to",changeMonth:!0,changeYear:!0,numberOfMonths:1},h),d,l,c,f=[];h=k('').appendTo(b).bind("change.tsfilter",function(){var a=this.value;a.match(" - ")?(a=a.split(" - "),b.find(".dateTo").val(a[1]), c(a[0])):a.match(">=")?c(a.replace(">=","")):a.match("<=")&&l(a.replace("<=",""))});var g=b.closest("table")[0].config;b.closest("thead").find("th[data-column="+e+"]").addClass("filter-parsed");d="';k(d).appendTo(b);a.oldonClose=a.onClose;var n=a.defaultDate=a.from||a.defaultDate;c=a.onClose=function(c,d){var g=(new Date(b.find(".dateFrom").datepicker("getDate"))).getTime()|| "",e=(new Date(b.find(".dateTo").datepicker("getDate"))).getTime()||"",g=g?e?g+" - "+e:">="+g:e?"<="+e:"";b.find(".dateRange").val(g).trigger("search").end().find(".dateTo").datepicker("option","minDate",c).end().find(".dateFrom").val(c);f.length&&f.find(".dateTo").datepicker("option","minDate",c).end().find(".dateFrom").val(c);"function"===typeof a.oldonClose&&a.oldonClose(c,d)};b.find(".dateFrom").datepicker(a);a.defaultDate=a.to||"+7d";l=a.onClose=function(c,d){var g=(new Date(b.find(".dateFrom").datepicker("getDate"))).getTime()|| "",e=(new Date(b.find(".dateTo").datepicker("getDate"))).getTime()||"",g=g?e?g+" - "+e:">="+g:e?"<="+e:"";b.find(".dateRange").val(g).trigger("search").end().find(".dateFrom").datepicker("option","maxDate",c).end().find(".dateTo").val(c);f.length&&f.find(".dateFrom").datepicker("option","maxDate",c).end().find(".dateTo").val(c);"function"===typeof a.oldonClose&&a.oldonClose(c,d)};b.find(".dateTo").datepicker(a);g.$table.bind("stickyHeadersInit",function(){f=g.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(e).empty(); f.append(d);a.onClose=l;f.find(".dateTo").datepicker(a);a.defaultDate=n;a.onClose=c;f.find(".dateFrom").datepicker(a)});b.closest("table").bind("filterReset",function(){b.find(".dateFrom, .dateTo").val("").datepicker("option","currentText","");f.length&&f.find(".dateFrom, .dateTo").val("").datepicker("option","currentText","")});return h.val(a.from?a.to?a.from+" - "+a.to:">="+a.from:a.to?"<="+a.to:"")},html5Number:function(b,e,h){var a,d=k.extend({value:0,min:0,max:100,step:1,delayed:!0,disabled:!1, addToggle:!0,exactMatch:!0,compare:"",compareOptions:!1,skipTest:!1},h);h=k('').appendTo(b);var l=d.skipTest||"number"===h.attr("type")&&"test"!==h.val(),c,f=[],g=b.closest("table")[0].config,n=function(a){var c=b.find(".number").val();b.find(".compare").val(a);b.find("input[type=hidden]").val(a+c).trigger("search",d.delayed).end();f.length&&f.find(".compare").val(a)},m=function(a,c){var g=d.addToggle?b.find(".toggle").is(":checked"):!0, e=b.find(".compare").val()||d.compare;b.find("input[type=hidden]").val(!d.addToggle||g?(e?e:d.exactMatch?"=":"")+a:"").trigger("search",c?c:d.delayed).end().find(".number").val(a);b.find(".number").length&&(b.find(".number")[0].disabled=d.disabled||!g);f.length&&(f.find(".number").val(a)[0].disabled=d.disabled||!g,d.addToggle&&(f.find(".toggle")[0].checked=g))};h.remove();l&&(c=d.addToggle?'
':"");if(d.compareOptions){c='";b.append(c).find(".compare").bind("change",function(){n(k(this).val())})}else c&&b.append(c);l&&(a='',b.append(a+'').find(".toggle, .number").bind("change",function(){m(b.find(".number").val())}).closest("thead").find("th[data-column="+ e+"]").addClass("filter-parsed").closest("table").bind("filterReset",function(){d.addToggle&&(b.find(".toggle")[0].checked=!1,f.length&&(f.find(".toggle")[0].checked=!1));m(b.find(".number").val())}),g.$table.bind("stickyHeadersInit",function(){f=g.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(e).empty();d.compareOptions?f.append(c).find(".compare").bind("change",function(){n(k(this).val())}):f.append(c);f.append(a).find(".toggle, .number").bind("change",function(){m(f.find(".number").val())}); m(b.find(".number").val())}),m(b.find(".number").val()));return l?b.find('input[type="hidden"]'):k('')},html5Range:function(b,e,h){var a=k.extend({value:0,min:0,max:100,step:1,delayed:!0,valueToHeader:!0,exactMatch:!0,compare:"",allText:"all",skipTest:!1},h);h=k('').appendTo(b);var d=a.skipTest||"range"===h.attr("type")&&"test"!==h.val(),l=[],c=b.closest("table")[0].config,f=function(c,d){c=(c+"").replace(/[<>=]/g,"")|| a.min;var f=" ("+(a.compare?a.compare+c:c==a.min?a.allText:c)+")";b.find("input[type=hidden]").val(a.compare?a.compare+c:c==a.min?"":(a.exactMatch?"=":"")+c).trigger("search",d?d:a.delayed).end().find(".range").val(c);b.closest("thead").find("th[data-column="+e+"]").find(".curvalue").html(f);l.length&&(l.find(".range").val(c),l.closest("thead").find("th[data-column="+e+"]").find(".curvalue").html(f))};h.remove();d&&(b.html('').closest("thead").find("th[data-column="+e+"]").addClass("filter-parsed").find(".tablesorter-header-inner").append(''),b.find(".range").bind("change",function(){f(this.value)}),b.find("input[type=hidden]").bind("change.tsfilter",function(){var b=this.value;b!==this.lastValue&&(this.value=this.lastValue=a.compare?a.compare+b:b==a.min?"":(a.exactMatch?"=":"")+b,f(b))}),c.$table.bind("stickyHeadersInit",function(){l=c.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(e).empty(); l.html('').find(".range").bind("change",function(){f(l.find(".range").val())});f(b.find(".range").val())}),b.closest("table").bind("filterReset",function(){f(a.value)}),f(b.find(".range").val()));return d?b.find('input[type="hidden"]'):k('')},html5Color:function(b,e,h){var a,d=k.extend({value:"#000000",disabled:!1,addToggle:!0,exactMatch:!0,valueToHeader:!1,skipTest:!1},h);h=k('').appendTo(b); var l=d.skipTest||"color"===h.attr("type")&&"test"!==h.val(),c=[],f=b.closest("table")[0].config,g=function(a){a=a||d.value;var f=!0,g=" ("+a+")";d.addToggle&&(f=b.find(".toggle").is(":checked"));b.find(".colorpicker").length&&(b.find(".colorpicker").val(a)[0].disabled=d.disabled||!f);b.find("input[type=hidden]").val(f?a+(d.exactMatch?"=":""):"").trigger("search");d.valueToHeader?b.closest("thead").find("th[data-column="+e+"]").find(".curcolor").html(g):b.find(".currentColor").html(g);c.length&&(c.find(".colorpicker").val(a)[0].disabled= d.disabled||!f,d.addToggle&&(c.find(".toggle")[0].checked=f),d.valueToHeader?c.closest("thead").find("th[data-column="+e+"]").find(".curcolor").html(g):c.find(".currentColor").html(g))};h.remove();l&&(a='
',a+=d.addToggle?'
':"",a+='',a+=(d.valueToHeader?"":'(#000000)')+ "
",b.html(a),d.valueToHeader&&b.closest("thead").find("th[data-column="+e+"]").find(".tablesorter-header-inner").append(''),b.find(".toggle, .colorpicker").bind("change",function(){g(b.find(".colorpicker").val())}),b.find("input[type=hidden]").bind("change.tsfilter",function(){g(this.value)}),b.closest("table").bind("filterReset",function(){b.find(".toggle")[0].checked=!1;g(b.find(".colorpicker").val())}),f.$table.bind("stickyHeadersInit",function(){c=f.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(e); c.html(a).find(".toggle, .colorpicker").bind("change",function(){g(c.find(".colorpicker").val())});g(c.find(".colorpicker").val())}),g(d.value));return l?b.find('input[type="hidden"]'):k('')}}})(jQuery); \ No newline at end of file +;(function(h){var s=h.tablesorter||{},p=s.filterFormatter={addCompare:function(b,c,f){if(f.compare&&h.isArray(f.compare)&&1'+f.cellText+"":"";h.each(f.compare,function(b,d){a+=""});b.wrapInner('
').prepend(g+'').appendTo(b).bind("change.tsfilter",function(){d({value:this.value,delayed:!1})}), g=[],k=b.closest("table")[0].config,d=function(d,e){var q=!0,c,r=d&&d.value&&s.formatFloat((d.value+"").replace(/[><=]/g,""))||b.find(".spinner").val()||a.value,t=(h.isArray(a.compare)?b.find(".compare-select").val()||a.compare[a.selected||0]:a.compare)||"",f=d&&"boolean"===typeof d.delayed?d.delayed:k.$table[0].hasInitialized?a.delayed:!0;a.addToggle&&(q=b.find(".toggle").is(":checked"));c=a.disabled||!q?"disable":"enable";b.find(".filter").val(q?(t?t:a.exactMatch?"=":"")+r:"").trigger(e?"":"search", f).end().find(".spinner").spinner(c).val(r);g.length&&(g.find(".spinner").spinner(c).val(r).end().find(".compare-select").val(t),a.addToggle&&(g.find(".toggle")[0].checked=q))};a.oldcreate=a.create;a.oldspin=a.spin;a.create=function(b,e){d();"function"===typeof a.oldcreate&&a.oldcreate(b,e)};a.spin=function(b,e){d(e);"function"===typeof a.oldspin&&a.oldspin(b,e)};a.addToggle&&h('
').appendTo(b).find(".toggle").bind("change", function(){d()});b.closest("thead").find("th[data-column="+c+"]").addClass("filter-parsed");h('').val(a.value).appendTo(b).spinner(a).bind("change keyup",function(){d()});k.$table.bind("filterFomatterUpdate",function(){var c=p.updateCompare(b,e,a)[0];b.find(".spinner").val(c);d({value:c},!0)});a.compare&&(p.addCompare(b,c,a),b.find(".compare-select").bind("change",function(){d()}));k.$table.bind("stickyHeadersInit",function(){g=k.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(c).empty(); a.addToggle&&h('
').appendTo(g).find(".toggle").bind("change",function(){b.find(".toggle")[0].checked=this.checked;d()});h('').val(a.value).appendTo(g).spinner(a).bind("change keyup",function(){b.find(".spinner").val(this.value);d()});a.compare&&(p.addCompare(g,c,a),g.find(".compare-select").bind("change",function(){b.find(".compare-select").val(h(this).val()); d()}))});k.$table.bind("filterReset",function(){h.isArray(a.compare)&&b.add(g).find(".compare-select").val(a.compare[a.selected||0]);a.addToggle&&(b.find(".toggle")[0].checked=!1);b.find(".spinner").spinner("value",a.value);setTimeout(function(){d()},0)});d();return e},uiSlider:function(b,c,f){var a=h.extend({delayed:!0,valueToHeader:!1,exactMatch:!0,cellText:"",compare:"",allText:"all",value:0,min:0,max:100,step:1,range:"min"},f),e=h('').appendTo(b).bind("change.tsfilter", function(){d({value:this.value})}),g=[],k=b.closest("table")[0].config,d=function(d,e){var q="undefined"!==typeof d?s.formatFloat((d.value+"").replace(/[><=]/g,""))||a.value:a.value,n=a.compare?q:q===a.min?a.allText:q,r=(h.isArray(a.compare)?b.find(".compare-select").val()||a.compare[a.selected||0]:a.compare)||"",n=r+n,f=d&&"boolean"===typeof d.delayed?d.delayed:k.$table[0].hasInitialized?a.delayed:!0;a.valueToHeader?b.closest("thead").find("th[data-column="+c+"]").find(".curvalue").html(" ("+n+")"): b.find(".ui-slider-handle").addClass("value-popup").attr("data-value",n);b.find(".filter").val(r?r+q:q===a.min?"":(a.exactMatch?"=":"")+q).trigger(e?"":"search",f).end().find(".slider").slider("value",q);g.length&&(g.find(".compare-select").val(r).end().find(".slider").slider("value",q),a.valueToHeader?g.closest("thead").find("th[data-column="+c+"]").find(".curvalue").html(" ("+n+")"):g.find(".ui-slider-handle").addClass("value-popup").attr("data-value",n))};b.closest("thead").find("th[data-column="+ c+"]").addClass("filter-parsed");a.valueToHeader&&b.closest("thead").find("th[data-column="+c+"]").find(".tablesorter-header-inner").append('');a.oldcreate=a.create;a.oldslide=a.slide;a.create=function(b,e){d();"function"===typeof a.oldcreate&&a.oldcreate(b,e)};a.slide=function(b,e){d(e);"function"===typeof a.oldslide&&a.oldslide(b,e)};h('
').appendTo(b).slider(a);k.$table.bind("filterFomatterUpdate",function(){var c=p.updateCompare(b,e,a)[0]; b.find(".slider").slider("value",c);d({value:c},!1)});a.compare&&(p.addCompare(b,c,a),b.find(".compare-select").bind("change",function(){d({value:b.find(".slider").slider("value")})}));k.$table.bind("filterReset",function(){h.isArray(a.compare)&&b.add(g).find(".compare-select").val(a.compare[a.selected||0]);setTimeout(function(){d({value:a.value})},0)});k.$table.bind("stickyHeadersInit",function(){g=k.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(c).empty();h('
').val(a.value).appendTo(g).slider(a).bind("change keyup",function(){b.find(".slider").slider("value",this.value);d()});a.compare&&(p.addCompare(g,c,a),g.find(".compare-select").bind("change",function(){b.find(".compare-select").val(h(this).val());d()}))});return e},uiRange:function(b,c,f){var a=h.extend({delayed:!0,valueToHeader:!1,values:[0,100],min:0,max:100,range:!0},f),e=h('').appendTo(b).bind("change.tsfilter",function(){d()}),g=[],k=b.closest("table")[0].config, d=function(){var b=e.val(),d=b.split(" - ");""===b&&(d=[a.min,a.max]);d&&d[1]&&l({values:d,delay:!1},!0)},l=function(d,e){var n=d&&d.values||a.values,h=n[0]+" - "+n[1],f=n[0]===a.min&&n[1]===a.max?"":h,l=d&&"boolean"===typeof d.delayed?d.delayed:k.$table[0].hasInitialized?a.delayed:!0;a.valueToHeader?b.closest("thead").find("th[data-column="+c+"]").find(".currange").html(" ("+h+")"):b.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value",n[0]).end().eq(1).attr("data-value",n[1]); b.find(".filter").val(f).trigger(e?"":"search",l).end().find(".range").slider("values",n);g.length&&(g.find(".range").slider("values",n),a.valueToHeader?g.closest("thead").find("th[data-column="+c+"]").find(".currange").html(" ("+h+")"):g.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value",n[0]).end().eq(1).attr("data-value",n[1]))};b.closest("thead").find("th[data-column="+c+"]").addClass("filter-parsed");a.valueToHeader&&b.closest("thead").find("th[data-column="+c+"]").find(".tablesorter-header-inner").append(''); a.oldcreate=a.create;a.oldslide=a.slide;a.create=function(b,d){l();"function"===typeof a.oldcreate&&a.oldcreate(b,d)};a.slide=function(b,d){l(d);"function"===typeof a.oldslide&&a.oldslide(b,d)};h('
').appendTo(b).slider(a);k.$table.bind("filterFomatterUpdate",function(){d()});k.$table.bind("filterReset",function(){b.find(".range").slider("values",a.values);setTimeout(function(){l()},0)});k.$table.bind("stickyHeadersInit",function(){g=k.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(c).empty(); h('
').val(a.value).appendTo(g).slider(a).bind("change keyup",function(){b.find(".range").val(this.value);l()})});return e},uiDateCompare:function(b,c,f){var a=h.extend({cellText:"",compare:"",endOfDay:!0,defaultDate:"",changeMonth:!0,changeYear:!0,numberOfMonths:1},f),e;f=b.closest("thead").find("th[data-column="+c+"]").addClass("filter-parsed");var g=h('').appendTo(b).bind("change.tsfilter",function(){var b=this.value;if(b)a.onClose(b)}), k,d=[],l=b.closest("table")[0].config,m=function(c,n){var f,g;f=c||e.datepicker("getDate")||"";var m=(h.isArray(a.compare)?b.find(".compare-select").val()||a.compare[a.selected||0]:a.compare)||"",k=l.$table[0].hasInitialized?a.delayed:!0;e.datepicker("setDate",""===f?a.defaultDate||"":f);""===f&&(n=!1);g=(f=e.datepicker("getDate"))?(a.endOfDay&&/<=/.test(m)?f.setHours(23,59,59):f.getTime())||"":"";f&&a.endOfDay&&"="===m&&(m="",g+=" - "+f.setHours(23,59,59),n=!1);b.find(".dateCompare").val(m+g).trigger(n? "":"search",k).end();d.length&&d.find(".dateCompare").val(m+g).end().find(".compare-select").val(m)};k='';e=h(k).appendTo(b);a.oldonClose=a.onClose;a.onClose=function(b,d){m();"function"===typeof a.oldonClose&&a.oldonClose(b,d)};e.datepicker(a);l.$table.bind("filterReset",function(){h.isArray(a.compare)&&b.add(d).find(".compare-select").val(a.compare[a.selected||0]);b.add(d).find(".date").val(a.defaultDate).datepicker("setDate", "");setTimeout(function(){m()},0)});l.$table.bind("filterFomatterUpdate",function(){var c;c=g.val();/\s+-\s+/.test(c)?(b.find(".compare-select").val("="),c=new Date(Number(c.split(/\s+-\s+/)[0])),e.datepicker("setDate",c)):(c=p.updateCompare(b,g,a)[1].toString()||"",c=""!==c?new Date(/\d{5}/g.test(c)?Number(c):c)||"":"");b.add(d).find(".date").datepicker("setDate",c);m(c,!0)});a.compare&&(p.addCompare(b,c,a),b.find(".compare-select").bind("change",function(){m()}));l.$table.bind("stickyHeadersInit", function(){d=l.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(c).empty();d.append(k).find(".date").datepicker(a);a.compare&&(p.addCompare(d,c,a),d.find(".compare-select").bind("change",function(){b.find(".compare-select").val(h(this).val());m()}))});return g.val(a.defaultDate?a.defaultDate:"")},uiDatepicker:function(b,c,f){var a=h.extend({endOfDay:!0,textFrom:"from",textTo:"to",from:"",to:"",changeMonth:!0,changeYear:!0,numberOfMonths:1},f),e,g,k,d=[],l=h('').appendTo(b).bind("change.tsfilter", function(){var a=this.value;a.match(" - ")?(a=a.split(" - "),b.find(".dateTo").val(a[1]),k(a[0])):a.match(">=")?k(a.replace(">=","")):a.match("<=")&&g(a.replace("<=",""))}),m=b.closest("table")[0].config;b.closest("thead").find("th[data-column="+c+"]").addClass("filter-parsed");e="';h(e).appendTo(b);a.oldonClose=a.onClose;var q=a.defaultDate=a.from||a.defaultDate;k=a.onClose= function(c,e){var f;f=(new Date(b.find(".dateFrom").datepicker("getDate"))).getTime()||"";var g=b.find(".dateTo").datepicker("getDate")||"",g=g?(a.endOfDay?g.setHours(23,59,59):g.getTime())||"":"";f=f?g?f+" - "+g:">="+f:g?"<="+g:"";b.find(".dateRange").val(f).trigger("search").end().find(".dateTo").datepicker("option","minDate",c).end().find(".dateFrom").val(c);d.length&&d.find(".dateTo").datepicker("option","minDate",c).end().find(".dateFrom").val(c);"function"===typeof a.oldonClose&&a.oldonClose(c, e)};b.find(".dateFrom").datepicker(a);a.defaultDate=a.to||"+7d";g=a.onClose=function(c,e){var f;f=(new Date(b.find(".dateFrom").datepicker("getDate"))).getTime()||"";var g=b.find(".dateTo").datepicker("getDate")||"",g=g?(a.endOfDay?g.setHours(23,59,59):g.getTime())||"":"";f=f?g?f+" - "+g:">="+f:g?"<="+g:"";b.find(".dateRange").val(f).trigger("search").end().find(".dateFrom").datepicker("option","maxDate",c).end().find(".dateTo").val(c);d.length&&d.find(".dateFrom").datepicker("option","maxDate",c).end().find(".dateTo").val(c); "function"===typeof a.oldonClose&&a.oldonClose(c,e)};b.find(".dateTo").datepicker(a);m.$table.bind("filterFomatterUpdate",function(){var a=l.val()||"",c="",e="";/\s+-\s+/.test(a)?(a=a.split(/\s+-\s+/)||[],c=a[0]||"",e=a[1]||""):/>=/.test(a)?c=new Date(Number(a.replace(/>=/,"")))||"":/<=/.test(a)&&(e=new Date(Number(a.replace(/<=/,"")))||"");b.add(d).find(".dateFrom").datepicker("setDate",c);b.add(d).find(".dateTo").datepicker("setDate",e);g(e)});m.$table.bind("stickyHeadersInit",function(){d=m.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(c).empty(); d.append(e);a.onClose=g;d.find(".dateTo").datepicker(a);a.defaultDate=q;a.onClose=k;d.find(".dateFrom").datepicker(a)});b.closest("table").bind("filterReset",function(){b.add(d).find(".dateFrom").val("").datepicker("setDate",a.from);b.add(d).find(".dateTo").val("").datepicker("setDate",a.to)});return l.val(a.from?a.to?a.from+" - "+a.to:">="+a.from:a.to?"<="+a.to:"")},html5Number:function(b,c,f){var a,e=h.extend({value:0,min:0,max:100,step:1,delayed:!0,disabled:!1,addToggle:!1,exactMatch:!1,cellText:"", compare:"",skipTest:!1},f),g;f=h('').appendTo(b);var k=e.skipTest||"number"===f.attr("type")&&"test"!==f.val(),d=[],l=b.closest("table")[0].config,m=function(a,c){var f=e.addToggle?b.find(".toggle").is(":checked"):!0,m=b.find(".number").val(),k=(h.isArray(e.compare)?b.find(".compare-select").val()||e.compare[e.selected||0]:e.compare)||"",p=l.$table[0].hasInitialized?a?a:e.delayed:!0;g.val(!e.addToggle||f?(k?k:e.exactMatch?"=":"")+m:"").trigger(c? "":"search",p).end().find(".number").val(m);b.find(".number").length&&(b.find(".number")[0].disabled=e.disabled||!f);d.length&&(d.find(".number").val(m)[0].disabled=e.disabled||!f,d.find(".compare-select").val(k),e.addToggle&&(d.find(".toggle")[0].checked=f))};f.remove();k&&(a=e.addToggle?'
':"",a+='',b.append(a+'').find(".toggle, .number").bind("change",function(){m()}).closest("thead").find("th[data-column="+c+"]").addClass("filter-parsed").closest("table").bind("filterReset",function(){h.isArray(e.compare)&&b.add(d).find(".compare-select").val(e.compare[e.selected||0]);e.addToggle&&(b.find(".toggle")[0].checked=!1,d.length&&(d.find(".toggle")[0].checked=!1));b.find(".number").val(e.value);setTimeout(function(){m()},0)}),g=b.find("input[type=hidden]").bind("change", function(){b.find(".number").val(this.value);m()}),l.$table.bind("filterFomatterUpdate",function(){var a=p.updateCompare(b,g,e)[0]||e.value;b.find(".number").val(((a||"")+"").replace(/[><=]/g,""));m(!1,!0)}),e.compare&&(p.addCompare(b,c,e),b.find(".compare-select").bind("change",function(){m()})),l.$table.bind("stickyHeadersInit",function(){d=l.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(c).empty();d.append(a).find(".toggle, .number").bind("change",function(){b.find(".number").val(h(this).val()); m()});e.compare&&(p.addCompare(d,c,e),d.find(".compare-select").bind("change",function(){b.find(".compare-select").val(h(this).val());m()}));m()}),m());return k?b.find('input[type="hidden"]'):h('')},html5Range:function(b,c,f){var a=h.extend({value:0,min:0,max:100,step:1,delayed:!0,valueToHeader:!0,exactMatch:!0,cellText:"",compare:"",allText:"all",skipTest:!1},f),e;f=h('').appendTo(b);var g=a.skipTest||"range"===f.attr("type")&& "test"!==f.val(),k=[],d=b.closest("table")[0].config,l=function(f,g,l){f=("undefined"===typeof f?e.val():f).toString().replace(/[<>=]/g,"")||a.value;var r=(h.isArray(a.compare)?b.find(".compare-select").val()||a.compare[a.selected||0]:a.compare)||"",p=" ("+(r?r+f:f==a.min?a.allText:f)+")";g=d.$table[0].hasInitialized?g?g:a.delayed:!0;b.find("input[type=hidden]").val(r?r+f:f==a.min?"":(a.exactMatch?"=":"")+f).trigger(l?"":"search",g).end().find(".range").val(f);b.closest("thead").find("th[data-column="+ c+"]").find(".curvalue").html(p);k.length&&(k.find(".range").val(f).end().find(".compare-select").val(r),k.closest("thead").find("th[data-column="+c+"]").find(".curvalue").html(p))};f.remove();g&&(b.html('').closest("thead").find("th[data-column="+c+"]").addClass("filter-parsed").find(".tablesorter-header-inner").append(''),e=b.find("input[type=hidden]").bind("change.tsfilter", function(){var c=this.value,d=(h.isArray(a.compare)?b.find(".compare-select").val()||a.compare[a.selected||0]:a.compare)||"";c!==this.lastValue&&(this.value=this.lastValue=d?d+c:c==a.min?"":(a.exactMatch?"=":"")+c,l(c))}),b.find(".range").bind("change",function(){l(this.value)}),d.$table.bind("filterFomatterUpdate",function(){var c=p.updateCompare(b,e,a)[0];b.find(".range").val(c);l(c,!1,!0)}),a.compare&&(p.addCompare(b,c,a),b.find(".compare-select").bind("change",function(){l()})),d.$table.bind("stickyHeadersInit", function(){k=d.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(c).empty();k.html('').find(".range").bind("change",function(){l(k.find(".range").val())});l();a.compare&&(p.addCompare(k,c,a),k.find(".compare-select").bind("change",function(){b.find(".compare-select").val(h(this).val());l()}))}),b.closest("table").bind("filterReset",function(){h.isArray(a.compare)&&b.add(k).find(".compare-select").val(a.compare[a.selected|| 0]);setTimeout(function(){l(a.value,!1,!0)},0)}),l());return g?b.find('input[type="hidden"]'):h('')},html5Color:function(b,c,f){var a,e=h.extend({value:"#000000",disabled:!1,addToggle:!0,exactMatch:!0,valueToHeader:!1,skipTest:!1},f),g;f=h('').appendTo(b);var k=e.skipTest||"color"===f.attr("type")&&"test"!==f.val(),d=[],l=b.closest("table")[0].config,m=function(a,f){a=("undefined"===typeof a?g.val():a).toString().replace("=", "")||e.value;var h=!0,k=" ("+a+")";e.addToggle&&(h=b.find(".toggle").is(":checked"));b.find(".colorpicker").length&&(b.find(".colorpicker").val(a)[0].disabled=e.disabled||!h);g.val(h?a+(e.exactMatch?"=":""):"").trigger(!l.$table[0].hasInitialized||f?"":"search");e.valueToHeader?b.closest("thead").find("th[data-column="+c+"]").find(".curcolor").html(k):b.find(".currentColor").html(k);d.length&&(d.find(".colorpicker").val(a)[0].disabled=e.disabled||!h,e.addToggle&&(d.find(".toggle")[0].checked=h),e.valueToHeader? d.closest("thead").find("th[data-column="+c+"]").find(".curcolor").html(k):d.find(".currentColor").html(k))};f.remove();k&&(a=""+c+Math.round(100*Math.random()),a='
'+(e.addToggle?'
':"")+''+(e.valueToHeader?"":'(#000000)')+"
",b.html(a),e.valueToHeader&& b.closest("thead").find("th[data-column="+c+"]").find(".tablesorter-header-inner").append(''),b.find(".toggle, .colorpicker").bind("change",function(){m(b.find(".colorpicker").val())}),g=b.find("input[type=hidden]").bind("change.tsfilter",function(){m(this.value)}),l.$table.bind("filterFomatterUpdate",function(){m(g.val(),!0)}),b.closest("table").bind("filterReset",function(){e.addToggle&&(b.find(".toggle")[0].checked=!1);setTimeout(function(){m()},0)}),l.$table.bind("stickyHeadersInit", function(){d=l.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(c);d.html(a).find(".toggle, .colorpicker").bind("change",function(){m(d.find(".colorpicker").val())});m(d.find(".colorpicker").val())}),m(e.value));return k?b.find('input[type="hidden"]'):h('')}}})(jQuery); diff --git a/js/jquery.tablesorter.widgets.js b/js/jquery.tablesorter.widgets.js index de74519b..99ce215c 100644 --- a/js/jquery.tablesorter.widgets.js +++ b/js/jquery.tablesorter.widgets.js @@ -1,4 +1,4 @@ -/*! tableSorter 2.8+ widgets - updated 12/16/2013 (v2.15.0) +/*! tableSorter 2.8+ widgets - updated 2/19/2014 (v2.15.0) * * Column Styles * Column Filters @@ -1177,7 +1177,6 @@ ts.addWidget({ $header = $thead.children('tr').not('.sticky-false').children(), innerHeader = '.' + ts.css.headerIn, $tfoot = $table.find('tfoot'), - filterInputs = '.' + ts.css.filter, $stickyOffset = isNaN(wo.stickyHeaders_offset) ? $(wo.stickyHeaders_offset) : '', stickyOffset = $attach.length ? 0 : $stickyOffset.length ? $stickyOffset.height() || 0 : parseInt(wo.stickyHeaders_offset, 10) || 0, diff --git a/js/jquery.tablesorter.widgets.min.js b/js/jquery.tablesorter.widgets.min.js index 6daaddf1..3e722e68 100644 --- a/js/jquery.tablesorter.widgets.min.js +++ b/js/jquery.tablesorter.widgets.min.js @@ -1,16 +1,17 @@ -/*! tableSorter 2.8+ widgets - updated 12/16/2013 (v2.14.5) */ +/*! tableSorter 2.8+ widgets - updated 2/19/2013 (v2.15.0) */ ;(function(k){ -var f=k.tablesorter=k.tablesorter||{}; -f.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",footerRow:"",footerCells:"",icons:"",sortNone:"bootstrap-icon-unsorted",sortAsc:"icon-chevron-up glyphicon glyphicon-chevron-up",sortDesc:"icon-chevron-down glyphicon glyphicon-chevron-down",active:"",hover:"",filterRow:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",caption:"ui-widget-content ui-corner-all",header:"ui-widget-header ui-corner-all ui-state-default", footerRow:"",footerCells:"",icons:"ui-icon",sortNone:"ui-icon-carat-2-n-s",sortAsc:"ui-icon-carat-1-n",sortDesc:"ui-icon-carat-1-s",active:"ui-state-active",hover:"ui-state-hover",filterRow:"",even:"ui-widget-content",odd:"ui-state-default"}}; -f.storage=function(b,a,c,e){b=k(b)[0];var d,g,f=!1;d={};g=b.config;var p=k(b);b=e&&e.id||p.attr(e&&e.group||"data-table-group")||b.id||k(".tablesorter").index(p);e=e&&e.url||p.attr(e&&e.page||"data-table-page")||g&&g.fixedUrl||window.location.pathname;if("localStorage"in window)try{window.localStorage.setItem("_tmptest","temp"),f=!0,window.localStorage.removeItem("_tmptest")}catch(q){}k.parseJSON&&(f?d=k.parseJSON(localStorage[a]||"{}"):(g=document.cookie.split(/[;\s|=]/),d=k.inArray(a,g)+1,d=0!==d?k.parseJSON(g[d]||"{}"):{}));if((c||""===c)&&window.JSON&&JSON.hasOwnProperty("stringify"))d[e]||(d[e]={}),d[e][b]=c,f?localStorage[a]=JSON.stringify(d):(c=new Date,c.setTime(c.getTime()+31536E6),document.cookie=a+"="+JSON.stringify(d).replace(/\"/g,'"')+"; expires="+c.toGMTString()+ "; path=/");else return d&&d[e]?d[e][b]:{}}; -f.addHeaderResizeEvent=function(b,a,c){var e;c=k.extend({},{timer:250},c);var d=b.config,g=d.widgetOptions,f=function(a){g.resize_flag=!0;e=[];d.$headers.each(function(){var a=k(this),b=a.data("savedSizes")||[0,0],c=this.offsetWidth,d=this.offsetHeight;if(c!==b[0]||d!==b[1])a.data("savedSizes",[c,d]),e.push(this)});e.length&&!1!==a&&d.$table.trigger("resize",[e]);g.resize_flag=!1};f(!1);clearInterval(g.resize_timer);if(a)return g.resize_flag=!1;g.resize_timer= setInterval(function(){g.resize_flag||f()},c.timer)}; -f.addWidget({id:"uitheme",priority:10,format:function(b,a,c){var e,d,g,h,p=f.themes,q=a.$table,m=a.$headers,l=a.theme||"jui",n=p[l]||p.jui,s=n.sortNone+" "+n.sortDesc+" "+n.sortAsc;a.debug&&(e=new Date);q.hasClass("tablesorter-"+l)&&a.theme!==l&&b.hasInitialized||(""!==n.even&&(c.zebra[0]+=" "+n.even),""!==n.odd&&(c.zebra[1]+=" "+n.odd),q.find("caption").addClass(n.caption),b=q.removeClass(""===a.theme?"":"tablesorter-"+a.theme).addClass("tablesorter-"+ l+" "+n.table).find("tfoot"),b.length&&b.find("tr").addClass(n.footerRow).children("th, td").addClass(n.footerCells),m.addClass(n.header).not(".sorter-false").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(a){k(this)["mouseenter"===a.type?"addClass":"removeClass"](n.hover)}),m.find(".tablesorter-wrapper").length||m.wrapInner('
'),a.cssIcon&&m.find("."+f.css.icon).addClass(n.icons),q.hasClass("hasFilters")&& m.find(".tablesorter-filter-row").addClass(n.filterRow));k.each(m,function(){g=k(this);h=f.css.icon?g.find("."+f.css.icon):g;this.sortDisabled?(g.removeClass(s),h.removeClass(s+" tablesorter-icon "+n.icons)):(d=g.hasClass(f.css.sortAsc)?n.sortAsc:g.hasClass(f.css.sortDesc)?n.sortDesc:g.hasClass(f.css.header)?n.sortNone:"",g[d===n.sortNone?"removeClass":"addClass"](n.active),h.removeClass(s).addClass(d))});a.debug&&f.benchmark("Applying "+l+" theme",e)},remove:function(b,a,c){b=a.$table;a=a.theme|| "jui";c=f.themes[a]||f.themes.jui;var e=b.children("thead").children(),d=c.sortNone+" "+c.sortDesc+" "+c.sortAsc;b.removeClass("tablesorter-"+a+" "+c.table).find(f.css.header).removeClass(c.header);e.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(c.hover+" "+d+" "+c.active).find(".tablesorter-filter-row").removeClass(c.filterRow);e.find(".tablesorter-icon").removeClass(c.icons)}}); -f.addWidget({id:"columns",priority:30,options:{columns:["primary","secondary","tertiary"]},format:function(b, a,c){var e,d,g,h,p,q,m,l,n=a.$table,s=a.$tbodies,r=a.sortList,v=r.length,w=c&&c.columns||["primary","secondary","tertiary"],x=w.length-1;m=w.join(" ");a.debug&&(e=new Date);for(g=0;g=]/g},types:{regex:function(b,a,c,e){if(f.filter.regex.regex.test(a)){var d;b=f.filter.regex.regex.exec(a);try{d=RegExp(b[1],b[2]).test(e)}catch(g){d=!1}return d}return null},exact:function(b,a,c,e){return f.filter.regex.exact.test(a)? a.replace(f.filter.regex.exact,"")==e:null},notMatch:function(b,a,c,e,d,g,f,p){return/^\!/.test(a)?(a=a.replace("!",""),b=e.search(k.trim(a)),""===a?!0:!(p.filter_startsWith?0===b:0<=b)):null},operators:function(b,a,c,e,d,g,h,k,q){if(/^[<>]=?/.test(a)){var m,l;m=h.config;b=f.formatFloat(a.replace(f.filter.regex.operators,""),h);c=m.parsers[g];k=b;if(q[g]||"numeric"===c.type)m=c.format(""+a.replace(f.filter.regex.operators,""),h,m.$headers.eq(g),g),b="number"!==typeof b||""===m||isNaN(m)?b:m;m=!q[g]&& "numeric"!==c.type||isNaN(b)||!d?isNaN(e)?f.formatFloat(e.replace(f.filter.regex.nondigit,""),h):f.formatFloat(e,h):d;/>/.test(a)&&(l=/>=/.test(a)?m>=b:m>b);/k&&(e=c,c=k,k=e); return a>=c&&a<=k||""===c||""===k}return null},wild:function(b,a,c,e,d,f,h){return/[\?|\*]/.test(a)||/\s+OR\s+/.test(b)?(b=h.config,a=a.replace(/\s+OR\s+/gi,"|"),!b.$headers.filter('[data-column="'+f+'"]:last').hasClass("filter-match")&&/\|/.test(a)&&(a="^("+a+")$"),RegExp(a.replace(/\?/g,"\\S{1}").replace(/\*/g,"\\S*")).test(e)):null},fuzzy:function(b,a,c,e){if(/^~/.test(a)){b=0;c=e.length;var d=a.slice(1);for(a=0;a'+(g.data("placeholder")||g.attr("data-placeholder")||"")+"":"",e+='");a.$table.find("thead").find('select.tablesorter-filter[data-column="'+h+'"]').append(e)}f.filter.buildDefault(b, !0);a.$table.find("select.tablesorter-filter").bind("change search",function(a,c){f.filter.checkFilters(b,c)});c.filter_hideFilters&&f.filter.hideFilters(b,a);a.showProcessing&&a.$table.bind("filterStart.tsfilter filterEnd.tsfilter",function(c,d){g=d?a.$table.find("."+f.css.header).filter("[data-column]").filter(function(){return""!==d[k(this).data("column")]}):"";f.isProcessing(b,"filterStart"===c.type,d?g:"")});a.debug&&f.benchmark("Applying Filter widget",q);a.$table.bind("tablesorter-initialized pagerInitialized", function(){p=f.filter.setDefaults(b,a,c)||[];p.length&&f.setFilters(b,p,!0);f.filter.checkFilters(b,p)});c.filter_Initialized=!0;a.$table.trigger("filterInit")},setDefaults:function(b,a,c){var e,d=[],g=a.columns;c.filter_saveFilters&&f.storage&&(d=f.storage(b,"tablesorter-filters")||[],(e=k.isArray(d))&&""===d.join("")||!e)&&(d=[]);if(!d.length)for(e=0;e';for(b=0;b";a.$filters=k(d+"").appendTo(a.$table.find("thead").eq(0)).find("td");for(b=0;b").appendTo(a.$filters.eq(b)):(c.filter_formatter&&k.isFunction(c.filter_formatter[b])?((d=c.filter_formatter[b](a.$filters.eq(b),b))&&0===d.length&&(d=a.$filters.eq(b).children("input")),d&&(0===d.parent().length||d.parent().length&&d.parent()[0]!==a.$filters[b])&&a.$filters.eq(b).append(d)):d=k('').appendTo(a.$filters.eq(b)),d&&d.attr("placeholder",e.data("placeholder")||e.attr("data-placeholder")||"")),d&&(d.addClass("tablesorter-filter "+c.filter_cssFilter).attr("data-column", b),g&&(d.addClass("disabled")[0].disabled=!0))},bindSearch:function(b,a){b=k(b)[0];var c,e=b.config.widgetOptions;a.unbind("keyup search filterReset").bind("keyup search",function(d,g){var h=k(this);if(27===d.which)this.value="";else if("number"===typeof e.filter_liveSearch&&this.value.lengthd.which&&8!==d.which&&!0===e.filter_liveSearch&&13!==d.which||37<=d.which&&40>=d.which||13!==d.which&&!1===e.filter_liveSearch))return;h.hasClass("tablesorter-filter")&& !h.hasClass("tablesorter-external-filter")?c=g:(c=[],a.each(function(){c[k(this).data("column")||0]=k(this).val()}));f.filter.searching(b,g,c)}).bind("filterReset",function(){a.val("")})},checkFilters:function(b,a){var c=b.config,e=c.widgetOptions,d=k.isArray(a),g=d?a:f.getFilters(b),h=(g||[]).join("");d&&f.setFilters(b,g);e.filter_hideFilters&&c.$table.find(".tablesorter-filter-row").trigger(""===h?"mouseleave":"mouseenter");if(c.lastCombinedFilter!==h||!1===a)if(!1===a&&(c.lastCombinedFilter=null), c.$table.trigger("filterStart",[g]),c.showProcessing)setTimeout(function(){f.filter.findRows(b,g,h);return!1},30);else return f.filter.findRows(b,g,h),!1},hideFilters:function(b,a){var c,e,d;a.$table.find(".tablesorter-filter-row").addClass("hideme").bind("mouseenter mouseleave",function(a){c=k(this);clearTimeout(d);d=setTimeout(function(){/enter|over/.test(a.type)?c.removeClass("hideme"):k(document.activeElement).closest("tr")[0]!==c[0]&&""===f.getFilters(b).join("")&&c.addClass("hideme")},200)}).find("input, select").bind("focus blur", function(a){e=k(this).closest("tr");clearTimeout(d);d=setTimeout(function(){if(""===f.getFilters(b).join(""))e["focus"===a.type?"removeClass":"addClass"]("hideme")},200)})},findRows:function(b,a,c){if(b.config.lastCombinedFilter!==c){var e,d,g,h,p,q,m,l,n,s,r,v,w,x,A,y,B,C,z,E,u=b.config,t=u.widgetOptions,G=u.columns,D=u.$tbodies,H=["range","notMatch","operators"],F=u.$headers.map(function(a){return f.getData?"parsed"===f.getData(u.$headers.filter('[data-column="'+a+'"]:last'),u.headers[a],"filter"): k(this).hasClass("filter-parsed")}).get();u.debug&&(E=new Date);for(p=0;pk.inArray(c,H))if(A=d(a[l],w,r,v,e,l,b,t,F),null!==A)return C=A,!1}),null!==C?y=C:(r=(v+s).indexOf(w),y=!t.filter_startsWith&&0<=r||t.filter_startsWith&&0===r));if(t.filter_anyMatch){if(z=y)break}else z=y?z:!1}g[h].style.display=z?"":"none";g.eq(h)[z?"removeClass":"addClass"](t.filter_filteredRow);if(n.length){if(u.pager&&u.pager.countChildRows||t.pager_countChildRows|| t.filter_childRows)n[z?"removeClass":"addClass"](t.filter_filteredRow);n.toggle(z)}}f.processTbody(b,q,!1)}u.lastCombinedFilter=c;u.lastSearch=a;u.$table.data("lastSearch",a);t.filter_saveFilters&&f.storage&&f.storage(b,"tablesorter-filters",a);u.debug&&f.benchmark("Completed filter widget search",E);u.$table.trigger("applyWidgets");u.$table.trigger("filterEnd")}},buildSelect:function(b,a,c,e){a=parseInt(a,10);var d,g,h;b=b.config;var p=b.widgetOptions,q=b.$tbodies,m=[],l=b.$headers.filter('[data-column="'+ a+'"]:last'),n='";for(g=0;g"+m[e]+"":"";b.$table.find("thead").find('select.tablesorter-filter[data-column="'+a+'"]')[c?"html":"append"](n)},buildDefault:function(b,a){var c,e,d=b.config,g=d.widgetOptions,h=d.columns;for(c=0;cb.top&&eMath.abs(q.parent().width()-q.width()),r=function(){f.storage&&l&&(p[l.index()]=l.width(),p[n.index()]= n.width(),l.width(p[l.index()]),n.width(p[n.index()]),!1!==c.resizable&&f.storage(b,"tablesorter-resizable",p));m=0;l=n=null;k(window).trigger("resize")};if(p=f.storage&&!1!==c.resizable?f.storage(b,"tablesorter-resizable"):{})for(h in p)!isNaN(h)&&h
');c.resizable_addLastColumn||(g=g.slice(0,-1));d=d?d.add(g):g});d.each(function(){var a=k(this),b=parseInt(a.css("padding-right"),10)+10;a.find(".tablesorter-wrapper").append('
')}).bind("mousemove.tsresize",function(a){if(0!==m&&l){var b=a.pageX-m,c=l.width();l.width(c+b);l.width()!==c&&s&&n.width(n.width()-b);m=a.pageX}}).bind("mouseup.tsresize",function(){r()}).find(".tablesorter-resizer,.tablesorter-resizer-grip").bind("mousedown",function(b){l=k(b.target).closest("th");var c=a.$headers.filter('[data-column="'+l.attr("data-column")+'"]');1
'),a.cssIcon&&n.find("."+c.css.icon).addClass(l.icons),q.hasClass("hasFilters")&&n.find("."+c.css.filterRow).addClass(l.filterRow));k.each(n,function(){f=k(this);h=c.css.icon?f.find("."+c.css.icon):f;this.sortDisabled?(f.removeClass(v),h.removeClass(v+" "+l.icons)):(e=f.hasClass(c.css.sortAsc)?l.sortAsc:f.hasClass(c.css.sortDesc)? l.sortDesc:f.hasClass(c.css.header)?l.sortNone:"",f[e===l.sortNone?"removeClass":"addClass"](l.active),h.removeClass(v).addClass(e))});a.debug&&c.benchmark("Applying "+p+" theme",g)},remove:function(b,a,d){b=a.$table;a=a.theme||"jui";d=c.themes[a]||c.themes.jui;var g=b.children("thead").children(),e=d.sortNone+" "+d.sortDesc+" "+d.sortAsc;b.removeClass("tablesorter-"+a+" "+d.table).find(c.css.header).removeClass(d.header);g.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(d.hover+" "+ e+" "+d.active).find("."+c.css.filterRow).removeClass(d.filterRow);g.find("."+c.css.icon).removeClass(d.icons)}}); +c.addWidget({id:"columns",priority:30,options:{columns:["primary","secondary","tertiary"]},format:function(b,a,d){var g,e,f,h,m,q,n,p,l=a.$table,v=a.$tbodies,s=a.sortList,u=s.length,w=d&&d.columns||["primary","secondary","tertiary"],x=w.length-1;n=w.join(" ");a.debug&&(g=new Date);for(f=0;f=]/g},types:{regex:function(b,a,d,g){if(c.filter.regex.regex.test(a)){var e; b=c.filter.regex.regex.exec(a);try{e=RegExp(b[1],b[2]).test(g)}catch(f){e=!1}return e}return null},operators:function(b,a,d,g,e,f,h,k,q){if(/^[<>]=?/.test(a)){var n,p;n=h.config;b=c.formatFloat(a.replace(c.filter.regex.operators,""),h);d=n.parsers[f];k=b;if(q[f]||"numeric"===d.type)n=d.format(""+a.replace(c.filter.regex.operators,""),h,n.$headers.eq(f),f),b="number"!==typeof b||""===n||isNaN(n)?b:n;n=!q[f]&&"numeric"!==d.type||isNaN(b)||!e?isNaN(g)?c.formatFloat(g.replace(c.filter.regex.nondigit, ""),h):c.formatFloat(g,h):e;/>/.test(a)&&(p=/>=/.test(a)?n>=b:n>b);/k&&(g=d,d=k,k=g);return a>=d&&a<=k||""===d||""===k}return null},wild:function(b,a,c,g,e,f,h,m,q,n){return/[\?|\*]/.test(a)||/\s+OR\s+/i.test(b)?(b=h.config,a=a.replace(/\s+OR\s+/gi,"|"),!b.$headers.filter('[data-column="'+f+'"]:last').hasClass("filter-match")&&/\|/.test(a)&&(a=k.isArray(n)?"("+a+")":"^("+a+")$"),RegExp(a.replace(/\?/g,"\\S{1}").replace(/\*/g, "\\S*")).test(g)):null},fuzzy:function(b,a,c,g){if(/^~/.test(a)){b=0;c=g.length;var e=a.slice(1);for(a=0;a'+(f.data("placeholder")||f.attr("data-placeholder")||"")+"":"",g+='");a.$table.find("thead").find("select."+c.css.filter+'[data-column="'+h+'"]').append(g)}c.filter.buildDefault(b,!0);a.$table.find("select."+c.css.filter).bind("change search",function(a,d){c.filter.checkFilters(b,d,!0)});d.filter_hideFilters&&c.filter.hideFilters(b,a); a.showProcessing&&a.$table.bind("filterStart.tsfilter filterEnd.tsfilter",function(d,e){f=e?a.$table.find("."+c.css.header).filter("[data-column]").filter(function(){return""!==e[k(this).data("column")]}):"";c.isProcessing(b,"filterStart"===d.type,e?f:"")});a.debug&&c.benchmark("Applying Filter widget",q);a.$table.bind("tablesorter-initialized pagerInitialized",function(){m=c.filter.setDefaults(b,a,d)||[];m.length&&c.setFilters(b,m,!0);a.$table.trigger("filterFomatterUpdate");c.filter.checkFilters(b, m)});d.filter_initialized=!0;a.$table.trigger("filterInit")},setDefaults:function(b,a,d){var g=c.getFilters(b);d.filter_saveFilters&&c.storage&&(d=c.storage(b,"tablesorter-filters")||[],(b=k.isArray(d))&&""===d.join("")||!b||(g=d));a.$table.data("lastSearch",g);return g},buildRow:function(b,a,d){var g,e,f,h=a.columns;e='';for(b=0;b";a.$filters=k(e+"").appendTo(a.$table.find("thead").eq(0)).find("td");for(b=0;b").appendTo(a.$filters.eq(b)):(d.filter_formatter&&k.isFunction(d.filter_formatter[b])?((e=d.filter_formatter[b](a.$filters.eq(b),b))&&0===e.length&&(e=a.$filters.eq(b).children("input")),e&& (0===e.parent().length||e.parent().length&&e.parent()[0]!==a.$filters[b])&&a.$filters.eq(b).append(e)):e=k('').appendTo(a.$filters.eq(b)),e&&e.attr("placeholder",g.data("placeholder")||g.attr("data-placeholder")||"")),e&&(g=(k.isArray(d.filter_cssFilter)?"undefined"!==typeof d.filter_cssFilter[b]?d.filter_cssFilter[b]||"":"":d.filter_cssFilter)||"",e.addClass(c.css.filter+" "+g).attr("data-column",b),f&&(e.addClass("disabled")[0].disabled=!0))},bindSearch:function(b,a,d){b=k(b)[0]; a=k(a);if(a.length){var g=b.config,e=g.widgetOptions,f=e.filter_$externalFilters;!0!==d&&(e.filter_$anyMatch=a.filter('[data-column="all"]'),e.filter_$externalFilters=f&&f.length?e.filter_$externalFilters.add(a):a,c.setFilters(b,g.$table.data("lastSearch")||[],!1===d));a.data("lastSearchTime",(new Date).getTime()).unbind("keyup search change").bind("keyup search change",function(a,d){k(this).data("lastSearchTime",(new Date).getTime());if(27===a.which)this.value="";else if("number"===typeof e.filter_liveSearch&& this.value.lengtha.which&&8!==a.which&&!0===e.filter_liveSearch&&13!==a.which||37<=a.which&&40>=a.which||13!==a.which&&!1===e.filter_liveSearch))return;c.filter.searching(b,d||c.getFilters(b,!0),!0)});g.$table.bind("filterReset",function(){a.val("")})}},checkFilters:function(b,a,d){var g=b.config,e=g.widgetOptions,f=k.isArray(a),h=f?a:c.getFilters(b),m=(h||[]).join("");f&&c.setFilters(b,h,!1,!0!==d);e.filter_hideFilters&&g.$table.find("."+ c.css.filterRow).trigger(""===m?"mouseleave":"mouseenter");if(g.lastCombinedFilter!==m||!1===a)if(!1===a&&(g.lastCombinedFilter=null),g.$table.trigger("filterStart",[h]),g.showProcessing)setTimeout(function(){c.filter.findRows(b,h,m);return!1},30);else return c.filter.findRows(b,h,m),!1},hideFilters:function(b,a){var d,g,e;a.$table.find("."+c.css.filterRow).addClass("hideme").bind("mouseenter mouseleave",function(a){d=k(this);clearTimeout(e);e=setTimeout(function(){/enter|over/.test(a.type)?d.removeClass("hideme"): k(document.activeElement).closest("tr")[0]!==d[0]&&""===c.getFilters(b).join("")&&d.addClass("hideme")},200)}).find("input, select").bind("focus blur",function(a){g=k(this).closest("tr");clearTimeout(e);e=setTimeout(function(){if(""===c.getFilters(b).join(""))g["focus"===a.type?"removeClass":"addClass"]("hideme")},200)})},findRows:function(b,a,d){if(b.config.lastCombinedFilter!==d){var g,e,f,h,m,q,n,p,l,v,s,u,w,x,B,z,y,D,C,A,L,E,G,H,I,J,M,r=b.config,t=r.widgetOptions,N=r.columns,K=r.$tbodies,O=["range", "notMatch","operators"],F=r.$headers.map(function(a){return r.parsers[a].parsed||(c.getData?"parsed"===c.getData(r.$headers.filter('[data-column="'+a+'"]:last'),r.headers[a],"filter"):k(this).hasClass("filter-parsed"))}).get();r.debug&&(L=new Date);for(q=0;qk.inArray(a,O)&&(z=c(E,G,I,J,M,N,b,t,F,H),null!==z))return C=z, !1}),A=null!==C?C:0<=(J+s).indexOf(G));for(l=0;l'+(p.data("placeholder")||p.attr("data-placeholder")||"")+"";for(f=0;f"+n[g]+"":"";b.$table.find("thead").find("select."+c.css.filter+'[data-column="'+a+'"]')[d?"html":"append"](l)},buildDefault:function(b,a){var d,g,e=b.config, f=e.widgetOptions,h=e.columns;for(d=0;db.top&&cMath.abs(q.parent().width()-q.width()),s=function(){c.storage&&p&&l&&(m={},m[p.index()]=p.width(),m[l.index()]=l.width(),p.width(m[p.index()]),l.width(m[l.index()]),!1!==d.resizable&&c.storage(b,"tablesorter-resizable",m));n=0;p=l=null; k(window).trigger("resize")};if(m=c.storage&&!1!==d.resizable?c.storage(b,"tablesorter-resizable"):{})for(h in m)!isNaN(h)&&h
');d.resizable_addLastColumn||(f=f.slice(0,-1));e=e?e.add(f):f});e.each(function(){var a=k(this),b=parseInt(a.css("padding-right"),10)+10;a.find("."+c.css.wrapper).append('
')}).bind("mousemove.tsresize",function(a){if(0!==n&&p){var b=a.pageX-n,c= p.width();p.width(c+b);p.width()!==c&&v&&l.width(l.width()-b);n=a.pageX}}).bind("mouseup.tsresize",function(){s()}).find("."+c.css.resizer+",."+c.css.grip).bind("mousedown",function(b){p=k(b.target).closest("th");var c=a.$headers.filter('[data-column="'+p.attr("data-column")+'"]');1