/*! Widget: scroller - updated 5/17/2015 (v2.22.0) */ !function(a,b){"use strict";var c=a.tablesorter,d=c.css;a.extend(c.css,{scrollerWrap:"tablesorter-scroller",scrollerHeader:"tablesorter-scroller-header",scrollerTable:"tablesorter-scroller-table",scrollerFooter:"tablesorter-scroller-footer",scrollerFixed:"tablesorter-scroller-fixed",scrollerFixedPanel:"tablesorter-scroller-fixed-panel",scrollerHasFix:"tablesorter-scroller-has-fixed-columns",scrollerHideColumn:"tablesorter-scroller-hidden-column",scrollerHideElement:"tablesorter-scroller-hidden",scrollerSpacerRow:"tablesorter-scroller-spacer",scrollerBarSpacer:"tablesorter-scroller-bar-spacer",scrollerAddedHeight:"tablesorter-scroller-added-height",scrollerHack:"tablesorter-scroller-scrollbar-hack",scrollerReset:"tablesorter-scroller-reset",scrollerRtl:"ts-scroller-rtl"}),c.addWidget({id:"scroller",priority:60,options:{scroller_height:300,scroller_jumpToHeader:!0,scroller_upAfterSort:!0,scroller_fixedColumns:0,scroller_rowHighlight:"hover",scroller_addFixedOverlay:!1,scroller_barWidth:null},format:function(a,b,d){b.isScrolling||c.scroller.setup(b,d)},remove:function(a,b,d){c.scroller.remove(b,d)}}),c.window_resize=function(){c.timer_resize&&clearTimeout(c.timer_resize),c.timer_resize=setTimeout(function(){a(b).trigger("resizeEnd")},250)},a(function(){var b="";a(b).appendTo("body")}),c.scroller={isFirefox:navigator.userAgent.toLowerCase().indexOf("firefox")>-1,isOldIE:document.all&&!b.atob,isSafari:navigator.userAgent.toLowerCase().indexOf("safari")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("chrome"),hasScrollBar:function(a,b){return b?a.get(0).scrollWidth>a.width():a.get(0).scrollHeight>a.height()},setWidth:function(a,b){a.css({width:b,"min-width":b,"max-width":b})},getBarWidth:function(){var b=a("
").css({position:"absolute",top:"-9999px",left:0,width:"100px",height:"100px",overflow:"scroll",visibility:"hidden"}).appendTo("body"),c=b[0],d=c.offsetWidth-c.clientWidth;return b.remove(),d},setup:function(e,f){var g,h,i,j,k,l,m,n,o=a(b),p=e.namespace+"tsscroller",q=a(),r=e.namespace.slice(1)+"tsscroller",s=e.$table;f.scroller_calcWidths=[],f.scroller_isBusy=!0,f.scroller_barSetWidth=null!==f.scroller_barWidth?f.scroller_barWidth:c.scroller.getBarWidth()||15,g=f.scroller_height||300,i=a(''+s.children("thead")[0].outerHTML+"
"),f.scroller_$header=i.addClass(e.namespace.slice(1)+"_extra_table"),j=s.children("tfoot"),j.length&&(q=a('
').addClass(e.namespace.slice(1)+"_extra_table").append(j.clone(!0)).wrap('
'),l=q.children("tfoot").eq(0).children("tr").children()),f.scroller_$footer=q,s.wrap('
').before(i).find("."+d.filterRow).addClass(d.filterRowHide),f.scroller_$container=s.parent(),q.length&&s.after(q.parent()),k=i.wrap('
').find("."+d.header),s.wrap('
'),m=s.parent(),c.bindEvents(e.table,k),s.hasClass("hasFilters")&&c.filter.bindSearch(s,i.find("."+d.filter)),s.find("thead").addClass(d.scrollerHideElement),h=m.parent().height(),m.off("scroll"+p).on("scroll"+p,function(){if(f.scroller_jumpToHeader){var b=o.scrollTop()-i.offset().top;0!==a(this).scrollTop()&&h>b&&b>0&&o.scrollTop(i.offset().top)}i.parent().add(q.parent()).scrollLeft(a(this).scrollLeft())}),n="sortEnd setFixedColumnSize updateComplete pagerComplete pagerInitialized columnUpdate ".split(" ").join(p+" "),s.off(n).on("sortEnd"+p,function(){f.scroller_upAfterSort&&s.parent().animate({scrollTop:0},"fast")}).on("setFixedColumnSize"+p,function(a,b){var g=f.scroller_$container;"undefined"==typeof b||isNaN(b)||(f.scroller_fixedColumns=parseInt(b,10)),c.scroller.removeFixed(e,f),b=f.scroller_fixedColumns,b>0&&b'),k=j.find("."+d.scrollerTable),l=k.children("table").children("tbody"),k.children("table").addClass(a.namespace.slice(1)+"_extra_table").attr("id","").children("thead, tfoot").remove(),b.scroller_$fixedColumns=j,m.hasClass(d.scrollerRtl)&&j.addClass(d.scrollerRtl),g=j.find("tr"),h=g.length,e=0;h>e;e++)g.eq(e).children(":gt("+(o-1)+")").remove();if(j.addClass(d.scrollerHideElement).prependTo(n),a.$table.hasClass("hasFilters"))for(g=j.find("."+d.filter).not("."+d.filterDisabled).prop("disabled",!1),c.filter.bindSearch(m,j.find("."+d.filter)),g=n.children("."+d.scrollerHeader).find("."+d.filter),h=g.length,e=0;h>e;e++)g.eq(e).hasClass(d.filterDisabled||"disabled")||g.eq(e).prop("disabled",o>e);for(a.$table.add("."+d.scrollerFooter+" table").children("thead").children("tr."+d.headerRow).children().attr("tabindex",-1),g=b.scroller_$header.add(j.find("."+d.scrollerTable+" table")).children("thead").children("tr."+d.headerRow),h=g.length,e=0;h>e;e++)for(i=g.eq(e).children(),f=0;ff?-1:0);c.bindEvents(a.table,j.find("."+d.header)),c.scroller.bindFixedColumnEvents(a,b),(c.scroller.isFirefox||c.scroller.isOldIE)&&k.wrap('
')},bindFixedColumnEvents:function(b,e){var f=c.scroller,g=b.namespace+"tsscrollerFixed",h=((c.hasWidget(b.table,"filter")?"filterEnd":"tablesorter-initialized")+" sortEnd ").split(" ").join(g+" "),i="scroll"+g,j=e.scroller_$fixedColumns.find("."+d.scrollerTable),k=!0,l=!0;b.$table.off(h).on(h,function(){f.updateFixed(b,e,!1),f.resize(b,e)}).parent().off(i).on(i,function(){e.scroller_isBusy||(k||!f.isFirefox)&&(l=!1,j[0].scrollTop=a(this).scrollTop(),setTimeout(function(){l=!0},20))}),j.off(i).on(i,function(){(l||!f.isFirefox)&&(k=!1,b.$table.parent()[0].scrollTop=a(this).scrollTop(),setTimeout(function(){k=!0},20))}).scroll(),""!==e.scroller_rowHighlight&&(h="mouseover mouseleave ".split(" ").join(g+" "),b.$table.off(h,"tbody > tr").on(h,"tbody > tr",function(a){var c=b.$table.children("tbody").children("tr").index(this);j.children("table").children("tbody").children("tr").eq(c).add(this).toggleClass(e.scroller_rowHighlight,"mouseover"===a.type)}),j.find("table").off(h,"tbody > tr").on(h,"tbody > tr",function(a){var c=j.children("table").children("tbody").children("tr"),d=c.index(this);b.$table.children("tbody").children("tr").eq(d).add(this).toggleClass(e.scroller_rowHighlight,"mouseover"===a.type)}))},updateFixed:function(b,e){var f=e.scroller_$container;if(0===e.scroller_fixedColumns)return e.scroller_isBusy=!1,void c.scroller.removeFixed(b,e);if(b.isScrolling){e.scroller_isBusy=!0,f.find("."+d.scrollerFixed).length||c.scroller.setupFixed(b,e);var g,h,i,j,k,l,m,n,o,p,q,r,s,t=b.$table,u=t.parent(),v=e.scroller_$header,w=e.scroller_$footer,x=e.scroller_$container.children("."+d.scrollerTable).children("table").children("tbody"),y=e.scroller_$header.children("thead").children("."+d.headerRow),z=e.scroller_$fixedColumns.addClass(d.scrollerHideElement),A=z.find("."+d.scrollerTable).children("table"),B=A.children("tbody"),C=c.scroller,D=e.scroller_barSetWidth,E=e.scroller_fixedColumns,F=t.hasClass(d.scrollerRtl),G=t.find("tbody td"),H=parseInt(G.css("border-right-width"),10)||1,I=parseInt((G.css("border-spacing")||"").split(/\s/)[0],10)/2||0,J=parseInt(t.css("padding-left"),10)+parseInt(t.css("padding-right"),10)-H,K=e.scroller_calcWidths;for(c.scroller.removeFixed(b,e,!1),g=0;E>g;g++)J+=K[g]+I;for(J=J+2*H-I,C.setWidth(z.add(z.children()),J),C.setWidth(z.children().children("table"),J),t.find("."+d.scrollerSpacerRow).remove(),s='',g=0;g';for(b.$tbodies.eq(0).prepend(s+=""),h=0;hi;i++)k=a(y[i].outerHTML),k.children("td, th").slice(E).remove(),l.append(k);for(m=z.find("thead").children("tr."+d.headerRow).children(),n=z.find(d.scrollerSpacerRow).children(),o=z.find("tfoot").children("tr").eq(0).children(),k=v.children("thead").children("tr").children("td, th"),y=w.children("tfoot").children("tr").children("td, th"),g=0;gg&&(G=m.eq(g).add(n.eq(g)).add(o.eq(g)),C.setWidth(G,K[g])),G=k.eq(g).add(y.eq(g)),C.setWidth(G,K[g]);c.processTbody(A,l,!1)}for(r=c.scroller.hasScrollBar(u)?D:0,(C.isFirefox||C.isOldIE)&&A.css("width",J).parent().css("width",J+r),z.removeClass(d.scrollerHideElement),g=0;E>g;g++)f.children("div").children("table").find("th:nth-child("+(g+1)+"), td:nth-child("+(g+1)+")").addClass(d.scrollerHideColumn);J-=H,q=u.parent().innerWidth()-J,u.width(q),f.children("."+d.scrollerTable).css(F?"right":"left",J),f.children("."+d.scrollerHeader+", ."+d.scrollerFooter).css(F?"right":"left",J+(F&&c.scroller.isSafari?r:0)),v.parent().add(w.parent()).width(q-r),q=c.scroller.hasScrollBar(u,!0),r=q?D:0,!z.find("."+d.scrollerBarSpacer).length&&q?(G=a('
').css("height",r+"px"),z.find("."+d.scrollerTable).append(G)):q||z.find("."+d.scrollerBarSpacer).remove(),c.scroller.updateRowHeight(b,e),z.height(f.height()),z.removeClass(d.scrollerHideElement),e.scroller_isBusy=!1}},fixHeight:function(a,b){var c,e,f,g,h,i=a.length;for(c=0;i>c;c++)g=a.eq(c),h=b.eq(c),e=g.height(),f=h.height(),e>f?h.addClass(d.scrollerAddedHeight).height(e):f>e&&g.addClass(d.scrollerAddedHeight).height(f)},updateRowHeight:function(a,b){var e,f,g=b.scroller_$fixedColumns;b.scroller_$container.find("."+d.scrollerAddedHeight).removeClass(d.scrollerAddedHeight).height(""),e=b.scroller_$header.children("thead").children("tr"),f=g.children("."+d.scrollerHeader).children("table").children("thead").children("tr"),c.scroller.fixHeight(e,f),e=b.scroller_$footer.children("tfoot").children("tr"),f=g.children("."+d.scrollerFooter).children("table").children("tfoot").children("tr"),c.scroller.fixHeight(e,f),(c.scroller.isFirefox||c.scroller.isOldIE)&&(g=g.find("."+d.scrollerHack)),e=a.$table.children("tbody").children("tr"),f=g.children("."+d.scrollerTable).children("table").children("tbody").children("tr"),c.scroller.fixHeight(e,f)},removeFixed:function(a,b,c){var e=a.$table,f=b.scroller_$container,g=e.hasClass(d.scrollerRtl);(c||"undefined"==typeof c)&&f.find("."+d.scrollerFixed).remove(),f.find("."+d.scrollerHideColumn).removeClass(d.scrollerHideColumn),f.children(":not(."+d.scrollerFixed+")").css(g?"right":"left",0)},remove:function(c,e){var f=e.scroller_$container,g=c.namespace+"tsscroller";c.$table.off(g).insertBefore(f).find("thead").removeClass(d.scrollerHideElement).children("tr."+d.headerRow).children().attr("tabindex",0).end().find("."+d.filterRow).removeClass(d.scrollerHideElement+" "+d.filterRowHide),c.$table.find("."+d.filter).not("."+d.filterDisabled).prop("disabled",!1),f.remove(),a(b).off(g),c.isScrolling=!1}}}(jQuery,window);