tablesorter/dist/js/extras/jquery.tablesorter.pager.min.js
Rob Garrison 97784fac29 v2.28.4
2017-01-06 20:56:05 -06:00

5 lines
20 KiB
JavaScript

/*!
* tablesorter (FORK) pager plugin
* updated 1/6/2017 (v2.28.4)
*/
!function(a){"use strict";var b=a.tablesorter;a.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(a,b){return b},ajaxError:null,ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(a){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,pageReset:0,size:10,maxOptionSize:20,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 c="filterInit filterStart filterEnd sortEnd disablePager enablePager destroyPager updateComplete pageSize pageSet pageAndSize pagerUpdate refreshComplete ",d=this,e=function(a,b,c){var d,e="addClass",f="removeClass",g=b.cssDisabled,h=!!c,i=h||0===b.page,j=t(a,b),k=h||b.page===j-1||0===j;b.updateArrows&&(d=b.$container.find(b.cssFirst+","+b.cssPrev),d[i?e:f](g),d.each(function(){this.ariaDisabled=i}),d=b.$container.find(b.cssNext+","+b.cssLast),d[k?e:f](g),d.each(function(){this.ariaDisabled=k}))},f=function(a,c){var d,e,f,g=a.config,h=g.$table.hasClass("hasFilters");if(h&&!c.ajax)if(b.isEmptyObject(g.cache))c.filteredRows=c.totalRows=g.$tbodies.eq(0).children("tr").not(c.countChildRows?"":"."+g.cssChildRow).length;else for(c.filteredRows=0,d=g.cache[0].normalized,f=d.length,e=0;e<f;e++)c.filteredRows+=c.regexRows.test(d[e][g.columns].$row[0].className)?0:1;else h||(c.filteredRows=c.totalRows)},g=function(c,d,g){if(!d.initializing){var j,k,l,m,n,o,p,q,r=c.config,s=r.namespace+"pager",w=u(d,d.size,"get");if("all"===w&&(w=d.totalRows),d.countChildRows&&(k[k.length]=r.cssChildRow),d.totalPages=Math.ceil(d.totalRows/w),r.totalRows=d.totalRows,v(c,d),f(c,d),r.filteredRows=d.filteredRows,d.filteredPages=Math.ceil(d.filteredRows/w)||0,t(c,d)>=0){if(k=w*d.page>d.filteredRows&&g,d.page=k?d.pageReset||0:d.page,d.startRow=k?w*d.page+1:0===d.filteredRows?0:w*d.page+1,d.endRow=Math.min(d.filteredRows,d.totalRows,w*(d.page+1)),l=d.$container.find(d.cssPageDisplay),"function"==typeof d.output?j=d.output(c,d):(q=l.attr("data-pager-output"+(d.filteredRows<d.totalRows?"-filtered":""))||d.output,j=(d.ajaxData&&d.ajaxData.output?d.ajaxData.output||q:q).replace(/\{page([\-+]\d+)?\}/gi,function(a,b){return d.totalPages?d.page+(b?parseInt(b,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(a){var b,c,e=a.replace(/[{}\s]/g,""),f=e.split(":"),g=d.ajaxData,h=/(rows?|pages?)$/i.test(e)?0:"";return/(startRow|page)/.test(f[0])&&"input"===f[1]?(b=(""+("page"===f[0]?d.totalPages:d.totalRows)).length,c="page"===f[0]?d.page+1:d.startRow,'<input type="text" class="ts-'+f[0]+'" style="max-width:'+b+'em" value="'+c+'"/>'):f.length>1&&g&&g[f[0]]?g[f[0]][f[1]]:d[e]||(g?g[e]:h)||h})),m=d.$container.find(d.cssGoto),m.length){for(k="",p=h(c,d),o=p.length,n=0;n<o;n++)k+='<option value="'+p[n]+'">'+p[n]+"</option>";m.html(k).val(d.page+1)}l.length&&(l["INPUT"===l[0].nodeName?"val":"html"](j),l.find(".ts-startRow, .ts-page").unbind("change"+s).bind("change"+s,function(){var b=a(this).val(),c=a(this).hasClass("ts-startRow")?Math.floor(b/w)+1:b;r.$table.triggerHandler("pageSet"+s,[c])}))}e(c,d),i(c,d),d.initialized&&g!==!1&&(r.debug&&console.log("Pager: Triggering pagerComplete"),r.$table.triggerHandler("pagerComplete",d),d.savePages&&b.storage&&b.storage(c,d.storageKey,{page:d.page,size:w===d.totalRows?"all":w}))}},h=function(b,c){var d,e,f,g,h,i,j=t(b,c)||1,k=5*Math.ceil(j/c.maxOptionSize/5),l=j>c.maxOptionSize,m=c.page+1,n=k,o=j-k,p=[1],q=l?k:1;for(d=q;d<=j;)p[p.length]=d,d+=l?k:1;if(p[p.length]=j,l){for(f=[],e=Math.max(Math.floor(c.maxOptionSize/k)-1,5),n=m-e,n<1&&(n=1),o=m+e,o>j&&(o=j),d=n;d<=o;d++)f[f.length]=d;p=a.grep(p,function(b,c){return a.inArray(b,p)===c}),h=p.length,i=f.length,h-i>k/2&&h+i>c.maxOptionSize&&(g=Math.floor(h/2)-Math.floor(i/2),Array.prototype.splice.apply(p,[g,i])),p=p.concat(f)}return p=a.grep(p,function(b,c){return a.inArray(b,p)===c}).sort(function(a,b){return a-b})},i=function(b,c){var d,e,f=b.config,g=f.$tbodies.eq(0);g.find("tr.pagerSavedHeightSpacer").remove(),c.fixedHeight&&!c.isDisabled&&(e=a.data(b,"pagerSavedHeight"),e&&(d=e-g.height(),d>5&&a.data(b,"pagerLastSize")===c.size&&g.children("tr:visible").length<("all"===c.size?c.totalRows:c.size)&&g.append('<tr class="pagerSavedHeightSpacer '+f.selectorRemove.slice(1)+'" style="height:'+d+'px;"></tr>')))},j=function(b,c){var d,e=b.config,f=e.$tbodies.eq(0);f.find("tr.pagerSavedHeightSpacer").remove(),f.children("tr:visible").length||f.append('<tr class="pagerSavedHeightSpacer '+e.selectorRemove.slice(1)+'"><td>&nbsp</td></tr>'),d=f.children("tr").eq(0).height()*("all"===c.size?c.totalRows:c.size),a.data(b,"pagerSavedHeight",d),i(b,c),a.data(b,"pagerLastSize",c.size)},k=function(a,c){if(!c.ajaxUrl){var d,e=0,f=a.config,g=f.$tbodies.eq(0).children("tr"),h=g.length,i="all"===c.size?c.totalRows:c.size,j=c.page*i,k=j+i,l=0,m=0;for(c.cacheIndex=[],d=0;d<h;d++)c.regexFiltered.test(g[d].className)||(m===j&&g[d].className.match(f.cssChildRow)?g[d].style.display="none":(g[d].style.display=m>=j&&m<k?"":"none",l!==m&&m>=j&&m<k&&(c.cacheIndex[c.cacheIndex.length]=d,l=m),m+=g[d].className.match(f.cssChildRow+"|"+f.selectorRemove.slice(1))&&!c.countChildRows?0:1,m===k&&"none"!==g[d].style.display&&g[d].className.match(b.css.cssHasChild)&&(e=d)));if(e>0&&g[e].className.match(b.css.cssHasChild))for(;++e<h&&g[e].className.match(f.cssChildRow);)g[e].style.display=""}},l=function(b,c){var d=c.$container.find(c.cssPageSize);c.size=u(c,d.val(),"get"),d.val(c.size),a.data(b,"pagerLastSize",c.size),e(b,c),c.removeRows||(k(b,c),a(b).bind("sortEnd filterEnd ".split(" ").join(b.config.namespace+"pager "),function(){k(b,c)}))},m=function(c,d,e,f,h,i){if("function"==typeof e.ajaxProcessing){d.config.$tbodies.eq(0).empty();var j,k,l,m,n,o,p,q,r,s,t,v,w,x,y,z=d.config,A=z.$table,C="",D=e.ajaxProcessing(c,d,f)||[0,[]];A.find("thead th").length;if(b.showError(d),i)z.debug&&console.error("Pager: >> Ajax Error",f,h,i),b.showError(d,f,h,i),z.$tbodies.eq(0).children("tr").detach(),e.totalRows=0;else{if(a.isArray(D)?(l=isNaN(D[0])&&!isNaN(D[1]),w=D[l?1:0],e.totalRows=isNaN(w)?e.totalRows||0:w,z.totalRows=z.filteredRows=e.filteredRows=e.totalRows,t=0===e.totalRows?[]:D[l?0:1]||[],s=D[2]):(e.ajaxData=D,z.totalRows=e.totalRows=D.total,z.filteredRows=e.filteredRows="undefined"!=typeof D.filteredRows?D.filteredRows:D.total,s=D.headers,t=D.rows||[]),v=t&&t.length,t instanceof jQuery)e.processAjaxOnInit&&(z.$tbodies.eq(0).empty(),z.$tbodies.eq(0).append(t));else if(v){for(j=0;j<v;j++){for(C+="<tr>",k=0;k<t[j].length;k++)C+=/^\s*<td/.test(t[j][k])?a.trim(t[j][k]):"<td>"+t[j][k]+"</td>";C+="</tr>"}e.processAjaxOnInit&&z.$tbodies.eq(0).html(C)}if(e.processAjaxOnInit=!0,s)for(m=A.hasClass("hasStickyHeaders"),o=m?z.widgetOptions.$sticky.children("thead:first").children("tr:not(."+z.cssIgnoreRow+")").children():"",n=A.find("tfoot tr:first").children(),p=z.$headers.filter("th "),x=p.length,k=0;k<x;k++)q=p.eq(k),q.find("."+b.css.icon).length?(r=q.find("."+b.css.icon).clone(!0),q.find("."+b.css.headerIn).html(s[k]).append(r),m&&o.length&&(r=o.eq(k).find("."+b.css.icon).clone(!0),o.eq(k).find("."+b.css.headerIn).html(s[k]).append(r))):(q.find("."+b.css.headerIn).html(s[k]),m&&o.length&&(e.$container=e.$container.add(z.widgetOptions.$sticky),o.eq(k).find("."+b.css.headerIn).html(s[k]))),n.eq(k).html(s[k])}z.showProcessing&&b.isProcessing(d),y=u(e,e.size,"get"),e.totalPages="all"===y?1:Math.ceil(e.totalRows/y),e.last.totalRows=e.totalRows,e.last.currentFilters=e.currentFilters,e.last.sortList=(z.sortList||[]).join(","),g(d,e,!1),b.updateCache(z,function(){e.initialized&&setTimeout(function(){z.debug&&console.log("Pager: Triggering pagerChange"),A.triggerHandler("pagerChange",e),b.applyWidget(d),g(d,e,!0)},0)})}e.initialized||B(d,e)},n=function(c,d){var e,f=o(c,d),g=a(document),h=c.config,i=h.namespace+"pager";""!==f&&(h.showProcessing&&b.isProcessing(c,!0),g.bind("ajaxError"+i,function(a,b,e,f){m(null,c,d,b,e,f),g.unbind("ajaxError"+i)}),e=++d.ajaxCounter,d.last.ajaxUrl=f,d.ajaxObject.url=f,d.ajaxObject.success=function(a,b,f){e<d.ajaxCounter||(m(a,c,d,f),g.unbind("ajaxError"+i),"function"==typeof d.oldAjaxSuccess&&d.oldAjaxSuccess(a))},h.debug&&console.log("Pager: Ajax initialized",d.ajaxObject),a.ajax(d.ajaxObject))},o=function(b,c){var d,e,f=b.config,g=c.ajaxUrl?c.ajaxUrl.replace(/\{page([\-+]\d+)?\}/,function(a,b){return c.page+(b?parseInt(b,10):0)}).replace(/\{size\}/g,c.size):"",h=f.sortList,i=c.currentFilters||a(b).data("lastSearch")||[],j=g.match(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/),k=g.match(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/),l=[];if(j){for(j=j[1],e=h.length,d=0;d<e;d++)l[l.length]=j+"["+h[d][0]+"]="+h[d][1];g=g.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g,l.length?l.join("&"):j),l=[]}if(k){for(k=k[1],e=i.length,d=0;d<e;d++)i[d]&&(l[l.length]=k+"["+d+"]="+encodeURIComponent(i[d]));g=g.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g,l.length?l.join("&"):k),c.currentFilters=i}return"function"==typeof c.customAjaxUrl&&(g=c.customAjaxUrl(b,g)),f.debug&&console.log("Pager: Ajax url = "+g),g},p=function(c,d,e){var f,h,i,j,l=a(c),m=c.config,n=m.$table.hasClass("hasFilters"),o=d&&d.length||0,p="all"===e.size?e.totalRows:e.size,q=e.page*p;if(o<1)return void(m.debug&&console.warn("Pager: >> No rows for pager to render"));if(e.page>=e.totalPages&&y(c,e),e.cacheIndex=[],e.isDisabled=!1,e.initialized&&(m.debug&&console.log("Pager: Triggering pagerChange"),l.triggerHandler("pagerChange",e)),e.removeRows){for(b.clearTableBody(c),f=b.processTbody(c,m.$tbodies.eq(0),!0),h=n?0:q,i=n?0:q,j=0;j<p&&h<d.length;)n&&e.regexFiltered.test(d[h][0].className)||(i++,i>q&&j<=p&&(j++,e.cacheIndex[e.cacheIndex.length]=h,f.append(d[h]))),h++;b.processTbody(c,f,!1)}else k(c,e);g(c,e),c.isUpdating&&(m.debug&&console.log("Pager: Triggering updateComplete"),l.triggerHandler("updateComplete",[c,!0]))},q=function(c,d){var f,g,h;for(d.ajax?e(c,d,!0):(a.data(c,"pagerLastPage",d.page),a.data(c,"pagerLastSize",d.size),d.page=0,d.size="all",d.totalPages=1,a(c).addClass("pagerDisabled").removeAttr("aria-describedby").find("tr.pagerSavedHeightSpacer").remove(),p(c,c.config.rowsCopy,d),d.isDisabled=!0,b.applyWidget(c),c.config.debug&&console.log("Pager: Disabled")),g=d.$container.find(d.cssGoto+","+d.cssPageSize+", .ts-startRow, .ts-page"),h=g.length,f=0;f<h;f++)g.eq(f).addClass(d.cssDisabled)[0].disabled=!0,g[f].ariaDisabled=!0},r=function(a){var c=a.config,d=c.pager;b.updateCache(c,function(){var b,e=[],f=a.config.cache[0].normalized;for(d.totalRows=f.length,b=0;b<d.totalRows;b++)e[e.length]=f[b][c.columns].$row;c.rowsCopy=e,s(a,d,!0)})},s=function(c,d,e){if(!d.isDisabled){var g,h=c.config,i=a(c),j=d.last;return e!==!1&&d.initialized&&b.isEmptyObject(h.cache)?r(c):void(d.ajax&&b.hasWidget(c,"filter")&&!h.widgetOptions.filter_initialized||(v(c,d),f(c,d),j.currentFilters=""===(j.currentFilters||[]).join("")?[]:j.currentFilters,d.currentFilters=""===(d.currentFilters||[]).join("")?[]:d.currentFilters,j.page===d.page&&j.size===d.size&&j.totalRows===d.totalRows&&(j.currentFilters||[]).join(",")===(d.currentFilters||[]).join(",")&&(j.ajaxUrl||"")===(d.ajaxObject.url||"")&&(j.optAjaxUrl||"")===(d.ajaxUrl||"")&&j.sortList===(h.sortList||[]).join(",")||(h.debug&&console.log("Pager: Changing to page "+d.page),d.last={page:d.page,size:d.size,sortList:(h.sortList||[]).join(","),totalRows:d.totalRows,currentFilters:d.currentFilters||[],ajaxUrl:d.ajaxObject.url||"",optAjaxUrl:d.ajaxUrl||""},d.ajax?d.processAjaxOnInit||b.isEmptyObject(d.initialRows)?n(c,d):(d.processAjaxOnInit=!0,g=d.initialRows,d.totalRows="undefined"!=typeof g.total?g.total:h.debug?console.error("Pager: no initial total page set!")||0:0,d.filteredRows="undefined"!=typeof g.filtered?g.filtered:h.debug?console.error("Pager: no initial filtered page set!")||0:0,B(c,d)):d.ajax||p(c,h.rowsCopy,d),a.data(c,"pagerLastPage",d.page),d.initialized&&e!==!1&&(h.debug&&console.log("Pager: Triggering pageMoved"),i.triggerHandler("pageMoved",d),b.applyWidget(c),c.isUpdating&&(h.debug&&console.log("Pager: Triggering updateComplete"),i.triggerHandler("updateComplete",[c,!0]))))))}},t=function(a,c){return b.hasWidget(a,"filter")?Math.min(c.totalPages,c.filteredPages):c.totalPages},u=function(a,b,c){var d=parseInt(b,10)||a.size||a.settings.size||10;return a.initialized&&(/all/i.test(b)||d===a.totalRows)?"all":"get"===c?d:a.size},v=function(a,b){var c=t(a,b)-1;return b.page=parseInt(b.page,10),(b.page<0||isNaN(b.page))&&(b.page=0),b.page>c&&c>=0&&(b.page=c),b.page},w=function(b,c,d){d.size=u(d,c,"get"),d.$container.find(d.cssPageSize).val(u(d,d.size,"set")),a.data(b,"pagerLastPage",v(b,d)),a.data(b,"pagerLastSize",d.size),d.totalPages="all"===d.size?1:Math.ceil(d.totalRows/d.size),d.filteredPages="all"===d.size?1:Math.ceil(d.filteredRows/d.size),s(b,d)},x=function(a,b){b.page=0,s(a,b)},y=function(a,b){b.page=t(a,b)-1,s(a,b)},z=function(a,b){b.page++;var c=t(a,b)-1;b.page>=c&&(b.page=c),s(a,b)},A=function(a,b){b.page--,b.page<=0&&(b.page=0),s(a,b)},B=function(c,d){d.initialized=!0,d.initializing=!1,c.config.debug&&console.log("Pager: Triggering pagerInitialized"),a(c).triggerHandler("pagerInitialized",d),b.applyWidget(c),g(c,d)},C=function(b,c){var d=b.config;d.pager=a.extend(!0,{},a.tablesorterPager.defaults,c.settings),F(b,c.settings)},D=function(a,c){var d=a.config,e=d.namespace+"pager",f=[c.cssFirst,c.cssPrev,c.cssNext,c.cssLast,c.cssGoto,c.cssPageSize].join(",");q(a,c),c.$container.hide().find(f).unbind(e),d.appender=null,d.$table.unbind(e),b.storage&&b.storage(a,c.storageKey,""),delete d.pager,delete d.rowsCopy},E=function(c,d,e){var f,g,h,i=c.config;d.$container.find(d.cssGoto+","+d.cssPageSize+",.ts-startRow, .ts-page").removeClass(d.cssDisabled).removeAttr("disabled").each(function(){this.ariaDisabled=!1}),d.isDisabled=!1,d.page=a.data(c,"pagerLastPage")||d.page||0,h=d.$container.find(d.cssPageSize),g=h.find("option[selected]").val(),d.size=a.data(c,"pagerLastSize")||u(d,g,"get"),h.val(d.size),d.totalPages="all"===d.size?1:Math.ceil(t(c,d)/d.size),c.id&&!i.$table.attr("aria-describedby")&&(h=d.$container.find(d.cssPageDisplay),f=h.attr("id"),f||(f=c.id+"_pager_info",h.attr("id",f)),i.$table.attr("aria-describedby",f)),j(c,d),e&&(b.update(i),w(c,d.size,d),l(c,d),i.debug&&console.log("Pager: Enabled"))},F=function(e,f){var h,i,m,n,o=e.config,p=o.widgetOptions,t=o.pager=a.extend(!0,{},a.tablesorterPager.defaults,f),v=o.$table,B=o.namespace+"pager",F=t.$container=a(t.container).addClass("tablesorter-pager").show();t.settings=a.extend(!0,{},a.tablesorterPager.defaults,f),o.debug&&console.log("Pager: Initializing"),t.oldAjaxSuccess=t.oldAjaxSuccess||t.ajaxObject.success,o.appender=d.appender,t.initializing=!0,t.savePages&&b.storage&&(h=b.storage(e,t.storageKey)||{},t.page=isNaN(h.page)?t.page:h.page,t.size="all"===h.size?h.size:(isNaN(h.size)?t.size:h.size)||t.setSize||10,a.data(e,"pagerLastSize",t.size),F.find(t.cssPageSize).val(t.size)),t.regexRows=new RegExp("("+(p.filter_filteredRow||"filtered")+"|"+o.selectorRemove.slice(1)+"|"+o.cssChildRow+")"),t.regexFiltered=new RegExp(p.filter_filteredRow||"filtered"),v.unbind(c.split(" ").join(B+" ").replace(/\s+/g," ")).bind("filterInit filterStart ".split(" ").join(B+" "),function(b,c){t.currentFilters=a.isArray(c)?c:o.$table.data("lastSearch"),"filterStart"===b.type&&t.pageReset!==!1&&(o.lastCombinedFilter||"")!==(t.currentFilters||[]).join("")&&(t.page=t.pageReset)}).bind("filterEnd sortEnd ".split(" ").join(B+" "),function(){t.currentFilters=o.$table.data("lastSearch"),(t.initialized||t.initializing)&&(o.delayInit&&o.rowsCopy&&0===o.rowsCopy.length&&r(e),g(e,t,!1),s(e,t,!1),b.applyWidget(e))}).bind("disablePager"+B,function(a){a.stopPropagation(),q(e,t)}).bind("enablePager"+B,function(a){a.stopPropagation(),E(e,t,!0)}).bind("destroyPager"+B,function(a){a.stopPropagation(),D(e,t)}).bind("resetToLoadState"+B,function(a){a.stopPropagation(),C(e,t)}).bind("updateComplete"+B,function(a,b,c){if(a.stopPropagation(),b&&!c&&!t.ajax){var d=o.$tbodies.eq(0).children("tr").not(o.selectorRemove);t.totalRows=d.length-(t.countChildRows?0:d.filter("."+o.cssChildRow).length),t.totalPages="all"===t.size?1:Math.ceil(t.totalRows/t.size),d.length&&o.rowsCopy&&0===o.rowsCopy.length&&r(b),t.page>=t.totalPages&&y(b,t),k(b,t),j(b,t),g(b,t,!0)}}).bind("pageSize refreshComplete ".split(" ").join(B+" "),function(a,b){a.stopPropagation(),w(e,u(t,b,"get"),t),k(e,t),g(e,t,!1)}).bind("pageSet pagerUpdate ".split(" ").join(B+" "),function(a,b){a.stopPropagation(),"pagerUpdate"===a.type&&(b="undefined"==typeof b?t.page+1:b,t.last.page=!0),t.page=(parseInt(b,10)||1)-1,s(e,t,!0),g(e,t,!1)}).bind("pageAndSize"+B,function(a,b,c){a.stopPropagation(),t.page=(parseInt(b,10)||1)-1,w(e,u(t,c,"get"),t),s(e,t,!0),k(e,t),g(e,t,!1)}),i=[t.cssFirst,t.cssPrev,t.cssNext,t.cssLast],m=[x,A,z,y],o.debug&&!F.length&&console.warn("Pager: >> Container not found"),F.find(i.join(",")).attr("tabindex",0).unbind("click"+B).bind("click"+B,function(b){b.stopPropagation();var c,d=a(this),f=i.length;if(!d.hasClass(t.cssDisabled))for(c=0;c<f;c++)if(d.is(i[c])){m[c](e,t);break}}),n=F.find(t.cssGoto),n.length?n.unbind("change"+B).bind("change"+B,function(){t.page=a(this).val()-1,s(e,t,!0),g(e,t,!1)}):o.debug&&console.warn("Pager: >> Goto selector not found"),n=F.find(t.cssPageSize),n.length?(n.find("option").removeAttr("selected"),n.unbind("change"+B).bind("change"+B,function(){if(!a(this).hasClass(t.cssDisabled)){var b=a(this).val();t.$container.find(t.cssGoto).val(b),w(e,b,t),j(e,t)}return!1})):o.debug&&console.warn("Pager: >> Size selector not found"),t.initialized=!1,v.triggerHandler("pagerBeforeInitialized",t),E(e,t,!1),"string"==typeof t.ajaxUrl?(t.ajax=!0,o.widgetOptions.filter_serversideFiltering=!0,o.serverSideSorting=!0,s(e,t)):(t.ajax=!1,b.appendCache(o,!0),l(e,t)),t.ajax||t.initialized||(t.initializing=!1,t.initialized=!0,s(e,t),o.debug&&console.log("Pager: Triggering pagerInitialized"),o.$table.triggerHandler("pagerInitialized",t),o.widgetOptions.filter_initialized&&b.hasWidget(e,"filter")||g(e,t,!1)),o.widgetInit.pager=!0};d.appender=function(b,c){var d=b.config,e=d.pager;e.ajax||(d.rowsCopy=c,e.totalRows=e.countChildRows?d.$tbodies.eq(0).children("tr").length:c.length,e.size=a.data(b,"pagerLastSize")||e.size||e.settings.size||10,e.totalPages="all"===e.size?1:Math.ceil(e.totalRows/e.size),p(b,c,e),g(b,e,!1))},d.construct=function(a){return this.each(function(){this.config&&this.hasInitialized&&F(this,a)})}}}),b.showError=function(b,c,d,e){var f,g=a(b),h=g[0].config,i=h&&h.widgetOptions,j=h.pager&&h.pager.cssErrorRow||i&&i.pager_css&&i.pager_css.errorRow||"tablesorter-errorRow",k=typeof c,l=!0,m="",n=function(){h.$table.find("thead").find("."+j).remove()};if(!g.length)return void console.error("tablesorter showError: no table parameter passed");if("function"==typeof h.pager.ajaxError){if(l=h.pager.ajaxError(h,c,d,e),l===!1)return n();m=l}else if("function"==typeof i.pager_ajaxError){if(l=i.pager_ajaxError(h,c,d,e),l===!1)return n();m=l}if(""===m)if("object"===k)m=0===c.status?"Not connected, verify Network":404===c.status?"Requested page not found [404]":500===c.status?"Internal Server Error [500]":"parsererror"===e?"Requested JSON parse failed":"timeout"===e?"Time out error":"abort"===e?"Ajax Request aborted":"Uncaught error: "+c.statusText+" ["+c.status+"]";else{if("string"!==k)return n();m=c}f=a(/tr\>/.test(m)?m:'<tr><td colspan="'+h.columns+'">'+m+"</td></tr>").click(function(){a(this).remove()}).appendTo(h.$table.find("thead:first")).addClass(j+" "+h.selectorRemove.slice(1)).attr({role:"alert","aria-live":"assertive"})},a.fn.extend({tablesorterPager:a.tablesorterPager.construct})}(jQuery);