diff --git a/README.markdown b/README.markdown index fdb3a4b7..9c57b345 100644 Binary files a/README.markdown and b/README.markdown differ diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index 226db474..2abb6be3 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -1,8 +1,8 @@ /*! * tablesorter pager plugin - * updated 11/15/2012 + * updated 11/27/2012 */ -/*jshint browser:true, jquery:true */ +/*jshint browser:true, jquery:true, unused:false */ ;(function($) { "use strict"; $.extend({tablesorterPager: new function() { @@ -231,7 +231,7 @@ } else { $b.html( tds ); // add tbody } - c.temp.remove(); // remove loading icon + $.tablesorter.isProcessing(table); // remove loading icon $t.trigger('update'); c.totalRows = result[0] || 0; c.totalPages = Math.ceil( c.totalRows / c.size ); @@ -246,8 +246,7 @@ }, getAjax = function(table, c){ - var $t = $(table), - url = (c.ajaxUrl) ? c.ajaxUrl.replace(/\{page\}/g, c.page).replace(/\{size\}/g, c.size) : '', + var url = (c.ajaxUrl) ? c.ajaxUrl.replace(/\{page\}/g, c.page).replace(/\{size\}/g, c.size) : '', arry = [], sl = table.config.sortList, col = url.match(/\{sortList[\s+]?:[\s+]?(.*)\}/); @@ -261,12 +260,7 @@ } if ( url !== '' ) { // loading icon - c.temp = $('
', { - 'class' : 'tablesorter-processing', - width : $t.outerWidth(true), - height: $t.outerHeight(true) - }); - $t.before( c.temp ); + $.tablesorter.isProcessing(table, true); $(document).ajaxError(function(e, xhr, settings, exception) { renderAjax(null, table, c, exception); }); @@ -335,12 +329,13 @@ if ( c.page < 0 || c.page > ( p - 1 ) ) { c.page = 0; } - $.data(table, 'pagerLastPage', c.page); - if ( c.ajax ) { + // change if page changed - fixes #182 + if (c.ajax && $.data(table, 'pagerLastPage') !== c.page) { getAjax(table, c); - } else { + } else if (!c.ajax) { renderTable(table, table.config.rowsCopy, c); } + $.data(table, 'pagerLastPage', c.page); if (c.initialized) { $(table).trigger('pageMoved', c); } }, @@ -387,6 +382,7 @@ enablePager = function(table, c, triggered){ var p = $(c.cssPageSize, c.container).removeClass(c.cssDisabled).removeAttr('disabled'); + $(c.container).find(c.cssGoto).removeClass(c.cssDisabled).removeAttr('disabled'); c.isDisabled = false; c.page = $.data(table, 'pagerLastPage') || c.page || 0; c.size = $.data(table, 'pagerLastSize') || parseInt(p.find('option[selected]').val(), 10) || c.size; @@ -439,10 +435,12 @@ $(table) .unbind('filterEnd.pager updateComplete.pager ') .bind('filterEnd.pager updateComplete.pager', function() { - c.page = 0; - updatePageDisplay(table, c); - moveToPage(table, c); - changeHeight(table, c); + if ($(this).hasClass('hasFilters')) { + c.page = 0; + updatePageDisplay(table, c); + moveToPage(table, c); + changeHeight(table, c); + } }); if ( $(c.cssGoto, pager).length ) { diff --git a/addons/pager/jquery.tablesorter.pager.min.js b/addons/pager/jquery.tablesorter.pager.min.js index 9066517e..7fc93aa3 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 11/15/2012 */ -;(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",cssDisabled:"disabled",totalRows:0,totalPages:0,filteredRows:0,filteredPages:0};var s=this,m=function(c,b){var a= c.cssDisabled,e=!!b,f=Math.min(c.totalPages,c.filteredPages);c.updateArrows&&(d(c.cssFirst+","+c.cssPrev,c.container)[e||0===c.page?"addClass":"removeClass"](a),d(c.cssNext+","+c.cssLast,c.container)[e||c.page===f-1?"addClass":"removeClass"](a))},u=function(c,b){var a,e,f;a=d(c).hasClass("hasFilters");b.filteredRows=a?d(c).find("tbody tr:not(.filtered)").length:b.totalRows;b.filteredPages=a?Math.ceil(b.filteredRows/b.size):b.totalPages;if(0 b.filteredRows,b.startRow=f?1:b.size*b.page+1,b.page=f?0:b.page,b.endRow=Math.min(b.filteredRows,b.totalRows,b.size*(b.page+1)),e=d(b.cssPageDisplay,b.container),a=b.output.replace(/\{(page|filteredRows|filteredPages|totalPages|startRow|endRow|totalRows)\}/gi,function(a){return{"{page}":b.page+1,"{filteredRows}":b.filteredRows,"{filteredPages}":b.filteredPages,"{totalPages}":b.totalPages,"{startRow}":b.startRow,"{endRow}":b.endRow,"{totalRows}":b.totalRows}[a]}),e[0]&&(e["INPUT"===e[0].tagName?"val": "html"](a),d(b.cssGoto,b.container).length))){f="";e=Math.min(b.totalPages,b.filteredPages);for(a=1;a<=e;a++)f+="";d(b.cssGoto,b.container).html(f).val(b.page+1)}m(b);b.initialized&&d(c).trigger("pagerComplete",b)},v=function(c,b){var a,e=d(c.tBodies[0]);if(b.fixedHeight&&(e.find("tr.pagerSavedHeightSpacer").remove(),a=d.data(c,"pagerSavedHeight")))a-=e.height(),5')},t=function(c,b){var a=d(c.tBodies[0]);a.find("tr.pagerSavedHeightSpacer").remove();d.data(c,"pagerSavedHeight",a.height());v(c,b);d.data(c,"pagerLastSize",b.size)},n=function(c,b){if(!b.ajaxUrl){var a,e=d("tr:not(."+c.config.cssChildRow+")",c.tBodies),f=e.length,g=b.page*b.size,h=g+b.size,i=0;for(a=0;a=g&&i'+(e?e.message+" ("+e.name+")":"No rows found")+"",m=a.ajaxProcessing(c)||[0,[]],r=m[1]||[],t=r.length, q=m[2];if(0";for(f=0;f"+r[c][f]+"";p+=""}q&&q.length===n&&(g=j.hasClass("hasStickyHeaders"),i=j.find("."+(l.widgetOptions&&l.widgetOptions.stickyHeaders||"tablesorter-stickyheader")),h=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(q[a]).append(c),g&&i.length&&(c=i.find("th").eq(a).find("."+ l.cssIcon).clone(!0),i.find("th").eq(a).find(".tablesorter-header-inner").html(q[a]).append(c))):(b.find(".tablesorter-header-inner").html(q[a]),i.find("th").eq(a).find(".tablesorter-header-inner").html(q[a]));h.eq(a).html(q[a])}));e?j.find("thead").append(s):k.html(p);a.temp.remove();j.trigger("update");a.totalRows=m[0]||0;a.totalPages=Math.ceil(a.totalRows/a.size);u(b,a);v(b,a);a.initialized&&j.trigger("pagerChange",a)}a.initialized||(a.initialized=!0,d(b).trigger("pagerInitialized",a))},y=function(c, b){var a=d(c),e=b.ajaxUrl?b.ajaxUrl.replace(/\{page\}/g,b.page).replace(/\{size\}/g,b.size):"",f=[],g=c.config.sortList,h=e.match(/\{sortList[\s+]?:[\s+]?(.*)\}/);h&&(h=h[1],d.each(g,function(a,b){f.push(h+"["+b[0]+"]="+b[1])}),e=e.replace(/\{sortList[\s+]?:[\s+]?(.*)\}/g,f.length?f.join("&"):h));""!==e&&(b.temp=d("
",{"class":"tablesorter-processing",width:a.outerWidth(!0),height:a.outerHeight(!0)}),a.before(b.temp),d(document).ajaxError(function(a,d,e,f){x(null,c,b,f)}),d.getJSON(e,function(a){x(a, c,b)}))},r=function(c,b,a){var e,f,g,h=document.createDocumentFragment(),i=b.length;e=a.page*a.size;var j=e+a.size;if(!(1>i)){a.initialized&&d(c).trigger("pagerChange",a);if(a.removeRows){j>b.length&&(j=b.length);d(c.tBodies[0]).addClass("tablesorter-hidden");for(d.tablesorter.clearTableBody(c);e=a.totalPages&&(a.page=Math.min(a.totalPages, a.filteredPages)-1,k(c,a));u(c,a);a.isDisabled||v(c,a);d(c).trigger("applyWidgets")}},z=function(c,b){b.ajax?m(b,!0):(b.isDisabled=!0,d.data(c,"pagerLastPage",b.page),d.data(c,"pagerLastSize",b.size),b.page=0,b.size=b.totalRows,b.totalPages=1,d("tr.pagerSavedHeightSpacer",c.tBodies[0]).remove(),r(c,c.config.rowsCopy,b));d(b.container).find(b.cssPageSize+","+b.cssGoto).each(function(){d(this).addClass(b.cssDisabled)[0].disabled=!0})},k=function(c,b){if(!b.isDisabled){var a=Math.min(b.totalPages,b.filteredPages); if(0>b.page||b.page>a-1)b.page=0;d.data(c,"pagerLastPage",b.page);b.ajax?y(c,b):r(c,c.config.rowsCopy,b);b.initialized&&d(c).trigger("pageMoved",b)}},A=function(c,b,a){a.size=b;d.data(c,"pagerLastPage",a.page);d.data(c,"pagerLastSize",a.size);a.totalPages=Math.ceil(a.totalRows/a.size);k(c,a)},B=function(c,b,a){var e=d(b.cssPageSize,b.container).removeClass(b.cssDisabled).removeAttr("disabled");b.isDisabled=!1;b.page=d.data(c,"pagerLastPage")||b.page||0;b.size=d.data(c,"pagerLastSize")||parseInt(e.find("option[selected]").val(), 10)||b.size;e.val(b.size);b.totalPages=Math.ceil(Math.min(b.totalPages,b.filteredPages)/b.size);a&&(d(c).trigger("update"),A(c,b.size,b),w(c,b),v(c,b))};s.appender=function(c,b){var a=c.config.pager;a.ajax||(c.config.rowsCopy=b,a.totalRows=b.length,a.size=d.data(c,"pagerLastSize")||a.size,a.totalPages=Math.ceil(a.totalRows/a.size),r(c,b,a))};s.construct=function(c){return this.each(function(){if(this.config&&this.hasInitialized){var b=this.config,a=b.pager=d.extend({},d.tablesorterPager.defaults, c),e=this,f=d(e),g=d(a.container).addClass("tablesorter-pager").show();b.appender=s.appender;a.initialized=!1;B(e,a,!1);"string"===typeof a.ajaxUrl?(a.ajax=!0,y(e,a)):(a.ajax=!1,d(this).trigger("appendCache",!0),w(e,a));d(e).unbind("filterEnd.pager updateComplete.pager ").bind("filterEnd.pager updateComplete.pager",function(){a.page=0;u(e,a);k(e,a);t(e,a)});d(a.cssGoto,g).length&&(d(a.cssGoto,g).bind("change",function(){a.page=d(this).val()-1;k(e,a)}),u(e,a));d(a.cssFirst,g).unbind("click.pager").bind("click.pager", function(){d(this).hasClass(a.cssDisabled)||(a.page=0,k(e,a));return!1});d(a.cssNext,g).unbind("click.pager").bind("click.pager",function(){d(this).hasClass(a.cssDisabled)||(a.page++,a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)-1),k(e,a));return!1});d(a.cssPrev,g).unbind("click.pager").bind("click.pager",function(){d(this).hasClass(a.cssDisabled)||(a.page--,0>=a.page&&(a.page=0),k(e,a));return!1});d(a.cssLast,g).unbind("click.pager").bind("click.pager", function(){d(this).hasClass(a.cssDisabled)||(a.page=Math.min(a.totalPages,a.filteredPages)-1,k(e,a));return!1});d(a.cssPageSize,g).unbind("change.pager").bind("change.pager",function(){d(a.cssPageSize,g).val(d(this).val());d(this).hasClass(a.cssDisabled)||(A(e,parseInt(d(this).val(),10),a),t(e,a));return!1});f.unbind("disable.pager enable.pager destroy.pager update.pager").bind("disable.pager",function(){z(e,a)}).bind("enable.pager",function(){B(e,a,!0)}).bind("destroy.pager",function(){z(e,a);d(a.container).hide(); e.config.appender=null;d(e).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager")}).bind("update.pager",function(){n(e,a)});a.ajax||(a.initialized=!0,d(e).trigger("pagerInitialized",a))}})}}});d.fn.extend({tablesorterPager:d.tablesorterPager.construct})})(jQuery); +/*! tablesorter pager plugin minified - updated 11/27/2012 */ +;(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",cssDisabled:"disabled",totalRows:0,totalPages:0,filteredRows:0,filteredPages:0};var r=this,j=function(c,a){var b= c.cssDisabled,e=!!a,f=Math.min(c.totalPages,c.filteredPages);c.updateArrows&&(d(c.cssFirst+","+c.cssPrev,c.container)[e||0===c.page?"addClass":"removeClass"](b),d(c.cssNext+","+c.cssLast,c.container)[e||c.page===f-1?"addClass":"removeClass"](b))},t=function(c,a){var b,e,f;b=d(c).hasClass("hasFilters");a.filteredRows=b?d(c).find("tbody tr:not(.filtered)").length:a.totalRows;a.filteredPages=b?Math.ceil(a.filteredRows/a.size):a.totalPages;if(0 a.filteredRows,a.startRow=f?1:a.size*a.page+1,a.page=f?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),e=d(a.cssPageDisplay,a.container),b=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]}),e[0]&&(e["INPUT"===e[0].tagName?"val": "html"](b),d(a.cssGoto,a.container).length))){f="";e=Math.min(a.totalPages,a.filteredPages);for(b=1;b<=e;b++)f+="";d(a.cssGoto,a.container).html(f).val(a.page+1)}j(a);a.initialized&&d(c).trigger("pagerComplete",a)},u=function(c,a){var b,e=d(c.tBodies[0]);if(a.fixedHeight&&(e.find("tr.pagerSavedHeightSpacer").remove(),b=d.data(c,"pagerSavedHeight")))b-=e.height(),5')},s=function(c,a){var b=d(c.tBodies[0]);b.find("tr.pagerSavedHeightSpacer").remove();d.data(c,"pagerSavedHeight",b.height());u(c,a);d.data(c,"pagerLastSize",a.size)},m=function(c,a){if(!a.ajaxUrl){var b,e=d("tr:not(."+c.config.cssChildRow+")",c.tBodies),f=e.length,g=a.page*a.size,v=g+a.size,h=0;for(b=0;b=g&&h'+(e?e.message+" ("+e.name+")":"No rows found")+"",j=b.ajaxProcessing(c)||[0,[]],q=j[1]||[],s=q.length, p=j[2];if(0";for(f=0;f"+q[c][f]+"";n+=""}p&&p.length===m&&(g=i.hasClass("hasStickyHeaders"),h=i.find("."+(l.widgetOptions&&l.widgetOptions.stickyHeaders||"tablesorter-stickyheader")),v=i.find("tfoot tr:first").children(),i.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(p[a]).append(c),g&&h.length&&(c=h.find("th").eq(a).find("."+ l.cssIcon).clone(!0),h.find("th").eq(a).find(".tablesorter-header-inner").html(p[a]).append(c))):(b.find(".tablesorter-header-inner").html(p[a]),h.find("th").eq(a).find(".tablesorter-header-inner").html(p[a]));v.eq(a).html(p[a])}));e?i.find("thead").append(r):k.html(n);d.tablesorter.isProcessing(a);i.trigger("update");b.totalRows=j[0]||0;b.totalPages=Math.ceil(b.totalRows/b.size);t(a,b);u(a,b);b.initialized&&i.trigger("pagerChange",b)}b.initialized||(b.initialized=!0,d(a).trigger("pagerInitialized", b))},y=function(c,a){var b=a.ajaxUrl?a.ajaxUrl.replace(/\{page\}/g,a.page).replace(/\{size\}/g,a.size):"",e=[],f=c.config.sortList,g=b.match(/\{sortList[\s+]?:[\s+]?(.*)\}/);g&&(g=g[1],d.each(f,function(a,b){e.push(g+"["+b[0]+"]="+b[1])}),b=b.replace(/\{sortList[\s+]?:[\s+]?(.*)\}/g,e.length?e.join("&"):g));""!==b&&(d.tablesorter.isProcessing(c,!0),d(document).ajaxError(function(b,d,e,f){x(null,c,a,f)}),d.getJSON(b,function(b){x(b,c,a)}))},q=function(c,a,b){var e,f,g,j=document.createDocumentFragment(), h=a.length;e=b.page*b.size;var i=e+b.size;if(!(1>h)){b.initialized&&d(c).trigger("pagerChange",b);if(b.removeRows){i>a.length&&(i=a.length);d(c.tBodies[0]).addClass("tablesorter-hidden");for(d.tablesorter.clearTableBody(c);e=b.totalPages&&(b.page=Math.min(b.totalPages,b.filteredPages)-1,k(c,b));t(c,b);b.isDisabled||u(c,b);d(c).trigger("applyWidgets")}}, z=function(c,a){a.ajax?j(a,!0):(a.isDisabled=!0,d.data(c,"pagerLastPage",a.page),d.data(c,"pagerLastSize",a.size),a.page=0,a.size=a.totalRows,a.totalPages=1,d("tr.pagerSavedHeightSpacer",c.tBodies[0]).remove(),q(c,c.config.rowsCopy,a));d(a.container).find(a.cssPageSize+","+a.cssGoto).each(function(){d(this).addClass(a.cssDisabled)[0].disabled=!0})},k=function(c,a){if(!a.isDisabled){var b=Math.min(a.totalPages,a.filteredPages);if(0>a.page||a.page>b-1)a.page=0;a.ajax&&d.data(c,"pagerLastPage")!==a.page? y(c,a):a.ajax||q(c,c.config.rowsCopy,a);d.data(c,"pagerLastPage",a.page);a.initialized&&d(c).trigger("pageMoved",a)}},A=function(c,a,b){b.size=a;d.data(c,"pagerLastPage",b.page);d.data(c,"pagerLastSize",b.size);b.totalPages=Math.ceil(b.totalRows/b.size);k(c,b)},B=function(c,a,b){var e=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(c,"pagerLastPage")||a.page|| 0;a.size=d.data(c,"pagerLastSize")||parseInt(e.find("option[selected]").val(),10)||a.size;e.val(a.size);a.totalPages=Math.ceil(Math.min(a.totalPages,a.filteredPages)/a.size);b&&(d(c).trigger("update"),A(c,a.size,a),w(c,a),u(c,a))};r.appender=function(c,a){var b=c.config.pager;b.ajax||(c.config.rowsCopy=a,b.totalRows=a.length,b.size=d.data(c,"pagerLastSize")||b.size,b.totalPages=Math.ceil(b.totalRows/b.size),q(c,a,b))};r.construct=function(c){return this.each(function(){if(this.config&&this.hasInitialized){var a= this.config,b=a.pager=d.extend({},d.tablesorterPager.defaults,c),e=this,f=d(e),g=d(b.container).addClass("tablesorter-pager").show();a.appender=r.appender;b.initialized=!1;B(e,b,!1);"string"===typeof b.ajaxUrl?(b.ajax=!0,y(e,b)):(b.ajax=!1,d(this).trigger("appendCache",!0),w(e,b));d(e).unbind("filterEnd.pager updateComplete.pager ").bind("filterEnd.pager updateComplete.pager",function(){d(this).hasClass("hasFilters")&&(b.page=0,t(e,b),k(e,b),s(e,b))});d(b.cssGoto,g).length&&(d(b.cssGoto,g).bind("change", function(){b.page=d(this).val()-1;k(e,b)}),t(e,b));d(b.cssFirst,g).unbind("click.pager").bind("click.pager",function(){d(this).hasClass(b.cssDisabled)||(b.page=0,k(e,b));return!1});d(b.cssNext,g).unbind("click.pager").bind("click.pager",function(){d(this).hasClass(b.cssDisabled)||(b.page++,b.page>=Math.min(b.totalPages,b.filteredPages)-1&&(b.page=Math.min(b.totalPages,b.filteredPages)-1),k(e,b));return!1});d(b.cssPrev,g).unbind("click.pager").bind("click.pager",function(){d(this).hasClass(b.cssDisabled)|| (b.page--,0>=b.page&&(b.page=0),k(e,b));return!1});d(b.cssLast,g).unbind("click.pager").bind("click.pager",function(){d(this).hasClass(b.cssDisabled)||(b.page=Math.min(b.totalPages,b.filteredPages)-1,k(e,b));return!1});d(b.cssPageSize,g).unbind("change.pager").bind("change.pager",function(){d(b.cssPageSize,g).val(d(this).val());d(this).hasClass(b.cssDisabled)||(A(e,parseInt(d(this).val(),10),b),s(e,b));return!1});f.unbind("disable.pager enable.pager destroy.pager update.pager").bind("disable.pager", function(){z(e,b)}).bind("enable.pager",function(){B(e,b,!0)}).bind("destroy.pager",function(){z(e,b);d(b.container).hide();e.config.appender=null;d(e).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager")}).bind("update.pager",function(){m(e,b)});b.ajax||(b.initialized=!0,d(e).trigger("pagerInitialized",b))}})}}});d.fn.extend({tablesorterPager:d.tablesorterPager.construct})})(jQuery); diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index 83e77e40..99b81a95 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -1,5 +1,5 @@ /*! -* TableSorter 2.5.1 - Client-side table sorting with ease! +* TableSorter 2.5.2 - Client-side table sorting with ease! * @requires jQuery v1.2.6+ * * Copyright (c) 2007 Christian Bach @@ -23,7 +23,7 @@ var ts = this; - ts.version = "2.5.1"; + ts.version = "2.5.2"; ts.parsers = []; ts.widgets = []; diff --git a/js/jquery.tablesorter.min.js b/js/jquery.tablesorter.min.js index 4f6974f0..1f3601ec 100644 --- a/js/jquery.tablesorter.min.js +++ b/js/jquery.tablesorter.min.js @@ -1,5 +1,5 @@ /*! -* TableSorter 2.5.1 min - Client-side table sorting with ease! +* TableSorter 2.5.2 min - Client-side table sorting with ease! * Copyright (c) 2007 Christian Bach */ -!function(f){f.extend({tablesorter:new function(){function d(c){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(c):alert(c)}function u(c,b){d(c+" ("+((new Date).getTime()-b.getTime())+"ms)")}function n(c,b,a){if(!b)return"";var g=c.config,h=g.textExtraction,e="",e="simple"===h?g.supportsTextContent?b.textContent:f(b).text():"function"===typeof h?h(b,c,a):"object"===typeof h&&h.hasOwnProperty(a)?h[a](b,c,a):g.supportsTextContent?b.textContent:f(b).text();return f.trim(e)} function i(c){var b=c.config,a=f(c.tBodies).filter(":not(."+b.cssInfoBlock+")"),g,h,s,j,l,k,m="";if(0!==a.length){a=a[0].rows;if(a[0]){g=[];h=a[0].cells.length;for(s=0;s thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};e.benchmark=u;e.construct= function(c){return this.each(function(){if(this.tHead&&!(0===this.tBodies.length||!0===this.hasInitialized)){var b=f(this),a,g,h,s="",j,l,k,m,C=f.metadata;this.hasInitialized=!1;this.config={};a=f.extend(!0,this.config,e.defaults,c);f.data(this,"tablesorter",a);a.debug&&f.data(this,"startoveralltimer",new Date);a.supportsTextContent="x"===f("x")[0].textContent;a.supportsDataObject=1.4<=parseFloat(f.fn.jquery);a.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1}; /tablesorter\-/.test(b.attr("class"))||(s=""!==a.theme?" tablesorter-"+a.theme:"");b.addClass(a.tableClass+s);var q=[],M={},x=f(this).find("thead:eq(0) tr, tfoot tr"),H,I,v,y,L,A,J,N,O,F;for(H=0;H':"";this.innerHTML='
'+this.innerHTML+P+"
";w.onRenderHeader&&w.onRenderHeader.apply(z,[a]);this.column=M[this.parentNode.rowIndex+"-"+this.cellIndex];var b=e.getData(z,K,"sortInitialOrder")||w.sortInitialOrder;this.order= /^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;"false"===e.getData(z,K,"sorter")?(this.sortDisabled=!0,z.addClass("sorter-false")):z.removeClass("sorter-false");this.lockedOrder=!1;G=e.getData(z,K,"lockedOrder")||!1;"undefined"!==typeof G&&!1!==G&&(this.order=this.lockedOrder=/^d/i.test(G)||1===G?[1,1,1]:[0,0,0]);z.addClass((this.sortDisabled?"sorter-false ":" ")+w.cssHeader);w.headerList[a]=this;z.parent().addClass(w.cssHeaderRow)});this.config.debug&&(u("Built headers:",Q),d(q));a.$headers= q;a.parsers=i(this);a.delayInit||p(this);a.$headers.find("*").andSelf().filter(a.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter",function(c,d){var i=(this.tagName.match("TH|TD")?f(this):f(this).parents("th, td").filter(":last"))[0];if(1!==(c.which||c.button))return!1;if("mousedown"===c.type)return m=(new Date).getTime(),"INPUT"===c.target.tagName?"":!a.cancelSelection;if(!0!==d&&250<(new Date).getTime()-m)return!1;a.delayInit&&!a.cache&& p(b[0]);if(!i.sortDisabled){b.trigger("sortStart",b[0]);s=!c[a.sortMultiSortKey];i.count=(i.count+1)%(a.sortReset?3:2);a.sortRestart&&(g=i,a.$headers.each(function(){if(this!==g&&(s||!f(this).is("."+a.cssDesc+",."+a.cssAsc)))this.count=-1}));g=i.column;if(s){a.sortList=[];if(null!==a.sortForce){j=a.sortForce;for(h=0;hk&&(a.sortList.push([g,k]),1k&&(a.sortList.push([g,k]),1"),S=f(this).width();f("tr:first td",this.tBodies[0]).each(function(){R.append(f("").css("width",parseInt(1E3*(f(this).width()/S),10)/10+"%"))});f(this).prepend(R)}a.showProcessing&&b.unbind("sortBegin sortEnd").bind("sortBegin sortEnd",function(a){e.isProcessing(b[0], "sortBegin"===a.type)});this.hasInitialized=!0;a.debug&&e.benchmark("Overall initialization time",f.data(this,"startoveralltimer"));b.trigger("tablesorter-initialized",this);"function"===typeof a.initialized&&a.initialized(this)}})};e.isProcessing=function(c,b,a){var g=c.config,c=a||f(c).find("."+g.cssHeader);b?(0'),c=f.fn.detach?b.detach():b.remove();c=f(c).find("span.tablesorter-savemyplace");b.insertAfter(c);c.remove()};e.clearTableBody=function(c){f(c.tBodies).filter(":not(."+c.config.cssInfoBlock+")").empty()};e.destroy=function(c,b,a){var g=f(c),h=c.config,d=g.find("thead:first");c.hasInitialized=!1;d.find("tr:not(."+h.cssHeaderRow+")").remove();d.find(".tablesorter-resizer").remove();e.refreshWidgets(c,!0,!0); g.removeData("tablesorter").unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave").find("."+h.cssHeader).unbind("click mousedown mousemove mouseup").removeClass(h.cssHeader+" "+h.cssAsc+" "+h.cssDesc).find(".tablesorter-header-inner").each(function(){""!==h.cssIcon&&f(this).find("."+h.cssIcon).remove();f(this).replaceWith(f(this).contents())});!1!==b&&g.removeClass(h.tableClass);"function"===typeof a&&a(c)};e.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];e.sortText=function(c,b,a,g){if(b===a)return 0;var h=c.config,d=h.string[h.empties[g]||h.emptyTo],j=e.regex;if(""===b&&0!==d)return"boolean"===typeof d?d?-1:1:-d||-1;if(""===a&&0!==d)return"boolean"===typeof d?d?1:-1:d||1;if("function"===typeof h.textSorter)return h.textSorter(b,a,c,g);c=b.replace(j[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");g=a.replace(j[0], "\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=parseInt(b.match(j[2]),16)||1!==c.length&&b.match(j[1])&&Date.parse(b);if(a=parseInt(a.match(j[2]),16)||b&&a.match(j[1])&&Date.parse(a)||null){if(ba)return 1}h=Math.max(c.length,g.length);for(b=0;bj)return 1}return 0};e.sortTextDesc= function(c,b,a,g){if(b===a)return 0;var d=c.config,f=d.string[d.empties[g]||d.emptyTo];return""===b&&0!==f?"boolean"===typeof f?f?-1:1:f||1:""===a&&0!==f?"boolean"===typeof f?f?1:-1:-f||-1:"function"===typeof d.textSorter?d.textSorter(a,b,c,g):e.sortText(c,a,b)};e.getTextValue=function(c,b,a){if(b){for(var g=c.length,d=b+a,b=0;bf.inArray(j[g].id,i)))h.debug&&d("removing "+j[g].id),j[g].hasOwnProperty("remove")&&j[g].remove(c,h,h.widgetOptions);!0!==a&&e.applyWidget(c,b)};e.getData=function(c,b,a){var d="",c=f(c),e,i;if(!c.length)return""; e=f.metadata?c.metadata():!1;i=" "+(c.attr("class")||"");"undefined"!==typeof c.data(a)||"undefined"!==typeof c.data(a.toLowerCase())?d+=c.data(a)||c.data(a.toLowerCase()):e&&"undefined"!==typeof e[a]?d+=e[a]:b&&"undefined"!==typeof b[a]?d+=b[a]:" "!==i&&i.match(" "+a+"-")&&(d=i.match(RegExp(" "+a+"-(\\w+)"))[1]||"");return f.trim(d)};e.formatFloat=function(c,b){if("string"!==typeof c||""===c)return c;c=!1!==b.config.usNumberFormat?c.replace(/,/g,""):c.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(c)&& (c=c.replace(/^\s*\(/,"-").replace(/\)/,""));var a=parseFloat(c);return isNaN(a)?f.trim(c):a};e.isDigit=function(c){return isNaN(c)?/^[\-+(]?\d+[)]?$/.test(c.toString().replace(/[,.'\s]/g,"")):!0}}});var i=f.tablesorter;f.fn.extend({tablesorter:i.construct});i.addParser({id:"text",is:function(){return!0},format:function(d,u){var n=u.config,d=f.trim(n.ignoreCase?d.toLocaleLowerCase():d);return n.sortLocaleCompare?i.replaceAccents(d):d},type:"text"});i.addParser({id:"currency",is:function(d){return/^\(?[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+/.test(d)}, format:function(d,f){return i.formatFloat(d.replace(/[^\w,. \-()]/g,""),f)},type:"numeric"});i.addParser({id:"ipAddress",is:function(d){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(d)},format:function(d,f){var n,t=d.split("."),p="",r=t.length;for(n=0;n thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};e.benchmark=u;e.construct= function(c){return this.each(function(){if(this.tHead&&!(0===this.tBodies.length||!0===this.hasInitialized)){var b=f(this),a,g,h,s="",j,l,k,m,C=f.metadata;this.hasInitialized=!1;this.config={};a=f.extend(!0,this.config,e.defaults,c);f.data(this,"tablesorter",a);a.debug&&f.data(this,"startoveralltimer",new Date);a.supportsTextContent="x"===f("x")[0].textContent;a.supportsDataObject=1.4<=parseFloat(f.fn.jquery);a.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1}; /tablesorter\-/.test(b.attr("class"))||(s=""!==a.theme?" tablesorter-"+a.theme:"");b.addClass(a.tableClass+s);var q=[],M={},x=f(this).find("thead:eq(0) tr, tfoot tr"),H,I,v,y,L,A,J,N,O,F;for(H=0;H':"";this.innerHTML='
'+this.innerHTML+P+"
";w.onRenderHeader&&w.onRenderHeader.apply(z,[a]);this.column=M[this.parentNode.rowIndex+"-"+this.cellIndex];var b=e.getData(z,K,"sortInitialOrder")||w.sortInitialOrder;this.order= /^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;"false"===e.getData(z,K,"sorter")?(this.sortDisabled=!0,z.addClass("sorter-false")):z.removeClass("sorter-false");this.lockedOrder=!1;G=e.getData(z,K,"lockedOrder")||!1;"undefined"!==typeof G&&!1!==G&&(this.order=this.lockedOrder=/^d/i.test(G)||1===G?[1,1,1]:[0,0,0]);z.addClass((this.sortDisabled?"sorter-false ":" ")+w.cssHeader);w.headerList[a]=this;z.parent().addClass(w.cssHeaderRow)});this.config.debug&&(u("Built headers:",Q),d(q));a.$headers= q;a.parsers=i(this);a.delayInit||p(this);a.$headers.find("*").andSelf().filter(a.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter",function(c,d){var i=(this.tagName.match("TH|TD")?f(this):f(this).parents("th, td").filter(":last"))[0];if(1!==(c.which||c.button))return!1;if("mousedown"===c.type)return m=(new Date).getTime(),"INPUT"===c.target.tagName?"":!a.cancelSelection;if(!0!==d&&250<(new Date).getTime()-m)return!1;a.delayInit&&!a.cache&& p(b[0]);if(!i.sortDisabled){b.trigger("sortStart",b[0]);s=!c[a.sortMultiSortKey];i.count=(i.count+1)%(a.sortReset?3:2);a.sortRestart&&(g=i,a.$headers.each(function(){if(this!==g&&(s||!f(this).is("."+a.cssDesc+",."+a.cssAsc)))this.count=-1}));g=i.column;if(s){a.sortList=[];if(null!==a.sortForce){j=a.sortForce;for(h=0;hk&&(a.sortList.push([g,k]),1k&&(a.sortList.push([g,k]),1"),S=f(this).width();f("tr:first td",this.tBodies[0]).each(function(){R.append(f("").css("width",parseInt(1E3*(f(this).width()/S),10)/10+"%"))});f(this).prepend(R)}a.showProcessing&&b.unbind("sortBegin sortEnd").bind("sortBegin sortEnd",function(a){e.isProcessing(b[0], "sortBegin"===a.type)});this.hasInitialized=!0;a.debug&&e.benchmark("Overall initialization time",f.data(this,"startoveralltimer"));b.trigger("tablesorter-initialized",this);"function"===typeof a.initialized&&a.initialized(this)}})};e.isProcessing=function(c,b,a){var g=c.config,c=a||f(c).find("."+g.cssHeader);b?(0'),c=f.fn.detach?b.detach():b.remove();c=f(c).find("span.tablesorter-savemyplace");b.insertAfter(c);c.remove()};e.clearTableBody=function(c){f(c.tBodies).filter(":not(."+c.config.cssInfoBlock+")").empty()};e.destroy=function(c,b,a){var g=f(c),h=c.config,d=g.find("thead:first");c.hasInitialized=!1;d.find("tr:not(."+h.cssHeaderRow+")").remove();d.find(".tablesorter-resizer").remove();e.refreshWidgets(c,!0,!0); g.removeData("tablesorter").unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave").find("."+h.cssHeader).unbind("click mousedown mousemove mouseup").removeClass(h.cssHeader+" "+h.cssAsc+" "+h.cssDesc).find(".tablesorter-header-inner").each(function(){""!==h.cssIcon&&f(this).find("."+h.cssIcon).remove();f(this).replaceWith(f(this).contents())});!1!==b&&g.removeClass(h.tableClass);"function"===typeof a&&a(c)};e.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];e.sortText=function(c,b,a,g){if(b===a)return 0;var h=c.config,d=h.string[h.empties[g]||h.emptyTo],j=e.regex;if(""===b&&0!==d)return"boolean"===typeof d?d?-1:1:-d||-1;if(""===a&&0!==d)return"boolean"===typeof d?d?1:-1:d||1;if("function"===typeof h.textSorter)return h.textSorter(b,a,c,g);c=b.replace(j[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");g=a.replace(j[0], "\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=parseInt(b.match(j[2]),16)||1!==c.length&&b.match(j[1])&&Date.parse(b);if(a=parseInt(a.match(j[2]),16)||b&&a.match(j[1])&&Date.parse(a)||null){if(ba)return 1}h=Math.max(c.length,g.length);for(b=0;bj)return 1}return 0};e.sortTextDesc= function(c,b,a,g){if(b===a)return 0;var d=c.config,f=d.string[d.empties[g]||d.emptyTo];return""===b&&0!==f?"boolean"===typeof f?f?-1:1:f||1:""===a&&0!==f?"boolean"===typeof f?f?1:-1:-f||-1:"function"===typeof d.textSorter?d.textSorter(a,b,c,g):e.sortText(c,a,b)};e.getTextValue=function(c,b,a){if(b){for(var g=c.length,d=b+a,b=0;bf.inArray(j[g].id,i)))h.debug&&d("removing "+j[g].id),j[g].hasOwnProperty("remove")&&j[g].remove(c,h,h.widgetOptions);!0!==a&&e.applyWidget(c,b)};e.getData=function(c,b,a){var d="",c=f(c),e,i;if(!c.length)return""; e=f.metadata?c.metadata():!1;i=" "+(c.attr("class")||"");"undefined"!==typeof c.data(a)||"undefined"!==typeof c.data(a.toLowerCase())?d+=c.data(a)||c.data(a.toLowerCase()):e&&"undefined"!==typeof e[a]?d+=e[a]:b&&"undefined"!==typeof b[a]?d+=b[a]:" "!==i&&i.match(" "+a+"-")&&(d=i.match(RegExp(" "+a+"-(\\w+)"))[1]||"");return f.trim(d)};e.formatFloat=function(c,b){if("string"!==typeof c||""===c)return c;c=!1!==b.config.usNumberFormat?c.replace(/,/g,""):c.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(c)&& (c=c.replace(/^\s*\(/,"-").replace(/\)/,""));var a=parseFloat(c);return isNaN(a)?f.trim(c):a};e.isDigit=function(c){return isNaN(c)?/^[\-+(]?\d+[)]?$/.test(c.toString().replace(/[,.'\s]/g,"")):!0}}});var i=f.tablesorter;f.fn.extend({tablesorter:i.construct});i.addParser({id:"text",is:function(){return!0},format:function(d,u){var n=u.config,d=f.trim(n.ignoreCase?d.toLocaleLowerCase():d);return n.sortLocaleCompare?i.replaceAccents(d):d},type:"text"});i.addParser({id:"currency",is:function(d){return/^\(?[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+/.test(d)}, format:function(d,f){return i.formatFloat(d.replace(/[^\w,. \-()]/g,""),f)},type:"numeric"});i.addParser({id:"ipAddress",is:function(d){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(d)},format:function(d,f){var n,t=d.split("."),p="",r=t.length;for(n=0;n