/* tablesorter pager plugin updated 6/28/2014 (v2.17.3) */ ;(function(h){var k=h.tablesorter;h.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(c,a){return a},ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(c){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,pageReset:0,size:10,savePages:!0,storageKey:"tablesorter-pager",fixedHeight:!1,countChildRows:!1,removeRows:!1,cssFirst:".first",cssPrev:".prev",cssNext:".next",cssLast:".last", cssGoto:".gotoPage",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssErrorRow:"tablesorter-errorRow",cssDisabled:"disabled",totalRows:0,totalPages:0,filteredRows:0,filteredPages:0,ajaxCounter:0,currentFilters:[],startRow:0,endRow:0,$size:null,last:{}};var w=this,p=function(c,a){var b=c.cssDisabled,e=!!a,g=e||0===c.page,f=Math.min(c.totalPages,c.filteredPages),e=e||c.page===f-1||0===f;c.updateArrows&&(c.$container.find(c.cssFirst+","+c.cssPrev)[g?"addClass":"removeClass"](b).attr("aria-disabled", g),c.$container.find(c.cssNext+","+c.cssLast)[e?"addClass":"removeClass"](b).attr("aria-disabled",e))},t=function(c,a,b){var e,g,f,l=c.config;e=l.$table.hasClass("hasFilters");f=[];g=a.size||10;f=[l.widgetOptions&&l.widgetOptions.filter_filteredRow||"filtered",l.selectorRemove.replace(/^(\w+\.)/g,"")];a.countChildRows&&f.push(l.cssChildRow);f.join("|");a.totalPages=Math.ceil(a.totalRows/g);e&&!a.ajaxUrl?(a.filteredRows=0,h.each(l.cache[0].normalized,function(d,c){a.filteredRows+=a.regexRows.test(c[l.columns].$row[0].className)? 0:1})):e||(a.filteredRows=a.totalRows);a.filteredPages=Math.ceil(a.filteredRows/g)||0;if(0<=Math.min(a.totalPages,a.filteredPages)&&(f=a.size*a.page>a.filteredRows,a.startRow=f?1:0===a.filteredRows?0: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=a.$container.find(a.cssPageDisplay),f=(a.ajaxData&&a.ajaxData.output?a.ajaxData.output||a.output:a.output).replace(/\{page([\-+]\d+)?\}/gi,function(d,c){return a.totalPages?a.page+(c?parseInt(c,10):1): 0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(d){d=d.replace(/[{}\s]/g,"");var c=d.split(":"),b=a.ajaxData,e=/(rows?|pages?)$/i.test(d)?0:"";return 1"+e+"";a.$goto.html(f).val(a.page+1)}p(a);a.initialized&&!1!==b&&(l.$table.trigger("pagerComplete",a),a.savePages&&k.storage&&k.storage(c,a.storageKey, {page:a.page,size:a.size}))},u=function(c,a){var b,e=c.config,g=e.$tbodies.eq(0);a.fixedHeight&&(g.find("tr.pagerSavedHeightSpacer").remove(),b=h.data(c,"pagerSavedHeight"))&&(b-=g.height(),5'))},z=function(c,a){var b=c.config.$tbodies.eq(0);b.find("tr.pagerSavedHeightSpacer").remove();h.data(c,"pagerSavedHeight", b.height());u(c,a);h.data(c,"pagerLastSize",a.size)},v=function(c,a){if(!a.ajaxUrl){var b,e=0,g=c.config,f=g.$tbodies.eq(0).children("tr"),h=f.length,d=a.page*a.size,m=d+a.size,n=g.widgetOptions&&g.widgetOptions.filter_filteredRow||"filtered",r=0;for(b=0;b=d&&r";for(g=0;g"+e[f][g]+"";p+=""}b.processAjaxOnInit&& s.$tbodies.eq(0).html(p)}b.processAjaxOnInit=!0;n&&n.length===c&&(m=(l=q.hasClass("hasStickyHeaders"))?s.widgetOptions.$sticky.children("thead:first").children("tr").children():"",d=q.find("tfoot tr:first").children(),s.$headers.filter("th").each(function(a){var c=h(this),b;c.find("."+k.css.icon).length?(b=c.find("."+k.css.icon).clone(!0),c.find(".tablesorter-header-inner").html(n[a]).append(b),l&&m.length&&(b=m.eq(a).find("."+k.css.icon).clone(!0),m.eq(a).find(".tablesorter-header-inner").html(n[a]).append(b))): (c.find(".tablesorter-header-inner").html(n[a]),l&&m.length&&m.eq(a).find(".tablesorter-header-inner").html(n[a]));d.eq(a).html(n[a])}))}s.showProcessing&&k.isProcessing(a);b.totalPages=Math.ceil(b.totalRows/(b.size||10));b.last.totalRows=b.totalRows;b.last.currentFilters=b.currentFilters;b.last.sortList=(s.sortList||[]).join(",");t(a,b);u(a,b);q.trigger("updateCache",[function(){b.initialized&&setTimeout(function(){q.trigger("applyWidgets").trigger("pagerChange",b)},0)}])}b.initialized||(b.initialized= !0,h(a).trigger("applyWidgets").trigger("pagerInitialized",b))},G=function(c,a){var b=F(c,a),e=h(document),g,f=c.config;""!==b&&(f.showProcessing&&k.isProcessing(c,!0),e.bind("ajaxError.pager",function(b,d,g,f){B(null,c,a,d,f);e.unbind("ajaxError.pager")}),g=++a.ajaxCounter,a.ajaxObject.url=b,a.ajaxObject.success=function(b,d,f){g(a&&a.length||0))){b.page>=b.totalPages&&C(c,b);b.isDisabled=!1;b.initialized&&d.trigger("pagerChange",b);if(b.removeRows){k.clearTableBody(c); e=k.processTbody(c,e.$tbodies.eq(0),!0);g=m?0:n;f=m?0:n;for(l=0;ln&&l<=r&&(l++,e.append(a[g]))),g++;k.processTbody(c,e,!1)}else v(c,b);t(c,b);b.isDisabled||u(c,b);d.trigger("applyWidgets");c.isUpdating&&d.trigger("updateComplete",c)}},D=function(c,a){a.ajax?p(a,!0):(a.isDisabled=!0,h.data(c,"pagerLastPage",a.page),h.data(c,"pagerLastSize",a.size),a.page=0,a.size=a.totalRows,a.totalPages=1,h(c).addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(), x(c,c.config.rowsCopy,a),c.config.debug&&k.log("pager disabled"));a.$size.add(a.$goto).each(function(){h(this).attr("aria-disabled","true").addClass(a.cssDisabled)[0].disabled=!0})},q=function(c,a,b){if(!a.isDisabled){var e=c.config,g=h(c),f=a.last,l=Math.min(a.totalPages,a.filteredPages);0>a.page&&(a.page=0);a.page>l-1&&0!==l&&(a.page=l-1);f.currentFilters=""===(f.currentFilters||[]).join("")?[]:f.currentFilters;a.currentFilters=""===(a.currentFilters||[]).join("")?[]:a.currentFilters;if(f.page!== a.page||f.size!==a.size||f.totalRows!==a.totalRows||(f.currentFilters||[]).join(",")!==(a.currentFilters||[]).join(",")||f.sortList!==(e.sortList||[]).join(","))e.debug&&k.log("Pager changing to page "+a.page),a.last={page:a.page,size:a.size,sortList:(e.sortList||[]).join(","),totalRows:a.totalRows,currentFilters:a.currentFilters||[]},a.ajax?G(c,a):a.ajax||x(c,e.rowsCopy,a),h.data(c,"pagerLastPage",a.page),a.initialized&&!1!==b&&(g.trigger("pageMoved",a).trigger("applyWidgets"),c.isUpdating&&g.trigger("updateComplete"))}}, y=function(c,a,b){b.size=a||b.size||10;b.$size.val(b.size);h.data(c,"pagerLastPage",b.page);h.data(c,"pagerLastSize",b.size);b.totalPages=Math.ceil(b.totalRows/b.size);b.filteredPages=Math.ceil(b.filteredRows/b.size);q(c,b)},H=function(c,a){a.page=0;q(c,a)},C=function(c,a){a.page=Math.min(a.totalPages,a.filteredPages)-1;q(c,a)},I=function(c,a){a.page++;a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)-1);q(c,a)},J=function(c,a){a.page--;0>=a.page&&(a.page= 0);q(c,a)},E=function(c,a,b){var e,g=c.config;a.$size.add(a.$goto).removeClass(a.cssDisabled).removeAttr("disabled").attr("aria-disabled","false");a.isDisabled=!1;a.page=h.data(c,"pagerLastPage")||a.page||0;a.size=h.data(c,"pagerLastSize")||parseInt(a.$size.find("option[selected]").val(),10)||a.size||10;a.$size.val(a.size);a.totalPages=Math.ceil(Math.min(a.totalRows,a.filteredRows)/a.size);c.id&&(e=c.id+"_pager_info",a.$container.find(a.cssPageDisplay).attr("id",e),g.$table.attr("aria-describedby", e));b&&(g.$table.trigger("updateRows"),y(c,a.size,a),A(c,a),u(c,a),g.debug&&k.log("pager enabled"))};w.appender=function(c,a){var b=c.config,e=b.pager;e.ajax||(b.rowsCopy=a,e.totalRows=e.countChildRows?b.$tbodies.eq(0).children("tr").length:a.length,e.size=h.data(c,"pagerLastSize")||e.size||10,e.totalPages=Math.ceil(e.totalRows/e.size),x(c,a,e),t(c,e,!1))};w.construct=function(c){return this.each(function(){if(this.config&&this.hasInitialized){var a,b,e,g=this,f=g.config,l=f.widgetOptions,d=f.pager= h.extend(!0,{},h.tablesorterPager.defaults,c),m=f.$table,n=d.$container=h(d.container).addClass("tablesorter-pager").show();f.debug&&k.log("Pager initializing");d.oldAjaxSuccess=d.oldAjaxSuccess||d.ajaxObject.success;f.appender=w.appender;k.filter&&0<=h.inArray("filter",f.widgets)&&(d.currentFilters=f.$table.data("lastSearch")||k.filter.setDefaults(g,f,f.widgetOptions)||[],k.setFilters(g,d.currentFilters,!1));d.savePages&&k.storage&&(a=k.storage(g,d.storageKey)||{},d.page=isNaN(a.page)?d.page:a.page, d.size=(isNaN(a.size)?d.size:a.size)||10,h.data(g,"pagerLastSize",d.size));d.regexRows=new RegExp("("+(l.filter_filteredRow||"filtered")+"|"+f.selectorRemove.replace(/^(\w+\.)/g,"")+"|"+f.cssChildRow+")");m.unbind("filterStart filterEnd sortEnd disable enable destroy update updateRows updateAll addRows pageSize ".split(" ").join(".pager ")).bind("filterStart.pager",function(a,b){d.currentFilters=b;!1!==d.pageReset&&(f.lastCombinedFilter||"")!==(b||[]).join("")&&(d.page=d.pageReset)}).bind("filterEnd.pager sortEnd.pager", function(){d.initialized&&(t(g,d,!1),q(g,d,!1),u(g,d))}).bind("disable.pager",function(a){a.stopPropagation();D(g,d)}).bind("enable.pager",function(a){a.stopPropagation();E(g,d,!0)}).bind("destroy.pager",function(a){a.stopPropagation();D(g,d);d.$container.hide();g.config.appender=null;d.initialized=!1;delete g.config.rowsCopy;h(g).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager");k.storage&&k.storage(g,d.storageKey,"")}).bind("update.pager updateRows.pager updateAll.pager addRows.pager ", function(a){a.stopPropagation();u(g,d);a=f.$tbodies.eq(0).children("tr");d.totalRows=a.length-(d.countChildRows?0:a.filter("."+f.cssChildRow).length);d.totalPages=Math.ceil(d.totalRows/d.size);t(g,d);v(g,d)}).bind("pageSize.pager",function(a,b){a.stopPropagation();y(g,parseInt(b,10)||10,d);v(g,d);t(g,d,!1);d.$size.length&&d.$size.val(d.size)}).bind("pageSet.pager",function(a,b){a.stopPropagation();d.page=(parseInt(b,10)||1)-1;d.$goto.length&&d.$goto.val(d.size);q(g,d);t(g,d,!1)});b=[d.cssFirst,d.cssPrev, d.cssNext,d.cssLast];e=[H,J,I,C];n.find(b.join(",")).attr("tabindex",0).unbind("click.pager").bind("click.pager",function(a){a.stopPropagation();var c=h(this),f=b.length;if(!c.hasClass(d.cssDisabled))for(a=0;a/.test(p)?h(p):h(''+p+"")).click(function(){h(this).remove()}).appendTo(k.$table.find("thead:first")).addClass(u+" "+k.selectorRemove.replace(/^(\w+\.)/g,"")).attr({role:"alert","aria-live":"assertive"}))})};h.fn.extend({tablesorterPager:h.tablesorterPager.construct})})(jQuery);