backend_theme/static/lib/js/iscroll-probe.5.2.0.js
File iscroll-probe.5.2.0.js
has 1676 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*! iScroll v5.2.0 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
Function utils
has 213 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var utils = (function () {
var me = {};
var _elementStyle = document.createElement('div').style;
var _vendor = (function () {
Function _initSnap
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_initSnap: function () {
this.currentPage = {};
if ( typeof this.options.snap == 'string' ) {
this.options.snap = this.scroller.querySelectorAll(this.options.snap);
Function _initIndicators
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_initIndicators: function () {
var interactive = this.options.interactiveScrollbars,
customStyle = typeof this.options.scrollbars != 'string',
indicators = [],
indicator;
Function _move
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_move: function (e) {
if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
return;
}
Function _wheel
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_wheel: function (e) {
if ( !this.enabled ) {
return;
}
Function _key
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_key: function (e) {
if ( !this.enabled ) {
return;
}
Function refresh
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
refresh: function () {
this.transitionTime();
if ( this.options.listenX && !this.options.listenY ) {
this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none';
Function _end
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_end: function (e) {
if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
return;
}
Function IScroll
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function IScroll (el, options) {
this.wrapper = typeof el == 'string' ? document.querySelector(el) : el;
this.scroller = this.wrapper.children[0];
this.scrollerStyle = this.scroller.style; // cache style for better performance
Function _nearestSnap
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_nearestSnap: function (x, y) {
if ( !this.pages.length ) {
return { x: 0, y: 0, pageX: 0, pageY: 0 };
}
Function Indicator
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Indicator (scroller, options) {
this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el;
this.wrapperStyle = this.wrapper.style;
this.indicator = this.wrapper.children[0];
this.indicatorStyle = this.indicator.style;
Function updatePosition
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updatePosition: function () {
var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0,
y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0;
if ( !this.options.ignoreBoundaries ) {
Function handleEvent
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleEvent: function (e) {
switch ( e.type ) {
case 'touchstart':
case 'pointerdown':
case 'MSPointerDown':
Function _start
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_start: function (e) {
// React to left mouse button only
if ( utils.eventType[e.type] != 1 ) {
// for button property
// http://unixpapa.com/js/mouse.html
Function _animate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_animate: function (destX, destY, duration, easingFn) {
var that = this,
startX = this.x,
startY = this.y,
startTime = utils.getTime(),
Function _initEvents
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_initEvents: function (remove) {
var eventType = remove ? utils.removeEvent : utils.addEvent,
target = this.options.bindToWrapper ? this.wrapper : window;
eventType(window, 'orientationchange', this);
Function _initKeys
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_initKeys: function (e) {
// default key bindings
var keys = {
pageUp: 33,
pageDown: 34,
Function _end
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_end: function (e) {
if ( !this.initiated ) {
return;
}
Function createDefaultScrollbar
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createDefaultScrollbar (direction, interactive, type) {
var scrollbar = document.createElement('div'),
indicator = document.createElement('div');
if ( type === true ) {
Function momentum
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
Consider simplifying this complex logical expression. Open
Open
if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
// initMouseEvent is deprecated.
ev = document.createEvent(window.MouseEvent ? 'MouseEvents' : 'Event');
ev.initEvent('click', true, true);
Function scrollToElement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
scrollToElement: function (el, time, offsetX, offsetY, easing) {
Avoid too many return
statements within this function. Open
Open
return;