2014-01-16 20:53:49 +00:00
|
|
|
!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},ajaxObject:{dataType:"json"},processAjaxOnInit:!0,ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page: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 a=this,s=function(e,t){var a="addClass",s="removeClass",i=e.cssDisabled,r=!!t,o=Math.min(e.totalPages,e.filteredPages);e.updateArrows&&(e.$container.find(e.cssFirst+","+e.cssPrev)[r||0===e.page?a:s](i),e.$container.find(e.cssNext+","+e.cssLast)[r||e.page===o-1||0===e.totalPages?a:s](i))},i=function(e,a,i){var r,o,n,g,l=e.config,d=l.$table.hasClass("hasFilters")&&!a.ajaxUrl,c=(l.widgetOptions&&l.widgetOptions.filter_filteredRow||"filtered")+","+l.selectorRemove+(a.countChildRows?"":",."+l.cssChildRow),p=a.size||10;if(a.totalPages=Math.ceil(a.totalRows/p),a.filteredRows=d?l.$tbodies.eq(0).children("tr").not("."+c).length:a.totalRows,a.filteredPages=d?Math.ceil(a.filteredRows/p)||1:a.totalPages,Math.min(a.totalPages,a.filteredPages)>=0&&(c=a.size*a.page>a.filteredRows,a.startRow=c?1:0===a.filteredRows?0:a.size*a.page+1,a.page=c?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),g=a.$container.find(a.cssPageDisplay),n=(a.ajaxData&&a.ajaxData.output?a.ajaxData.output||a.output:a.output).replace(/\{page([\-+]\d+)?\}/gi,function(e,t){return a.totalPages?a.page+(t?parseInt(t,10):1):0}).replace(/\{\w+(\s*:\s*\w+)?\}/gi,function(e){var t=e.replace(/[{}\s]/g,""),s=t.split(":"),i=a.ajaxData,r=/(rows?|pages?)$/i.test(t)?0:"";return s.length>1&&i&&i[s[0]]?i[s[0]][s[1]]:a[t]||(i?i[t]:r)||r}),g.length&&(g["INPUT"===g[0].tagName?"val":"html"](n),a.$goto.length))){for(c="",o=Math.min(a.totalPages,a.filteredPages),r=1;o>=r;r++)c+="<option>"+r+"</option>";a.$goto.html(c).val(a.page+1)}s(a),a.initialized&&i!==!1&&(l.$table.trigger("pagerComplete",a),a.savePages&&t.storage&&t.storage(e,a.storageKey,{page:a.page,size:a.size}))},r=function(t,a){var s,i,r=t.config,o=r.$tbodies.eq(0);a.fixedHeight&&(o.find("tr.pagerSavedHeightSpacer").remove(),i=e.data(t,"pagerSavedHeight"),i&&(s=i-o.height(),s>5&&e.data(t,"pagerLastSize")===a.size&&o.children("tr:visible").length<a.size&&o.append('<tr class="pagerSavedHeightSpacer '+r.selectorRemove.replace(/(tr)?\./g,"")+'" style="height:'+s+'px;"></tr>')))},o=function(t,a){var s=t.config.$tbodies.eq(0);s.find("tr.pagerSavedHeightSpacer").remove(),e.data(t,"pagerSavedHeight",s.height()),r(t,a),e.data(t,"pagerLastSize",a.size)},n=function(e,t){if(!t.ajaxUrl){var a,s=e.config,i=s.$tbodies.eq(0).children(),r=i.length,o=t.page*t.size,n=o+t.size,g=s.widgetOptions&&s.widgetOptions.filter_filteredRow||"filtered",l=0;for(a=0;r>a;a++)i[a].className.match(g)||(i[a].style.display=l>=o&&n>l?"":"none",l+=i[a].className.match(s.cssChildRow+"|"+s.selectorRemove.slice(1))&&!t.countChildRows?0:1)}},g=function(t,a){a.size=parseInt(a.$size.val(),10)||a.size,e.data(t,"pagerLastSize",a.size),s(a),a.removeRows||(n(t,a),e(t).bind("sortEnd.pager filterEnd.pager",function(){n(t,a)}))},l=function(a,s,o,n,g){if("function"==typeof o.ajaxProcessing){var l,d,c,p,f,u,h,b,z,w,P,j=s.config,v=j.$table,x="",R=o.ajaxProcessing(a,s)||[0,[]],m=v.find("thead th").length;if(v.find("thead tr."+o.cssErrorRow).remove(),g)j.debug&&t.log("Ajax Error",n,g),w=e('<tr class="'+o.cssErrorRow+'"><td style="text-align:center;" colspan="'+m+'">'+(0===n.status?"Not connected, verify Network":404===n.status?"Requested page not found [404]":500===n.status?"Internal Server Error [500]":"parsererror"===g?"Requested JSON parse failed":"timeout"===g?"Time out error":"abort"===g?"Ajax Request ab
|