From 41f4c6c9638818fc7e6d8b6d7572a93ed4062b4b Mon Sep 17 00:00:00 2001 From: Mottie Date: Sun, 17 Feb 2013 13:29:02 -0600 Subject: [PATCH] use addBack() if supported - fixes #229 --- README.md | 162 +++++++------------ addons/pager/jquery.tablesorter.pager.js | 2 +- addons/pager/jquery.tablesorter.pager.min.js | 4 +- component.json | 2 +- js/jquery.tablesorter.js | 8 +- js/jquery.tablesorter.min.js | 4 +- js/jquery.tablesorter.widgets.js | 4 +- js/jquery.tablesorter.widgets.min.js | 18 +-- package.json | 17 +- tablesorter.jquery.json | 17 +- test.html | 7 +- 11 files changed, 101 insertions(+), 144 deletions(-) diff --git a/README.md b/README.md index f0493dc5..241d2d02 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,67 @@ tablesorter can successfully parse and sort many types of data including linked * Original examples and docs at: [http://tablesorter.com](http://tablesorter.com). * Dual licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) and [GPL](http://www.gnu.org/licenses/gpl.html) licenses. +### Special Thanks + +* Big shout-out to [Nick Craver](https://github.com/NickCraver) for getting rid of the `eval()` function that was previously needed for multi-column sorting. +* Also big thanks to [thezoggy](https://github.com/thezoggy) for helping with code, themes and valuable feedback. +* And, thanks to everyone that has contributed, and continue to contribute to this forked project! + ### Change Log View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Change). +#### Version 2.7.7 (2/17/2013) + +* Updated the currency parser to ignore formatting (commas, decimals and spaces) when detecting the column parser. +* Updated the natural sort regex to better work with scientific notation and alphanumerics with the number first - see [this issue](https://github.com/overset/javascript-natural-sort/issues/8). +* Reverted code to only add a colgroup if the [`widthFixed`](http://mottie.github.com/tablesorter/docs/#widthfixed) option is `true` and no colgroup exists. Fixes issues [#238](https://github.com/Mottie/tablesorter/issues/238) and [#239](https://github.com/Mottie/tablesorter/issues/239). +* Added a tablesorter namespace to all bound events. Fixes [issue #233](https://github.com/Mottie/tablesorter/issues/233). +* Added a [`filterReset`](http://mottie.github.com/tablesorter/docs/#filterreset) method which is the same code executed when the [`filter_reset`](http://mottie.github.com/tablesorter/docs/#widget-filter-reset) element is clicked. +* Added a `pageSet` method to the pager which allows you to easily change the pager page (see [issue #231](https://github.com/Mottie/tablesorter/issues/231)): + + ```javascript + // go to page 3 + $('table').trigger('pageSet', 3); + ``` + +* Added a range filter to the filter widget. + * You can now search for a range of values using either of these formats: `10 - 20` or `10 to 20`. Note the space before and after the dash so as to differentiate it from a negative sign. + * You can also use symbols within the range `10% - 20%` or `$10 - $20`. + * Thanks to [matzhu](https://github.com/matzhu) and [satacoy](https://github.com/satacoy) for code ideas in [issue #166](https://github.com/Mottie/tablesorter/issues/166#issuecomment-10167129). +* Added logical AND and OR operators to the filters to the filter widget. + * Entering `box && bat` (or `box AND bat`) will only show rows that contain `box` and `bat` within the same column below the filter. It does not search other columns. The spaces between the operators and the queries are important. + * Entering `box|bat` (or `box OR bat`) will only show rows that contain either `box` or `bat` within the same column below the filter. It does not search other columns. The spaces between the operators and the queries are important. + * At this time you cannot combine different operators. So, `>= 100 AND <= 200` will not work, use the range filter operator (`100 - 200`) instead. + * Using the `|` (or operator) was previously undocumented, but useable. + * This was also requested in [issue #166](https://github.com/Mottie/tablesorter/issues/166). +* Added a new filter widget option named [`filter_formatter`](http://mottie.github.com/tablesorter/docs/#widget-filter-formatter): + * This option allows you to add custom selectors into the filter row. + * Because of the amount of coding, new files named "jquery.tablesorter.widgets-filter-formatter.js" and "filter.formatter.css" were added. They include code to add jQuery UI and HTML5 controls via the filter_formatter option. + * Filter formatter functions include: "uiSpinner", "uiSlider", "uiRange" (uiSlider ranged), "uiDatepicker" (range only), "html5Number", "html5Range" and "html5Color". + * As an example, this code will add the jQuery UI spinner to the first column: + + ```javascript + filter_formatter : { + 0 : function($cell, indx){ + return $.tablesorter.filterFormatter.uiSpinner( $cell, indx, { + value : 0, // starting value + min : 0, // minimum value + max : 50, // maximum value + step : 1, // increment value by + addToggle: true, // enable or disable the control + exactMatch: true, + numberFormat: "n" + }); + } + } + ``` + + * You can also choose to add the current selector value into a css3 tooltip or into the header by setting the `valueToHeader` option, if available. + * Fulfills [ErinsMatthew](https://github.com/ErinsMatthew)'s feature request - [issue #232](https://github.com/Mottie/tablesorter/issues/232). Thanks for the great idea! +* NOTE: I know the js folder is getting messy. In version 3, I plan on having a separate folder for widgets and parsers. And with the build system, you'll be able to pick and choose which components you need. + + #### Version 2.7.6 (2/6/2013) * Merged in an update from [Somebi](https://github.com/Somebi) to fix a javascript error which occurs when the table doesn't have a thead or tbody, or it is already initialized. @@ -70,108 +127,3 @@ View the [complete listing here](https://github.com/Mottie/tablesorter/wiki/Chan #### Version 2.7.3 (1/10/2013) * Fixed a serious bug in the filter widget that was breaking the widget completely if `filter_functions` was not defined (introduced in v2.7.2). Fixes [issue #213](https://github.com/Mottie/tablesorter/issues/213). - -#### Version 2.7.2 (1/8/2013) - -* Updated filter widget to update the filter-select when an update event is triggered. See [this StackOverflow question](http://stackoverflow.com/q/14223044/145346). -* Replaced `background-image: url();` with `background-image: none;` in all applicable theme files. - -#### Version 2.7.1b (1/7/2013) - -* Updated bootstrap demo - * It now properly removes the "table-striped" class when the zebra widget is enabled. - * The demo now uses the [`refreshWidgets` method](http://mottie.github.com/tablesorter/docs/index.html#refreshwidgets) (added in v2.4) to completely remove the zebra widget. - * Thanks to [potsky](https://github.com/Mottie/tablesorter/issues/111#issuecomment-11951369) for notifying me of this problem! - -#### Version 2.7.1 (1/4/2013) - -* Added two internal parameters to always make sure we're targeting the correct elements. - * Added `table.config.$table` which is a jQuery object of the table. - * Added `table.config.$tbodies` which is a jQuery object of sortable tbodies; the ones without the class name in the `cssInfoBlock` option. -* Fixed removal methods: - * Tablesorter destroy will now properly restore the header and remove all bindings. - * Widgets should now again be removed properly. - * Updated the storage utility to allow setting a property to an empty string, previously it was just ignored. -* Fixed pager issues: - * Pager status will now update properly while filtering rows. - * Pager status will also update properly after sorting filtered rows. - * The above issues were fixes for [issue #207](https://github.com/Mottie/tablesorter/issues/207). - * Fixed the pager's `fixedHeight` option to again properly pad the table to maintain the height. - -#### Version 2.7 (12/26/2012) - -* Added `headerTemplate` option: - * `headerTemplate` is a template string which allows adding additional content to the header while it is being built. - * This template string has two default tags: `{content}` and `{icon}`. - * `{content}` will be replaced by the current header HTML content. - * `{icon}` will be replaced by ``, but only if a class name is defined in the `cssIcon` option. - * Everything within this template string will be wrapped in a div with class `tablesorter-header-inner`. - * The default template is `{content}`. - * The following themes DO NEED the icon (`{icon}`) included in the template: Bootstrap, jQuery UI, Grey and Dropbox. -* Added `onRenderTemplate` option: - * This is a function that is called after the template string has been built, but before the template string is applied to the header and before the onRenderHeader function is called. - * The onRenderTemplate function receives a column index and template string parameters. The template string, from the headerTemplate option, will already have the {icon} and {content} tags replaced; it's just a string of formatted HTML. When done manipulating this string, return it. - * Check out the [demo here](http://mottie.github.com/tablesorter/docs/example-option-render-template.html). -* Updated `uitheme` widget - * The `uitheme` setting is no longer required, use the `theme` option instead. - * When using the `bootstrap` or `jui` theme, just add the name to the `theme` option: e.g. `theme: "bootstrap"`. - * The `uitheme` widget option will still work, but if the theme name exists within `$.tablesorter.themes` it will override the `uitheme` option. - * Look at the [theme demo](http://mottie.github.com/tablesorter/docs/themes.html) source for a better example. -* Fixed `sortReset` bug - see [issue #167](https://github.com/Mottie/tablesorter/issues/167). -* Fixed an issue with the pager resetting to the first page after every sort. -* Fixed javascript errors popping up when initializing the plugin on an empty table. Fixes [issue #206](https://github.com/Mottie/tablesorter/issues/206). -* - -#### Version 2.6.2 (12/20/2012) - -* Fixed sort breaking when `tfoot` contained a table. Fixes problem mentioned in [issue #196](https://github.com/Mottie/tablesorter/issues/196). -* Fixed javascript error due to using `hasOwnProperty` inside of the formatFloat function in IE8. Fixes [issue #200](https://github.com/Mottie/tablesorter/issues/200). -* Fixed the reformatted minified widget file. Fixes [issue #201](https://github.com/Mottie/tablesorter/issues/201). -* Fixed pager ajax. It no longer load the initial page twice. Fixes [issue #202](https://github.com/Mottie/tablesorter/issues/202). - -#### Version 2.6.1 (12/19/2012) - -* Updated the pager - * Added an event named `pagerBeforeInitialized` which is triggered after all of the controls have been set up, but before rendering of the table or ajax data is obtained. - * Cleaned up pager code. -* Modifed the `formatFloat` function - * Previously you had to call the formatFloat function with a table so it could get the number format configuration - - ```javascript - $.tablesorter.formatFloat('1,234,567.89', table); // result if usNumberFormat true = 1234567.89 - ``` - - * Now you can either pass the table or a boolean to indicate the format: - - ```javascript - var usNumberFormat = true; - $.tablesorter.formatFloat('1,234', usNumberFormat); // result = 1234 - $.tablesorter.formatFloat('1,234', false); // non-U.S. format result = 1.234 - ``` - -* Fixed pager size result incorrect with nested tables. Fixes [issue #196](https://github.com/Mottie/tablesorter/issues/196). -* Fixed parser javascript error when clearing tr's from table. Fixes [issue #199](https://github.com/Mottie/tablesorter/issues/199). -* Fixed themes so that the `sorter-false` class now restores the header padding. Mentioned in [issue #](188). - -#### Version 2.6 (12/18/2012) - -* Added `sortResetKey`: - * By default, holding down the ctrl key while clicking on a header cell will reset that column's sort. - * When sorting multiple columns, holding shift+ctrl will maintain the previous sorts and reset the selected column. - * Thanks to [emmerich](https://github.com/emmerich) for sharing [this code](https://github.com/Mottie/tablesorter/pull/194)! -* Added basic unit testing: - * JSHint checks of core, widgets and pager addon. - * Checks of various public functions, parsers and methods. - * This is a work-in-progress, so many more tests still need to be added. - * See the [basic test results here](http://mottie.github.com/tablesorter/test.html). -* Sorting arrows no longer show when a header column is disabled. Fixes [issue #188](https://github.com/Mottie/tablesorter/issues/188). -* Improved pager AJAX support: - * Added `serverSideSorting` option (default is `false`) to the plugin core which when `true` will disable client-side sorting. - * Added `filter_serversideFiltering` filter widget option (default is `false`) which when `true` will disable client-side filter widget processing. - * Added a `filterList` (`{filterList:fcol}`) ajax parameter to the pager's `ajaxUrl` option. - * Added `cssErrorRow` option to the pager options, allowing you to style the ajax error row which only appears with ajax errors. - * This update also fixes an issue with page size changing. See [issue #198](https://github.com/Mottie/tablesorter/issues/198). - * Thanks to [dhamma](https://github.com/dhamma) for [this enhancement](https://github.com/Mottie/tablesorter/pull/183)! -* Added `footerRow` and `footerCells` to the tablesorter themes (`$.tablesorter.themes`): - * This allows styling of the footer in the bootstrap and jQuery UI themes. - * Used by the `uitheme` widget. diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 1ffd65d4..fb0e4659 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -1,6 +1,6 @@ /*! * tablesorter pager plugin - * updated 1/29/2013 + * updated 2/17/2013 */ /*jshint browser:true, jquery:true, unused:false */ ;(function($) { diff --git a/addons/pager/jquery.tablesorter.pager.min.js b/addons/pager/jquery.tablesorter.pager.min.js index d87e8190..3cfb0730 100644 --- a/addons/pager/jquery.tablesorter.pager.min.js +++ b/addons/pager/jquery.tablesorter.pager.min.js @@ -1,2 +1,2 @@ -/*! tablesorter pager plugin minified - updated 1/29/2013 */ -;(function(d){d.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,fixedHeight:!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}; var p=this,s=function(b,a){var c=b.cssDisabled,g=!!a,h=Math.min(b.totalPages,b.filteredPages);b.updateArrows&&(d(b.cssFirst+","+b.cssPrev,b.container)[g||0===b.page?"addClass":"removeClass"](c),d(b.cssNext+","+b.cssLast,b.container)[g||b.page===h-1?"addClass":"removeClass"](c))},t=function(b,a){var c,g,h;c=d(b).hasClass("hasFilters")&&!a.ajaxUrl;a.filteredRows=c?b.config.$tbodies.children("tr:not(.filtered,.remove-me)").length:a.totalRows;a.filteredPages=c?Math.ceil(a.filteredRows/a.size):a.totalPages; if(0a.filteredRows,a.startRow=h?1:a.size*a.page+1,a.page=h?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),g=d(a.cssPageDisplay,a.container),c=a.output.replace(/\{(page|filteredRows|filteredPages|totalPages|startRow|endRow|totalRows)\}/gi,function(b){return{"{page}":a.page+1,"{filteredRows}":a.filteredRows,"{filteredPages}":a.filteredPages,"{totalPages}":a.totalPages,"{startRow}":a.startRow,"{endRow}":a.endRow,"{totalRows}":a.totalRows}[b]}), g[0]&&(g["INPUT"===g[0].tagName?"val":"html"](c),d(a.cssGoto,a.container).length))){h="";g=Math.min(a.totalPages,a.filteredPages);for(c=1;c<=g;c++)h+="";d(a.cssGoto,a.container).html(h).val(a.page+1)}s(a);a.initialized&&d(b).trigger("pagerComplete",a)},u=function(b,a){var c,g=d(b.tBodies[0]);if(a.fixedHeight&&(g.find("tr.pagerSavedHeightSpacer").remove(),c=d.data(b,"pagerSavedHeight")))c-=g.height(),5')},w=function(b,a){var c=d(b.tBodies[0]);c.find("tr.pagerSavedHeightSpacer").remove();d.data(b,"pagerSavedHeight",c.height());u(b,a);d.data(b,"pagerLastSize",a.size)},n=function(b,a){if(!a.ajaxUrl){var c,g=d(b.tBodies).children("tr:not(."+b.config.cssChildRow+")"),h=g.length,e=a.page*a.size,f=e+a.size,k=0;for(c=0;c=e&&k'+(g?g.message+" ("+g.name+")":"No rows found")+"",n=c.ajaxProcessing(b)||[0,[]],p=n[1]||[],s=p.length,r=n[2];if(0";for(h=0;h"+p[b][h]+"";q+=""}r&&r.length===y&&(e=j.hasClass("hasStickyHeaders"),k=j.find("."+(l.widgetOptions&&l.widgetOptions.stickyHeaders||"tablesorter-stickyheader")),f=j.find("tfoot tr:first").children(),j.find("th."+l.cssHeader).each(function(a){var b=d(this),c;b.find("."+l.cssIcon).length?(c=b.find("."+ l.cssIcon).clone(!0),b.find(".tablesorter-header-inner").html(r[a]).append(c),e&&k.length&&(c=k.find("th").eq(a).find("."+l.cssIcon).clone(!0),k.find("th").eq(a).find(".tablesorter-header-inner").html(r[a]).append(c))):(b.find(".tablesorter-header-inner").html(r[a]),k.find("th").eq(a).find(".tablesorter-header-inner").html(r[a]));f.eq(a).html(r[a])}));j.find("thead tr."+c.cssErrorRow).remove();g?j.find("thead").append(m):d(a.tBodies[0]).html(q);l.showProcessing&&d.tablesorter.isProcessing(a);j.trigger("update"); c.totalRows=n[0]||0;c.totalPages=Math.ceil(c.totalRows/c.size);t(a,c);u(a,c);c.initialized&&j.trigger("pagerChange",c)}c.initialized||(c.initialized=!0,d(a).trigger("pagerInitialized",c))},v=function(b,a,c){c.isDisabled=!1;var g,h,e,f=document.createDocumentFragment(),k=a.length;g=c.page*c.size;var j=g+c.size;if(!(1>k)){c.initialized&&d(b).trigger("pagerChange",c);if(c.removeRows){j>a.length&&(j=a.length);d(b.tBodies[0]).addClass("tablesorter-hidden");for(d.tablesorter.clearTableBody(b);g=c.totalPages&&A(b,c);t(b,c);c.isDisabled||u(b,c);d(b).trigger("applyWidgets")}},B=function(b,a){a.ajax?s(a,!0):(a.isDisabled=!0,d.data(b,"pagerLastPage",a.page),d.data(b,"pagerLastSize",a.size),a.page=0,a.size=a.totalRows,a.totalPages=1,d("tr.pagerSavedHeightSpacer",b.tBodies[0]).remove(),v(b,b.config.rowsCopy,a));d(a.container).find(a.cssPageSize+","+ a.cssGoto).each(function(){d(this).addClass(a.cssDisabled)[0].disabled=!0})},m=function(b,a){if(!a.isDisabled){var c=Math.min(a.totalPages,a.filteredPages);if(0>a.page||a.page>c-1)a.page=0;if(a.ajax){var g,c=a.ajaxUrl?a.ajaxUrl.replace(/\{page\}/g,a.page).replace(/\{size\}/g,a.size):"",h=b.config.sortList,e=a.currentFilters||[],f=c.match(/\{sortList[\s+]?:[\s+]?([^}]*)\}/),k=c.match(/\{filterList[\s+]?:[\s+]?([^}]*)\}/),j=[];f&&(f=f[1],d.each(h,function(a,b){j.push(f+"["+b[0]+"]="+b[1])}),c=c.replace(/\{sortList[\s+]?:[\s+]?([^\}]*)\}/g, j.length?j.join("&"):f));k&&(k=k[1],d.each(e,function(a,b){b&&j.push(k+"["+a+"]="+encodeURIComponent(b))}),c=c.replace(/\{filterList[\s+]?:[\s+]?([^\}]*)\}/g,j.length?j.join("&"):k));g=c;c=b.config;""!==g&&(c.showProcessing&&d.tablesorter.isProcessing(b,!0),d(document).bind("ajaxError.pager",function(c,e,f,h){f.url===g&&(z(null,b,a,h),d(document).unbind("ajaxError.pager"))}),d.getJSON(g,function(c){z(c,b,a);d(document).unbind("ajaxError.pager")}))}else a.ajax||v(b,b.config.rowsCopy,a);d.data(b,"pagerLastPage", a.page);d.data(b,"pagerUpdateTriggered",!0);a.initialized&&d(b).trigger("pageMoved",a)}},C=function(b,a,c){c.size=a;d.data(b,"pagerLastPage",c.page);d.data(b,"pagerLastSize",c.size);c.totalPages=Math.ceil(c.totalRows/c.size);m(b,c)},E=function(b,a){a.page=0;m(b,a)},A=function(b,a){a.page=Math.min(a.totalPages,a.filteredPages)-1;m(b,a)},F=function(b,a){a.page++;a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)-1);m(b,a)},G=function(b,a){a.page--;0>=a.page&& (a.page=0);m(b,a)},D=function(b,a,c){var g=d(a.cssPageSize,a.container).removeClass(a.cssDisabled).removeAttr("disabled");d(a.container).find(a.cssGoto).removeClass(a.cssDisabled).removeAttr("disabled");a.isDisabled=!1;a.page=d.data(b,"pagerLastPage")||a.page||0;a.size=d.data(b,"pagerLastSize")||parseInt(g.find("option[selected]").val(),10)||a.size;g.val(a.size);a.totalPages=Math.ceil(Math.min(a.totalPages,a.filteredPages)/a.size);c&&(d(b).trigger("update"),C(b,a.size,a),x(b,a),u(b,a))};p.appender= function(b,a){var c=b.config.pager;c.ajax||(b.config.rowsCopy=a,c.totalRows=a.length,c.size=d.data(b,"pagerLastSize")||c.size,c.totalPages=Math.ceil(c.totalRows/c.size),v(b,a,c))};p.construct=function(b){return this.each(function(){if(this.config&&this.hasInitialized){var a,c,g,h=this.config,e=h.pager=d.extend({},d.tablesorterPager.defaults,b),f=this,k=f.config,j=d(f),l=d(e.container).addClass("tablesorter-pager").show();h.appender=p.appender;j.unbind("filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager pageSize.pager").bind("filterStart.pager", function(a,b){d.data(f,"pagerUpdateTriggered",!1);e.currentFilters=b}).bind("filterEnd.pager sortEnd.pager",function(a){d.data(f,"pagerUpdateTriggered")?d.data(f,"pagerUpdateTriggered",!1):("filterEnd"===a.type&&(e.page=0),t(f,e),m(f,e),u(f,e))}).bind("disable.pager",function(){B(f,e)}).bind("enable.pager",function(){D(f,e,!0)}).bind("destroy.pager",function(){B(f,e);d(e.container).hide();f.config.appender=null;d(f).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager")}).bind("update.pager", function(){n(f,e)}).bind("pageSize.pager",function(a,b){e.size=parseInt(b,10)||10;n(f,e);t(f,e)});c=[e.cssFirst,e.cssPrev,e.cssNext,e.cssLast];g=[E,G,F,A];l.find(c.join(",")).unbind("click.pager").bind("click.pager",function(){var a,b=d(this),h=c.length;if(!b.hasClass(e.cssDisabled))for(a=0;aa.filteredRows,a.startRow=h?1:a.size*a.page+1,a.page=h?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),g=d(a.cssPageDisplay,a.container),c=a.output.replace(/\{(page|filteredRows|filteredPages|totalPages|startRow|endRow|totalRows)\}/gi,function(b){return{"{page}":a.page+1,"{filteredRows}":a.filteredRows,"{filteredPages}":a.filteredPages,"{totalPages}":a.totalPages,"{startRow}":a.startRow,"{endRow}":a.endRow,"{totalRows}":a.totalRows}[b]}), g[0]&&(g["INPUT"===g[0].tagName?"val":"html"](c),d(a.cssGoto,a.container).length))){h="";g=Math.min(a.totalPages,a.filteredPages);for(c=1;c<=g;c++)h+="";d(a.cssGoto,a.container).html(h).val(a.page+1)}s(a);a.initialized&&d(b).trigger("pagerComplete",a)},u=function(b,a){var c,g=d(b.tBodies[0]);if(a.fixedHeight&&(g.find("tr.pagerSavedHeightSpacer").remove(),c=d.data(b,"pagerSavedHeight")))c-=g.height(),5')},w=function(b,a){var c=d(b.tBodies[0]);c.find("tr.pagerSavedHeightSpacer").remove();d.data(b,"pagerSavedHeight",c.height());u(b,a);d.data(b,"pagerLastSize",a.size)},n=function(b,a){if(!a.ajaxUrl){var c,g=d(b.tBodies).children("tr:not(."+b.config.cssChildRow+")"),h=g.length,e=a.page*a.size,f=e+a.size,k=0;for(c=0;c=e&&k'+(g?g.message+" ("+g.name+")":"No rows found")+"",n=c.ajaxProcessing(b)||[0,[]],p=n[1]||[],s=p.length,r=n[2];if(0";for(h=0;h"+p[b][h]+"";q+=""}r&&r.length===y&&(e=j.hasClass("hasStickyHeaders"),k=j.find("."+(l.widgetOptions&&l.widgetOptions.stickyHeaders||"tablesorter-stickyheader")),f=j.find("tfoot tr:first").children(),j.find("th."+l.cssHeader).each(function(a){var b=d(this),c;b.find("."+l.cssIcon).length?(c=b.find("."+ l.cssIcon).clone(!0),b.find(".tablesorter-header-inner").html(r[a]).append(c),e&&k.length&&(c=k.find("th").eq(a).find("."+l.cssIcon).clone(!0),k.find("th").eq(a).find(".tablesorter-header-inner").html(r[a]).append(c))):(b.find(".tablesorter-header-inner").html(r[a]),k.find("th").eq(a).find(".tablesorter-header-inner").html(r[a]));f.eq(a).html(r[a])}));j.find("thead tr."+c.cssErrorRow).remove();g?j.find("thead").append(m):d(a.tBodies[0]).html(q);l.showProcessing&&d.tablesorter.isProcessing(a);j.trigger("update"); c.totalRows=n[0]||0;c.totalPages=Math.ceil(c.totalRows/c.size);t(a,c);u(a,c);c.initialized&&j.trigger("pagerChange",c)}c.initialized||(c.initialized=!0,d(a).trigger("pagerInitialized",c))},v=function(b,a,c){c.isDisabled=!1;var g,h,e,f=document.createDocumentFragment(),k=a.length;g=c.page*c.size;var j=g+c.size;if(!(1>k)){c.initialized&&d(b).trigger("pagerChange",c);if(c.removeRows){j>a.length&&(j=a.length);d(b.tBodies[0]).addClass("tablesorter-hidden");for(d.tablesorter.clearTableBody(b);g=c.totalPages&&A(b,c);t(b,c);c.isDisabled||u(b,c);d(b).trigger("applyWidgets")}},B=function(b,a){a.ajax?s(a,!0):(a.isDisabled=!0,d.data(b,"pagerLastPage",a.page),d.data(b,"pagerLastSize",a.size),a.page=0,a.size=a.totalRows,a.totalPages=1,d("tr.pagerSavedHeightSpacer",b.tBodies[0]).remove(),v(b,b.config.rowsCopy,a));d(a.container).find(a.cssPageSize+","+ a.cssGoto).each(function(){d(this).addClass(a.cssDisabled)[0].disabled=!0})},m=function(b,a){if(!a.isDisabled){var c=Math.min(a.totalPages,a.filteredPages);0>a.page&&(a.page=0);a.page>c-1&&(a.page=c-1);if(a.ajax){var g,c=a.ajaxUrl?a.ajaxUrl.replace(/\{page\}/g,a.page).replace(/\{size\}/g,a.size):"",h=b.config.sortList,e=a.currentFilters||[],f=c.match(/\{sortList[\s+]?:[\s+]?([^}]*)\}/),k=c.match(/\{filterList[\s+]?:[\s+]?([^}]*)\}/),j=[];f&&(f=f[1],d.each(h,function(a,b){j.push(f+"["+b[0]+"]="+b[1])}), c=c.replace(/\{sortList[\s+]?:[\s+]?([^\}]*)\}/g,j.length?j.join("&"):f));k&&(k=k[1],d.each(e,function(a,b){b&&j.push(k+"["+a+"]="+encodeURIComponent(b))}),c=c.replace(/\{filterList[\s+]?:[\s+]?([^\}]*)\}/g,j.length?j.join("&"):k));g=c;c=b.config;""!==g&&(c.showProcessing&&d.tablesorter.isProcessing(b,!0),d(document).bind("ajaxError.pager",function(c,e,f,h){f.url===g&&(z(null,b,a,h),d(document).unbind("ajaxError.pager"))}),d.getJSON(g,function(c){z(c,b,a);d(document).unbind("ajaxError.pager")}))}else a.ajax|| v(b,b.config.rowsCopy,a);d.data(b,"pagerLastPage",a.page);d.data(b,"pagerUpdateTriggered",!0);a.initialized&&d(b).trigger("pageMoved",a)}},C=function(b,a,c){c.size=a;d.data(b,"pagerLastPage",c.page);d.data(b,"pagerLastSize",c.size);c.totalPages=Math.ceil(c.totalRows/c.size);m(b,c)},E=function(b,a){a.page=0;m(b,a)},A=function(b,a){a.page=Math.min(a.totalPages,a.filteredPages)-1;m(b,a)},F=function(b,a){a.page++;a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)- 1);m(b,a)},G=function(b,a){a.page--;0>=a.page&&(a.page=0);m(b,a)},D=function(b,a,c){var g=d(a.cssPageSize,a.container).removeClass(a.cssDisabled).removeAttr("disabled");d(a.container).find(a.cssGoto).removeClass(a.cssDisabled).removeAttr("disabled");a.isDisabled=!1;a.page=d.data(b,"pagerLastPage")||a.page||0;a.size=d.data(b,"pagerLastSize")||parseInt(g.find("option[selected]").val(),10)||a.size;g.val(a.size);a.totalPages=Math.ceil(Math.min(a.totalPages,a.filteredPages)/a.size);c&&(d(b).trigger("update"), C(b,a.size,a),x(b,a),u(b,a))};p.appender=function(b,a){var c=b.config.pager;c.ajax||(b.config.rowsCopy=a,c.totalRows=a.length,c.size=d.data(b,"pagerLastSize")||c.size,c.totalPages=Math.ceil(c.totalRows/c.size),v(b,a,c))};p.construct=function(b){return this.each(function(){if(this.config&&this.hasInitialized){var a,c,g,h=this.config,e=h.pager=d.extend({},d.tablesorterPager.defaults,b),f=this,k=f.config,j=d(f),l=d(e.container).addClass("tablesorter-pager").show();h.appender=p.appender;j.unbind("filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager pageSize.pager").bind("filterStart.pager", function(a,b){d.data(f,"pagerUpdateTriggered",!1);e.currentFilters=b}).bind("filterEnd.pager sortEnd.pager",function(a){d.data(f,"pagerUpdateTriggered")?d.data(f,"pagerUpdateTriggered",!1):("filterEnd"===a.type&&(e.page=0),m(f,e),t(f,e),u(f,e))}).bind("disable.pager",function(){B(f,e)}).bind("enable.pager",function(){D(f,e,!0)}).bind("destroy.pager",function(){B(f,e);d(e.container).hide();f.config.appender=null;d(f).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager")}).bind("update.pager", function(){n(f,e)}).bind("pageSize.pager",function(a,b){e.size=parseInt(b,10)||10;n(f,e);t(f,e)}).bind("pageSet.pager",function(a,b){e.page=(parseInt(b,10)||1)-1;m(f,e);t(f,e)});c=[e.cssFirst,e.cssPrev,e.cssNext,e.cssLast];g=[E,G,F,A];l.find(c.join(",")).unbind("click.pager").bind("click.pager",function(){var a,b=d(this),h=c.length;if(!b.hasClass(e.cssDisabled))for(a=0;a=1.2.6" } diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index d339d303..59a49ab7 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -1,5 +1,5 @@ /*! -* TableSorter 2.7.6 - Client-side table sorting with ease! +* TableSorter 2.7.7 - 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.7.6"; + ts.version = "2.7.7"; ts.parsers = []; ts.widgets = []; @@ -580,8 +580,8 @@ // apply event handling to headers // this is to big, perhaps break it out? c.$headers - // http://stackoverflow.com/questions/5312849/jquery-find-self - .find('*').andSelf().filter(c.selectorSort) + // http://stackoverflow.com/questions/5312849/jquery-find-self; andSelf() deprecated in jQuery 1.8 + .find('*')[ $.fn.addBack ? 'addBack': 'andSelf' ]().filter(c.selectorSort) .unbind('mousedown.tablesorter mouseup.tablesorter') .bind('mousedown.tablesorter mouseup.tablesorter', function(e, external) { // jQuery v1.2.6 doesn't have closest() diff --git a/js/jquery.tablesorter.min.js b/js/jquery.tablesorter.min.js index 88c5f225..1dddff4c 100644 --- a/js/jquery.tablesorter.min.js +++ b/js/jquery.tablesorter.min.js @@ -1,5 +1,5 @@ /*! -* TableSorter 2.7.6 min - Client-side table sorting with ease! +* TableSorter 2.7.7 min - Client-side table sorting with ease! * Copyright (c) 2007 Christian Bach */ -!function(j){j.extend({tablesorter:new function(){function e(d){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(d):alert(d)}function v(d,c){e(d+" ("+((new Date).getTime()-c.getTime())+"ms)")}function p(d,c,a){if(!c)return"";var b=d.config,g=b.textExtraction,f="",f="simple"===g?b.supportsTextContent?c.textContent:j(c).text():"function"===typeof g?g(c,d,a):"object"===typeof g&&g.hasOwnProperty(a)?g[a](c,d,a):b.supportsTextContent?c.textContent:j(c).text();return j.trim(f)} function h(d){var c=d.config,a=c.$tbodies=c.$table.children("tbody:not(."+c.cssInfoBlock+")"),b,q,f,l,j,n,k="";if(0===a.length)return c.debug?e("*Empty table!* Not building a parser cache"):"";a=a[0].rows;if(a[0]){b=[];q=a[0].cells.length;for(f=0;f thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};g.benchmark=v;g.construct=function(d){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config&&this.config.debug?e("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var c=j(this),a=this,b,q,f,l="",u,n,k,C,x=j.metadata; a.hasInitialized=!1;a.config={};b=j.extend(!0,a.config,g.defaults,d);j.data(a,"tablesorter",b);b.debug&&j.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===j("x")[0].textContent;b.supportsDataObject=1.4<=parseFloat(j.fn.jquery);b.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(c.attr("class"))||(l=""!==b.theme?" tablesorter-"+b.theme:"");b.$table=c.addClass(b.tableClass+l);b.$tbodies=c.children("tbody:not(."+b.cssInfoBlock+ ")");var t=[],y={},Q=0,V=j(a).find("thead:eq(0), tfoot").children("tr"),E,L,z,A,R,D,M,W,X,H;for(E=0;E':"";t=j(a).find(w.selectorHeaders).each(function(a){B=j(this);N=w.headers[a];w.headerContent[a]=this.innerHTML;O=w.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,Y);w.onRenderTemplate&&(S=w.onRenderTemplate.apply(B,[a,O]))&&"string"===typeof S&&(O=S);this.innerHTML='
'+O+"
";w.onRenderHeader&&w.onRenderHeader.apply(B, [a]);this.column=y[this.parentNode.rowIndex+"-"+this.cellIndex];var b=g.getData(B,N,"sortInitialOrder")||w.sortInitialOrder;this.order=/^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;"false"===g.getData(B,N,"sorter")?(this.sortDisabled=!0,B.addClass("sorter-false")):B.removeClass("sorter-false");this.lockedOrder=!1;J=g.getData(B,N,"lockedOrder")||!1;"undefined"!==typeof J&&!1!==J&&(this.order=this.lockedOrder=/^d/i.test(J)||1===J?[1,1,1]:[0,0,0]);B.addClass((this.sortDisabled?"sorter-false ":" ")+ w.cssHeader);w.headerList[a]=this;B.parent().addClass(w.cssHeaderRow)});a.config.debug&&(v("Built headers:",K),e(t));b.$headers=t;var T,P=a.config,U=j("");K=P.$table.find("colgroup");var Z=P.$table.width();j("tr:first td",a.tBodies[0]).each(function(){T=j("");P.widthFixed&&T.css("width",parseInt(1E3*(j(this).width()/Z),10)/10+"%");U.append(T)});K.length?K.html(U.html()):P.$table.prepend(U);b.parsers=h(a);b.delayInit||s(a);b.$headers.find("*").andSelf().filter(b.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter", function(d,e){var h=(this.tagName.match("TH|TD")?j(this):j(this).parents("th, td").filter(":last"))[0];if(1!==(d.which||d.button))return!1;if("mousedown"===d.type)return C=(new Date).getTime(),"INPUT"===d.target.tagName?"":!b.cancelSelection;if(!0!==e&&250<(new Date).getTime()-C)return!1;b.delayInit&&!b.cache&&s(a);if(!h.sortDisabled){c.trigger("sortStart",a);l=!d[b.sortMultiSortKey];h.count=d[b.sortResetKey]?2:(h.count+1)%(b.sortReset?3:2);b.sortRestart&&(q=h,b.$headers.each(function(){if(this!== q&&(l||!j(this).is("."+b.cssDesc+",."+b.cssAsc)))this.count=-1}));q=h.column;if(l){b.sortList=[];if(null!==b.sortForce){u=b.sortForce;for(f=0;fk&&(b.sortList.push([q,k]),1k&&(b.sortList.push([q,k]),1'), d=j.fn.detach?c.detach():c.remove();d=j(d).find("span.tablesorter-savemyplace");c.insertAfter(d);d.remove()};g.clearTableBody=function(d){d.config.$tbodies.empty()};g.destroy=function(d,c,a){if(d.hasInitialized){g.refreshWidgets(d,!0,!0);var b=j(d),e=d.config,f=b.find("thead:first"),l=f.find("tr."+e.cssHeaderRow).removeClass(e.cssHeaderRow),h=b.find("tfoot:first > tr").children("th, td");f.find("tr").not(l).remove();b.removeData("tablesorter").unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave"); e.$headers.add(h).removeClass(e.cssHeader+" "+e.cssAsc+" "+e.cssDesc).removeAttr("data-column");l.find(e.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter");l.children().each(function(a){j(this).html(e.headerContent[a])});!1!==c&&b.removeClass(e.tableClass+" tablesorter-"+e.theme);d.hasInitialized=!1;"function"===typeof a&&a(d)}};g.regex=[/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, /^0x[0-9a-f]+$/i];g.sortText=function(d,c,a,b){if(c===a)return 0;var e=d.config,f=e.string[e.empties[b]||e.emptyTo],h=g.regex;if(""===c&&0!==f)return"boolean"===typeof f?f?-1:1:-f||-1;if(""===a&&0!==f)return"boolean"===typeof f?f?1:-1:f||1;if("function"===typeof e.textSorter)return e.textSorter(c,a,d,b);d=c.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=a.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");c=parseInt(c.match(h[2]),16)||1!==d.length&& c.match(h[1])&&Date.parse(c);if(a=parseInt(a.match(h[2]),16)||c&&a.match(h[1])&&Date.parse(a)||null){if(ca)return 1}e=Math.max(d.length,b.length);for(c=0;ch)return 1}return 0};g.sortTextDesc=function(d,c,a,b){if(c===a)return 0;var e=d.config,f=e.string[e.empties[b]||e.emptyTo];return""===c&& 0!==f?"boolean"===typeof f?f?-1:1:f||1:""===a&&0!==f?"boolean"===typeof f?f?1:-1:-f||-1:"function"===typeof e.textSorter?e.textSorter(a,c,d,b):g.sortText(d,a,c)};g.getTextValue=function(d,c,a){if(c){var b=d.length,e=c+a;for(c=0;cj.inArray(l[b].id,f)))h.debug&&e("Refeshing widgets: Removing "+l[b].id),l[b].hasOwnProperty("remove")&&l[b].remove(d,h,h.widgetOptions);!0!==a&&g.applyWidget(d,c)};g.getData=function(d,c,a){var b="";d=j(d); var e,f;if(!d.length)return"";e=j.metadata?d.metadata():!1;f=" "+(d.attr("class")||"");"undefined"!==typeof d.data(a)||"undefined"!==typeof d.data(a.toLowerCase())?b+=d.data(a)||d.data(a.toLowerCase()):e&&"undefined"!==typeof e[a]?b+=e[a]:c&&"undefined"!==typeof c[a]?b+=c[a]:" "!==f&&f.match(" "+a+"-")&&(b=f.match(RegExp(" "+a+"-(\\w+)"))[1]||"");return j.trim(b)};g.formatFloat=function(d,c){if("string"!==typeof d||""===d)return d;var a;d=(c&&c.config?!1!==c.config.usNumberFormat:"undefined"!==typeof c? c:1)?d.replace(/,/g,""):d.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(d)&&(d=d.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(d);return isNaN(a)?j.trim(d):a};g.isDigit=function(d){return isNaN(d)?/^[\-+(]?\d+[)]?$/.test(d.toString().replace(/[,.'"\s]/g,"")):!0}}});var h=j.tablesorter;j.fn.extend({tablesorter:h.construct});h.addParser({id:"text",is:function(){return!0},format:function(e,v){var p=v.config;e=j.trim(p.ignoreCase?e.toLocaleLowerCase():e);return p.sortLocaleCompare? h.replaceAccents(e):e},type:"text"});h.addParser({id:"currency",is:function(e){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test(e)},format:function(e,j){return h.formatFloat(e.replace(/[^\w,. \-()]/g,""),j)},type:"numeric"});h.addParser({id:"ipAddress",is:function(e){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(e)},format:function(e,j){var p,r=e.split("."),s="",m=r.length;for(p=0;p thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};g.benchmark=u;g.construct=function(d){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config&&this.config.debug?e("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var c=j(this),a=this,b,q,f,l="",v,n,k,C,x=j.metadata; a.hasInitialized=!1;a.config={};b=j.extend(!0,a.config,g.defaults,d);j.data(a,"tablesorter",b);b.debug&&j.data(a,"startoveralltimer",new Date);b.supportsTextContent="x"===j("x")[0].textContent;b.supportsDataObject=1.4<=parseFloat(j.fn.jquery);b.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(c.attr("class"))||(l=""!==b.theme?" tablesorter-"+b.theme:"");b.$table=c.addClass(b.tableClass+l);b.$tbodies=c.children("tbody:not(."+b.cssInfoBlock+ ")");var t=[],y={},O=0,R=j(a).find("thead:eq(0), tfoot").children("tr"),E,K,z,A,P,D,L,S,T,H;for(E=0;E':"";t=j(a).find(w.selectorHeaders).each(function(a){B=j(this);M=w.headers[a];w.headerContent[a]=this.innerHTML;N=w.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,U);w.onRenderTemplate&&(Q=w.onRenderTemplate.apply(B,[a,N]))&&"string"===typeof Q&&(N=Q);this.innerHTML='
'+N+"
";w.onRenderHeader&&w.onRenderHeader.apply(B, [a]);this.column=y[this.parentNode.rowIndex+"-"+this.cellIndex];var b=g.getData(B,M,"sortInitialOrder")||w.sortInitialOrder;this.order=/^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;"false"===g.getData(B,M,"sorter")?(this.sortDisabled=!0,B.addClass("sorter-false")):B.removeClass("sorter-false");this.lockedOrder=!1;J=g.getData(B,M,"lockedOrder")||!1;"undefined"!==typeof J&&!1!==J&&(this.order=this.lockedOrder=/^d/i.test(J)||1===J?[1,1,1]:[0,0,0]);B.addClass((this.sortDisabled?"sorter-false ":" ")+ w.cssHeader);w.headerList[a]=this;B.parent().addClass(w.cssHeaderRow)});a.config.debug&&(u("Built headers:",V),e(t));b.$headers=t;if(a.config.widthFixed&&0===j(a).find("colgroup").length){var W=j(""),X=j(a).width();j("tr:first td",a.tBodies[0]).each(function(){W.append(j("").css("width",parseInt(1E3*(j(this).width()/X),10)/10+"%"))});j(a).prepend(W)}b.parsers=h(a);b.delayInit||s(a);b.$headers.find("*")[j.fn.addBack?"addBack":"andSelf"]().filter(b.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter", function(d,e){var h=(this.tagName.match("TH|TD")?j(this):j(this).parents("th, td").filter(":last"))[0];if(1!==(d.which||d.button))return!1;if("mousedown"===d.type)return C=(new Date).getTime(),"INPUT"===d.target.tagName?"":!b.cancelSelection;if(!0!==e&&250<(new Date).getTime()-C)return!1;b.delayInit&&!b.cache&&s(a);if(!h.sortDisabled){c.trigger("sortStart",a);l=!d[b.sortMultiSortKey];h.count=d[b.sortResetKey]?2:(h.count+1)%(b.sortReset?3:2);b.sortRestart&&(q=h,b.$headers.each(function(){if(this!== q&&(l||!j(this).is("."+b.cssDesc+",."+b.cssAsc)))this.count=-1}));q=h.column;if(l){b.sortList=[];if(null!==b.sortForce){v=b.sortForce;for(f=0;fk&&(b.sortList.push([q,k]),1k&&(b.sortList.push([q,k]),1'),d=j.fn.detach?c.detach():c.remove();d=j(d).find("span.tablesorter-savemyplace");c.insertAfter(d);d.remove()};g.clearTableBody=function(d){d.config.$tbodies.empty()};g.destroy=function(d,c,a){if(d.hasInitialized){g.refreshWidgets(d,!0,!0);var b=j(d),e=d.config,f=b.find("thead:first"),h=f.find("tr."+e.cssHeaderRow).removeClass(e.cssHeaderRow),u=b.find("tfoot:first > tr").children("th, td"); f.find("tr").not(h).remove();b.removeData("tablesorter").unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave sortBegin sortEnd ".split(" ").join(".tablesorter "));e.$headers.add(u).removeClass(e.cssHeader+" "+e.cssAsc+" "+e.cssDesc).removeAttr("data-column");h.find(e.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter");h.children().each(function(a){j(this).html(e.headerContent[a])});!1!==c&&b.removeClass(e.tableClass+ " tablesorter-"+e.theme);d.hasInitialized=!1;"function"===typeof a&&a(d)}};g.regex=[/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,/^0x[0-9a-f]+$/i];g.sortText=function(d,c,a,b){if(c===a)return 0;var e=d.config,f=e.string[e.empties[b]||e.emptyTo],h=g.regex;if(""===c&&0!==f)return"boolean"===typeof f?f?-1:1:-f||-1;if(""===a&&0!==f)return"boolean"===typeof f? f?1:-1:f||1;if("function"===typeof e.textSorter)return e.textSorter(c,a,d,b);d=c.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=a.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");c=parseInt(c.match(h[2]),16)||1!==d.length&&c.match(h[1])&&Date.parse(c);if(a=parseInt(a.match(h[2]),16)||c&&a.match(h[1])&&Date.parse(a)||null){if(ca)return 1}e=Math.max(d.length,b.length);for(c=0;ch)return 1}return 0};g.sortTextDesc=function(d,c,a,b){if(c===a)return 0;var e=d.config,f=e.string[e.empties[b]||e.emptyTo];return""===c&&0!==f?"boolean"===typeof f?f?-1:1:f||1:""===a&&0!==f?"boolean"===typeof f?f?1:-1:-f||-1:"function"===typeof e.textSorter?e.textSorter(a,c,d,b):g.sortText(d,a,c)};g.getTextValue=function(d,c,a){if(c){var b=d.length,e=c+a; for(c=0;cj.inArray(l[b].id,f)))h.debug&&e("Refeshing widgets: Removing "+l[b].id),l[b].hasOwnProperty("remove")&&l[b].remove(d,h,h.widgetOptions);!0!==a&&g.applyWidget(d,c)};g.getData=function(d,c,a){var b="";d=j(d);var e,f;if(!d.length)return"";e=j.metadata?d.metadata():!1;f=" "+(d.attr("class")||"");"undefined"!==typeof d.data(a)||"undefined"!==typeof d.data(a.toLowerCase())? b+=d.data(a)||d.data(a.toLowerCase()):e&&"undefined"!==typeof e[a]?b+=e[a]:c&&"undefined"!==typeof c[a]?b+=c[a]:" "!==f&&f.match(" "+a+"-")&&(b=f.match(RegExp(" "+a+"-(\\w+)"))[1]||"");return j.trim(b)};g.formatFloat=function(d,c){if("string"!==typeof d||""===d)return d;var a;d=(c&&c.config?!1!==c.config.usNumberFormat:"undefined"!==typeof c?c:1)?d.replace(/,/g,""):d.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(d)&&(d=d.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(d);return isNaN(a)? j.trim(d):a};g.isDigit=function(d){return isNaN(d)?/^[\-+(]?\d+[)]?$/.test(d.toString().replace(/[,.'"\s]/g,"")):!0}}});var h=j.tablesorter;j.fn.extend({tablesorter:h.construct});h.addParser({id:"text",is:function(){return!0},format:function(e,u){var p=u.config;e=j.trim(p.ignoreCase?e.toLocaleLowerCase():e);return p.sortLocaleCompare?h.replaceAccents(e):e},type:"text"});h.addParser({id:"currency",is:function(e){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test((e|| "").replace(/[,. ]/g,""))},format:function(e,j){return h.formatFloat(e.replace(/[^\w,. \-()]/g,""),j)},type:"numeric"});h.addParser({id:"ipAddress",is:function(e){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(e)},format:function(e,j){var p,r=e.split("."),s="",m=r.length;for(p=0;p'),n.cssIcon&&p.find("."+n.cssIcon).addClass(l.icons),g.hasClass("hasFilters")&&p.find(".tablesorter-filter-row").addClass(l.filterRow);b.each(p,function(a){d=b(this);h=n.cssIcon?d.find("."+n.cssIcon):d;this.sortDisabled?(d.removeClass(r),h.removeClass(r+" tablesorter-icon "+l.icons)):(f=g.hasClass("hasStickyHeaders")?g.find(t).find("th").eq(a).add(d):d,c=d.hasClass(n.cssAsc)? l.sortAsc:d.hasClass(n.cssDesc)?l.sortDesc:d.hasClass(n.cssHeader)?l.sortNone:"",d[c===l.sortNone?"removeClass":"addClass"](l.active),h.removeClass(r).addClass(c))});n.debug&&b.tablesorter.benchmark("Applying "+s+" theme",a)},remove:function(e,a,c){e=b(e);var d="object"===typeof c.uitheme?"jui":c.uitheme||"jui";c="object"===typeof c.uitheme?c.uitheme:b.tablesorter.themes[b.tablesorter.themes.hasOwnProperty(d)?d:"jui"];var h=e.children("thead").children(),f=c.sortNone+" "+c.sortDesc+" "+c.sortAsc; e.removeClass("tablesorter-"+d+" "+c.table).find(a.cssHeader).removeClass(c.header);h.unbind("mouseenter mouseleave").removeClass(c.hover+" "+f+" "+c.active).find(".tablesorter-filter-row").removeClass(c.filterRow);h.find(".tablesorter-icon").removeClass(c.icons)}}); -b.tablesorter.addWidget({id:"columns",format:function(e){var a,c,d,h,f,g,n,q,s,l=b(e),p=e.config,t=p.widgetOptions,r=p.$tbodies,m=p.sortList,v=m.length,k=["primary","secondary","tertiary"],k=p.widgetColumns&&p.widgetColumns.hasOwnProperty("css")? p.widgetColumns.css||k:t&&t.hasOwnProperty("columns")?t.columns||k:k;g=k.length-1;n=k.join(" ");p.debug&&(f=new Date);for(s=0;s=]/g],M=B.map(function(a){return A.getData?"parsed"===A.getData(B.filter('[data-column="'+a+'"]:last'),u.headers[a],"filter"):b(this).hasClass("filter-parsed")}).get(),H,I,D=function(a){var c=b.isArray(a),e=w.find("thead").eq(0).children("tr").find("select."+z+", input."+z),d=c?a:e.map(function(){return b(this).val()||""}).get(),f=(d||[]).join("");c&&e.each(function(c,d){b(d).val(a[c]||"")});!0===j.filter_hideFilters&& w.find(".tablesorter-filter-row").trigger(""===f?"mouseleave":"mouseenter");if(!(G===f&&!1!==a))if(w.trigger("filterStart",[d]),u.showProcessing)setTimeout(function(){J(a,d,f);return!1},30);else return J(a,d,f),!1},J=function(h,g,l){var p,s,r,t,x,y,z;u.debug&&(z=new Date);for(d=0;d]=?/.test(f)?(m=isNaN(q)?b.tablesorter.formatFloat(q.replace(C[5],""),e):b.tablesorter.formatFloat(q,e),v=b.tablesorter.formatFloat(f.replace(C[5],"").replace(C[6],""),e),/>/.test(f)&&(y=/>=/.test(f)?m>=v:m>v),/'+(B.filter('[data-column="'+a+'"]:last').attr("data-placeholder")||"")+"";for(d=0;d'+g[d]+"";w.find("thead").find("select."+z+'[data-column="'+a+'"]')[f?"html":"append"](m)},L=function(b){for(a=0;a';for(a=0;a":">")+"";w.find("thead").eq(0).append(k+="")}w.bind(["addRows", "updateCell","update","appendCache","search"].join(".tsfilter "),function(b,a){"search"!==b.type&&L(!0);D("search"===b.type?a:"");return!1}).find("input."+z).bind("keyup search",function(b,a){if(!(32>b.which&&8!==b.which||37<=b.which&&40>=b.which)){if("undefined"!==typeof a)return D(a),!1;clearTimeout(I);I=setTimeout(function(){D()},j.filter_searchDelay||300)}});j.filter_reset&&b(j.filter_reset).length&&b(j.filter_reset).bind("click",function(){w.find("."+z).val("");D();return!1});if(j.filter_functions)for(x in j.filter_functions)if(j.filter_functions.hasOwnProperty(x)&& "string"===typeof x)if(k=B.filter('[data-column="'+x+'"]:last'),g="",!0===j.filter_functions[x]&&!k.hasClass("filter-false"))K(x);else if("string"===typeof x&&!k.hasClass("filter-false")){for(l in j.filter_functions[x])"string"===typeof l&&(g+=""===g?'":"",g+='");w.find("thead").find("select."+z+'[data-column="'+x+'"]').append(g)}L(!0);w.find("select."+z).bind("change search",function(){D()});!0===j.filter_hideFilters&& w.find(".tablesorter-filter-row").addClass("hideme").bind("mouseenter mouseleave",function(a){var c;p=b(this);clearTimeout(s);s=setTimeout(function(){/enter|over/.test(a.type)?p.removeClass("hideme"):b(document.activeElement).closest("tr")[0]!==p[0]&&(c=w.find("."+(j.filter_cssFilter||"tablesorter-filter")).map(function(){return b(this).val()||""}).get().join(""),""===c&&p.addClass("hideme"))},200)}).find("input, select").bind("focus blur",function(a){t=b(this).closest("tr");clearTimeout(s);s=setTimeout(function(){if(""=== w.find("."+(j.filter_cssFilter||"tablesorter-filter")).map(function(){return b(this).val()||""}).get().join(""))t["focus"===a.type?"removeClass":"addClass"]("hideme")},200)});u.showProcessing&&w.bind("filterStart filterEnd",function(a,c){var d=c?w.find("."+u.cssHeader).filter("[data-column]").filter(function(){return""!==c[b(this).data("column")]}):"";A.isProcessing(w[0],"filterStart"===a.type,c?d:"")});u.debug&&A.benchmark("Applying Filter widget",H);w.trigger("filterInit")}},remove:function(e,a, c){var d,h;d=b(e);a=a.$tbodies;d.removeClass("hasFilters").unbind(["addRows","updateCell","update","appendCache","search"].join(".tsfilter")).find(".tablesorter-filter-row").remove();for(d=0;db.top&&cMath.abs(l.parent().width()-l.width()),x=function(){b.tablesorter.storage&&m&&(f[m.index()]=m.width(),f[v.index()]=v.width(),m.width(f[m.index()]),v.width(f[v.index()]),!1!==t.resizable&&b.tablesorter.storage(e,"tablesorter-resizable",f));r=0;m=v=null;b(window).trigger("resize")};if(f=b.tablesorter.storage&& !1!==t.resizable?b.tablesorter.storage(e,"tablesorter-resizable"):{})for(h in f)!isNaN(h)&&h');g=g.slice(0,-1);n=n?n.add(g):g});n.each(function(){a=b(this);h=parseInt(a.css("padding-right"),10)+10;c='
';a.find(".tablesorter-wrapper").append(c)}).bind("mousemove.tsresize",function(a){0!==r&&m&&(q=a.pageX-r,s=m.width(),m.width(s+q),m.width()!==s&&k&&v.width(v.width()- q),r=a.pageX)}).bind("mouseup.tsresize",function(){x()}).find(".tablesorter-resizer,.tablesorter-resizer-grip").bind("mousedown",function(a){m=b(a.target).closest("th");c=p.$headers.filter('[data-column="'+m.attr("data-column")+'"]');1'),n.cssIcon&&r.find("."+n.cssIcon).addClass(h.icons),l.hasClass("hasFilters")&&r.find(".tablesorter-filter-row").addClass(h.filterRow);b.each(r,function(a){e=b(this);g=n.cssIcon?e.find("."+n.cssIcon):e;this.sortDisabled?(e.removeClass(t),g.removeClass(t+" tablesorter-icon "+h.icons)):(f=l.hasClass("hasStickyHeaders")? l.find(w).find("th").eq(a).add(e):e,d=e.hasClass(n.cssAsc)?h.sortAsc:e.hasClass(n.cssDesc)?h.sortDesc:e.hasClass(n.cssHeader)?h.sortNone:"",e[d===h.sortNone?"removeClass":"addClass"](h.active),g.removeClass(t).addClass(d))});n.debug&&b.tablesorter.benchmark("Applying "+q+" theme",a)},remove:function(c,a,d){c=b(c);var e="object"===typeof d.uitheme?"jui":d.uitheme||"jui";d="object"===typeof d.uitheme?d.uitheme:b.tablesorter.themes[b.tablesorter.themes.hasOwnProperty(e)?e:"jui"];var g=c.children("thead").children(), f=d.sortNone+" "+d.sortDesc+" "+d.sortAsc;c.removeClass("tablesorter-"+e+" "+d.table).find(a.cssHeader).removeClass(d.header);g.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(d.hover+" "+f+" "+d.active).find(".tablesorter-filter-row").removeClass(d.filterRow);g.find(".tablesorter-icon").removeClass(d.icons)}}); +b.tablesorter.addWidget({id:"columns",format:function(c){var a,d,e,g,f,l,n,m,q,h=b(c),r=c.config,w=r.widgetOptions,t=r.$tbodies,k=r.sortList,u=k.length,s=["primary","secondary", "tertiary"],s=r.widgetColumns&&r.widgetColumns.hasOwnProperty("css")?r.widgetColumns.css||s:w&&w.hasOwnProperty("columns")?w.columns||s:s;l=s.length-1;n=s.join(" ");r.debug&&(f=new Date);for(q=0;q=]/g],L,M,N,H=function(a){var c=b.isArray(a),d=y.find("thead").eq(0).find(".tablesorter-filter-row").children(),e=c?a:d.map(function(a){a=b(this).find("select."+E+", input."+E);return a.length?a.val()||"":""}).get(),f=(e||[]).join("");c&&d.each(function(c,d){b(d).val(a[c]||"")});!0===j.filter_hideFilters&&y.find(".tablesorter-filter-row").trigger(""=== f?"mouseleave":"mouseenter");if(!(K===f&&!1!==a))if(y.trigger("filterStart",[e]),v.showProcessing)setTimeout(function(){O(a,e,f);return!1},30);else return O(a,e,f),!1},O=function(k,g,l){var h,r,q,t,w,x,G,B,z;v.debug&&(G=new Date);for(e=0;e]=?/.test(f))u=isNaN(m)?F(m.replace(A[5],""),c):F(m,c),s=F(f.replace(A[5],"").replace(A[6],""),c),/>/.test(f)&&(x=/>=/.test(f)?u>=s:u>s),/z&&(x=B,B=z,z=x),x=u>=B&&u<=z||""===B||""===z?!0:!1):/[\?|\*]/.test(f)||/\s+OR\s+/.test(g[a])?x=RegExp(f.replace(/\s+or\s+/gi,"|").replace(/\?/g,"\\S{1}").replace(/\*/g,"\\S*")).test(m):(n=(m+p).indexOf(f),x=!j.filter_startsWith&&0<=n||j.filter_startsWith&&0===n);t=x?t?!0:!1:!1}h[d].style.display=t?"":"none";h.eq(d)[t?"removeClass":"addClass"]("filtered");if(q.length)q[t?"show":"hide"]()}b.tablesorter.processTbody(c,k,!1)}K=l;v.debug&&C.benchmark("Completed filter widget search", G);y.trigger("applyWidgets");y.trigger("filterEnd")},P=function(a,f){var k,h=[];a=parseInt(a,10);k='";for(e=0;e'+h[e]+"";y.find("thead").find("select."+E+'[data-column="'+a+'"]')[f?"html":"append"](k)},Q=function(b){for(a=0;a';for(a=0;a";k=y.find("thead").eq(0).append(p+="").find("td");for(a=0;a").appendTo(k.eq(a)):(j.filter_formatter&&b.isFunction(j.filter_formatter[a])?((p=j.filter_formatter[a](k.eq(a),a))&&0===p.length&&(p=k.eq(a).children("input")),p&&(0===p.parent().length||p.parent().length&&p.parent()[0]!==k[a])&&k.eq(a).append(p)):p=b('').appendTo(k.eq(a)),p&&p.attr("placeholder",t.attr("data-placeholder")||"")),p&&(p.addClass(E).attr("data-column",a),G&& (p.addClass("disabled")[0].disabled=!0))}y.bind("addRows updateCell update updateRows appendCache filterReset search ".split(" ").join(".tsfilter "),function(a,b){/(search|filterReset)/.test(a.type)||Q(!0);"filterReset"===a.type&&y.find("."+E).val("");H("search"===a.type?b:"");return!1}).find("input."+E).bind("keyup search",function(a,b){if(!(32>a.which&&8!==a.which||37<=a.which&&40>=a.which)){if("undefined"!==typeof b)return H(b),!1;clearTimeout(N);N=setTimeout(function(){H()},j.filter_searchDelay|| 300)}});L=D.map(function(a){return C.getData?"parsed"===C.getData(D.filter('[data-column="'+a+'"]:last'),v.headers[a],"filter"):b(this).hasClass("filter-parsed")}).get();j.filter_reset&&b(j.filter_reset).length&&b(j.filter_reset).bind("click.tsfilter",function(){y.trigger("filterReset")});if(j.filter_functions)for(z in j.filter_functions)if(j.filter_functions.hasOwnProperty(z)&&"string"===typeof z)if(p=D.filter('[data-column="'+z+'"]:last'),l="",!0===j.filter_functions[z]&&!p.hasClass("filter-false"))P(z); else if("string"===typeof z&&!p.hasClass("filter-false")){for(h in j.filter_functions[z])"string"===typeof h&&(l+=""===l?'":"",l+='");y.find("thead").find("select."+E+'[data-column="'+z+'"]').append(l)}Q(!0);y.find("select."+E).bind("change search",function(){H()});!0===j.filter_hideFilters&&y.find(".tablesorter-filter-row").addClass("hideme").bind("mouseenter mouseleave",function(a){var c;r=b(this); clearTimeout(q);q=setTimeout(function(){/enter|over/.test(a.type)?r.removeClass("hideme"):b(document.activeElement).closest("tr")[0]!==r[0]&&(c=y.find("."+(j.filter_cssFilter||"tablesorter-filter")).map(function(){return b(this).val()||""}).get().join(""),""===c&&r.addClass("hideme"))},200)}).find("input, select").bind("focus blur",function(a){w=b(this).closest("tr");clearTimeout(q);q=setTimeout(function(){if(""===y.find("."+(j.filter_cssFilter||"tablesorter-filter")).map(function(){return b(this).val()|| ""}).get().join(""))w["focus"===a.type?"removeClass":"addClass"]("hideme")},200)});v.showProcessing&&y.bind("filterStart.tsfilter filterEnd.tsfilter",function(a,c){var d=c?y.find("."+v.cssHeader).filter("[data-column]").filter(function(){return""!==c[b(this).data("column")]}):"";C.isProcessing(y[0],"filterStart"===a.type,c?d:"")});v.debug&&C.benchmark("Applying Filter widget",M);y.trigger("filterInit");H()}},remove:function(c,a,d){var e,g;e=b(c);a=a.$tbodies;e.removeClass("hasFilters").unbind("addRows updateCell update appendCache search filterStart filterEnd ".split(" ").join(".tsfilter ")).find(".tablesorter-filter-row").remove(); for(e=0;eb.top&&cMath.abs(h.parent().width()-h.width()),p=function(){b.tablesorter.storage&&k&&(f[k.index()]=k.width(),f[u.index()]=u.width(),k.width(f[k.index()]),u.width(f[u.index()]),!1!==w.resizable&&b.tablesorter.storage(c,"tablesorter-resizable",f));t=0;k=u=null;b(window).trigger("resize")};if(f=b.tablesorter.storage&&!1!==w.resizable?b.tablesorter.storage(c,"tablesorter-resizable"):{})for(g in f)!isNaN(g)&&g');l=l.slice(0, -1);n=n?n.add(l):l});n.each(function(){a=b(this);g=parseInt(a.css("padding-right"),10)+10;d='
';a.find(".tablesorter-wrapper").append(d)}).bind("mousemove.tsresize",function(a){0!==t&&k&&(m=a.pageX-t,q=k.width(),k.width(q+m),k.width()!==q&&s&&u.width(u.width()-m),t=a.pageX)}).bind("mouseup.tsresize",function(){p()}).find(".tablesorter-resizer,.tablesorter-resizer-grip").bind("mousedown", function(a){k=b(a.target).closest("th");d=r.$headers.filter('[data-column="'+k.attr("data-column")+'"]');1