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

2 lines
14 KiB
JavaScript
Raw Normal View History

2015-07-28 20:01:32 +00:00
/*! Widget: scroller - updated 7/28/2015 (v2.22.4) */
!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",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="<style>."+d.scrollerWrap+" { position: relative; overflow: hidden; }."+d.scrollerWrap+" * { box-sizing: border-box; }."+d.scrollerHeader+", ."+d.scrollerFooter+" { position: relative; overflow: hidden; }."+d.scrollerHeader+" table."+d.table+" { margin-bottom: 0; }."+d.scrollerTable+" { position: relative; overflow: auto; }."+d.scrollerTable+" table."+d.table+" { border-top: 0; margin-top: 0; margin-bottom: 0; overflow: hidden; }."+d.scrollerTable+" tfoot, ."+d.scrollerHideElement+", ."+d.scrollerHideColumn+" { display: none; }."+d.scrollerFixed+", ."+d.scrollerFixed+" ."+d.scrollerFixedPanel+" { 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: auto; }."+d.scrollerFixed+" ."+d.scrollerFooter+" { position: absolute; bottom: 0; }."+d.scrollerFixed+" ."+d.scrollerTable+" { position: relative; left: 0; overflow: auto; -ms-overflow-style: none; }."+d.scrollerFixed+" ."+d.scrollerTable+"::-webkit-scrollbar { display: none; }."+d.scrollerWrap+" ."+d.scrollerFixedPanel+" { position: absolute; top: 0; bottom: 0; z-index: 2; left: 0; right: 0; } </style>";a(b).appendTo("body")}),c.scroller={isFirefox:navigator.userAgent.toLowerCase().indexOf("firefox")>-1,isOldIE:document.all&&!b.atob,isIE:document.all&&!b.atob||navigator.appVersion.indexOf("Trident/")>0,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("<div>").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=c.scroller,q=e.namespace+"tsscroller",r=a(),s=e.namespace.slice(1)+"tsscroller",t=e.$table;e.widthFixed=!0,f.scroller_calcWidths=[],f.scroller_saved=[0,0],f.scroller_isBusy=!0,f.scroller_barSetWidth=null!==f.scroller_barWidth?f.scroller_barWidth:p.getBarWidth()||15,g=f.scroller_height||300,i=a('<table class="'+t.attr("class")+'" cellpadding=0 cellspacing=0>'+t.children("thead")[0].outerHTML+"</table>"),f.scroller_$header=i.addClass(e.namespace.slice(1)+"_extra_table"),j=t.children("tfoot"),j.length&&(r=a('<table class="'+t.attr("class")+'" cellpadding=0 cellspacing=0 style="margin-top:0"></table>').addClass(e.namespace.slice(1)+"_extra_table").append(j.clone(!0)).wrap('<div class="'+d.scrollerFooter+'"/>'),l=r.children("tfoot").eq(0).chil