code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function attachEvents() { const swiper = this; const document = getDocument(); const { params, support } = swiper; swiper.onTouchStart = onTouchStart.bind(swiper); swiper.onTouchMove = onTouchMove.bind(swiper); swiper.onTouchEnd = onTouchEnd.bind(swiper); if (params.cssMode) { swiper.onScroll = onScroll.bind(swiper); } swiper.onClick = onClick.bind(swiper); if (support.touch && !dummyEventAttached) { document.addEventListener('touchstart', dummyEventListener); dummyEventAttached = true; } events(swiper, 'on'); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
attachEvents
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function detachEvents() { const swiper = this; events(swiper, 'off'); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
detachEvents
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
isGridEnabled = (swiper, params) => { return swiper.grid && params.grid && params.grid.rows > 1; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
isGridEnabled
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
isGridEnabled = (swiper, params) => { return swiper.grid && params.grid && params.grid.rows > 1; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
isGridEnabled
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function setBreakpoint() { const swiper = this; const { activeIndex, initialized, loopedSlides = 0, params, $el } = swiper; const breakpoints = params.breakpoints; if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el); if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; const breakpointParams = breakpointOnlyParams || swiper.originalParams; const wasMultiRow = isGridEnabled(swiper, params); const isMultiRow = isGridEnabled(swiper, breakpointParams); const wasEnabled = params.enabled; if (wasMultiRow && !isMultiRow) { $el.removeClass(`${params.containerModifierClass}grid ${params.containerModifierClass}grid-column`); swiper.emitContainerClasses(); } else if (!wasMultiRow && isMultiRow) { $el.addClass(`${params.containerModifierClass}grid`); if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') { $el.addClass(`${params.containerModifierClass}grid-column`); } swiper.emitContainerClasses(); } // Toggle navigation, pagination, scrollbar ['navigation', 'pagination', 'scrollbar'].forEach(prop => { const wasModuleEnabled = params[prop] && params[prop].enabled; const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled; if (wasModuleEnabled && !isModuleEnabled) { swiper[prop].disable(); } if (!wasModuleEnabled && isModuleEnabled) { swiper[prop].enable(); } }); const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); if (directionChanged && initialized) { swiper.changeDirection(); } extend(swiper.params, breakpointParams); const isEnabled = swiper.params.enabled; Object.assign(swiper, { allowTouchMove: swiper.params.allowTouchMove, allowSlideNext: swiper.params.allowSlideNext, allowSlidePrev: swiper.params.allowSlidePrev }); if (wasEnabled && !isEnabled) { swiper.disable(); } else if (!wasEnabled && isEnabled) { swiper.enable(); } swiper.currentBreakpoint = breakpoint; swiper.emit('_beforeBreakpoint', breakpointParams); if (needsReLoop && initialized) { swiper.loopDestroy(); swiper.loopCreate(); swiper.updateSlides(); swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false); } swiper.emit('breakpoint', breakpointParams); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
setBreakpoint
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function getBreakpoint(breakpoints, base, containerEl) { if (base === void 0) { base = 'window'; } if (!breakpoints || base === 'container' && !containerEl) return undefined; let breakpoint = false; const window = getWindow(); const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight; const points = Object.keys(breakpoints).map(point => { if (typeof point === 'string' && point.indexOf('@') === 0) { const minRatio = parseFloat(point.substr(1)); const value = currentHeight * minRatio; return { value, point }; } return { value: point, point }; }); points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10)); for (let i = 0; i < points.length; i += 1) { const { point, value } = points[i]; if (base === 'window') { if (window.matchMedia(`(min-width: ${value}px)`).matches) { breakpoint = point; } } else if (value <= containerEl.clientWidth) { breakpoint = point; } } return breakpoint || 'max'; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
getBreakpoint
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function prepareClasses(entries, prefix) { const resultClasses = []; entries.forEach(item => { if (typeof item === 'object') { Object.keys(item).forEach(classNames => { if (item[classNames]) { resultClasses.push(prefix + classNames); } }); } else if (typeof item === 'string') { resultClasses.push(prefix + item); } }); return resultClasses; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
prepareClasses
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function addClasses() { const swiper = this; const { classNames, params, rtl, $el, device, support } = swiper; // prettier-ignore const suffixes = prepareClasses(['initialized', params.direction, { 'pointer-events': !support.touch }, { 'free-mode': swiper.params.freeMode && params.freeMode.enabled }, { 'autoheight': params.autoHeight }, { 'rtl': rtl }, { 'grid': params.grid && params.grid.rows > 1 }, { 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' }, { 'android': device.android }, { 'ios': device.ios }, { 'css-mode': params.cssMode }, { 'centered': params.cssMode && params.centeredSlides }, { 'watch-progress': params.watchSlidesProgress }], params.containerModifierClass); classNames.push(...suffixes); $el.addClass([...classNames].join(' ')); swiper.emitContainerClasses(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
addClasses
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function removeClasses() { const swiper = this; const { $el, classNames } = swiper; $el.removeClass(classNames.join(' ')); swiper.emitContainerClasses(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
removeClasses
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) { const window = getWindow(); let image; function onReady() { if (callback) callback(); } const isPicture = $(imageEl).parent('picture')[0]; if (!isPicture && (!imageEl.complete || !checkForComplete)) { if (src) { image = new window.Image(); image.onload = onReady; image.onerror = onReady; if (sizes) { image.sizes = sizes; } if (srcset) { image.srcset = srcset; } if (src) { image.src = src; } } else { onReady(); } } else { // image already loaded... onReady(); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
loadImage
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function onReady() { if (callback) callback(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
onReady
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function preloadImages() { const swiper = this; swiper.imagesToLoad = swiper.$el.find('img'); function onReady() { if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return; if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1; if (swiper.imagesLoaded === swiper.imagesToLoad.length) { if (swiper.params.updateOnImagesReady) swiper.update(); swiper.emit('imagesReady'); } } for (let i = 0; i < swiper.imagesToLoad.length; i += 1) { const imageEl = swiper.imagesToLoad[i]; swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
preloadImages
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function onReady() { if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return; if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1; if (swiper.imagesLoaded === swiper.imagesToLoad.length) { if (swiper.params.updateOnImagesReady) swiper.update(); swiper.emit('imagesReady'); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
onReady
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function checkOverflow() { const swiper = this; const { isLocked: wasLocked, params } = swiper; const { slidesOffsetBefore } = params; if (slidesOffsetBefore) { const lastSlideIndex = swiper.slides.length - 1; const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; swiper.isLocked = swiper.size > lastSlideRightEdge; } else { swiper.isLocked = swiper.snapGrid.length === 1; } if (params.allowSlideNext === true) { swiper.allowSlideNext = !swiper.isLocked; } if (params.allowSlidePrev === true) { swiper.allowSlidePrev = !swiper.isLocked; } if (wasLocked && wasLocked !== swiper.isLocked) { swiper.isEnd = false; } if (wasLocked !== swiper.isLocked) { swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
checkOverflow
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function moduleExtendParams(params, allModulesParams) { return function extendParams(obj) { if (obj === void 0) { obj = {}; } const moduleParamName = Object.keys(obj)[0]; const moduleParams = obj[moduleParamName]; if (typeof moduleParams !== 'object' || moduleParams === null) { extend(allModulesParams, obj); return; } if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) { params[moduleParamName] = { auto: true }; } if (!(moduleParamName in params && 'enabled' in moduleParams)) { extend(allModulesParams, obj); return; } if (params[moduleParamName] === true) { params[moduleParamName] = { enabled: true }; } if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) { params[moduleParamName].enabled = true; } if (!params[moduleParamName]) params[moduleParamName] = { enabled: false }; extend(allModulesParams, obj); }; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
moduleExtendParams
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
constructor() { let el; let params; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') { params = args[0]; } else { [el, params] = args; } if (!params) params = {}; params = extend({}, params); if (el && !params.el) params.el = el; if (params.el && $(params.el).length > 1) { const swipers = []; $(params.el).each(containerEl => { const newParams = extend({}, params, { el: containerEl }); swipers.push(new Swiper(newParams)); }); // eslint-disable-next-line no-constructor-return return swipers; } // Swiper Instance const swiper = this; swiper.__swiper__ = true; swiper.support = getSupport(); swiper.device = getDevice({ userAgent: params.userAgent }); swiper.browser = getBrowser(); swiper.eventsListeners = {}; swiper.eventsAnyListeners = []; swiper.modules = [...swiper.__modules__]; if (params.modules && Array.isArray(params.modules)) { swiper.modules.push(...params.modules); } const allModulesParams = {}; swiper.modules.forEach(mod => { mod({ swiper, extendParams: moduleExtendParams(params, allModulesParams), on: swiper.on.bind(swiper), once: swiper.once.bind(swiper), off: swiper.off.bind(swiper), emit: swiper.emit.bind(swiper) }); }); // Extend defaults with modules params const swiperParams = extend({}, defaults, allModulesParams); // Extend defaults with passed params swiper.params = extend({}, swiperParams, extendedDefaults, params); swiper.originalParams = extend({}, swiper.params); swiper.passedParams = extend({}, params); // add event listeners if (swiper.params && swiper.params.on) { Object.keys(swiper.params.on).forEach(eventName => { swiper.on(eventName, swiper.params.on[eventName]); }); } if (swiper.params && swiper.params.onAny) { swiper.onAny(swiper.params.onAny); } // Save Dom lib swiper.$ = $; // Extend Swiper Object.assign(swiper, { enabled: swiper.params.enabled, el, // Classes classNames: [], // Slides slides: $(), slidesGrid: [], snapGrid: [], slidesSizesGrid: [], // isDirection isHorizontal() { return swiper.params.direction === 'horizontal'; }, isVertical() { return swiper.params.direction === 'vertical'; }, // Indexes activeIndex: 0, realIndex: 0, // isBeginning: true, isEnd: false, // Props translate: 0, previousTranslate: 0, progress: 0, velocity: 0, animating: false, // Locks allowSlideNext: swiper.params.allowSlideNext, allowSlidePrev: swiper.params.allowSlidePrev, // Touch Events touchEvents: function touchEvents() { const touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel']; const desktop = ['pointerdown', 'pointermove', 'pointerup']; swiper.touchEventsTouch = { start: touch[0], move: touch[1], end: touch[2], cancel: touch[3] }; swiper.touchEventsDesktop = { start: desktop[0], move: desktop[1], end: desktop[2] }; return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop; }(), touchEventsData: { isTouched: undefined, isMoved: undefined, allowTouchCallbacks: undefined, touchStartTime: undefined, isScrolling: undefined, currentTranslate: undefined, startTranslate: undefined, allowThresholdMove: undefined, // Form elements to match focusableElements: swiper.params.focusableElements, // Last click time lastClickTime: now(), clickTimeout: undefined, // Velocities velocities: [], allowMomentumBounce: undefined, isTouchEvent: undefined, startMoving: undefined }, // Clicks allowClick: true, // Touches allowTouchMove: swiper.params.allowTouchMove, touches: { startX: 0, startY: 0, currentX: 0, currentY: 0, diff: 0 }, // Images imagesToLoad: [], imagesLoaded: 0 }); swiper.emit('_swiper'); // Init if (swiper.params.init) { swiper.init(); } // Return app instance // eslint-disable-next-line no-constructor-return return swiper; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
constructor
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
isHorizontal() { return swiper.params.direction === 'horizontal'; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
isHorizontal
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
isVertical() { return swiper.params.direction === 'vertical'; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
isVertical
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
enable() { const swiper = this; if (swiper.enabled) return; swiper.enabled = true; if (swiper.params.grabCursor) { swiper.setGrabCursor(); } swiper.emit('enable'); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
enable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
disable() { const swiper = this; if (!swiper.enabled) return; swiper.enabled = false; if (swiper.params.grabCursor) { swiper.unsetGrabCursor(); } swiper.emit('disable'); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
disable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
setProgress(progress, speed) { const swiper = this; progress = Math.min(Math.max(progress, 0), 1); const min = swiper.minTranslate(); const max = swiper.maxTranslate(); const current = (max - min) * progress + min; swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
setProgress
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
emitContainerClasses() { const swiper = this; if (!swiper.params._emitClasses || !swiper.el) return; const cls = swiper.el.className.split(' ').filter(className => { return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; }); swiper.emit('_containerClasses', cls.join(' ')); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
emitContainerClasses
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
getSlideClasses(slideEl) { const swiper = this; if (swiper.destroyed) return ''; return slideEl.className.split(' ').filter(className => { return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; }).join(' '); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
getSlideClasses
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
emitSlidesClasses() { const swiper = this; if (!swiper.params._emitClasses || !swiper.el) return; const updates = []; swiper.slides.each(slideEl => { const classNames = swiper.getSlideClasses(slideEl); updates.push({ slideEl, classNames }); swiper.emit('_slideClass', slideEl, classNames); }); swiper.emit('_slideClasses', updates); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
emitSlidesClasses
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
slidesPerViewDynamic(view, exact) { if (view === void 0) { view = 'current'; } if (exact === void 0) { exact = false; } const swiper = this; const { params, slides, slidesGrid, slidesSizesGrid, size: swiperSize, activeIndex } = swiper; let spv = 1; if (params.centeredSlides) { let slideSize = slides[activeIndex].swiperSlideSize; let breakLoop; for (let i = activeIndex + 1; i < slides.length; i += 1) { if (slides[i] && !breakLoop) { slideSize += slides[i].swiperSlideSize; spv += 1; if (slideSize > swiperSize) breakLoop = true; } } for (let i = activeIndex - 1; i >= 0; i -= 1) { if (slides[i] && !breakLoop) { slideSize += slides[i].swiperSlideSize; spv += 1; if (slideSize > swiperSize) breakLoop = true; } } } else { // eslint-disable-next-line if (view === 'current') { for (let i = activeIndex + 1; i < slides.length; i += 1) { const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize; if (slideInView) { spv += 1; } } } else { // previous for (let i = activeIndex - 1; i >= 0; i -= 1) { const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize; if (slideInView) { spv += 1; } } } } return spv; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
slidesPerViewDynamic
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
update() { const swiper = this; if (!swiper || swiper.destroyed) return; const { snapGrid, params } = swiper; // Breakpoints if (params.breakpoints) { swiper.setBreakpoint(); } swiper.updateSize(); swiper.updateSlides(); swiper.updateProgress(); swiper.updateSlidesClasses(); function setTranslate() { const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); swiper.setTranslate(newTranslate); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } let translated; if (swiper.params.freeMode && swiper.params.freeMode.enabled) { setTranslate(); if (swiper.params.autoHeight) { swiper.updateAutoHeight(); } } else { if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) { translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true); } else { translated = swiper.slideTo(swiper.activeIndex, 0, false, true); } if (!translated) { setTranslate(); } } if (params.watchOverflow && snapGrid !== swiper.snapGrid) { swiper.checkOverflow(); } swiper.emit('update'); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
update
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function setTranslate() { const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); swiper.setTranslate(newTranslate); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
setTranslate
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
changeDirection(newDirection, needUpdate) { if (needUpdate === void 0) { needUpdate = true; } const swiper = this; const currentDirection = swiper.params.direction; if (!newDirection) { // eslint-disable-next-line newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; } if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') { return swiper; } swiper.$el.removeClass(`${swiper.params.containerModifierClass}${currentDirection}`).addClass(`${swiper.params.containerModifierClass}${newDirection}`); swiper.emitContainerClasses(); swiper.params.direction = newDirection; swiper.slides.each(slideEl => { if (newDirection === 'vertical') { slideEl.style.width = ''; } else { slideEl.style.height = ''; } }); swiper.emit('changeDirection'); if (needUpdate) swiper.update(); return swiper; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
changeDirection
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
changeLanguageDirection(direction) { const swiper = this; if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return; swiper.rtl = direction === 'rtl'; swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl; if (swiper.rtl) { swiper.$el.addClass(`${swiper.params.containerModifierClass}rtl`); swiper.el.dir = 'rtl'; } else { swiper.$el.removeClass(`${swiper.params.containerModifierClass}rtl`); swiper.el.dir = 'ltr'; } swiper.update(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
changeLanguageDirection
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
mount(el) { const swiper = this; if (swiper.mounted) return true; // Find el const $el = $(el || swiper.params.el); el = $el[0]; if (!el) { return false; } el.swiper = swiper; const getWrapperSelector = () => { return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; }; const getWrapper = () => { if (el && el.shadowRoot && el.shadowRoot.querySelector) { const res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items res.children = options => $el.children(options); return res; } if (!$el.children) { return $($el).children(getWrapperSelector()); } return $el.children(getWrapperSelector()); }; // Find Wrapper let $wrapperEl = getWrapper(); if ($wrapperEl.length === 0 && swiper.params.createElements) { const document = getDocument(); const wrapper = document.createElement('div'); $wrapperEl = $(wrapper); wrapper.className = swiper.params.wrapperClass; $el.append(wrapper); $el.children(`.${swiper.params.slideClass}`).each(slideEl => { $wrapperEl.append(slideEl); }); } Object.assign(swiper, { $el, el, $wrapperEl, wrapperEl: $wrapperEl[0], mounted: true, // RTL rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl', rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'), wrongRTL: $wrapperEl.css('display') === '-webkit-box' }); return true; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
mount
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
getWrapperSelector = () => { return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
getWrapperSelector
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
getWrapperSelector = () => { return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
getWrapperSelector
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
getWrapper = () => { if (el && el.shadowRoot && el.shadowRoot.querySelector) { const res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items res.children = options => $el.children(options); return res; } if (!$el.children) { return $($el).children(getWrapperSelector()); } return $el.children(getWrapperSelector()); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
getWrapper
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
getWrapper = () => { if (el && el.shadowRoot && el.shadowRoot.querySelector) { const res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items res.children = options => $el.children(options); return res; } if (!$el.children) { return $($el).children(getWrapperSelector()); } return $el.children(getWrapperSelector()); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
getWrapper
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
init(el) { const swiper = this; if (swiper.initialized) return swiper; const mounted = swiper.mount(el); if (mounted === false) return swiper; swiper.emit('beforeInit'); // Set breakpoint if (swiper.params.breakpoints) { swiper.setBreakpoint(); } // Add Classes swiper.addClasses(); // Create loop if (swiper.params.loop) { swiper.loopCreate(); } // Update size swiper.updateSize(); // Update slides swiper.updateSlides(); if (swiper.params.watchOverflow) { swiper.checkOverflow(); } // Set Grab Cursor if (swiper.params.grabCursor && swiper.enabled) { swiper.setGrabCursor(); } if (swiper.params.preloadImages) { swiper.preloadImages(); } // Slide To Initial Slide if (swiper.params.loop) { swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true); } else { swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); } // Attach events swiper.attachEvents(); // Init Flag swiper.initialized = true; // Emit swiper.emit('init'); swiper.emit('afterInit'); return swiper; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
init
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
destroy(deleteInstance, cleanStyles) { if (deleteInstance === void 0) { deleteInstance = true; } if (cleanStyles === void 0) { cleanStyles = true; } const swiper = this; const { params, $el, $wrapperEl, slides } = swiper; if (typeof swiper.params === 'undefined' || swiper.destroyed) { return null; } swiper.emit('beforeDestroy'); // Init Flag swiper.initialized = false; // Detach events swiper.detachEvents(); // Destroy loop if (params.loop) { swiper.loopDestroy(); } // Cleanup styles if (cleanStyles) { swiper.removeClasses(); $el.removeAttr('style'); $wrapperEl.removeAttr('style'); if (slides && slides.length) { slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index'); } } swiper.emit('destroy'); // Detach emitter events Object.keys(swiper.eventsListeners).forEach(eventName => { swiper.off(eventName); }); if (deleteInstance !== false) { swiper.$el[0].swiper = null; deleteProps(swiper); } swiper.destroyed = true; return null; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
destroy
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
static extendDefaults(newDefaults) { extend(extendedDefaults, newDefaults); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
extendDefaults
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
static get extendedDefaults() { return extendedDefaults; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
extendedDefaults
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
static get defaults() { return defaults; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
defaults
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
static installModule(mod) { if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = []; const modules = Swiper.prototype.__modules__; if (typeof mod === 'function' && modules.indexOf(mod) < 0) { modules.push(mod); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
installModule
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
static use(module) { if (Array.isArray(module)) { module.forEach(m => Swiper.installModule(m)); return Swiper; } Swiper.installModule(module); return Swiper; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
use
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function Virtual(_ref) { let { swiper, extendParams, on, emit } = _ref; extendParams({ virtual: { enabled: false, slides: [], cache: true, renderSlide: null, renderExternal: null, renderExternalUpdate: true, addSlidesBefore: 0, addSlidesAfter: 0 } }); let cssModeTimeout; swiper.virtual = { cache: {}, from: undefined, to: undefined, slides: [], offset: 0, slidesGrid: [] }; function renderSlide(slide, index) { const params = swiper.params.virtual; if (params.cache && swiper.virtual.cache[index]) { return swiper.virtual.cache[index]; } const $slideEl = params.renderSlide ? $(params.renderSlide.call(swiper, slide, index)) : $(`<div class="${swiper.params.slideClass}" data-swiper-slide-index="${index}">${slide}</div>`); if (!$slideEl.attr('data-swiper-slide-index')) $slideEl.attr('data-swiper-slide-index', index); if (params.cache) swiper.virtual.cache[index] = $slideEl; return $slideEl; } function update(force) { const { slidesPerView, slidesPerGroup, centeredSlides } = swiper.params; const { addSlidesBefore, addSlidesAfter } = swiper.params.virtual; const { from: previousFrom, to: previousTo, slides, slidesGrid: previousSlidesGrid, offset: previousOffset } = swiper.virtual; if (!swiper.params.cssMode) { swiper.updateActiveIndex(); } const activeIndex = swiper.activeIndex || 0; let offsetProp; if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top'; let slidesAfter; let slidesBefore; if (centeredSlides) { slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter; slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore; } else { slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter; slidesBefore = slidesPerGroup + addSlidesBefore; } const from = Math.max((activeIndex || 0) - slidesBefore, 0); const to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1); const offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); Object.assign(swiper.virtual, { from, to, offset, slidesGrid: swiper.slidesGrid }); function onRendered() { swiper.updateSlides(); swiper.updateProgress(); swiper.updateSlidesClasses(); if (swiper.lazy && swiper.params.lazy.enabled) { swiper.lazy.load(); } emit('virtualUpdate'); } if (previousFrom === from && previousTo === to && !force) { if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) { swiper.slides.css(offsetProp, `${offset}px`); } swiper.updateProgress(); emit('virtualUpdate'); return; } if (swiper.params.virtual.renderExternal) { swiper.params.virtual.renderExternal.call(swiper, { offset, from, to, slides: function getSlides() { const slidesToRender = []; for (let i = from; i <= to; i += 1) { slidesToRender.push(slides[i]); } return slidesToRender; }() }); if (swiper.params.virtual.renderExternalUpdate) { onRendered(); } else { emit('virtualUpdate'); } return; } const prependIndexes = []; const appendIndexes = []; if (force) { swiper.$wrapperEl.find(`.${swiper.params.slideClass}`).remove(); } else { for (let i = previousFrom; i <= previousTo; i += 1) { if (i < from || i > to) { swiper.$wrapperEl.find(`.${swiper.params.slideClass}[data-swiper-slide-index="${i}"]`).remove(); } } } for (let i = 0; i < slides.length; i += 1) { if (i >= from && i <= to) { if (typeof previousTo === 'undefined' || force) { appendIndexes.push(i); } else { if (i > previousTo) appendIndexes.push(i); if (i < previousFrom) prependIndexes.push(i); } } } appendIndexes.forEach(index => { swiper.$wrapperEl.append(renderSlide(slides[index], index)); }); prependIndexes.sort((a, b) => b - a).forEach(index => { swiper.$wrapperEl.prepend(renderSlide(slides[index], index)); }); swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, `${offset}px`); onRendered(); } function appendSlide(slides) { if (typeof slides === 'object' && 'length' in slides) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) swiper.virtual.slides.push(slides[i]); } } else { swiper.virtual.slides.push(slides); } update(true); } function prependSlide(slides) { const activeIndex = swiper.activeIndex; let newActiveIndex = activeIndex + 1; let numberOfNewSlides = 1; if (Array.isArray(slides)) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) swiper.virtual.slides.unshift(slides[i]); } newActiveIndex = activeIndex + slides.length; numberOfNewSlides = slides.length; } else { swiper.virtual.slides.unshift(slides); } if (swiper.params.virtual.cache) { const cache = swiper.virtual.cache; const newCache = {}; Object.keys(cache).forEach(cachedIndex => { const $cachedEl = cache[cachedIndex]; const cachedElIndex = $cachedEl.attr('data-swiper-slide-index'); if (cachedElIndex) { $cachedEl.attr('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides); } newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = $cachedEl; }); swiper.virtual.cache = newCache; } update(true); swiper.slideTo(newActiveIndex, 0); } function removeSlide(slidesIndexes) { if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return; let activeIndex = swiper.activeIndex; if (Array.isArray(slidesIndexes)) { for (let i = slidesIndexes.length - 1; i >= 0; i -= 1) { swiper.virtual.slides.splice(slidesIndexes[i], 1); if (swiper.params.virtual.cache) { delete swiper.virtual.cache[slidesIndexes[i]]; } if (slidesIndexes[i] < activeIndex) activeIndex -= 1; activeIndex = Math.max(activeIndex, 0); } } else { swiper.virtual.slides.splice(slidesIndexes, 1); if (swiper.params.virtual.cache) { delete swiper.virtual.cache[slidesIndexes]; } if (slidesIndexes < activeIndex) activeIndex -= 1; activeIndex = Math.max(activeIndex, 0); } update(true); swiper.slideTo(activeIndex, 0); } function removeAllSlides() { swiper.virtual.slides = []; if (swiper.params.virtual.cache) { swiper.virtual.cache = {}; } update(true); swiper.slideTo(0, 0); } on('beforeInit', () => { if (!swiper.params.virtual.enabled) return; swiper.virtual.slides = swiper.params.virtual.slides; swiper.classNames.push(`${swiper.params.containerModifierClass}virtual`); swiper.params.watchSlidesProgress = true; swiper.originalParams.watchSlidesProgress = true; if (!swiper.params.initialSlide) { update(); } }); on('setTranslate', () => { if (!swiper.params.virtual.enabled) return; if (swiper.params.cssMode && !swiper._immediateVirtual) { clearTimeout(cssModeTimeout); cssModeTimeout = setTimeout(() => { update(); }, 100); } else { update(); } }); on('init update resize', () => { if (!swiper.params.virtual.enabled) return; if (swiper.params.cssMode) { setCSSProperty(swiper.wrapperEl, '--swiper-virtual-size', `${swiper.virtualSize}px`); } }); Object.assign(swiper.virtual, { appendSlide, prependSlide, removeSlide, removeAllSlides, update }); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
Virtual
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function renderSlide(slide, index) { const params = swiper.params.virtual; if (params.cache && swiper.virtual.cache[index]) { return swiper.virtual.cache[index]; } const $slideEl = params.renderSlide ? $(params.renderSlide.call(swiper, slide, index)) : $(`<div class="${swiper.params.slideClass}" data-swiper-slide-index="${index}">${slide}</div>`); if (!$slideEl.attr('data-swiper-slide-index')) $slideEl.attr('data-swiper-slide-index', index); if (params.cache) swiper.virtual.cache[index] = $slideEl; return $slideEl; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
renderSlide
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function update(force) { const { slidesPerView, slidesPerGroup, centeredSlides } = swiper.params; const { addSlidesBefore, addSlidesAfter } = swiper.params.virtual; const { from: previousFrom, to: previousTo, slides, slidesGrid: previousSlidesGrid, offset: previousOffset } = swiper.virtual; if (!swiper.params.cssMode) { swiper.updateActiveIndex(); } const activeIndex = swiper.activeIndex || 0; let offsetProp; if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top'; let slidesAfter; let slidesBefore; if (centeredSlides) { slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter; slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore; } else { slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter; slidesBefore = slidesPerGroup + addSlidesBefore; } const from = Math.max((activeIndex || 0) - slidesBefore, 0); const to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1); const offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); Object.assign(swiper.virtual, { from, to, offset, slidesGrid: swiper.slidesGrid }); function onRendered() { swiper.updateSlides(); swiper.updateProgress(); swiper.updateSlidesClasses(); if (swiper.lazy && swiper.params.lazy.enabled) { swiper.lazy.load(); } emit('virtualUpdate'); } if (previousFrom === from && previousTo === to && !force) { if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) { swiper.slides.css(offsetProp, `${offset}px`); } swiper.updateProgress(); emit('virtualUpdate'); return; } if (swiper.params.virtual.renderExternal) { swiper.params.virtual.renderExternal.call(swiper, { offset, from, to, slides: function getSlides() { const slidesToRender = []; for (let i = from; i <= to; i += 1) { slidesToRender.push(slides[i]); } return slidesToRender; }() }); if (swiper.params.virtual.renderExternalUpdate) { onRendered(); } else { emit('virtualUpdate'); } return; } const prependIndexes = []; const appendIndexes = []; if (force) { swiper.$wrapperEl.find(`.${swiper.params.slideClass}`).remove(); } else { for (let i = previousFrom; i <= previousTo; i += 1) { if (i < from || i > to) { swiper.$wrapperEl.find(`.${swiper.params.slideClass}[data-swiper-slide-index="${i}"]`).remove(); } } } for (let i = 0; i < slides.length; i += 1) { if (i >= from && i <= to) { if (typeof previousTo === 'undefined' || force) { appendIndexes.push(i); } else { if (i > previousTo) appendIndexes.push(i); if (i < previousFrom) prependIndexes.push(i); } } } appendIndexes.forEach(index => { swiper.$wrapperEl.append(renderSlide(slides[index], index)); }); prependIndexes.sort((a, b) => b - a).forEach(index => { swiper.$wrapperEl.prepend(renderSlide(slides[index], index)); }); swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, `${offset}px`); onRendered(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
update
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function onRendered() { swiper.updateSlides(); swiper.updateProgress(); swiper.updateSlidesClasses(); if (swiper.lazy && swiper.params.lazy.enabled) { swiper.lazy.load(); } emit('virtualUpdate'); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
onRendered
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function appendSlide(slides) { if (typeof slides === 'object' && 'length' in slides) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) swiper.virtual.slides.push(slides[i]); } } else { swiper.virtual.slides.push(slides); } update(true); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
appendSlide
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function prependSlide(slides) { const activeIndex = swiper.activeIndex; let newActiveIndex = activeIndex + 1; let numberOfNewSlides = 1; if (Array.isArray(slides)) { for (let i = 0; i < slides.length; i += 1) { if (slides[i]) swiper.virtual.slides.unshift(slides[i]); } newActiveIndex = activeIndex + slides.length; numberOfNewSlides = slides.length; } else { swiper.virtual.slides.unshift(slides); } if (swiper.params.virtual.cache) { const cache = swiper.virtual.cache; const newCache = {}; Object.keys(cache).forEach(cachedIndex => { const $cachedEl = cache[cachedIndex]; const cachedElIndex = $cachedEl.attr('data-swiper-slide-index'); if (cachedElIndex) { $cachedEl.attr('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides); } newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = $cachedEl; }); swiper.virtual.cache = newCache; } update(true); swiper.slideTo(newActiveIndex, 0); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
prependSlide
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function removeSlide(slidesIndexes) { if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return; let activeIndex = swiper.activeIndex; if (Array.isArray(slidesIndexes)) { for (let i = slidesIndexes.length - 1; i >= 0; i -= 1) { swiper.virtual.slides.splice(slidesIndexes[i], 1); if (swiper.params.virtual.cache) { delete swiper.virtual.cache[slidesIndexes[i]]; } if (slidesIndexes[i] < activeIndex) activeIndex -= 1; activeIndex = Math.max(activeIndex, 0); } } else { swiper.virtual.slides.splice(slidesIndexes, 1); if (swiper.params.virtual.cache) { delete swiper.virtual.cache[slidesIndexes]; } if (slidesIndexes < activeIndex) activeIndex -= 1; activeIndex = Math.max(activeIndex, 0); } update(true); swiper.slideTo(activeIndex, 0); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
removeSlide
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function removeAllSlides() { swiper.virtual.slides = []; if (swiper.params.virtual.cache) { swiper.virtual.cache = {}; } update(true); swiper.slideTo(0, 0); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
removeAllSlides
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function Keyboard(_ref) { let { swiper, extendParams, on, emit } = _ref; const document = getDocument(); const window = getWindow(); swiper.keyboard = { enabled: false }; extendParams({ keyboard: { enabled: false, onlyInViewport: true, pageUpDown: true } }); function handle(event) { if (!swiper.enabled) return; const { rtlTranslate: rtl } = swiper; let e = event; if (e.originalEvent) e = e.originalEvent; // jquery fix const kc = e.keyCode || e.charCode; const pageUpDown = swiper.params.keyboard.pageUpDown; const isPageUp = pageUpDown && kc === 33; const isPageDown = pageUpDown && kc === 34; const isArrowLeft = kc === 37; const isArrowRight = kc === 39; const isArrowUp = kc === 38; const isArrowDown = kc === 40; // Directions locks if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) { return false; } if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) { return false; } if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { return undefined; } if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) { return undefined; } if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) { let inView = false; // Check that swiper should be inside of visible area of window if (swiper.$el.parents(`.${swiper.params.slideClass}`).length > 0 && swiper.$el.parents(`.${swiper.params.slideActiveClass}`).length === 0) { return undefined; } const $el = swiper.$el; const swiperWidth = $el[0].clientWidth; const swiperHeight = $el[0].clientHeight; const windowWidth = window.innerWidth; const windowHeight = window.innerHeight; const swiperOffset = swiper.$el.offset(); if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft; const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]]; for (let i = 0; i < swiperCoord.length; i += 1) { const point = swiperCoord[i]; if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) { if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line inView = true; } } if (!inView) return undefined; } if (swiper.isHorizontal()) { if (isPageUp || isPageDown || isArrowLeft || isArrowRight) { if (e.preventDefault) e.preventDefault();else e.returnValue = false; } if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext(); if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev(); } else { if (isPageUp || isPageDown || isArrowUp || isArrowDown) { if (e.preventDefault) e.preventDefault();else e.returnValue = false; } if (isPageDown || isArrowDown) swiper.slideNext(); if (isPageUp || isArrowUp) swiper.slidePrev(); } emit('keyPress', kc); return undefined; } function enable() { if (swiper.keyboard.enabled) return; $(document).on('keydown', handle); swiper.keyboard.enabled = true; } function disable() { if (!swiper.keyboard.enabled) return; $(document).off('keydown', handle); swiper.keyboard.enabled = false; } on('init', () => { if (swiper.params.keyboard.enabled) { enable(); } }); on('destroy', () => { if (swiper.keyboard.enabled) { disable(); } }); Object.assign(swiper.keyboard, { enable, disable }); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
Keyboard
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function handle(event) { if (!swiper.enabled) return; const { rtlTranslate: rtl } = swiper; let e = event; if (e.originalEvent) e = e.originalEvent; // jquery fix const kc = e.keyCode || e.charCode; const pageUpDown = swiper.params.keyboard.pageUpDown; const isPageUp = pageUpDown && kc === 33; const isPageDown = pageUpDown && kc === 34; const isArrowLeft = kc === 37; const isArrowRight = kc === 39; const isArrowUp = kc === 38; const isArrowDown = kc === 40; // Directions locks if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) { return false; } if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) { return false; } if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { return undefined; } if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) { return undefined; } if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) { let inView = false; // Check that swiper should be inside of visible area of window if (swiper.$el.parents(`.${swiper.params.slideClass}`).length > 0 && swiper.$el.parents(`.${swiper.params.slideActiveClass}`).length === 0) { return undefined; } const $el = swiper.$el; const swiperWidth = $el[0].clientWidth; const swiperHeight = $el[0].clientHeight; const windowWidth = window.innerWidth; const windowHeight = window.innerHeight; const swiperOffset = swiper.$el.offset(); if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft; const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]]; for (let i = 0; i < swiperCoord.length; i += 1) { const point = swiperCoord[i]; if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) { if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line inView = true; } } if (!inView) return undefined; } if (swiper.isHorizontal()) { if (isPageUp || isPageDown || isArrowLeft || isArrowRight) { if (e.preventDefault) e.preventDefault();else e.returnValue = false; } if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext(); if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev(); } else { if (isPageUp || isPageDown || isArrowUp || isArrowDown) { if (e.preventDefault) e.preventDefault();else e.returnValue = false; } if (isPageDown || isArrowDown) swiper.slideNext(); if (isPageUp || isArrowUp) swiper.slidePrev(); } emit('keyPress', kc); return undefined; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
handle
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function enable() { if (swiper.keyboard.enabled) return; $(document).on('keydown', handle); swiper.keyboard.enabled = true; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
enable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function disable() { if (!swiper.keyboard.enabled) return; $(document).off('keydown', handle); swiper.keyboard.enabled = false; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
disable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function Mousewheel(_ref) { let { swiper, extendParams, on, emit } = _ref; const window = getWindow(); extendParams({ mousewheel: { enabled: false, releaseOnEdges: false, invert: false, forceToAxis: false, sensitivity: 1, eventsTarget: 'container', thresholdDelta: null, thresholdTime: null } }); swiper.mousewheel = { enabled: false }; let timeout; let lastScrollTime = now(); let lastEventBeforeSnap; const recentWheelEvents = []; function normalize(e) { // Reasonable defaults const PIXEL_STEP = 10; const LINE_HEIGHT = 40; const PAGE_HEIGHT = 800; let sX = 0; let sY = 0; // spinX, spinY let pX = 0; let pY = 0; // pixelX, pixelY // Legacy if ('detail' in e) { sY = e.detail; } if ('wheelDelta' in e) { sY = -e.wheelDelta / 120; } if ('wheelDeltaY' in e) { sY = -e.wheelDeltaY / 120; } if ('wheelDeltaX' in e) { sX = -e.wheelDeltaX / 120; } // side scrolling on FF with DOMMouseScroll if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if ('deltaY' in e) { pY = e.deltaY; } if ('deltaX' in e) { pX = e.deltaX; } if (e.shiftKey && !pX) { // if user scrolls with shift he wants horizontal scroll pX = pY; pY = 0; } if ((pX || pY) && e.deltaMode) { if (e.deltaMode === 1) { // delta in LINE units pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { // delta in PAGE units pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } // Fall-back if spin cannot be determined if (pX && !sX) { sX = pX < 1 ? -1 : 1; } if (pY && !sY) { sY = pY < 1 ? -1 : 1; } return { spinX: sX, spinY: sY, pixelX: pX, pixelY: pY }; } function handleMouseEnter() { if (!swiper.enabled) return; swiper.mouseEntered = true; } function handleMouseLeave() { if (!swiper.enabled) return; swiper.mouseEntered = false; } function animateSlider(newEvent) { if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) { // Prevent if delta of wheel scroll delta is below configured threshold return false; } if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) { // Prevent if time between scrolls is below configured threshold return false; } // If the movement is NOT big enough and // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): // Don't go any further (avoid insignificant scroll movement). if (newEvent.delta >= 6 && now() - lastScrollTime < 60) { // Return false as a default return true; } // If user is scrolling towards the end: // If the slider hasn't hit the latest slide or // if the slider is a loop and // if the slider isn't moving right now: // Go to next slide and // emit a scroll event. // Else (the user is scrolling towards the beginning) and // if the slider hasn't hit the first slide or // if the slider is a loop and // if the slider isn't moving right now: // Go to prev slide and // emit a scroll event. if (newEvent.direction < 0) { if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { swiper.slideNext(); emit('scroll', newEvent.raw); } } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { swiper.slidePrev(); emit('scroll', newEvent.raw); } // If you got here is because an animation has been triggered so store the current time lastScrollTime = new window.Date().getTime(); // Return false as a default return false; } function releaseScroll(newEvent) { const params = swiper.params.mousewheel; if (newEvent.direction < 0) { if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { // Return true to animate scroll on edges return true; } } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { // Return true to animate scroll on edges return true; } return false; } function handle(event) { let e = event; let disableParentSwiper = true; if (!swiper.enabled) return; const params = swiper.params.mousewheel; if (swiper.params.cssMode) { e.preventDefault(); } let target = swiper.$el; if (swiper.params.mousewheel.eventsTarget !== 'container') { target = $(swiper.params.mousewheel.eventsTarget); } if (!swiper.mouseEntered && !target[0].contains(e.target) && !params.releaseOnEdges) return true; if (e.originalEvent) e = e.originalEvent; // jquery fix let delta = 0; const rtlFactor = swiper.rtlTranslate ? -1 : 1; const data = normalize(e); if (params.forceToAxis) { if (swiper.isHorizontal()) { if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true; } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true; } else { delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; } if (delta === 0) return true; if (params.invert) delta = -delta; // Get the scroll positions let positions = swiper.getTranslate() + delta * params.sensitivity; if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); // When loop is true: // the disableParentSwiper will be true. // When loop is false: // if the scroll positions is not on edge, // then the disableParentSwiper will be true. // if the scroll on edge positions, // then the disableParentSwiper will be false. disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); if (disableParentSwiper && swiper.params.nested) e.stopPropagation(); if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) { // Register the new event in a variable which stores the relevant data const newEvent = { time: now(), delta: Math.abs(delta), direction: Math.sign(delta), raw: event }; // Keep the most recent events if (recentWheelEvents.length >= 2) { recentWheelEvents.shift(); // only store the last N events } const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; recentWheelEvents.push(newEvent); // If there is at least one previous recorded event: // If direction has changed or // if the scroll is quicker than the previous one: // Animate the slider. // Else (this is the first time the wheel is moved): // Animate the slider. if (prevEvent) { if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) { animateSlider(newEvent); } } else { animateSlider(newEvent); } // If it's time to release the scroll: // Return now so you don't hit the preventDefault. if (releaseScroll(newEvent)) { return true; } } else { // Freemode or scrollContainer: // If we recently snapped after a momentum scroll, then ignore wheel events // to give time for the deceleration to finish. Stop ignoring after 500 msecs // or if it's a new scroll (larger delta or inverse sign as last event before // an end-of-momentum snap). const newEvent = { time: now(), delta: Math.abs(delta), direction: Math.sign(delta) }; const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction; if (!ignoreWheelEvents) { lastEventBeforeSnap = undefined; if (swiper.params.loop) { swiper.loopFix(); } let position = swiper.getTranslate() + delta * params.sensitivity; const wasBeginning = swiper.isBeginning; const wasEnd = swiper.isEnd; if (position >= swiper.minTranslate()) position = swiper.minTranslate(); if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); swiper.setTransition(0); swiper.setTranslate(position); swiper.updateProgress(); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) { swiper.updateSlidesClasses(); } if (swiper.params.freeMode.sticky) { // When wheel scrolling starts with sticky (aka snap) enabled, then detect // the end of a momentum scroll by storing recent (N=15?) wheel events. // 1. do all N events have decreasing or same (absolute value) delta? // 2. did all N events arrive in the last M (M=500?) msecs? // 3. does the earliest event have an (absolute value) delta that's // at least P (P=1?) larger than the most recent event's delta? // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration. // Snap immediately and ignore remaining wheel events in this scroll. // See comment above for "remaining wheel events in this scroll" determination. // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. clearTimeout(timeout); timeout = undefined; if (recentWheelEvents.length >= 15) { recentWheelEvents.shift(); // only store the last N events } const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; const firstEvent = recentWheelEvents[0]; recentWheelEvents.push(newEvent); if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) { // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. recentWheelEvents.splice(0); } else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) { // We're at the end of the deceleration of a momentum scroll, so there's no need // to wait for more events. Snap ASAP on the next tick. // Also, because there's some remaining momentum we'll bias the snap in the // direction of the ongoing scroll because it's better UX for the scroll to snap // in the same direction as the scroll instead of reversing to snap. Therefore, // if it's already scrolled more than 20% in the current direction, keep going. const snapToThreshold = delta > 0 ? 0.8 : 0.2; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); timeout = nextTick(() => { swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); }, 0); // no delay; move on next tick } if (!timeout) { // if we get here, then we haven't detected the end of a momentum scroll, so // we'll consider a scroll "complete" when there haven't been any wheel events // for 500ms. timeout = nextTick(() => { const snapToThreshold = 0.5; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); }, 500); } } // Emit event if (!ignoreWheelEvents) emit('scroll', e); // Stop autoplay if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop(); // Return page scroll on edge positions if (position === swiper.minTranslate() || position === swiper.maxTranslate()) return true; } } if (e.preventDefault) e.preventDefault();else e.returnValue = false; return false; } function events(method) { let target = swiper.$el; if (swiper.params.mousewheel.eventsTarget !== 'container') { target = $(swiper.params.mousewheel.eventsTarget); } target[method]('mouseenter', handleMouseEnter); target[method]('mouseleave', handleMouseLeave); target[method]('wheel', handle); } function enable() { if (swiper.params.cssMode) { swiper.wrapperEl.removeEventListener('wheel', handle); return true; } if (swiper.mousewheel.enabled) return false; events('on'); swiper.mousewheel.enabled = true; return true; } function disable() { if (swiper.params.cssMode) { swiper.wrapperEl.addEventListener(event, handle); return true; } if (!swiper.mousewheel.enabled) return false; events('off'); swiper.mousewheel.enabled = false; return true; } on('init', () => { if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) { disable(); } if (swiper.params.mousewheel.enabled) enable(); }); on('destroy', () => { if (swiper.params.cssMode) { enable(); } if (swiper.mousewheel.enabled) disable(); }); Object.assign(swiper.mousewheel, { enable, disable }); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
Mousewheel
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function normalize(e) { // Reasonable defaults const PIXEL_STEP = 10; const LINE_HEIGHT = 40; const PAGE_HEIGHT = 800; let sX = 0; let sY = 0; // spinX, spinY let pX = 0; let pY = 0; // pixelX, pixelY // Legacy if ('detail' in e) { sY = e.detail; } if ('wheelDelta' in e) { sY = -e.wheelDelta / 120; } if ('wheelDeltaY' in e) { sY = -e.wheelDeltaY / 120; } if ('wheelDeltaX' in e) { sX = -e.wheelDeltaX / 120; } // side scrolling on FF with DOMMouseScroll if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if ('deltaY' in e) { pY = e.deltaY; } if ('deltaX' in e) { pX = e.deltaX; } if (e.shiftKey && !pX) { // if user scrolls with shift he wants horizontal scroll pX = pY; pY = 0; } if ((pX || pY) && e.deltaMode) { if (e.deltaMode === 1) { // delta in LINE units pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { // delta in PAGE units pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } // Fall-back if spin cannot be determined if (pX && !sX) { sX = pX < 1 ? -1 : 1; } if (pY && !sY) { sY = pY < 1 ? -1 : 1; } return { spinX: sX, spinY: sY, pixelX: pX, pixelY: pY }; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
normalize
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function handleMouseEnter() { if (!swiper.enabled) return; swiper.mouseEntered = true; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
handleMouseEnter
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function handleMouseLeave() { if (!swiper.enabled) return; swiper.mouseEntered = false; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
handleMouseLeave
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function animateSlider(newEvent) { if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) { // Prevent if delta of wheel scroll delta is below configured threshold return false; } if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) { // Prevent if time between scrolls is below configured threshold return false; } // If the movement is NOT big enough and // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): // Don't go any further (avoid insignificant scroll movement). if (newEvent.delta >= 6 && now() - lastScrollTime < 60) { // Return false as a default return true; } // If user is scrolling towards the end: // If the slider hasn't hit the latest slide or // if the slider is a loop and // if the slider isn't moving right now: // Go to next slide and // emit a scroll event. // Else (the user is scrolling towards the beginning) and // if the slider hasn't hit the first slide or // if the slider is a loop and // if the slider isn't moving right now: // Go to prev slide and // emit a scroll event. if (newEvent.direction < 0) { if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { swiper.slideNext(); emit('scroll', newEvent.raw); } } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { swiper.slidePrev(); emit('scroll', newEvent.raw); } // If you got here is because an animation has been triggered so store the current time lastScrollTime = new window.Date().getTime(); // Return false as a default return false; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
animateSlider
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function releaseScroll(newEvent) { const params = swiper.params.mousewheel; if (newEvent.direction < 0) { if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { // Return true to animate scroll on edges return true; } } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { // Return true to animate scroll on edges return true; } return false; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
releaseScroll
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function handle(event) { let e = event; let disableParentSwiper = true; if (!swiper.enabled) return; const params = swiper.params.mousewheel; if (swiper.params.cssMode) { e.preventDefault(); } let target = swiper.$el; if (swiper.params.mousewheel.eventsTarget !== 'container') { target = $(swiper.params.mousewheel.eventsTarget); } if (!swiper.mouseEntered && !target[0].contains(e.target) && !params.releaseOnEdges) return true; if (e.originalEvent) e = e.originalEvent; // jquery fix let delta = 0; const rtlFactor = swiper.rtlTranslate ? -1 : 1; const data = normalize(e); if (params.forceToAxis) { if (swiper.isHorizontal()) { if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true; } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true; } else { delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; } if (delta === 0) return true; if (params.invert) delta = -delta; // Get the scroll positions let positions = swiper.getTranslate() + delta * params.sensitivity; if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); // When loop is true: // the disableParentSwiper will be true. // When loop is false: // if the scroll positions is not on edge, // then the disableParentSwiper will be true. // if the scroll on edge positions, // then the disableParentSwiper will be false. disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); if (disableParentSwiper && swiper.params.nested) e.stopPropagation(); if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) { // Register the new event in a variable which stores the relevant data const newEvent = { time: now(), delta: Math.abs(delta), direction: Math.sign(delta), raw: event }; // Keep the most recent events if (recentWheelEvents.length >= 2) { recentWheelEvents.shift(); // only store the last N events } const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; recentWheelEvents.push(newEvent); // If there is at least one previous recorded event: // If direction has changed or // if the scroll is quicker than the previous one: // Animate the slider. // Else (this is the first time the wheel is moved): // Animate the slider. if (prevEvent) { if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) { animateSlider(newEvent); } } else { animateSlider(newEvent); } // If it's time to release the scroll: // Return now so you don't hit the preventDefault. if (releaseScroll(newEvent)) { return true; } } else { // Freemode or scrollContainer: // If we recently snapped after a momentum scroll, then ignore wheel events // to give time for the deceleration to finish. Stop ignoring after 500 msecs // or if it's a new scroll (larger delta or inverse sign as last event before // an end-of-momentum snap). const newEvent = { time: now(), delta: Math.abs(delta), direction: Math.sign(delta) }; const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction; if (!ignoreWheelEvents) { lastEventBeforeSnap = undefined; if (swiper.params.loop) { swiper.loopFix(); } let position = swiper.getTranslate() + delta * params.sensitivity; const wasBeginning = swiper.isBeginning; const wasEnd = swiper.isEnd; if (position >= swiper.minTranslate()) position = swiper.minTranslate(); if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); swiper.setTransition(0); swiper.setTranslate(position); swiper.updateProgress(); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) { swiper.updateSlidesClasses(); } if (swiper.params.freeMode.sticky) { // When wheel scrolling starts with sticky (aka snap) enabled, then detect // the end of a momentum scroll by storing recent (N=15?) wheel events. // 1. do all N events have decreasing or same (absolute value) delta? // 2. did all N events arrive in the last M (M=500?) msecs? // 3. does the earliest event have an (absolute value) delta that's // at least P (P=1?) larger than the most recent event's delta? // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration. // Snap immediately and ignore remaining wheel events in this scroll. // See comment above for "remaining wheel events in this scroll" determination. // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. clearTimeout(timeout); timeout = undefined; if (recentWheelEvents.length >= 15) { recentWheelEvents.shift(); // only store the last N events } const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; const firstEvent = recentWheelEvents[0]; recentWheelEvents.push(newEvent); if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) { // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. recentWheelEvents.splice(0); } else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) { // We're at the end of the deceleration of a momentum scroll, so there's no need // to wait for more events. Snap ASAP on the next tick. // Also, because there's some remaining momentum we'll bias the snap in the // direction of the ongoing scroll because it's better UX for the scroll to snap // in the same direction as the scroll instead of reversing to snap. Therefore, // if it's already scrolled more than 20% in the current direction, keep going. const snapToThreshold = delta > 0 ? 0.8 : 0.2; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); timeout = nextTick(() => { swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); }, 0); // no delay; move on next tick } if (!timeout) { // if we get here, then we haven't detected the end of a momentum scroll, so // we'll consider a scroll "complete" when there haven't been any wheel events // for 500ms. timeout = nextTick(() => { const snapToThreshold = 0.5; lastEventBeforeSnap = newEvent; recentWheelEvents.splice(0); swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); }, 500); } } // Emit event if (!ignoreWheelEvents) emit('scroll', e); // Stop autoplay if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop(); // Return page scroll on edge positions if (position === swiper.minTranslate() || position === swiper.maxTranslate()) return true; } } if (e.preventDefault) e.preventDefault();else e.returnValue = false; return false; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
handle
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function events(method) { let target = swiper.$el; if (swiper.params.mousewheel.eventsTarget !== 'container') { target = $(swiper.params.mousewheel.eventsTarget); } target[method]('mouseenter', handleMouseEnter); target[method]('mouseleave', handleMouseLeave); target[method]('wheel', handle); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
events
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function enable() { if (swiper.params.cssMode) { swiper.wrapperEl.removeEventListener('wheel', handle); return true; } if (swiper.mousewheel.enabled) return false; events('on'); swiper.mousewheel.enabled = true; return true; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
enable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function disable() { if (swiper.params.cssMode) { swiper.wrapperEl.addEventListener(event, handle); return true; } if (!swiper.mousewheel.enabled) return false; events('off'); swiper.mousewheel.enabled = false; return true; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
disable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function createElementIfNotDefined(swiper, originalParams, params, checkProps) { const document = getDocument(); if (swiper.params.createElements) { Object.keys(checkProps).forEach(key => { if (!params[key] && params.auto === true) { let element = swiper.$el.children(`.${checkProps[key]}`)[0]; if (!element) { element = document.createElement('div'); element.className = checkProps[key]; swiper.$el.append(element); } params[key] = element; originalParams[key] = element; } }); } return params; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
createElementIfNotDefined
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function Navigation(_ref) { let { swiper, extendParams, on, emit } = _ref; extendParams({ navigation: { nextEl: null, prevEl: null, hideOnClick: false, disabledClass: 'swiper-button-disabled', hiddenClass: 'swiper-button-hidden', lockClass: 'swiper-button-lock', navigationDisabledClass: 'swiper-navigation-disabled' } }); swiper.navigation = { nextEl: null, $nextEl: null, prevEl: null, $prevEl: null }; function getEl(el) { let $el; if (el) { $el = $(el); if (swiper.params.uniqueNavElements && typeof el === 'string' && $el.length > 1 && swiper.$el.find(el).length === 1) { $el = swiper.$el.find(el); } } return $el; } function toggleEl($el, disabled) { const params = swiper.params.navigation; if ($el && $el.length > 0) { $el[disabled ? 'addClass' : 'removeClass'](params.disabledClass); if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled; if (swiper.params.watchOverflow && swiper.enabled) { $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); } } } function update() { // Update Navigation Buttons if (swiper.params.loop) return; const { $nextEl, $prevEl } = swiper.navigation; toggleEl($prevEl, swiper.isBeginning && !swiper.params.rewind); toggleEl($nextEl, swiper.isEnd && !swiper.params.rewind); } function onPrevClick(e) { e.preventDefault(); if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return; swiper.slidePrev(); emit('navigationPrev'); } function onNextClick(e) { e.preventDefault(); if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return; swiper.slideNext(); emit('navigationNext'); } function init() { const params = swiper.params.navigation; swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, { nextEl: 'swiper-button-next', prevEl: 'swiper-button-prev' }); if (!(params.nextEl || params.prevEl)) return; const $nextEl = getEl(params.nextEl); const $prevEl = getEl(params.prevEl); if ($nextEl && $nextEl.length > 0) { $nextEl.on('click', onNextClick); } if ($prevEl && $prevEl.length > 0) { $prevEl.on('click', onPrevClick); } Object.assign(swiper.navigation, { $nextEl, nextEl: $nextEl && $nextEl[0], $prevEl, prevEl: $prevEl && $prevEl[0] }); if (!swiper.enabled) { if ($nextEl) $nextEl.addClass(params.lockClass); if ($prevEl) $prevEl.addClass(params.lockClass); } } function destroy() { const { $nextEl, $prevEl } = swiper.navigation; if ($nextEl && $nextEl.length) { $nextEl.off('click', onNextClick); $nextEl.removeClass(swiper.params.navigation.disabledClass); } if ($prevEl && $prevEl.length) { $prevEl.off('click', onPrevClick); $prevEl.removeClass(swiper.params.navigation.disabledClass); } } on('init', () => { if (swiper.params.navigation.enabled === false) { // eslint-disable-next-line disable(); } else { init(); update(); } }); on('toEdge fromEdge lock unlock', () => { update(); }); on('destroy', () => { destroy(); }); on('enable disable', () => { const { $nextEl, $prevEl } = swiper.navigation; if ($nextEl) { $nextEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); } if ($prevEl) { $prevEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); } }); on('click', (_s, e) => { const { $nextEl, $prevEl } = swiper.navigation; const targetEl = e.target; if (swiper.params.navigation.hideOnClick && !$(targetEl).is($prevEl) && !$(targetEl).is($nextEl)) { if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; let isHidden; if ($nextEl) { isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass); } else if ($prevEl) { isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass); } if (isHidden === true) { emit('navigationShow'); } else { emit('navigationHide'); } if ($nextEl) { $nextEl.toggleClass(swiper.params.navigation.hiddenClass); } if ($prevEl) { $prevEl.toggleClass(swiper.params.navigation.hiddenClass); } } }); const enable = () => { swiper.$el.removeClass(swiper.params.navigation.navigationDisabledClass); init(); update(); }; const disable = () => { swiper.$el.addClass(swiper.params.navigation.navigationDisabledClass); destroy(); }; Object.assign(swiper.navigation, { enable, disable, update, init, destroy }); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
Navigation
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function getEl(el) { let $el; if (el) { $el = $(el); if (swiper.params.uniqueNavElements && typeof el === 'string' && $el.length > 1 && swiper.$el.find(el).length === 1) { $el = swiper.$el.find(el); } } return $el; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
getEl
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function toggleEl($el, disabled) { const params = swiper.params.navigation; if ($el && $el.length > 0) { $el[disabled ? 'addClass' : 'removeClass'](params.disabledClass); if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled; if (swiper.params.watchOverflow && swiper.enabled) { $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); } } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
toggleEl
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function update() { // Update Navigation Buttons if (swiper.params.loop) return; const { $nextEl, $prevEl } = swiper.navigation; toggleEl($prevEl, swiper.isBeginning && !swiper.params.rewind); toggleEl($nextEl, swiper.isEnd && !swiper.params.rewind); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
update
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function onPrevClick(e) { e.preventDefault(); if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return; swiper.slidePrev(); emit('navigationPrev'); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
onPrevClick
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function onNextClick(e) { e.preventDefault(); if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return; swiper.slideNext(); emit('navigationNext'); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
onNextClick
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function init() { const params = swiper.params.navigation; swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, { nextEl: 'swiper-button-next', prevEl: 'swiper-button-prev' }); if (!(params.nextEl || params.prevEl)) return; const $nextEl = getEl(params.nextEl); const $prevEl = getEl(params.prevEl); if ($nextEl && $nextEl.length > 0) { $nextEl.on('click', onNextClick); } if ($prevEl && $prevEl.length > 0) { $prevEl.on('click', onPrevClick); } Object.assign(swiper.navigation, { $nextEl, nextEl: $nextEl && $nextEl[0], $prevEl, prevEl: $prevEl && $prevEl[0] }); if (!swiper.enabled) { if ($nextEl) $nextEl.addClass(params.lockClass); if ($prevEl) $prevEl.addClass(params.lockClass); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
init
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function destroy() { const { $nextEl, $prevEl } = swiper.navigation; if ($nextEl && $nextEl.length) { $nextEl.off('click', onNextClick); $nextEl.removeClass(swiper.params.navigation.disabledClass); } if ($prevEl && $prevEl.length) { $prevEl.off('click', onPrevClick); $prevEl.removeClass(swiper.params.navigation.disabledClass); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
destroy
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
enable = () => { swiper.$el.removeClass(swiper.params.navigation.navigationDisabledClass); init(); update(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
enable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
enable = () => { swiper.$el.removeClass(swiper.params.navigation.navigationDisabledClass); init(); update(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
enable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
disable = () => { swiper.$el.addClass(swiper.params.navigation.navigationDisabledClass); destroy(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
disable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
disable = () => { swiper.$el.addClass(swiper.params.navigation.navigationDisabledClass); destroy(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
disable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function classesToSelector(classes) { if (classes === void 0) { classes = ''; } return `.${classes.trim().replace(/([\.:!\/])/g, '\\$1') // eslint-disable-line .replace(/ /g, '.')}`; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
classesToSelector
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function Pagination(_ref) { let { swiper, extendParams, on, emit } = _ref; const pfx = 'swiper-pagination'; extendParams({ pagination: { el: null, bulletElement: 'span', clickable: false, hideOnClick: false, renderBullet: null, renderProgressbar: null, renderFraction: null, renderCustom: null, progressbarOpposite: false, type: 'bullets', // 'bullets' or 'progressbar' or 'fraction' or 'custom' dynamicBullets: false, dynamicMainBullets: 1, formatFractionCurrent: number => number, formatFractionTotal: number => number, bulletClass: `${pfx}-bullet`, bulletActiveClass: `${pfx}-bullet-active`, modifierClass: `${pfx}-`, currentClass: `${pfx}-current`, totalClass: `${pfx}-total`, hiddenClass: `${pfx}-hidden`, progressbarFillClass: `${pfx}-progressbar-fill`, progressbarOppositeClass: `${pfx}-progressbar-opposite`, clickableClass: `${pfx}-clickable`, lockClass: `${pfx}-lock`, horizontalClass: `${pfx}-horizontal`, verticalClass: `${pfx}-vertical`, paginationDisabledClass: `${pfx}-disabled` } }); swiper.pagination = { el: null, $el: null, bullets: [] }; let bulletSize; let dynamicBulletIndex = 0; function isPaginationDisabled() { return !swiper.params.pagination.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0; } function setSideBullets($bulletEl, position) { const { bulletActiveClass } = swiper.params.pagination; $bulletEl[position]().addClass(`${bulletActiveClass}-${position}`)[position]().addClass(`${bulletActiveClass}-${position}-${position}`); } function update() { // Render || Update Pagination bullets/items const rtl = swiper.rtl; const params = swiper.params.pagination; if (isPaginationDisabled()) return; const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; const $el = swiper.pagination.$el; // Current/Total let current; const total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; if (swiper.params.loop) { current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup); if (current > slidesLength - 1 - swiper.loopedSlides * 2) { current -= slidesLength - swiper.loopedSlides * 2; } if (current > total - 1) current -= total; if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current; } else if (typeof swiper.snapIndex !== 'undefined') { current = swiper.snapIndex; } else { current = swiper.activeIndex || 0; } // Types if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { const bullets = swiper.pagination.bullets; let firstIndex; let lastIndex; let midIndex; if (params.dynamicBullets) { bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true); $el.css(swiper.isHorizontal() ? 'width' : 'height', `${bulletSize * (params.dynamicMainBullets + 4)}px`); if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) { dynamicBulletIndex += current - (swiper.previousIndex - swiper.loopedSlides || 0); if (dynamicBulletIndex > params.dynamicMainBullets - 1) { dynamicBulletIndex = params.dynamicMainBullets - 1; } else if (dynamicBulletIndex < 0) { dynamicBulletIndex = 0; } } firstIndex = Math.max(current - dynamicBulletIndex, 0); lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); midIndex = (lastIndex + firstIndex) / 2; } bullets.removeClass(['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`).join(' ')); if ($el.length > 1) { bullets.each(bullet => { const $bullet = $(bullet); const bulletIndex = $bullet.index(); if (bulletIndex === current) { $bullet.addClass(params.bulletActiveClass); } if (params.dynamicBullets) { if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { $bullet.addClass(`${params.bulletActiveClass}-main`); } if (bulletIndex === firstIndex) { setSideBullets($bullet, 'prev'); } if (bulletIndex === lastIndex) { setSideBullets($bullet, 'next'); } } }); } else { const $bullet = bullets.eq(current); const bulletIndex = $bullet.index(); $bullet.addClass(params.bulletActiveClass); if (params.dynamicBullets) { const $firstDisplayedBullet = bullets.eq(firstIndex); const $lastDisplayedBullet = bullets.eq(lastIndex); for (let i = firstIndex; i <= lastIndex; i += 1) { bullets.eq(i).addClass(`${params.bulletActiveClass}-main`); } if (swiper.params.loop) { if (bulletIndex >= bullets.length) { for (let i = params.dynamicMainBullets; i >= 0; i -= 1) { bullets.eq(bullets.length - i).addClass(`${params.bulletActiveClass}-main`); } bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(`${params.bulletActiveClass}-prev`); } else { setSideBullets($firstDisplayedBullet, 'prev'); setSideBullets($lastDisplayedBullet, 'next'); } } else { setSideBullets($firstDisplayedBullet, 'prev'); setSideBullets($lastDisplayedBullet, 'next'); } } } if (params.dynamicBullets) { const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; const offsetProp = rtl ? 'right' : 'left'; bullets.css(swiper.isHorizontal() ? offsetProp : 'top', `${bulletsOffset}px`); } } if (params.type === 'fraction') { $el.find(classesToSelector(params.currentClass)).text(params.formatFractionCurrent(current + 1)); $el.find(classesToSelector(params.totalClass)).text(params.formatFractionTotal(total)); } if (params.type === 'progressbar') { let progressbarDirection; if (params.progressbarOpposite) { progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; } else { progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; } const scale = (current + 1) / total; let scaleX = 1; let scaleY = 1; if (progressbarDirection === 'horizontal') { scaleX = scale; } else { scaleY = scale; } $el.find(classesToSelector(params.progressbarFillClass)).transform(`translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`).transition(swiper.params.speed); } if (params.type === 'custom' && params.renderCustom) { $el.html(params.renderCustom(swiper, current + 1, total)); emit('paginationRender', $el[0]); } else { emit('paginationUpdate', $el[0]); } if (swiper.params.watchOverflow && swiper.enabled) { $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); } } function render() { // Render Container const params = swiper.params.pagination; if (isPaginationDisabled()) return; const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; const $el = swiper.pagination.$el; let paginationHTML = ''; if (params.type === 'bullets') { let numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.loop && numberOfBullets > slidesLength) { numberOfBullets = slidesLength; } for (let i = 0; i < numberOfBullets; i += 1) { if (params.renderBullet) { paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); } else { paginationHTML += `<${params.bulletElement} class="${params.bulletClass}"></${params.bulletElement}>`; } } $el.html(paginationHTML); swiper.pagination.bullets = $el.find(classesToSelector(params.bulletClass)); } if (params.type === 'fraction') { if (params.renderFraction) { paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); } else { paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`; } $el.html(paginationHTML); } if (params.type === 'progressbar') { if (params.renderProgressbar) { paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); } else { paginationHTML = `<span class="${params.progressbarFillClass}"></span>`; } $el.html(paginationHTML); } if (params.type !== 'custom') { emit('paginationRender', swiper.pagination.$el[0]); } } function init() { swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, { el: 'swiper-pagination' }); const params = swiper.params.pagination; if (!params.el) return; let $el = $(params.el); if ($el.length === 0) return; if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) { $el = swiper.$el.find(params.el); // check if it belongs to another nested Swiper if ($el.length > 1) { $el = $el.filter(el => { if ($(el).parents('.swiper')[0] !== swiper.el) return false; return true; }); } } if (params.type === 'bullets' && params.clickable) { $el.addClass(params.clickableClass); } $el.addClass(params.modifierClass + params.type); $el.addClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); if (params.type === 'bullets' && params.dynamicBullets) { $el.addClass(`${params.modifierClass}${params.type}-dynamic`); dynamicBulletIndex = 0; if (params.dynamicMainBullets < 1) { params.dynamicMainBullets = 1; } } if (params.type === 'progressbar' && params.progressbarOpposite) { $el.addClass(params.progressbarOppositeClass); } if (params.clickable) { $el.on('click', classesToSelector(params.bulletClass), function onClick(e) { e.preventDefault(); let index = $(this).index() * swiper.params.slidesPerGroup; if (swiper.params.loop) index += swiper.loopedSlides; swiper.slideTo(index); }); } Object.assign(swiper.pagination, { $el, el: $el[0] }); if (!swiper.enabled) { $el.addClass(params.lockClass); } } function destroy() { const params = swiper.params.pagination; if (isPaginationDisabled()) return; const $el = swiper.pagination.$el; $el.removeClass(params.hiddenClass); $el.removeClass(params.modifierClass + params.type); $el.removeClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); if (swiper.pagination.bullets && swiper.pagination.bullets.removeClass) swiper.pagination.bullets.removeClass(params.bulletActiveClass); if (params.clickable) { $el.off('click', classesToSelector(params.bulletClass)); } } on('init', () => { if (swiper.params.pagination.enabled === false) { // eslint-disable-next-line disable(); } else { init(); render(); update(); } }); on('activeIndexChange', () => { if (swiper.params.loop) { update(); } else if (typeof swiper.snapIndex === 'undefined') { update(); } }); on('snapIndexChange', () => { if (!swiper.params.loop) { update(); } }); on('slidesLengthChange', () => { if (swiper.params.loop) { render(); update(); } }); on('snapGridLengthChange', () => { if (!swiper.params.loop) { render(); update(); } }); on('destroy', () => { destroy(); }); on('enable disable', () => { const { $el } = swiper.pagination; if ($el) { $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.pagination.lockClass); } }); on('lock unlock', () => { update(); }); on('click', (_s, e) => { const targetEl = e.target; const { $el } = swiper.pagination; if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && $el && $el.length > 0 && !$(targetEl).hasClass(swiper.params.pagination.bulletClass)) { if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; const isHidden = $el.hasClass(swiper.params.pagination.hiddenClass); if (isHidden === true) { emit('paginationShow'); } else { emit('paginationHide'); } $el.toggleClass(swiper.params.pagination.hiddenClass); } }); const enable = () => { swiper.$el.removeClass(swiper.params.pagination.paginationDisabledClass); if (swiper.pagination.$el) { swiper.pagination.$el.removeClass(swiper.params.pagination.paginationDisabledClass); } init(); render(); update(); }; const disable = () => { swiper.$el.addClass(swiper.params.pagination.paginationDisabledClass); if (swiper.pagination.$el) { swiper.pagination.$el.addClass(swiper.params.pagination.paginationDisabledClass); } destroy(); }; Object.assign(swiper.pagination, { enable, disable, render, update, init, destroy }); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
Pagination
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function isPaginationDisabled() { return !swiper.params.pagination.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
isPaginationDisabled
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function setSideBullets($bulletEl, position) { const { bulletActiveClass } = swiper.params.pagination; $bulletEl[position]().addClass(`${bulletActiveClass}-${position}`)[position]().addClass(`${bulletActiveClass}-${position}-${position}`); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
setSideBullets
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function update() { // Render || Update Pagination bullets/items const rtl = swiper.rtl; const params = swiper.params.pagination; if (isPaginationDisabled()) return; const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; const $el = swiper.pagination.$el; // Current/Total let current; const total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; if (swiper.params.loop) { current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup); if (current > slidesLength - 1 - swiper.loopedSlides * 2) { current -= slidesLength - swiper.loopedSlides * 2; } if (current > total - 1) current -= total; if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current; } else if (typeof swiper.snapIndex !== 'undefined') { current = swiper.snapIndex; } else { current = swiper.activeIndex || 0; } // Types if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { const bullets = swiper.pagination.bullets; let firstIndex; let lastIndex; let midIndex; if (params.dynamicBullets) { bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true); $el.css(swiper.isHorizontal() ? 'width' : 'height', `${bulletSize * (params.dynamicMainBullets + 4)}px`); if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) { dynamicBulletIndex += current - (swiper.previousIndex - swiper.loopedSlides || 0); if (dynamicBulletIndex > params.dynamicMainBullets - 1) { dynamicBulletIndex = params.dynamicMainBullets - 1; } else if (dynamicBulletIndex < 0) { dynamicBulletIndex = 0; } } firstIndex = Math.max(current - dynamicBulletIndex, 0); lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); midIndex = (lastIndex + firstIndex) / 2; } bullets.removeClass(['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`).join(' ')); if ($el.length > 1) { bullets.each(bullet => { const $bullet = $(bullet); const bulletIndex = $bullet.index(); if (bulletIndex === current) { $bullet.addClass(params.bulletActiveClass); } if (params.dynamicBullets) { if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { $bullet.addClass(`${params.bulletActiveClass}-main`); } if (bulletIndex === firstIndex) { setSideBullets($bullet, 'prev'); } if (bulletIndex === lastIndex) { setSideBullets($bullet, 'next'); } } }); } else { const $bullet = bullets.eq(current); const bulletIndex = $bullet.index(); $bullet.addClass(params.bulletActiveClass); if (params.dynamicBullets) { const $firstDisplayedBullet = bullets.eq(firstIndex); const $lastDisplayedBullet = bullets.eq(lastIndex); for (let i = firstIndex; i <= lastIndex; i += 1) { bullets.eq(i).addClass(`${params.bulletActiveClass}-main`); } if (swiper.params.loop) { if (bulletIndex >= bullets.length) { for (let i = params.dynamicMainBullets; i >= 0; i -= 1) { bullets.eq(bullets.length - i).addClass(`${params.bulletActiveClass}-main`); } bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(`${params.bulletActiveClass}-prev`); } else { setSideBullets($firstDisplayedBullet, 'prev'); setSideBullets($lastDisplayedBullet, 'next'); } } else { setSideBullets($firstDisplayedBullet, 'prev'); setSideBullets($lastDisplayedBullet, 'next'); } } } if (params.dynamicBullets) { const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; const offsetProp = rtl ? 'right' : 'left'; bullets.css(swiper.isHorizontal() ? offsetProp : 'top', `${bulletsOffset}px`); } } if (params.type === 'fraction') { $el.find(classesToSelector(params.currentClass)).text(params.formatFractionCurrent(current + 1)); $el.find(classesToSelector(params.totalClass)).text(params.formatFractionTotal(total)); } if (params.type === 'progressbar') { let progressbarDirection; if (params.progressbarOpposite) { progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; } else { progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; } const scale = (current + 1) / total; let scaleX = 1; let scaleY = 1; if (progressbarDirection === 'horizontal') { scaleX = scale; } else { scaleY = scale; } $el.find(classesToSelector(params.progressbarFillClass)).transform(`translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`).transition(swiper.params.speed); } if (params.type === 'custom' && params.renderCustom) { $el.html(params.renderCustom(swiper, current + 1, total)); emit('paginationRender', $el[0]); } else { emit('paginationUpdate', $el[0]); } if (swiper.params.watchOverflow && swiper.enabled) { $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
update
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function render() { // Render Container const params = swiper.params.pagination; if (isPaginationDisabled()) return; const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; const $el = swiper.pagination.$el; let paginationHTML = ''; if (params.type === 'bullets') { let numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.loop && numberOfBullets > slidesLength) { numberOfBullets = slidesLength; } for (let i = 0; i < numberOfBullets; i += 1) { if (params.renderBullet) { paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); } else { paginationHTML += `<${params.bulletElement} class="${params.bulletClass}"></${params.bulletElement}>`; } } $el.html(paginationHTML); swiper.pagination.bullets = $el.find(classesToSelector(params.bulletClass)); } if (params.type === 'fraction') { if (params.renderFraction) { paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); } else { paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`; } $el.html(paginationHTML); } if (params.type === 'progressbar') { if (params.renderProgressbar) { paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); } else { paginationHTML = `<span class="${params.progressbarFillClass}"></span>`; } $el.html(paginationHTML); } if (params.type !== 'custom') { emit('paginationRender', swiper.pagination.$el[0]); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
render
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function init() { swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, { el: 'swiper-pagination' }); const params = swiper.params.pagination; if (!params.el) return; let $el = $(params.el); if ($el.length === 0) return; if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) { $el = swiper.$el.find(params.el); // check if it belongs to another nested Swiper if ($el.length > 1) { $el = $el.filter(el => { if ($(el).parents('.swiper')[0] !== swiper.el) return false; return true; }); } } if (params.type === 'bullets' && params.clickable) { $el.addClass(params.clickableClass); } $el.addClass(params.modifierClass + params.type); $el.addClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); if (params.type === 'bullets' && params.dynamicBullets) { $el.addClass(`${params.modifierClass}${params.type}-dynamic`); dynamicBulletIndex = 0; if (params.dynamicMainBullets < 1) { params.dynamicMainBullets = 1; } } if (params.type === 'progressbar' && params.progressbarOpposite) { $el.addClass(params.progressbarOppositeClass); } if (params.clickable) { $el.on('click', classesToSelector(params.bulletClass), function onClick(e) { e.preventDefault(); let index = $(this).index() * swiper.params.slidesPerGroup; if (swiper.params.loop) index += swiper.loopedSlides; swiper.slideTo(index); }); } Object.assign(swiper.pagination, { $el, el: $el[0] }); if (!swiper.enabled) { $el.addClass(params.lockClass); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
init
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function destroy() { const params = swiper.params.pagination; if (isPaginationDisabled()) return; const $el = swiper.pagination.$el; $el.removeClass(params.hiddenClass); $el.removeClass(params.modifierClass + params.type); $el.removeClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); if (swiper.pagination.bullets && swiper.pagination.bullets.removeClass) swiper.pagination.bullets.removeClass(params.bulletActiveClass); if (params.clickable) { $el.off('click', classesToSelector(params.bulletClass)); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
destroy
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
enable = () => { swiper.$el.removeClass(swiper.params.pagination.paginationDisabledClass); if (swiper.pagination.$el) { swiper.pagination.$el.removeClass(swiper.params.pagination.paginationDisabledClass); } init(); render(); update(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
enable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
enable = () => { swiper.$el.removeClass(swiper.params.pagination.paginationDisabledClass); if (swiper.pagination.$el) { swiper.pagination.$el.removeClass(swiper.params.pagination.paginationDisabledClass); } init(); render(); update(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
enable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
disable = () => { swiper.$el.addClass(swiper.params.pagination.paginationDisabledClass); if (swiper.pagination.$el) { swiper.pagination.$el.addClass(swiper.params.pagination.paginationDisabledClass); } destroy(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
disable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
disable = () => { swiper.$el.addClass(swiper.params.pagination.paginationDisabledClass); if (swiper.pagination.$el) { swiper.pagination.$el.addClass(swiper.params.pagination.paginationDisabledClass); } destroy(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
disable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function Scrollbar(_ref) { let { swiper, extendParams, on, emit } = _ref; const document = getDocument(); let isTouched = false; let timeout = null; let dragTimeout = null; let dragStartPos; let dragSize; let trackSize; let divider; extendParams({ scrollbar: { el: null, dragSize: 'auto', hide: false, draggable: false, snapOnRelease: true, lockClass: 'swiper-scrollbar-lock', dragClass: 'swiper-scrollbar-drag', scrollbarDisabledClass: 'swiper-scrollbar-disabled', horizontalClass: `swiper-scrollbar-horizontal`, verticalClass: `swiper-scrollbar-vertical` } }); swiper.scrollbar = { el: null, dragEl: null, $el: null, $dragEl: null }; function setTranslate() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; const { scrollbar, rtlTranslate: rtl, progress } = swiper; const { $dragEl, $el } = scrollbar; const params = swiper.params.scrollbar; let newSize = dragSize; let newPos = (trackSize - dragSize) * progress; if (rtl) { newPos = -newPos; if (newPos > 0) { newSize = dragSize - newPos; newPos = 0; } else if (-newPos + dragSize > trackSize) { newSize = trackSize + newPos; } } else if (newPos < 0) { newSize = dragSize + newPos; newPos = 0; } else if (newPos + dragSize > trackSize) { newSize = trackSize - newPos; } if (swiper.isHorizontal()) { $dragEl.transform(`translate3d(${newPos}px, 0, 0)`); $dragEl[0].style.width = `${newSize}px`; } else { $dragEl.transform(`translate3d(0px, ${newPos}px, 0)`); $dragEl[0].style.height = `${newSize}px`; } if (params.hide) { clearTimeout(timeout); $el[0].style.opacity = 1; timeout = setTimeout(() => { $el[0].style.opacity = 0; $el.transition(400); }, 1000); } } function setTransition(duration) { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; swiper.scrollbar.$dragEl.transition(duration); } function updateSize() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; const { scrollbar } = swiper; const { $dragEl, $el } = scrollbar; $dragEl[0].style.width = ''; $dragEl[0].style.height = ''; trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight; divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); if (swiper.params.scrollbar.dragSize === 'auto') { dragSize = trackSize * divider; } else { dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); } if (swiper.isHorizontal()) { $dragEl[0].style.width = `${dragSize}px`; } else { $dragEl[0].style.height = `${dragSize}px`; } if (divider >= 1) { $el[0].style.display = 'none'; } else { $el[0].style.display = ''; } if (swiper.params.scrollbar.hide) { $el[0].style.opacity = 0; } if (swiper.params.watchOverflow && swiper.enabled) { scrollbar.$el[swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass); } } function getPointerPosition(e) { if (swiper.isHorizontal()) { return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientX : e.clientX; } return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientY : e.clientY; } function setDragPosition(e) { const { scrollbar, rtlTranslate: rtl } = swiper; const { $el } = scrollbar; let positionRatio; positionRatio = (getPointerPosition(e) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); positionRatio = Math.max(Math.min(positionRatio, 1), 0); if (rtl) { positionRatio = 1 - positionRatio; } const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio; swiper.updateProgress(position); swiper.setTranslate(position); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); } function onDragStart(e) { const params = swiper.params.scrollbar; const { scrollbar, $wrapperEl } = swiper; const { $el, $dragEl } = scrollbar; isTouched = true; dragStartPos = e.target === $dragEl[0] || e.target === $dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; e.preventDefault(); e.stopPropagation(); $wrapperEl.transition(100); $dragEl.transition(100); setDragPosition(e); clearTimeout(dragTimeout); $el.transition(0); if (params.hide) { $el.css('opacity', 1); } if (swiper.params.cssMode) { swiper.$wrapperEl.css('scroll-snap-type', 'none'); } emit('scrollbarDragStart', e); } function onDragMove(e) { const { scrollbar, $wrapperEl } = swiper; const { $el, $dragEl } = scrollbar; if (!isTouched) return; if (e.preventDefault) e.preventDefault();else e.returnValue = false; setDragPosition(e); $wrapperEl.transition(0); $el.transition(0); $dragEl.transition(0); emit('scrollbarDragMove', e); } function onDragEnd(e) { const params = swiper.params.scrollbar; const { scrollbar, $wrapperEl } = swiper; const { $el } = scrollbar; if (!isTouched) return; isTouched = false; if (swiper.params.cssMode) { swiper.$wrapperEl.css('scroll-snap-type', ''); $wrapperEl.transition(''); } if (params.hide) { clearTimeout(dragTimeout); dragTimeout = nextTick(() => { $el.css('opacity', 0); $el.transition(400); }, 1000); } emit('scrollbarDragEnd', e); if (params.snapOnRelease) { swiper.slideToClosest(); } } function events(method) { const { scrollbar, touchEventsTouch, touchEventsDesktop, params, support } = swiper; const $el = scrollbar.$el; if (!$el) return; const target = $el[0]; const activeListener = support.passiveListener && params.passiveListeners ? { passive: false, capture: false } : false; const passiveListener = support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false; if (!target) return; const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; if (!support.touch) { target[eventMethod](touchEventsDesktop.start, onDragStart, activeListener); document[eventMethod](touchEventsDesktop.move, onDragMove, activeListener); document[eventMethod](touchEventsDesktop.end, onDragEnd, passiveListener); } else { target[eventMethod](touchEventsTouch.start, onDragStart, activeListener); target[eventMethod](touchEventsTouch.move, onDragMove, activeListener); target[eventMethod](touchEventsTouch.end, onDragEnd, passiveListener); } } function enableDraggable() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; events('on'); } function disableDraggable() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; events('off'); } function init() { const { scrollbar, $el: $swiperEl } = swiper; swiper.params.scrollbar = createElementIfNotDefined(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, { el: 'swiper-scrollbar' }); const params = swiper.params.scrollbar; if (!params.el) return; let $el = $(params.el); if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1 && $swiperEl.find(params.el).length === 1) { $el = $swiperEl.find(params.el); } $el.addClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); let $dragEl = $el.find(`.${swiper.params.scrollbar.dragClass}`); if ($dragEl.length === 0) { $dragEl = $(`<div class="${swiper.params.scrollbar.dragClass}"></div>`); $el.append($dragEl); } Object.assign(scrollbar, { $el, el: $el[0], $dragEl, dragEl: $dragEl[0] }); if (params.draggable) { enableDraggable(); } if ($el) { $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass); } } function destroy() { const params = swiper.params.scrollbar; const $el = swiper.scrollbar.$el; if ($el) { $el.removeClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); } disableDraggable(); } on('init', () => { if (swiper.params.scrollbar.enabled === false) { // eslint-disable-next-line disable(); } else { init(); updateSize(); setTranslate(); } }); on('update resize observerUpdate lock unlock', () => { updateSize(); }); on('setTranslate', () => { setTranslate(); }); on('setTransition', (_s, duration) => { setTransition(duration); }); on('enable disable', () => { const { $el } = swiper.scrollbar; if ($el) { $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass); } }); on('destroy', () => { destroy(); }); const enable = () => { swiper.$el.removeClass(swiper.params.scrollbar.scrollbarDisabledClass); if (swiper.scrollbar.$el) { swiper.scrollbar.$el.removeClass(swiper.params.scrollbar.scrollbarDisabledClass); } init(); updateSize(); setTranslate(); }; const disable = () => { swiper.$el.addClass(swiper.params.scrollbar.scrollbarDisabledClass); if (swiper.scrollbar.$el) { swiper.scrollbar.$el.addClass(swiper.params.scrollbar.scrollbarDisabledClass); } destroy(); }; Object.assign(swiper.scrollbar, { enable, disable, updateSize, setTranslate, init, destroy }); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
Scrollbar
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function setTranslate() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; const { scrollbar, rtlTranslate: rtl, progress } = swiper; const { $dragEl, $el } = scrollbar; const params = swiper.params.scrollbar; let newSize = dragSize; let newPos = (trackSize - dragSize) * progress; if (rtl) { newPos = -newPos; if (newPos > 0) { newSize = dragSize - newPos; newPos = 0; } else if (-newPos + dragSize > trackSize) { newSize = trackSize + newPos; } } else if (newPos < 0) { newSize = dragSize + newPos; newPos = 0; } else if (newPos + dragSize > trackSize) { newSize = trackSize - newPos; } if (swiper.isHorizontal()) { $dragEl.transform(`translate3d(${newPos}px, 0, 0)`); $dragEl[0].style.width = `${newSize}px`; } else { $dragEl.transform(`translate3d(0px, ${newPos}px, 0)`); $dragEl[0].style.height = `${newSize}px`; } if (params.hide) { clearTimeout(timeout); $el[0].style.opacity = 1; timeout = setTimeout(() => { $el[0].style.opacity = 0; $el.transition(400); }, 1000); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
setTranslate
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function setTransition(duration) { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; swiper.scrollbar.$dragEl.transition(duration); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
setTransition
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function updateSize() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; const { scrollbar } = swiper; const { $dragEl, $el } = scrollbar; $dragEl[0].style.width = ''; $dragEl[0].style.height = ''; trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight; divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); if (swiper.params.scrollbar.dragSize === 'auto') { dragSize = trackSize * divider; } else { dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); } if (swiper.isHorizontal()) { $dragEl[0].style.width = `${dragSize}px`; } else { $dragEl[0].style.height = `${dragSize}px`; } if (divider >= 1) { $el[0].style.display = 'none'; } else { $el[0].style.display = ''; } if (swiper.params.scrollbar.hide) { $el[0].style.opacity = 0; } if (swiper.params.watchOverflow && swiper.enabled) { scrollbar.$el[swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
updateSize
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function getPointerPosition(e) { if (swiper.isHorizontal()) { return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientX : e.clientX; } return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientY : e.clientY; }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
getPointerPosition
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function setDragPosition(e) { const { scrollbar, rtlTranslate: rtl } = swiper; const { $el } = scrollbar; let positionRatio; positionRatio = (getPointerPosition(e) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); positionRatio = Math.max(Math.min(positionRatio, 1), 0); if (rtl) { positionRatio = 1 - positionRatio; } const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio; swiper.updateProgress(position); swiper.setTranslate(position); swiper.updateActiveIndex(); swiper.updateSlidesClasses(); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
setDragPosition
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function onDragStart(e) { const params = swiper.params.scrollbar; const { scrollbar, $wrapperEl } = swiper; const { $el, $dragEl } = scrollbar; isTouched = true; dragStartPos = e.target === $dragEl[0] || e.target === $dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; e.preventDefault(); e.stopPropagation(); $wrapperEl.transition(100); $dragEl.transition(100); setDragPosition(e); clearTimeout(dragTimeout); $el.transition(0); if (params.hide) { $el.css('opacity', 1); } if (swiper.params.cssMode) { swiper.$wrapperEl.css('scroll-snap-type', 'none'); } emit('scrollbarDragStart', e); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
onDragStart
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function onDragMove(e) { const { scrollbar, $wrapperEl } = swiper; const { $el, $dragEl } = scrollbar; if (!isTouched) return; if (e.preventDefault) e.preventDefault();else e.returnValue = false; setDragPosition(e); $wrapperEl.transition(0); $el.transition(0); $dragEl.transition(0); emit('scrollbarDragMove', e); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
onDragMove
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function onDragEnd(e) { const params = swiper.params.scrollbar; const { scrollbar, $wrapperEl } = swiper; const { $el } = scrollbar; if (!isTouched) return; isTouched = false; if (swiper.params.cssMode) { swiper.$wrapperEl.css('scroll-snap-type', ''); $wrapperEl.transition(''); } if (params.hide) { clearTimeout(dragTimeout); dragTimeout = nextTick(() => { $el.css('opacity', 0); $el.transition(400); }, 1000); } emit('scrollbarDragEnd', e); if (params.snapOnRelease) { swiper.slideToClosest(); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
onDragEnd
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function events(method) { const { scrollbar, touchEventsTouch, touchEventsDesktop, params, support } = swiper; const $el = scrollbar.$el; if (!$el) return; const target = $el[0]; const activeListener = support.passiveListener && params.passiveListeners ? { passive: false, capture: false } : false; const passiveListener = support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false; if (!target) return; const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; if (!support.touch) { target[eventMethod](touchEventsDesktop.start, onDragStart, activeListener); document[eventMethod](touchEventsDesktop.move, onDragMove, activeListener); document[eventMethod](touchEventsDesktop.end, onDragEnd, passiveListener); } else { target[eventMethod](touchEventsTouch.start, onDragStart, activeListener); target[eventMethod](touchEventsTouch.move, onDragMove, activeListener); target[eventMethod](touchEventsTouch.end, onDragEnd, passiveListener); } }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
events
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function enableDraggable() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; events('on'); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
enableDraggable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT
function disableDraggable() { if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; events('off'); }
Determines whether the `index` argument is a valid `number` after being converted from the `string` type. @type {boolean}
disableDraggable
javascript
cabloy/cabloy
src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.js
MIT