diff --git a/README.md b/README.md index 638a63dce..45afaecbf 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,13 @@ 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.8.1 (3/27/2013) + +* Added `customAjaxUrl` option to the pager: + * This function is called after all processing has been applied to the `ajaxUrl` string. + * Use this function to make any other string modifications, as desired. + * Thanks to [Cthulhu59](https://github.com/Cthulhu59) for contributing. See [pull request #256](https://github.com/Mottie/tablesorter/pull/256). + #### Version 2.8 (3/27/2013) * Added an `updateAll` method diff --git a/addons/pager/jquery.tablesorter.pager.js b/addons/pager/jquery.tablesorter.pager.js index bc2e7704a..2d28f0aeb 100644 --- a/addons/pager/jquery.tablesorter.pager.js +++ b/addons/pager/jquery.tablesorter.pager.js @@ -20,8 +20,8 @@ // and a filterList = [[2,Blue],[3,13]] becomes "&fcol[2]=Blue&fcol[3]=13" in the url ajaxUrl: null, + // modify the url after all processing has been applied customAjaxUrl: function(table, url) { return url; }, - // process ajax so that the following information is returned: // [ total_rows (number), rows (array of arrays), headers (array; optional) ] @@ -230,7 +230,7 @@ $f.eq(j).html( th[j] ); }); } - + $t.find('thead tr.' + c.cssErrorRow).remove(); // Clean up any previous error. if ( exception ) { // add error row to thead instead of tbody, or clicking on the header will result in a parser error @@ -273,18 +273,14 @@ }); } }, - + getAjaxUrl = function(table, c) { - var 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) : '', sl = table.config.sortList, fl = c.currentFilters || [], sortCol = url.match(/\{sortList[\s+]?:[\s+]?([^}]*)\}/), filterCol = url.match(/\{filterList[\s+]?:[\s+]?([^}]*)\}/), arry = []; - - if ( typeof(c.customAjaxUrl) === "function" ) { - url = c.customAjaxUrl(table, url); - } if (sortCol) { sortCol = sortCol[1]; @@ -304,7 +300,11 @@ // if the arry is empty, just add the fcol parameter... "&{filterList:fcol}" becomes "&fcol" url = url.replace(/\{filterList[\s+]?:[\s+]?([^\}]*)\}/g, arry.length ? arry.join('&') : filterCol ); } - + + if ( typeof(c.customAjaxUrl) === "function" ) { + url = c.customAjaxUrl(table, url); + } + return url; }, @@ -569,7 +569,7 @@ } changeHeight(table, c); - + // pager initialized if (!c.ajax) { c.initialized = true; diff --git a/addons/pager/jquery.tablesorter.pager.min.js b/addons/pager/jquery.tablesorter.pager.min.js index ffe8a317a..245d40079 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 3/27/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(c,a){var b=c.cssDisabled,g=!!a,h=Math.min(c.totalPages,c.filteredPages);c.updateArrows&&(d(c.cssFirst+","+c.cssPrev,c.container)[g||0===c.page?"addClass":"removeClass"](b),d(c.cssNext+","+c.cssLast,c.container)[g||c.page===h-1?"addClass":"removeClass"](b))},t=function(c,a){var b,g,h;b=d(c).hasClass("hasFilters")&&!a.ajaxUrl;a.filteredRows=b?c.config.$tbodies.children("tr:not(.filtered,.remove-me)").length:a.totalRows;a.filteredPages=b?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),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]}), g[0]&&(g["INPUT"===g[0].tagName?"val":"html"](b),d(a.cssGoto,a.container).length))){h="";g=Math.min(a.totalPages,a.filteredPages);for(b=1;b<=g;b++)h+="";d(a.cssGoto,a.container).html(h).val(a.page+1)}s(a);a.initialized&&d(c).trigger("pagerComplete",a)},u=function(c,a){var b,g=d(c.tBodies[0]);if(a.fixedHeight&&(g.find("tr.pagerSavedHeightSpacer").remove(),b=d.data(c,"pagerSavedHeight")))b-=g.height(),5')},w=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)},n=function(c,a){if(!a.ajaxUrl){var b,g=d(c.tBodies).children("tr:not(."+c.config.cssChildRow+")"),h=g.length,e=a.page*a.size,f=e+a.size,k=0;for(b=0;b=e&&k'+(g?g.message+" ("+g.name+")":"No rows found")+"",n=b.ajaxProcessing(c)||[0,[]],p=n[1]||[],s=p.length,r=n[2];if(0";for(h=0;h"+p[c][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."+b.cssErrorRow).remove();g?j.find("thead").append(m):d(a.tBodies[0]).html(q);l.showProcessing&&d.tablesorter.isProcessing(a);j.trigger("update"); b.totalRows=n[0]||0;b.totalPages=Math.ceil(b.totalRows/b.size);t(a,b);u(a,b);b.initialized&&j.trigger("pagerChange",b)}b.initialized||(b.initialized=!0,d(a).trigger("pagerInitialized",b))},v=function(c,a,b){b.isDisabled=!1;var g,h,e,f=document.createDocumentFragment(),k=a.length;g=b.page*b.size;var j=g+b.size;if(!(1>k)){b.initialized&&d(c).trigger("pagerChange",b);if(b.removeRows){j>a.length&&(j=a.length);d(c.tBodies[0]).addClass("tablesorter-hidden");for(d.tablesorter.clearTableBody(c);g=b.totalPages&&A(c,b);t(c,b);b.isDisabled||u(c,b);d(c).trigger("applyWidgets")}},B=function(c,a){a.ajax?s(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(),v(c,c.config.rowsCopy,a));d(a.container).find(a.cssPageSize+","+ a.cssGoto).each(function(){d(this).addClass(a.cssDisabled)[0].disabled=!0})},m=function(c,a){if(!a.isDisabled){var b=Math.min(a.totalPages,a.filteredPages);0>a.page&&(a.page=0);a.page>b-1&&0!==b&&(a.page=b-1);if(a.ajax){var g,b=a.ajaxUrl?a.ajaxUrl.replace(/\{page\}/g,a.page).replace(/\{size\}/g,a.size):"",h=c.config.sortList,e=a.currentFilters||[],f=b.match(/\{sortList[\s+]?:[\s+]?([^}]*)\}/),k=b.match(/\{filterList[\s+]?:[\s+]?([^}]*)\}/),j=[];f&&(f=f[1],d.each(h,function(a,b){j.push(f+"["+b[0]+ "]="+b[1])}),b=b.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))}),b=b.replace(/\{filterList[\s+]?:[\s+]?([^\}]*)\}/g,j.length?j.join("&"):k));g=b;b=c.config;""!==g&&(b.showProcessing&&d.tablesorter.isProcessing(c,!0),d(document).bind("ajaxError.pager",function(b,e,f,h){f.url===g&&(z(null,c,a,h),d(document).unbind("ajaxError.pager"))}),d.getJSON(g,function(b){z(b,c,a);d(document).unbind("ajaxError.pager")}))}else a.ajax|| v(c,c.config.rowsCopy,a);d.data(c,"pagerLastPage",a.page);d.data(c,"pagerUpdateTriggered",!0);a.initialized&&d(c).trigger("pageMoved",a)}},C=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);m(c,b)},E=function(c,a){a.page=0;m(c,a)},A=function(c,a){a.page=Math.min(a.totalPages,a.filteredPages)-1;m(c,a)},F=function(c,a){a.page++;a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)- 1);m(c,a)},G=function(c,a){a.page--;0>=a.page&&(a.page=0);m(c,a)},D=function(c,a,b){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(c,"pagerLastPage")||a.page||0;a.size=d.data(c,"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);b&&(d(c).trigger("update"), C(c,a.size,a),x(c,a),u(c,a))};p.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),v(c,a,b))};p.construct=function(c){return this.each(function(){if(this.config&&this.hasInitialized){var a,b,g,h=this.config,e=h.pager=d.extend({},d.tablesorterPager.defaults,c),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(a){a.stopPropagation();B(f,e)}).bind("enable.pager",function(a){a.stopPropagation();D(f,e,!0)}).bind("destroy.pager",function(a){a.stopPropagation();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(a){a.stopPropagation();n(f,e)}).bind("pageSize.pager",function(a,b){a.stopPropagation();e.size=parseInt(b,10)||10;n(f,e);t(f,e)}).bind("pageSet.pager",function(a,b){a.stopPropagation();e.page=(parseInt(b,10)||1)-1;m(f,e);t(f,e)});b=[e.cssFirst,e.cssPrev,e.cssNext,e.cssLast];g=[E,G,F,A];l.find(b.join(",")).unbind("click.pager").bind("click.pager",function(){var a,c=d(this),h=b.length;if(!c.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),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]}),g[0]&&(g["INPUT"===g[0].tagName?"val":"html"](b),d(a.cssGoto,a.container).length))){h="";g=Math.min(a.totalPages,a.filteredPages);for(b=1;b<=g;b++)h+="";d(a.cssGoto,a.container).html(h).val(a.page+1)}s(a);a.initialized&&d(c).trigger("pagerComplete",a)},u=function(c,a){var b,g=d(c.tBodies[0]);if(a.fixedHeight&&(g.find("tr.pagerSavedHeightSpacer").remove(),b=d.data(c,"pagerSavedHeight")))b-=g.height(), 5')},w=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)},n=function(c,a){if(!a.ajaxUrl){var b,g=d(c.tBodies).children("tr:not(."+c.config.cssChildRow+")"),h=g.length,e=a.page*a.size, f=e+a.size,k=0;for(b=0;b=e&&k'+(g?g.message+" ("+g.name+")":"No rows found")+"",n=b.ajaxProcessing(c)||[0,[]],p=n[1]||[],s=p.length,r=n[2];if(0";for(h=0;h"+p[c][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."+b.cssErrorRow).remove();g?j.find("thead").append(m):d(a.tBodies[0]).html(q); l.showProcessing&&d.tablesorter.isProcessing(a);j.trigger("update");b.totalRows=n[0]||0;b.totalPages=Math.ceil(b.totalRows/b.size);t(a,b);u(a,b);b.initialized&&j.trigger("pagerChange",b)}b.initialized||(b.initialized=!0,d(a).trigger("pagerInitialized",b))},v=function(c,a,b){b.isDisabled=!1;var g,h,e,f=document.createDocumentFragment(),k=a.length;g=b.page*b.size;var j=g+b.size;if(!(1>k)){b.initialized&&d(c).trigger("pagerChange",b);if(b.removeRows){j>a.length&&(j=a.length);d(c.tBodies[0]).addClass("tablesorter-hidden"); for(d.tablesorter.clearTableBody(c);g=b.totalPages&&A(c,b);t(c,b);b.isDisabled||u(c,b);d(c).trigger("applyWidgets")}},B=function(c,a){a.ajax?s(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(),v(c,c.config.rowsCopy, a));d(a.container).find(a.cssPageSize+","+a.cssGoto).each(function(){d(this).addClass(a.cssDisabled)[0].disabled=!0})},m=function(c,a){if(!a.isDisabled){var b=Math.min(a.totalPages,a.filteredPages);0>a.page&&(a.page=0);a.page>b-1&&0!==b&&(a.page=b-1);if(a.ajax){var g,b=a.ajaxUrl?a.ajaxUrl.replace(/\{page\}/g,a.page).replace(/\{size\}/g,a.size):"",h=c.config.sortList,e=a.currentFilters||[],f=b.match(/\{sortList[\s+]?:[\s+]?([^}]*)\}/),k=b.match(/\{filterList[\s+]?:[\s+]?([^}]*)\}/),j=[];f&&(f=f[1], d.each(h,function(a,b){j.push(f+"["+b[0]+"]="+b[1])}),b=b.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))}),b=b.replace(/\{filterList[\s+]?:[\s+]?([^\}]*)\}/g,j.length?j.join("&"):k));"function"===typeof a.customAjaxUrl&&(b=a.customAjaxUrl(c,b));g=b;b=c.config;""!==g&&(b.showProcessing&&d.tablesorter.isProcessing(c,!0),d(document).bind("ajaxError.pager",function(b,e,f,h){f.url===g&&(z(null,c,a,h), d(document).unbind("ajaxError.pager"))}),d.getJSON(g,function(b){z(b,c,a);d(document).unbind("ajaxError.pager")}))}else a.ajax||v(c,c.config.rowsCopy,a);d.data(c,"pagerLastPage",a.page);d.data(c,"pagerUpdateTriggered",!0);a.initialized&&d(c).trigger("pageMoved",a)}},C=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);m(c,b)},E=function(c,a){a.page=0;m(c,a)},A=function(c,a){a.page=Math.min(a.totalPages,a.filteredPages)- 1;m(c,a)},F=function(c,a){a.page++;a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)-1);m(c,a)},G=function(c,a){a.page--;0>=a.page&&(a.page=0);m(c,a)},D=function(c,a,b){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(c,"pagerLastPage")||a.page||0;a.size=d.data(c,"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);b&&(d(c).trigger("update"),C(c,a.size,a),x(c,a),u(c,a))};p.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),v(c,a,b))};p.construct=function(c){return this.each(function(){if(this.config&&this.hasInitialized){var a,b,g,h=this.config,e=h.pager=d.extend({},d.tablesorterPager.defaults, c),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(a){a.stopPropagation();B(f,e)}).bind("enable.pager",function(a){a.stopPropagation();D(f,e,!0)}).bind("destroy.pager",function(a){a.stopPropagation();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(a){a.stopPropagation();n(f,e)}).bind("pageSize.pager",function(a,b){a.stopPropagation();e.size=parseInt(b,10)||10;n(f,e);t(f,e)}).bind("pageSet.pager",function(a,b){a.stopPropagation(); e.page=(parseInt(b,10)||1)-1;m(f,e);t(f,e)});b=[e.cssFirst,e.cssPrev,e.cssNext,e.cssLast];g=[E,G,F,A];l.find(b.join(",")).unbind("click.pager").bind("click.pager",function(){var a,c=d(this),h=b.length;if(!c.hasClass(e.cssDisabled))for(a=0;a':"";x.$headers=g(c).find(x.selectorHeaders).each(function(c){u=g(this);v=x.headers[c];x.headerContent[c]=this.innerHTML;A=x.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,B);x.onRenderTemplate&&(z=x.onRenderTemplate.apply(u,[c,A]))&&"string"===typeof z&&(A=z);this.innerHTML='
'+A+"
";x.onRenderHeader&&x.onRenderHeader.apply(u,[c]);this.column=a[this.parentNode.rowIndex+"-"+ this.cellIndex];var b=f.getData(u,v,"sortInitialOrder")||x.sortInitialOrder;this.order=/^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1;y=f.getData(u,v,"lockedOrder")||!1;"undefined"!==typeof y&&!1!==y&&(this.order=this.lockedOrder=/^d/i.test(y)||1===y?[1,1,1]:[0,0,0]);u.addClass(x.cssHeader);x.headerList[c]=this;u.parent().addClass(x.cssHeaderRow)});E(c);x.debug&&(w("Built headers:",D),d(x.$headers))}function A(c,b,a){var e=g(c);e.find(c.config.selectorRemove).remove();l(c); s(c);D(e,b,a)}function E(c){var b,a=c.config;a.$headers.each(function(c,d){b="false"===f.getData(d,a.headers[c],"sorter");d.sortDisabled=b;g(d)[b?"addClass":"removeClass"]("sorter-false")})}function y(c){var b,a,e,d=c.config,j=d.sortList,h=[d.cssAsc,d.cssDesc],k=g(c).find("tfoot tr").children().removeClass(h.join(" "));d.$headers.removeClass(h.join(" "));e=j.length;for(b=0;bp&&(n.sortList.push([m, p]),1p&&(n.sortList.push([m,p]),1 thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};f.benchmark=w;f.construct=function(c){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config&& this.config.debug?d("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var b=g(this),a=this,e,t="",j=g.metadata;a.hasInitialized=!1;a.isProcessing=!0;a.config={};e=g.extend(!0,a.config,f.defaults,c);g.data(a,"tablesorter",e);e.debug&&g.data(a,"startoveralltimer",new Date);e.supportsTextContent="x"===g("x")[0].textContent;e.supportsDataObject=1.4<=parseFloat(g.fn.jquery);e.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1}; /tablesorter\-/.test(b.attr("class"))||(t=""!==e.theme?" tablesorter-"+e.theme:"");e.$table=b.addClass(e.tableClass+t);e.$tbodies=b.children("tbody:not(."+e.cssInfoBlock+")");z(a);if(a.config.widthFixed&&0===g(a).find("colgroup").length){var h=g(""),k=g(a).width();g(a.tBodies[0]).find("tr:first").children("td").each(function(){h.append(g("").css("width",parseInt(1E3*(g(this).width()/k),10)/10+"%"))});g(a).prepend(h)}l(a);e.delayInit||s(a);I(a);e.supportsDataObject&&"undefined"!==typeof b.data().sortlist? e.sortList=b.data().sortlist:j&&(b.metadata()&&b.metadata().sortlist)&&(e.sortList=b.metadata().sortlist);f.applyWidget(a,!0);0'), a=g.fn.detach?b.detach():b.remove();a=g(c).find("span.tablesorter-savemyplace");b.insertAfter(a);a.remove();c.isProcessing=!1};f.clearTableBody=function(c){g(c)[0].config.$tbodies.empty()};f.restoreHeaders=function(c){var b=c.config;b.$headers.each(function(a){g(this).find(".tablesorter-header-inner").length&&g(this).html(b.headerContent[a])})};f.destroy=function(c,b,a){c=g(c)[0];if(c.hasInitialized){f.refreshWidgets(c,!0,!0);var e=g(c),d=c.config,j=e.find("thead:first"),h=j.find("tr."+d.cssHeaderRow).removeClass(d.cssHeaderRow), k=e.find("tfoot:first > tr").children("th, td");j.find("tr").not(h).remove();e.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave sortBegin sortEnd ".split(" ").join(".tablesorter "));d.$headers.add(k).removeClass(d.cssHeader+" "+d.cssAsc+" "+d.cssDesc).removeAttr("data-column");h.find(d.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter");f.restoreHeaders(c); !1!==b&&e.removeClass(d.tableClass+" tablesorter-"+d.theme);c.hasInitialized=!1;"function"===typeof a&&a(c)}};f.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];f.sortText=function(c,b,a,e){if(b===a)return 0;var d=c.config,j=d.string[d.empties[e]||d.emptyTo],h=f.regex;if(""===b&&0!==j)return"boolean"===typeof j?j?-1:1:-j||-1;if(""=== a&&0!==j)return"boolean"===typeof j?j?1:-1:j||1;if("function"===typeof d.textSorter)return d.textSorter(b,a,c,e);c=b.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");e=a.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=parseInt(b.match(h[2]),16)||1!==c.length&&b.match(h[1])&&Date.parse(b);if(a=parseInt(a.match(h[2]),16)||b&&a.match(h[1])&&Date.parse(a)||null){if(ba)return 1}d=Math.max(c.length,e.length);for(b=0;bh)return 1}return 0};f.sortTextDesc=function(c,b,a,e){if(b===a)return 0;var d=c.config,j=d.string[d.empties[e]||d.emptyTo];return""===b&&0!==j?"boolean"===typeof j?j?-1:1:j||1:""===a&&0!==j?"boolean"===typeof j?j?1:-1:-j||-1:"function"===typeof d.textSorter?d.textSorter(a,b,c,e):f.sortText(c,a,b)};f.getTextValue=function(c,b,a){if(b){var e= c?c.length:0,d=b+a;for(b=0;bg.inArray(h[e].id,j)))l.debug&&d("Refeshing widgets: Removing "+h[e].id),h[e].hasOwnProperty("remove")&&h[e].remove(c,l,l.widgetOptions);!0!==a&&f.applyWidget(c,b)};f.getData=function(c,b,a){var d="";c=g(c);var f,j;if(!c.length)return"";f=g.metadata?c.metadata():!1;j=" "+(c.attr("class")||""); "undefined"!==typeof c.data(a)||"undefined"!==typeof c.data(a.toLowerCase())?d+=c.data(a)||c.data(a.toLowerCase()):f&&"undefined"!==typeof f[a]?d+=f[a]:b&&"undefined"!==typeof b[a]?d+=b[a]:" "!==j&&j.match(" "+a+"-")&&(d=j.match(RegExp("\\s"+a+"-([\\w-]+)"))[1]||"");return g.trim(d)};f.formatFloat=function(c,b){if("string"!==typeof c||""===c)return c;var a;c=(b&&b.config?!1!==b.config.usNumberFormat:"undefined"!==typeof b?b:1)?c.replace(/,/g,""):c.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(c)&& (c=c.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(c);return isNaN(a)?g.trim(c):a};f.isDigit=function(c){return isNaN(c)?/^[\-+(]?\d+[)]?$/.test(c.toString().replace(/[,.'"\s]/g,"")):!0}}});var l=g.tablesorter;g.fn.extend({tablesorter:l.construct});l.addParser({id:"text",is:function(){return!0},format:function(d,w){var r=w.config;d&&(d=g.trim(r.ignoreCase?d.toLocaleLowerCase():d),d=r.sortLocaleCompare?l.replaceAccents(d):d);return d},type:"text"});l.addParser({id:"digit",is:function(d){return l.isDigit(d)}, format:function(d,g){return d?l.formatFloat(d.replace(/[^\w,. \-()]/g,""),g):d},type:"numeric"});l.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,g){return d?l.formatFloat(d.replace(/[^\w,. \-()]/g,""),g):d},type:"numeric"});l.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 r,u=d?d.split("."): "",s="",v=u.length;for(r=0;r':"";x.$headers=g(c).find(x.selectorHeaders).each(function(c){u=g(this);v=x.headers[c];x.headerContent[c]=this.innerHTML;A=x.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,B);x.onRenderTemplate&&(z=x.onRenderTemplate.apply(u,[c,A]))&&"string"===typeof z&&(A=z);this.innerHTML='
'+A+"
";x.onRenderHeader&&x.onRenderHeader.apply(u,[c]);this.column=a[this.parentNode.rowIndex+"-"+ this.cellIndex];var b=f.getData(u,v,"sortInitialOrder")||x.sortInitialOrder;this.order=/^d/i.test(b)||1===b?[1,0,2]:[0,1,2];this.count=-1;this.lockedOrder=!1;y=f.getData(u,v,"lockedOrder")||!1;"undefined"!==typeof y&&!1!==y&&(this.order=this.lockedOrder=/^d/i.test(y)||1===y?[1,1,1]:[0,0,0]);u.addClass(x.cssHeader);x.headerList[c]=this;u.parent().addClass(x.cssHeaderRow)});E(c);x.debug&&(w("Built headers:",D),d(x.$headers))}function A(c,b,a){var e=g(c);e.find(c.config.selectorRemove).remove();l(c); s(c);D(e,b,a)}function E(c){var b,a=c.config;a.$headers.each(function(c,d){b="false"===f.getData(d,a.headers[c],"sorter");d.sortDisabled=b;g(d)[b?"addClass":"removeClass"]("sorter-false")})}function y(c){var b,a,e,d=c.config,j=d.sortList,h=[d.cssAsc,d.cssDesc],k=g(c).find("tfoot tr").children().removeClass(h.join(" "));d.$headers.removeClass(h.join(" "));e=j.length;for(b=0;bp&&(n.sortList.push([m, p]),1p&&(n.sortList.push([m,p]),1 thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};f.benchmark=w;f.construct=function(c){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config&& this.config.debug?d("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var b=g(this),a=this,e,t="",j=g.metadata;a.hasInitialized=!1;a.isProcessing=!0;a.config={};e=g.extend(!0,a.config,f.defaults,c);g.data(a,"tablesorter",e);e.debug&&g.data(a,"startoveralltimer",new Date);e.supportsTextContent="x"===g("x")[0].textContent;e.supportsDataObject=1.4<=parseFloat(g.fn.jquery);e.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1}; /tablesorter\-/.test(b.attr("class"))||(t=""!==e.theme?" tablesorter-"+e.theme:"");e.$table=b.addClass(e.tableClass+t);e.$tbodies=b.children("tbody:not(."+e.cssInfoBlock+")");z(a);if(a.config.widthFixed&&0===g(a).find("colgroup").length){var h=g(""),k=g(a).width();g(a.tBodies[0]).find("tr:first").children("td").each(function(){h.append(g("").css("width",parseInt(1E3*(g(this).width()/k),10)/10+"%"))});g(a).prepend(h)}l(a);e.delayInit||s(a);I(a);e.supportsDataObject&&"undefined"!==typeof b.data().sortlist? e.sortList=b.data().sortlist:j&&(b.metadata()&&b.metadata().sortlist)&&(e.sortList=b.metadata().sortlist);f.applyWidget(a,!0);0'), a=g.fn.detach?b.detach():b.remove();a=g(c).find("span.tablesorter-savemyplace");b.insertAfter(a);a.remove();c.isProcessing=!1};f.clearTableBody=function(c){g(c)[0].config.$tbodies.empty()};f.restoreHeaders=function(c){var b=c.config;b.$headers.each(function(a){g(this).find(".tablesorter-header-inner").length&&g(this).html(b.headerContent[a])})};f.destroy=function(c,b,a){c=g(c)[0];if(c.hasInitialized){f.refreshWidgets(c,!0,!0);var e=g(c),d=c.config,j=e.find("thead:first"),h=j.find("tr."+d.cssHeaderRow).removeClass(d.cssHeaderRow), k=e.find("tfoot:first > tr").children("th, td");j.find("tr").not(h).remove();e.removeData("tablesorter").unbind("sortReset update updateAll updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave sortBegin sortEnd ".split(" ").join(".tablesorter "));d.$headers.add(k).removeClass(d.cssHeader+" "+d.cssAsc+" "+d.cssDesc).removeAttr("data-column");h.find(d.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter");f.restoreHeaders(c); !1!==b&&e.removeClass(d.tableClass+" tablesorter-"+d.theme);c.hasInitialized=!1;"function"===typeof a&&a(c)}};f.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];f.sortText=function(c,b,a,e){if(b===a)return 0;var d=c.config,j=d.string[d.empties[e]||d.emptyTo],h=f.regex;if(""===b&&0!==j)return"boolean"===typeof j?j?-1:1:-j||-1;if(""=== a&&0!==j)return"boolean"===typeof j?j?1:-1:j||1;if("function"===typeof d.textSorter)return d.textSorter(b,a,c,e);c=b.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");e=a.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");b=parseInt(b.match(h[2]),16)||1!==c.length&&b.match(h[1])&&Date.parse(b);if(a=parseInt(a.match(h[2]),16)||b&&a.match(h[1])&&Date.parse(a)||null){if(ba)return 1}d=Math.max(c.length,e.length);for(b=0;bh)return 1}return 0};f.sortTextDesc=function(c,b,a,e){if(b===a)return 0;var d=c.config,j=d.string[d.empties[e]||d.emptyTo];return""===b&&0!==j?"boolean"===typeof j?j?-1:1:j||1:""===a&&0!==j?"boolean"===typeof j?j?1:-1:-j||-1:"function"===typeof d.textSorter?d.textSorter(a,b,c,e):f.sortText(c,a,b)};f.getTextValue=function(c,b,a){if(b){var e= c?c.length:0,d=b+a;for(b=0;bg.inArray(h[e].id,j)))l.debug&&d("Refeshing widgets: Removing "+h[e].id),h[e].hasOwnProperty("remove")&&h[e].remove(c,l,l.widgetOptions);!0!==a&&f.applyWidget(c,b)};f.getData=function(c,b,a){var d="";c=g(c);var f,j;if(!c.length)return"";f=g.metadata?c.metadata():!1;j=" "+(c.attr("class")||""); "undefined"!==typeof c.data(a)||"undefined"!==typeof c.data(a.toLowerCase())?d+=c.data(a)||c.data(a.toLowerCase()):f&&"undefined"!==typeof f[a]?d+=f[a]:b&&"undefined"!==typeof b[a]?d+=b[a]:" "!==j&&j.match(" "+a+"-")&&(d=j.match(RegExp("\\s"+a+"-([\\w-]+)"))[1]||"");return g.trim(d)};f.formatFloat=function(c,b){if("string"!==typeof c||""===c)return c;var a;c=(b&&b.config?!1!==b.config.usNumberFormat:"undefined"!==typeof b?b:1)?c.replace(/,/g,""):c.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(c)&& (c=c.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(c);return isNaN(a)?g.trim(c):a};f.isDigit=function(c){return isNaN(c)?/^[\-+(]?\d+[)]?$/.test(c.toString().replace(/[,.'"\s]/g,"")):!0}}});var l=g.tablesorter;g.fn.extend({tablesorter:l.construct});l.addParser({id:"text",is:function(){return!0},format:function(d,w){var r=w.config;d&&(d=g.trim(r.ignoreCase?d.toLocaleLowerCase():d),d=r.sortLocaleCompare?l.replaceAccents(d):d);return d},type:"text"});l.addParser({id:"digit",is:function(d){return l.isDigit(d)}, format:function(d,g){return d?l.formatFloat(d.replace(/[^\w,. \-()]/g,""),g):d},type:"numeric"});l.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,g){return d?l.formatFloat(d.replace(/[^\w,. \-()]/g,""),g):d},type:"numeric"});l.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 r,u=d?d.split("."): "",s="",v=u.length;for(r=0;r