tablesorter/addons/pager/jquery.tablesorter.pager.min.js

3 lines
11 KiB
JavaScript
Raw Normal View History

2013-10-18 18:38:46 +00:00
/*! tablesorter pager plugin minified - updated 10/18/2013 */
;(function(g){var l=g.tablesorter;g.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(b,a){return a},ajaxObject:{dataType:"json"},ajaxProcessing:function(b){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,savePages:!0,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,currentFilters:[],startRow:0,endRow:0,$size:null,last:{}};var w=this,x=function(b,a){var c=b.cssDisabled,f=!!a,e=Math.min(b.totalPages,b.filteredPages);b.updateArrows&&(b.$container.find(b.cssFirst+","+b.cssPrev)[f||0===b.page?"addClass":"removeClass"](c),b.$container.find(b.cssNext+","+b.cssLast)[f||b.page===e-1?"addClass":"removeClass"](c))},r=function(b,a,c){var f,e,h,d=b.config;f=d.$table.hasClass("hasFilters")&&!a.ajaxUrl; h=(d.widgetOptions&&d.widgetOptions.filter_filteredRow||"filtered")+","+d.selectorRemove;e=a.size||10;a.totalPages=Math.ceil(a.totalRows/e);a.filteredRows=f?d.$tbodies.eq(0).children("tr:not(."+h+")").length:a.totalRows;a.filteredPages=f?Math.ceil(a.filteredRows/e)||1:a.totalPages;if(0<=Math.min(a.totalPages,a.filteredPages)&&(h=a.size*a.page>a.filteredRows,a.startRow=h?1:0===a.filteredRows?0:a.size*a.page+1,a.page=h?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),f=a.$container.find(a.cssPageDisplay), h=(a.ajaxData&&a.ajaxData.output?a.ajaxData.output||a.output:a.output).replace(/\{page([\-+]\d+)?\}/gi,function(b,c){return a.page+(c?parseInt(c,10):1)}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(b){b=b.replace(/[{}\s]/g,"");var c=b.split(":"),d=a.ajaxData;return 1<c.length&&d&&d[c[0]]?d[c[0]][c[1]]:a[b]||(d?d[b]:"")||""}),f.length&&(f["INPUT"===f[0].tagName?"val":"html"](h),a.$goto.length))){h="";e=Math.min(a.totalPages,a.filteredPages);for(f=1;f<=e;f++)h+="<option>"+f+"</option>";a.$goto.html(h).val(a.page+ 1)}x(a);a.initialized&&!1!==c&&(d.$table.trigger("pagerComplete",a),a.savePages&&l.storage&&l.storage(b,"tablesorter-pager",{page:a.page,size:a.size}))},t=function(b,a){var c,f=b.config,e=f.$tbodies.eq(0);a.fixedHeight&&(e.find("tr.pagerSavedHeightSpacer").remove(),c=g.data(b,"pagerSavedHeight"))&&(c-=e.height(),5<c&&g.data(b,"pagerLastSize")===a.size&&e.children("tr:visible").length<a.size&&e.append('<tr class="pagerSavedHeightSpacer '+f.selectorRemove.replace(/(tr)?\./g,"")+'" style="height:'+c+ 'px;"></tr>'))},A=function(b,a){var c=b.config.$tbodies.eq(0);c.find("tr.pagerSavedHeightSpacer").remove();g.data(b,"pagerSavedHeight",c.height());t(b,a);g.data(b,"pagerLastSize",a.size)},u=function(b,a){if(!a.ajaxUrl){var c,f=b.config,e=f.$tbodies.eq(0).children(),h=e.length,d=a.page*a.size,g=d+a.size,n=f.widgetOptions&&f.widgetOptions.filter_filteredRow||"filtered",m=0;for(c=0;c<h;c++)e[c].className.match(n)||(e[c].style.display=m>=d&&m<g?"":"none",m+=e[c].className.match(f.cssChildRow+"|"+f.selectorRemove.slice(1))? 0:1)}},B=function(b,a){a.size=parseInt(a.$size.val(),10)||a.size;g.data(b,"pagerLastSize",a.size);x(a);a.removeRows||(u(b,a),g(b).bind("sortEnd.pager filterEnd.pager",function(){u(b,a)}))},C=function(b,a,c,f,e){if("function"===typeof c.ajaxProcessing){var h,d,s,n,m,v,k=a.config,p=k.$table,q="";h=c.ajaxProcessing(b,a)||[0,[]];b=p.find("thead th").length;p.find("thead tr."+c.cssErrorRow).remove();if(e)g('<tr class="'+c.cssErrorRow+'"><td style="text-align:center;" colspan="'+b+'">'+(0===f.status?"Not connected, verify Network": 404===f.status?"Requested page not found [404]":500===f.status?"Internal Server Error [500]":"parsererror"===e?"Requested JSON parse failed":"timeout"===e?"Time out error":"abort"===e?"Ajax Request aborted":"Uncaught error: "+f.statusText+" ["+f.status+"]")+"</td></tr>").click(function(){g(this).remove()}).appendTo(p.find("thead:first")),k.$tbodies.eq(0).empty();else{g.isArray(h)?(f=isNaN(h[0])&&!isNaN(h[1]),e=h[f?1:0],c.totalRows=isNaN(e)