PageSourceSearch

https://bikemotor.ru/javascript/fakescroll/fakescroll.min.js

js bikemotor.ru collected 2026-10-08 14:33:38 UTC 4,200 bytes, 12 lines download raw bytes

1/**
2 * By Yair Even Or (C)
3 * https://github.com/yairEO/fakescroll
4 */
5(function(){function e(b,a){b&&(this.settings=Object.assign({},this.defaults,a||{}),this.callback=a.callback?a.callback:null,this.state={},this.listeners={},this.DOM=this.build(b),this.events.binding.call(this,this.DOM),setTimeout(this.moveBar.bind(this)))}raf=window.requestAnimationFrame||function(b){return window.setTimeout(b,1E3/60)};e.prototype={defaults:{classname:"",track:!1},build:function(b){var a={};scopeHTML='<div class="fakeScroll__wrap">\n                                <div class="fakeScroll__content"></div>\n                             </div>\n                             <div class=\'fakeScroll__track '+
6this.settings.classname+'\'>\n                                <div class="fakeScroll__bar"></div>\n                             </div>';for(fragment=document.createDocumentFragment();b.childNodes.length;)fragment.appendChild(b.childNodes[0]);b.insertAdjacentHTML("afterbegin",scopeHTML);a.scope=b;a.scrollWrap=b.firstElementChild;a.scrollContent=a.scrollWrap.firstElementChild;a.scrollContent.appendChild(fragment);a.track=a.scrollWrap.nextElementSibling;a.bar=a.track.firstElementChild;a.scope.classList.add("fakeScroll__scope");
7return a},destroy:function(){this.events.off.call(this,window,"resize","onScrollResize")},events:{on:function(b,a,d){var c=this;a.split(" ").forEach(function(a){d in c.events.callbacks||console.warn(d," doesn't exist in Callbacks: ",c.events.callbacks);c.listeners[a]=c.events.callbacks[d].bind(c);b.addEventListener(a,c.listeners[a])});return this.events},off:function(b,a,d){var c=this;a.split(" ").forEach(function(a){return b.removeEventListener(a,c.listeners[a])});return this.events},binding:function(b){this.events.on.call(this,
8b.scrollContent,"scroll","onScrollResize").on.call(this,b.scope,"mouseenter","onScrollResize").on.call(this,b.bar,"mousedown","onBarMouseDown").on.call(this,window,"resize","onScrollResize");this.settings.track&&this.events.on.call(this,b.track,"click","onTrackClick")},drag:function(b){this.events[b].call(this,document,"mousemove","onDrag")[b].call(this,document,"mouseup","onStopDrag")},callbacks:{onScrollResize:function(b){this.moveBar.call(this);clearTimeout(this.listeners.timeout__resize);this.listeners.timeout__resize=
9setTimeout(this.getTrackBounds.bind(this),200)},onDrag:function(b){var a=this,d=b.pageY-this.state.lastPageY;raf(function(){var c=document.documentElement.scrollTop;b.pageY>=a.state.trackBounds.top+c&&b.pageY<=a.state.trackBounds.bottom+c&&(a.DOM.scrollContent.scrollTop=a.state.drag+d/a.state.scrollRatio)})},onStopDrag:function(b){var a=this;[this.DOM.bar,document.body].map(function(a){return a.classList.remove("fakeScroll--grabbed")});this.events.drag.call(this,"off");setTimeout(function(){a.state.drag=
10!1})},onBarMouseDown:function(b){this.state.drag=this.DOM.scrollContent.scrollTop;this.state.lastPageY=b.pageY;[this.DOM.bar,document.body].map(function(a){return a.classList.add("fakeScroll--grabbed")});this.events.drag.call(this,"on")},onTrackClick:function(b){var a=this;this.state.drag||(b=(b.clientY-this.state.trackBounds.top)/(this.state.trackBounds.height-this.state.trackBounds.topPad-this.state.trackBounds.bottomPad)*(this.DOM.scrollContent.scrollHeight-this.DOM.scrollWrap.clientHeight),"smooth"==
11this.settings.track&&(this.DOM.scrollContent.style.scrollBehavior="smooth",setTimeout(function(){a.DOM.scrollContent.style.scrollBehavior="unset"},500)),this.DOM.scrollContent.scrollTop=b)}}},getTrackBounds:function(){var b=this.DOM.track.getBoundingClientRect(),a=window.getComputedStyle(this.DOM.track,null);b.topPad=parseInt(a.paddingTop,10);b.bottomPad=parseInt(a.paddingBottom,10);return this.state.trackBounds=b},moveBar:function(){var b=this,a=this.DOM.scrollContent,d=a.scrollHeight,c=this.DOM.scrollWrap.clientHeight;
12this.state.scrollRatio=c/d;raf(function(){b.DOM.bar.style.cssText="height  : "+c/d*100+"%;\n                                              top     : "+a.scrollTop/d*100+"%;\n                                              display : "+(d<=c?"none":"")})}};Element.prototype.fakeScroll=function(b){return this._fakeScroll=this._fakeScroll||new e(this,b||{})}})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.