tablesorter/dist/js/widgets/widget-scroller.min.js

2 lines
12 KiB
JavaScript
Raw Normal View History

/*! Widget: scroller - updated 4/2/2015 (v2.21.5) */
!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",scrollerHasFix:"tablesorter-scroller-has-fixed-columns",scrollerReset:"tablesorter-scroller-reset",scrollerRtl:"tablesorter-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_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(){this.resize_timer&&clearTimeout(this.resize_timer),this.resize_timer=setTimeout(function(){a(this).trigger("resizeEnd")},250)},a(function(){var b="<style>."+d.scrollerWrap+"Measure { width: 100px; height: 100px; overflow: scroll; position: absolute; top: -9999px; }."+d.scrollerReset+" { width: auto !important; min-width: auto !important; max-width: auto !important; }."+d.scrollerWrap+" { position: relative; overflow: hidden; }."+d.scrollerWrap+" * { box-sizing: border-box; }."+d.scrollerHeader+", ."+d.scrollerFooter+" { overflow: hidden; }."+d.scrollerHeader+" table."+d.table+" { margin-bottom: 0; }."+d.scrollerFooter+" table."+d.table+" thead { visibility: hidden, height: 0; overflow: hidden; }."+d.scrollerTable+" { overflow-y: scroll; }."+d.scrollerTable+" table."+d.table+" { border-top: 0; margin-top: 0; margin-bottom: 0; overflow-y: scroll; }."+d.scrollerTable+" ."+(d.filterRow||"tablesorter-filter-row")+",."+d.scrollerFooter+" ."+(d.filterRow||"tablesorter-filter-row")+",."+d.scrollerTable+" tfoot { display: none; }."+d.scrollerTable+" table."+d.table+" thead tr."+d.headerRow+" *, ."+d.scrollerFooter+" table."+d.table+" thead * { line-height: 0; height: 0; border: none; background-image: none; padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; overflow: hidden; }."+d.scrollerFixed+" { pointer-events: none; }."+d.scrollerFixed+" > div { pointer-events: all; }."+d.scrollerWrap+" ."+d.scrollerFixed+" { position: absolute; top: 0; z-index: 1; left: 0 } ."+d.scrollerWrap+" ."+d.scrollerFixed+"."+d.scrollerRtl+" { left: auto; right: 0 } ."+d.scrollerWrap+"."+d.scrollerHasFix+" > ."+d.scrollerTable+" { overflow-x: auto; }."+d.scrollerFixed+" ."+d.scrollerFooter+" { position: absolute; bottom: 0; }."+d.scrollerFixed+" ."+d.scrollerTable+" { position: relative; left: 0; overflow-x: hidden; overflow-y: scroll; -ms-overflow-style: none; }."+d.scrollerFixed+" ."+d.scrollerTable+"::-webkit-scrollbar { display: none; }."+d.scrollerWrap+" ."+d.scrollerFixed+" table { border-right-color: transparent; padding-right: 0; }."+d.scrollerWrap+" ."+d.scrollerFixed+"."+d.scrollerRtl+" table { border-left-color: transparent; padding-left: 0; }</style>";a(b).appendTo("body")}),c.scroller={isFirefox:navigator.userAgent.toLowerCase().indexOf("firefox")>-1,isOldIE:document.all&&!b.atob,hasScrollBar:function(a){return 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('<div class="'+d.scrollerWrap+'Measure">').appendTo("body"),c=b[0],e=c.offsetWidth-c.clientWidth;return b.remove(),e},setup:function(e,f){var g,h,i,j,k,l,m,n=a(b),o=e.namespace+"tsscroller",p=a(),q=e.namespace.slice(1)+"tsscroller",r=e.$table;e.widthFixed=!0,g=f.scroller_height||300,h=r.children("tbody").height(),0!==h&&g>h&&(g=h+10),f.scroller_$header=i=a('<table class="'+r.attr("class")+'" cellpadding=0 cellspacing=0>'+r.children("thead")[0].outerHTML+"</table>").addClass(e.namespace.slice(1)+"_extra_table"),j=r.children("tfoot"),j.length&&(p=a('<table class="'+r.attr("class")+'" cellpadding=0 cellspacing=0 style="margin-top:0"></table>').addClass(e.namespace.slice(1)+"_extra_table").append(j.clone(!0)).append(r.children("thead")[0].outerHTML).wrap('<div class="'+d.scrollerFooter+'"/>'),l=p.children("tfoot").eq(0).children("tr").children()