All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.datatables.net-scroller.js.dataTables.scroller.min.js Maven / Gradle / Ivy

/*! Scroller 1.5.1
 * ©2011-2018 SpryMedia Ltd - datatables.net/license
 */
(function(a){if(typeof define==="function"&&define.amd){define(["jquery","datatables.net"],function(b){return a(b,window,document)})}else{if(typeof exports==="object"){module.exports=function(b,c){if(!b){b=window}if(!c||!c.fn.dataTable){c=require("datatables.net")(b,c).$}return a(c,b,b.document)}}else{a(jQuery,window,document)}}}(function(f,d,a,g){var e=f.fn.dataTable;var c=function(j,i){if(!(this instanceof c)){alert("Scroller warning: Scroller must be initialised with the 'new' keyword.");return}if(i===g){i={}}var h=f.fn.dataTable.Api(j);this.s={dt:h.settings()[0],dtApi:h,tableTop:0,tableBottom:0,redrawTop:0,redrawBottom:0,autoHeight:true,viewportRows:0,stateTO:null,drawTO:null,heights:{jump:null,page:null,virtual:null,scroll:null,row:null,viewport:null},topRowFloat:0,scrollDrawDiff:null,loaderVisible:false,forceReposition:false};this.s=f.extend(this.s,c.oDefaults,i);this.s.heights.row=this.s.rowHeight;this.dom={force:a.createElement("div"),scroller:null,table:null,loader:null};if(this.s.dt.oScroller){return}this.s.dt.oScroller=this;this._fnConstruct()};f.extend(c.prototype,{fnRowToPixels:function(h,k,j){var l;var i=h-this.s.baseRowTop;if(j){l=this._domain("virtualToPhysical",this.s.baseScrollTop);l+=i*this.s.heights.row}else{l=this.s.baseScrollTop;l+=i*this.s.heights.row}return k||k===g?parseInt(l,10):l},fnPixelsToRow:function(l,j,i){var h=l-this.s.baseScrollTop;var k=i?(this._domain("physicalToVirtual",this.s.baseScrollTop)+h)/this.s.heights.row:(h/this.s.heights.row)+this.s.baseRowTop;return j||j===g?parseInt(k,10):k},fnScrollToRow:function(n,m){var l=this;var i=false;var k=this.fnRowToPixels(n);var h=((this.s.displayBuffer-1)/2)*this.s.viewportRows;var j=n-h;if(j<0){j=0}if((k>this.s.redrawBottom||ktable",this.dom.scroller)[0];this.dom.table.style.position="absolute";this.dom.table.style.top="0px";this.dom.table.style.left="0px";f(h.table().container()).addClass("DTS");if(this.s.loadingIndicator){this.dom.loader=f('
'+this.s.dt.oLanguage.sLoadingRecords+"
").css("display","none");f(this.dom.scroller.parentNode).css("position","relative").append(this.dom.loader)}if(this.s.heights.row&&this.s.heights.row!="auto"){this.s.autoHeight=false}this.fnMeasure(false);this.s.ingnoreScroll=true;this.s.stateSaveThrottle=this.s.dt.oApi._fnThrottle(function(){i.s.dtApi.state.save()},500);f(this.dom.scroller).on("scroll.dt-scroller",function(l){i._fnScroll.call(i)});f(this.dom.scroller).on("touchstart.dt-scroller",function(){i._fnScroll.call(i)});f(d).on("resize.dt-scroller",function(){i.fnMeasure(false);i._fnInfo()});var k=true;var j=h.state.loaded();h.on("stateSaveParams.scroller",function(n,l,m){m.scroller={topRow:k&&j&&j.scroller?j.scroller.topRow:i.s.topRowFloat,baseScrollTop:i.s.baseScrollTop,baseRowTop:i.s.baseRowTop};k=false});if(j&&j.scroller){this.s.topRowFloat=j.scroller.topRow;this.s.baseScrollTop=j.scroller.baseScrollTop;this.s.baseRowTop=j.scroller.baseRowTop}h.on("init.scroller",function(){i.fnMeasure(false);i._fnDrawCallback();h.on("draw.scroller",function(){i._fnDrawCallback()})});h.on("preDraw.dt.scroller",function(){i._fnScrollForce()});h.on("destroy.scroller",function(){f(d).off("resize.dt-scroller");f(i.dom.scroller).off(".dt-scroller");f(i.s.dt.nTable).off(".scroller");f(i.s.dt.nTableWrapper).removeClass("DTS");f("div.DTS_Loading",i.dom.scroller.parentNode).remove();i.dom.table.style.position="";i.dom.table.style.top="";i.dom.table.style.left=""})},_fnScroll:function(){var k=this,l=this.s.heights,j=this.dom.scroller.scrollTop,m;if(this.s.skip){return}if(this.s.ingnoreScroll){return}if(this.s.dt.bFiltered||this.s.dt.bSorted){this.s.lastScrollTop=0;return}this._fnInfo();clearTimeout(this.s.stateTO);this.s.stateTO=setTimeout(function(){k.s.dtApi.state.save()},250);if(this.s.forceReposition||jthis.s.redrawBottom){var i=Math.ceil(((this.s.displayBuffer-1)/2)*this.s.viewportRows);m=parseInt(this._domain("physicalToVirtual",j)/l.row,10)-i;this.s.topRowFloat=this._domain("physicalToVirtual",j)/l.row;this.s.forceReposition=false;if(m<=0){m=0}else{if(m+this.s.dt._iDisplayLength>this.s.dt.fnRecordsDisplay()){m=this.s.dt.fnRecordsDisplay()-this.s.dt._iDisplayLength;if(m<0){m=0}}else{if(m%2!==0){m++}}}if(m!=this.s.dt._iDisplayStart){this.s.tableTop=f(this.s.dt.nTable).offset().top;this.s.tableBottom=f(this.s.dt.nTable).height()+this.s.tableTop;var h=function(){if(k.s.scrollDrawReq===null){k.s.scrollDrawReq=j}k.s.dt._iDisplayStart=m;k.s.dt.oApi._fnDraw(k.s.dt)};if(this.s.dt.oFeatures.bServerSide){clearTimeout(this.s.drawTO);this.s.drawTO=setTimeout(h,this.s.serverWait)}else{h()}if(this.dom.loader&&!this.s.loaderVisible){this.dom.loader.css("display","block");this.s.loaderVisible=true}}}else{this.s.topRowFloat=this.fnPixelsToRow(j,false,true)}this.s.lastScrollTop=j;this.s.stateSaveThrottle()},_domain:function(i,l){var k=this.s.heights;var h;if(k.virtual===k.scroll){return l}var m=(k.scroll-k.viewport)/2;var j=(k.virtual-k.viewport)/2;h=j/(m*m);if(i==="virtualToPhysical"){if(l=h){k=m.scroll-((h-this.s.topRowFloat)*m.row)}else{k=this._domain("virtualToPhysical",this.s.topRowFloat*m.row)}}this.dom.scroller.scrollTop=k;this.s.baseScrollTop=k;this.s.baseRowTop=this.s.topRowFloat;var q=k-((this.s.topRowFloat-s)*m.row);if(s===0){q=0}else{if(s+j>=h){q=m.scroll-p}}this.dom.table.style.top=q+"px";this.s.tableTop=q;this.s.tableBottom=p+this.s.tableTop;var o=(k-this.s.tableTop)*this.s.boundaryScale;this.s.redrawTop=k-o;this.s.redrawBottom=k+o>m.scroll-m.viewport-m.row?m.scroll-m.viewport-m.row:k+o;this.s.skip=false;if(this.s.dt.oFeatures.bStateSave&&this.s.dt.oLoadedState!==null&&typeof this.s.dt.oLoadedState.iScroller!="undefined"){var n=(this.s.dt.sAjaxSource||l.s.dt.ajax)&&!this.s.dt.oFeatures.bServerSide?true:false;if((n&&this.s.dt.iDraw==2)||(!n&&this.s.dt.iDraw==1)){setTimeout(function(){f(l.dom.scroller).scrollTop(l.s.dt.oLoadedState.iScroller);l.s.redrawTop=l.s.dt.oLoadedState.iScroller-(m.viewport/2);setTimeout(function(){l.s.ingnoreScroll=false},0)},0)}}else{l.s.ingnoreScroll=false}if(this.s.dt.oFeatures.bInfo){setTimeout(function(){l._fnInfo.call(l)},0)}if(this.dom.loader&&this.s.loaderVisible){this.dom.loader.css("display","none");this.s.loaderVisible=false}},_fnScrollForce:function(){var i=this.s.heights;var h=1000000;i.virtual=i.row*this.s.dt.fnRecordsDisplay();i.scroll=i.virtual;if(i.scroll>h){i.scroll=h}this.dom.force.style.height=i.scroll>this.s.heights.row?i.scroll+"px":this.s.heights.row+"px"},_fnCalcRowHeight:function(){var l=this.s.dt;var h=l.nTable;var k=h.cloneNode(false);var j=f("").appendTo(k);var i=f('
');f("tbody tr:lt(4)",h).clone().appendTo(j);while(f("tr",j).length<3){j.append(" ")}f("div."+l.oClasses.sScrollBody,i).append(k);var m=this.s.dt.nHolding||h.parentNode;if(!f(m).is(":visible")){m="body"}i.appendTo(m);this.s.heights.row=f("tr",j).eq(1).outerHeight();i.remove()},_fnInfo:function(){if(!this.s.dt.oFeatures.bInfo){return}var k=this.s.dt,u=k.oLanguage,p=this.dom.scroller.scrollTop,h=Math.floor(this.fnPixelsToRow(p,false,this.s.ani)+1),q=k.fnRecordsTotal(),v=k.fnRecordsDisplay(),r=Math.ceil(this.fnPixelsToRow(p+this.s.heights.viewport,false,this.s.ani)),z=v




© 2015 - 2025 Weber Informatics LLC | Privacy Policy