PageSourceSearch

https://blackink.agency/wp-content/cache/min/1/wp-content/themes/hervin/js/wheel-indicator.js?ver=1791142838

js blackink.agency collected 2026-10-07 09:26:56 UTC 3,820 bytes, 26 lines download raw bytes

1/**
2 * Generates event when user makes new movement (like a swipe on a touchscreen).
3 * @version 1.2.0
4 * @link https://github.com/Promo/wheel-indicator
5 * @license MIT
6 */
7var WheelIndicator=(function(){function Module(options){var DEFAULTS={callback:function(){},elem:document,preventMouse:!0};this.eventWheel='onwheel' in document?'wheel':'mousewheel';this._options=extend(DEFAULTS,options);this._deltaArray=[0,0,0];this._isAcceleration=!1;this._isStopped=!0;this._direction='';this._timer='';this._isWorking=!0;var self=this;this._wheelHandler=function(event){if(self._isWorking){processDelta.call(self,event);if(self._options.preventMouse){preventDefault(event)}}};addEvent(this._options.elem,this.eventWheel,this._wheelHandler)}
8Module.prototype={constructor:Module,turnOn:function(){this._isWorking=!0;return this},turnOff:function(){this._isWorking=!1;return this},setOptions:function(options){this._options=extend(this._options,options);return this},getOption:function(option){var neededOption=this._options[option];if(neededOption!==undefined){return neededOption}
9throw new Error('Unknown option')},destroy:function(){removeEvent(this._options.elem,this.eventWheel,this._wheelHandler);return this}};function triggerEvent(event){event.direction=this._direction;this._options.callback(event)}
10var getDeltaY=function(event){if(event.wheelDelta&&!event.deltaY){getDeltaY=function(event){return event.wheelDelta*-1}}else{getDeltaY=function(event){return event.deltaY}}
11return getDeltaY(event)};function preventDefault(event){event=event||window.event;if(event.preventDefault){event.preventDefault()}else{event.returnValue=!1}}
12function processDelta(event){var
13self=this,delta=getDeltaY(event);if(delta===0)return;var direction=delta>0?'down':'up',arrayLength=self._deltaArray.length,changedDirection=!1,repeatDirection=0,sustainableDirection,i;clearTimeout(self._timer);self._timer=setTimeout(function(){self._deltaArray=[0,0,0];self._isStopped=!0;self._direction=direction},150);for(i=0;i<arrayLength;i++){if(self._deltaArray[i]!==0){self._deltaArray[i]>0?++repeatDirection:--repeatDirection}}
14if(Math.abs(repeatDirection)===arrayLength){sustainableDirection=repeatDirection>0?'down':'up';if(sustainableDirection!==self._direction){changedDirection=!0;self._direction=direction}}
15if(!self._isStopped){if(changedDirection){self._isAcceleration=!0;triggerEvent.call(this,event)}else{if(Math.abs(repeatDirection)===arrayLength){analyzeArray.call(this,event)}}}
16if(self._isStopped){self._isStopped=!1;self._isAcceleration=!0;self._direction=direction;triggerEvent.call(this,event)}
17self._deltaArray.shift();self._deltaArray.push(delta)}
18function analyzeArray(event){var
19deltaArray0Abs=Math.abs(this._deltaArray[0]),deltaArray1Abs=Math.abs(this._deltaArray[1]),deltaArray2Abs=Math.abs(this._deltaArray[2]),deltaAbs=Math.abs(getDeltaY(event));if((deltaAbs>deltaArray2Abs)&&(deltaArray2Abs>deltaArray1Abs)&&(deltaArray1Abs>deltaArray0Abs)){if(!this._isAcceleration){triggerEvent.call(this,event);this._isAcceleration=!0}}
20if((deltaAbs<deltaArray2Abs)&&(deltaArray2Abs<=deltaArray1Abs)){this._isAcceleration=!1}}
21function addEvent(elem,type,handler){if(elem.addEventListener){elem.addEventListener(type,handler,!1)}else if(elem.attachEvent){elem.attachEvent('on'+type,handler)}}
22function removeEvent(elem,type,handler){if(elem.removeEventListener){elem.removeEventListener(type,handler,!1)}else if(elem.detachEvent){elem.detachEvent('on'+type,handler)}}
23function extend(defaults,options){var extended={},prop;for(prop in defaults){if(Object.prototype.hasOwnProperty.call(defaults,prop)){extended[prop]=defaults[prop]}}
24for(prop in options){if(Object.prototype.hasOwnProperty.call(options,prop)){extended[prop]=options[prop]}}
25return extended}
26return Module}());if(typeof exports==='object'){module.exports=WheelIndicator}

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.