source: public/assets/js/vendors/jquery.tablesorter.pager.min.js@ f457265

Last change on this file since f457265 was 0924b6c, checked in by Özkan İliyaz <iliyaz_96@…>, 4 years ago

initial commit

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