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 |
---|---|---|---|---|---|---|---|
init = () => {
if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return;
initialized = true;
const hash = document.location.hash.replace('#', '');
if (hash) {
const speed = 0;
for (let i = 0, length = swiper.slides.length; i < length; i += 1) {
const slide = swiper.slides.eq(i);
const slideHash = slide.attr('data-hash') || slide.attr('data-history');
if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) {
const index = slide.index();
swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true);
}
}
}
if (swiper.params.hashNavigation.watchState) {
$(window).on('hashchange', onHashChange);
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
destroy = () => {
if (swiper.params.hashNavigation.watchState) {
$(window).off('hashchange', onHashChange);
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
destroy = () => {
if (swiper.params.hashNavigation.watchState) {
$(window).off('hashchange', onHashChange);
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function Autoplay(_ref) {
let {
swiper,
extendParams,
on,
emit
} = _ref;
let timeout;
swiper.autoplay = {
running: false,
paused: false
};
extendParams({
autoplay: {
enabled: false,
delay: 3000,
waitForTransition: true,
disableOnInteraction: true,
stopOnLastSlide: false,
reverseDirection: false,
pauseOnMouseEnter: false
}
});
function run() {
if (!swiper.size) {
swiper.autoplay.running = false;
swiper.autoplay.paused = false;
return;
}
const $activeSlideEl = swiper.slides.eq(swiper.activeIndex);
let delay = swiper.params.autoplay.delay;
if ($activeSlideEl.attr('data-swiper-autoplay')) {
delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
}
clearTimeout(timeout);
timeout = nextTick(() => {
let autoplayResult;
if (swiper.params.autoplay.reverseDirection) {
if (swiper.params.loop) {
swiper.loopFix();
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.isBeginning) {
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.params.autoplay.stopOnLastSlide) {
autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true);
emit('autoplay');
} else {
stop();
}
} else if (swiper.params.loop) {
swiper.loopFix();
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.isEnd) {
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.params.autoplay.stopOnLastSlide) {
autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true);
emit('autoplay');
} else {
stop();
}
if (swiper.params.cssMode && swiper.autoplay.running) run();else if (autoplayResult === false) {
run();
}
}, delay);
}
function start() {
if (typeof timeout !== 'undefined') return false;
if (swiper.autoplay.running) return false;
swiper.autoplay.running = true;
emit('autoplayStart');
run();
return true;
}
function stop() {
if (!swiper.autoplay.running) return false;
if (typeof timeout === 'undefined') return false;
if (timeout) {
clearTimeout(timeout);
timeout = undefined;
}
swiper.autoplay.running = false;
emit('autoplayStop');
return true;
}
function pause(speed) {
if (!swiper.autoplay.running) return;
if (swiper.autoplay.paused) return;
if (timeout) clearTimeout(timeout);
swiper.autoplay.paused = true;
if (speed === 0 || !swiper.params.autoplay.waitForTransition) {
swiper.autoplay.paused = false;
run();
} else {
['transitionend', 'webkitTransitionEnd'].forEach(event => {
swiper.$wrapperEl[0].addEventListener(event, onTransitionEnd);
});
}
}
function onVisibilityChange() {
const document = getDocument();
if (document.visibilityState === 'hidden' && swiper.autoplay.running) {
pause();
}
if (document.visibilityState === 'visible' && swiper.autoplay.paused) {
run();
swiper.autoplay.paused = false;
}
}
function onTransitionEnd(e) {
if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return;
if (e.target !== swiper.$wrapperEl[0]) return;
['transitionend', 'webkitTransitionEnd'].forEach(event => {
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
});
swiper.autoplay.paused = false;
if (!swiper.autoplay.running) {
stop();
} else {
run();
}
}
function onMouseEnter() {
if (swiper.params.autoplay.disableOnInteraction) {
stop();
} else {
emit('autoplayPause');
pause();
}
['transitionend', 'webkitTransitionEnd'].forEach(event => {
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
});
}
function onMouseLeave() {
if (swiper.params.autoplay.disableOnInteraction) {
return;
}
swiper.autoplay.paused = false;
emit('autoplayResume');
run();
}
function attachMouseEvents() {
if (swiper.params.autoplay.pauseOnMouseEnter) {
swiper.$el.on('mouseenter', onMouseEnter);
swiper.$el.on('mouseleave', onMouseLeave);
}
}
function detachMouseEvents() {
swiper.$el.off('mouseenter', onMouseEnter);
swiper.$el.off('mouseleave', onMouseLeave);
}
on('init', () => {
if (swiper.params.autoplay.enabled) {
start();
const document = getDocument();
document.addEventListener('visibilitychange', onVisibilityChange);
attachMouseEvents();
}
});
on('beforeTransitionStart', (_s, speed, internal) => {
if (swiper.autoplay.running) {
if (internal || !swiper.params.autoplay.disableOnInteraction) {
swiper.autoplay.pause(speed);
} else {
stop();
}
}
});
on('sliderFirstMove', () => {
if (swiper.autoplay.running) {
if (swiper.params.autoplay.disableOnInteraction) {
stop();
} else {
pause();
}
}
});
on('touchEnd', () => {
if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) {
run();
}
});
on('destroy', () => {
detachMouseEvents();
if (swiper.autoplay.running) {
stop();
}
const document = getDocument();
document.removeEventListener('visibilitychange', onVisibilityChange);
});
Object.assign(swiper.autoplay, {
pause,
run,
start,
stop
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | Autoplay | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function run() {
if (!swiper.size) {
swiper.autoplay.running = false;
swiper.autoplay.paused = false;
return;
}
const $activeSlideEl = swiper.slides.eq(swiper.activeIndex);
let delay = swiper.params.autoplay.delay;
if ($activeSlideEl.attr('data-swiper-autoplay')) {
delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
}
clearTimeout(timeout);
timeout = nextTick(() => {
let autoplayResult;
if (swiper.params.autoplay.reverseDirection) {
if (swiper.params.loop) {
swiper.loopFix();
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.isBeginning) {
autoplayResult = swiper.slidePrev(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.params.autoplay.stopOnLastSlide) {
autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true);
emit('autoplay');
} else {
stop();
}
} else if (swiper.params.loop) {
swiper.loopFix();
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.isEnd) {
autoplayResult = swiper.slideNext(swiper.params.speed, true, true);
emit('autoplay');
} else if (!swiper.params.autoplay.stopOnLastSlide) {
autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true);
emit('autoplay');
} else {
stop();
}
if (swiper.params.cssMode && swiper.autoplay.running) run();else if (autoplayResult === false) {
run();
}
}, delay);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | run | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function start() {
if (typeof timeout !== 'undefined') return false;
if (swiper.autoplay.running) return false;
swiper.autoplay.running = true;
emit('autoplayStart');
run();
return true;
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | start | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function stop() {
if (!swiper.autoplay.running) return false;
if (typeof timeout === 'undefined') return false;
if (timeout) {
clearTimeout(timeout);
timeout = undefined;
}
swiper.autoplay.running = false;
emit('autoplayStop');
return true;
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | stop | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function pause(speed) {
if (!swiper.autoplay.running) return;
if (swiper.autoplay.paused) return;
if (timeout) clearTimeout(timeout);
swiper.autoplay.paused = true;
if (speed === 0 || !swiper.params.autoplay.waitForTransition) {
swiper.autoplay.paused = false;
run();
} else {
['transitionend', 'webkitTransitionEnd'].forEach(event => {
swiper.$wrapperEl[0].addEventListener(event, onTransitionEnd);
});
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | pause | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function onVisibilityChange() {
const document = getDocument();
if (document.visibilityState === 'hidden' && swiper.autoplay.running) {
pause();
}
if (document.visibilityState === 'visible' && swiper.autoplay.paused) {
run();
swiper.autoplay.paused = false;
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onVisibilityChange | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function onTransitionEnd(e) {
if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return;
if (e.target !== swiper.$wrapperEl[0]) return;
['transitionend', 'webkitTransitionEnd'].forEach(event => {
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
});
swiper.autoplay.paused = false;
if (!swiper.autoplay.running) {
stop();
} else {
run();
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onTransitionEnd | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function onMouseEnter() {
if (swiper.params.autoplay.disableOnInteraction) {
stop();
} else {
emit('autoplayPause');
pause();
}
['transitionend', 'webkitTransitionEnd'].forEach(event => {
swiper.$wrapperEl[0].removeEventListener(event, onTransitionEnd);
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onMouseEnter | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function onMouseLeave() {
if (swiper.params.autoplay.disableOnInteraction) {
return;
}
swiper.autoplay.paused = false;
emit('autoplayResume');
run();
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onMouseLeave | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function attachMouseEvents() {
if (swiper.params.autoplay.pauseOnMouseEnter) {
swiper.$el.on('mouseenter', onMouseEnter);
swiper.$el.on('mouseleave', onMouseLeave);
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | attachMouseEvents | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function detachMouseEvents() {
swiper.$el.off('mouseenter', onMouseEnter);
swiper.$el.off('mouseleave', onMouseLeave);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | detachMouseEvents | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function Thumb(_ref) {
let {
swiper,
extendParams,
on
} = _ref;
extendParams({
thumbs: {
swiper: null,
multipleActiveThumbs: true,
autoScrollOffset: 0,
slideThumbActiveClass: 'swiper-slide-thumb-active',
thumbsContainerClass: 'swiper-thumbs'
}
});
let initialized = false;
let swiperCreated = false;
swiper.thumbs = {
swiper: null
};
function onThumbClick() {
const thumbsSwiper = swiper.thumbs.swiper;
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
const clickedIndex = thumbsSwiper.clickedIndex;
const clickedSlide = thumbsSwiper.clickedSlide;
if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) return;
if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;
let slideToIndex;
if (thumbsSwiper.params.loop) {
slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10);
} else {
slideToIndex = clickedIndex;
}
if (swiper.params.loop) {
let currentIndex = swiper.activeIndex;
if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) {
swiper.loopFix(); // eslint-disable-next-line
swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
currentIndex = swiper.activeIndex;
}
const prevIndex = swiper.slides.eq(currentIndex).prevAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index();
const nextIndex = swiper.slides.eq(currentIndex).nextAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index();
if (typeof prevIndex === 'undefined') slideToIndex = nextIndex;else if (typeof nextIndex === 'undefined') slideToIndex = prevIndex;else if (nextIndex - currentIndex < currentIndex - prevIndex) slideToIndex = nextIndex;else slideToIndex = prevIndex;
}
swiper.slideTo(slideToIndex);
}
function init() {
const {
thumbs: thumbsParams
} = swiper.params;
if (initialized) return false;
initialized = true;
const SwiperClass = swiper.constructor;
if (thumbsParams.swiper instanceof SwiperClass) {
swiper.thumbs.swiper = thumbsParams.swiper;
Object.assign(swiper.thumbs.swiper.originalParams, {
watchSlidesProgress: true,
slideToClickedSlide: false
});
Object.assign(swiper.thumbs.swiper.params, {
watchSlidesProgress: true,
slideToClickedSlide: false
});
} else if (isObject(thumbsParams.swiper)) {
const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper);
Object.assign(thumbsSwiperParams, {
watchSlidesProgress: true,
slideToClickedSlide: false
});
swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams);
swiperCreated = true;
}
swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass);
swiper.thumbs.swiper.on('tap', onThumbClick);
return true;
}
function update(initial) {
const thumbsSwiper = swiper.thumbs.swiper;
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; // Activate thumbs
let thumbsToActivate = 1;
const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;
if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {
thumbsToActivate = swiper.params.slidesPerView;
}
if (!swiper.params.thumbs.multipleActiveThumbs) {
thumbsToActivate = 1;
}
thumbsToActivate = Math.floor(thumbsToActivate);
thumbsSwiper.slides.removeClass(thumbActiveClass);
if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {
for (let i = 0; i < thumbsToActivate; i += 1) {
thumbsSwiper.$wrapperEl.children(`[data-swiper-slide-index="${swiper.realIndex + i}"]`).addClass(thumbActiveClass);
}
} else {
for (let i = 0; i < thumbsToActivate; i += 1) {
thumbsSwiper.slides.eq(swiper.realIndex + i).addClass(thumbActiveClass);
}
}
const autoScrollOffset = swiper.params.thumbs.autoScrollOffset;
const useOffset = autoScrollOffset && !thumbsSwiper.params.loop;
if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {
let currentThumbsIndex = thumbsSwiper.activeIndex;
let newThumbsIndex;
let direction;
if (thumbsSwiper.params.loop) {
if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) {
thumbsSwiper.loopFix(); // eslint-disable-next-line
thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft;
currentThumbsIndex = thumbsSwiper.activeIndex;
} // Find actual thumbs index to slide to
const prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index();
const nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index();
if (typeof prevThumbsIndex === 'undefined') {
newThumbsIndex = nextThumbsIndex;
} else if (typeof nextThumbsIndex === 'undefined') {
newThumbsIndex = prevThumbsIndex;
} else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) {
newThumbsIndex = thumbsSwiper.params.slidesPerGroup > 1 ? nextThumbsIndex : currentThumbsIndex;
} else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) {
newThumbsIndex = nextThumbsIndex;
} else {
newThumbsIndex = prevThumbsIndex;
}
direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';
} else {
newThumbsIndex = swiper.realIndex;
direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';
}
if (useOffset) {
newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;
}
if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {
if (thumbsSwiper.params.centeredSlides) {
if (newThumbsIndex > currentThumbsIndex) {
newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;
} else {
newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;
}
} else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ;
thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);
}
}
}
on('beforeInit', () => {
const {
thumbs
} = swiper.params;
if (!thumbs || !thumbs.swiper) return;
init();
update(true);
});
on('slideChange update resize observerUpdate', () => {
update();
});
on('setTransition', (_s, duration) => {
const thumbsSwiper = swiper.thumbs.swiper;
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
thumbsSwiper.setTransition(duration);
});
on('beforeDestroy', () => {
const thumbsSwiper = swiper.thumbs.swiper;
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
if (swiperCreated) {
thumbsSwiper.destroy();
}
});
Object.assign(swiper.thumbs, {
init,
update
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | Thumb | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function onThumbClick() {
const thumbsSwiper = swiper.thumbs.swiper;
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
const clickedIndex = thumbsSwiper.clickedIndex;
const clickedSlide = thumbsSwiper.clickedSlide;
if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) return;
if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;
let slideToIndex;
if (thumbsSwiper.params.loop) {
slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10);
} else {
slideToIndex = clickedIndex;
}
if (swiper.params.loop) {
let currentIndex = swiper.activeIndex;
if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) {
swiper.loopFix(); // eslint-disable-next-line
swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
currentIndex = swiper.activeIndex;
}
const prevIndex = swiper.slides.eq(currentIndex).prevAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index();
const nextIndex = swiper.slides.eq(currentIndex).nextAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index();
if (typeof prevIndex === 'undefined') slideToIndex = nextIndex;else if (typeof nextIndex === 'undefined') slideToIndex = prevIndex;else if (nextIndex - currentIndex < currentIndex - prevIndex) slideToIndex = nextIndex;else slideToIndex = prevIndex;
}
swiper.slideTo(slideToIndex);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onThumbClick | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function init() {
const {
thumbs: thumbsParams
} = swiper.params;
if (initialized) return false;
initialized = true;
const SwiperClass = swiper.constructor;
if (thumbsParams.swiper instanceof SwiperClass) {
swiper.thumbs.swiper = thumbsParams.swiper;
Object.assign(swiper.thumbs.swiper.originalParams, {
watchSlidesProgress: true,
slideToClickedSlide: false
});
Object.assign(swiper.thumbs.swiper.params, {
watchSlidesProgress: true,
slideToClickedSlide: false
});
} else if (isObject(thumbsParams.swiper)) {
const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper);
Object.assign(thumbsSwiperParams, {
watchSlidesProgress: true,
slideToClickedSlide: false
});
swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams);
swiperCreated = true;
}
swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass);
swiper.thumbs.swiper.on('tap', onThumbClick);
return true;
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function update(initial) {
const thumbsSwiper = swiper.thumbs.swiper;
if (!thumbsSwiper || thumbsSwiper.destroyed) return;
const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; // Activate thumbs
let thumbsToActivate = 1;
const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;
if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {
thumbsToActivate = swiper.params.slidesPerView;
}
if (!swiper.params.thumbs.multipleActiveThumbs) {
thumbsToActivate = 1;
}
thumbsToActivate = Math.floor(thumbsToActivate);
thumbsSwiper.slides.removeClass(thumbActiveClass);
if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {
for (let i = 0; i < thumbsToActivate; i += 1) {
thumbsSwiper.$wrapperEl.children(`[data-swiper-slide-index="${swiper.realIndex + i}"]`).addClass(thumbActiveClass);
}
} else {
for (let i = 0; i < thumbsToActivate; i += 1) {
thumbsSwiper.slides.eq(swiper.realIndex + i).addClass(thumbActiveClass);
}
}
const autoScrollOffset = swiper.params.thumbs.autoScrollOffset;
const useOffset = autoScrollOffset && !thumbsSwiper.params.loop;
if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {
let currentThumbsIndex = thumbsSwiper.activeIndex;
let newThumbsIndex;
let direction;
if (thumbsSwiper.params.loop) {
if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) {
thumbsSwiper.loopFix(); // eslint-disable-next-line
thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft;
currentThumbsIndex = thumbsSwiper.activeIndex;
} // Find actual thumbs index to slide to
const prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index();
const nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index();
if (typeof prevThumbsIndex === 'undefined') {
newThumbsIndex = nextThumbsIndex;
} else if (typeof nextThumbsIndex === 'undefined') {
newThumbsIndex = prevThumbsIndex;
} else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) {
newThumbsIndex = thumbsSwiper.params.slidesPerGroup > 1 ? nextThumbsIndex : currentThumbsIndex;
} else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) {
newThumbsIndex = nextThumbsIndex;
} else {
newThumbsIndex = prevThumbsIndex;
}
direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';
} else {
newThumbsIndex = swiper.realIndex;
direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';
}
if (useOffset) {
newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;
}
if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {
if (thumbsSwiper.params.centeredSlides) {
if (newThumbsIndex > currentThumbsIndex) {
newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;
} else {
newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;
}
} else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ;
thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);
}
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function freeMode(_ref) {
let {
swiper,
extendParams,
emit,
once
} = _ref;
extendParams({
freeMode: {
enabled: false,
momentum: true,
momentumRatio: 1,
momentumBounce: true,
momentumBounceRatio: 1,
momentumVelocityRatio: 1,
sticky: false,
minimumVelocity: 0.02
}
});
function onTouchStart() {
const translate = swiper.getTranslate();
swiper.setTranslate(translate);
swiper.setTransition(0);
swiper.touchEventsData.velocities.length = 0;
swiper.freeMode.onTouchEnd({
currentPos: swiper.rtl ? swiper.translate : -swiper.translate
});
}
function onTouchMove() {
const {
touchEventsData: data,
touches
} = swiper; // Velocity
if (data.velocities.length === 0) {
data.velocities.push({
position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
time: data.touchStartTime
});
}
data.velocities.push({
position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
time: now()
});
}
function onTouchEnd(_ref2) {
let {
currentPos
} = _ref2;
const {
params,
$wrapperEl,
rtlTranslate: rtl,
snapGrid,
touchEventsData: data
} = swiper; // Time diff
const touchEndTime = now();
const timeDiff = touchEndTime - data.touchStartTime;
if (currentPos < -swiper.minTranslate()) {
swiper.slideTo(swiper.activeIndex);
return;
}
if (currentPos > -swiper.maxTranslate()) {
if (swiper.slides.length < snapGrid.length) {
swiper.slideTo(snapGrid.length - 1);
} else {
swiper.slideTo(swiper.slides.length - 1);
}
return;
}
if (params.freeMode.momentum) {
if (data.velocities.length > 1) {
const lastMoveEvent = data.velocities.pop();
const velocityEvent = data.velocities.pop();
const distance = lastMoveEvent.position - velocityEvent.position;
const time = lastMoveEvent.time - velocityEvent.time;
swiper.velocity = distance / time;
swiper.velocity /= 2;
if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) {
swiper.velocity = 0;
} // this implies that the user stopped moving a finger then released.
// There would be no events with distance zero, so the last event is stale.
if (time > 150 || now() - lastMoveEvent.time > 300) {
swiper.velocity = 0;
}
} else {
swiper.velocity = 0;
}
swiper.velocity *= params.freeMode.momentumVelocityRatio;
data.velocities.length = 0;
let momentumDuration = 1000 * params.freeMode.momentumRatio;
const momentumDistance = swiper.velocity * momentumDuration;
let newPosition = swiper.translate + momentumDistance;
if (rtl) newPosition = -newPosition;
let doBounce = false;
let afterBouncePosition;
const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio;
let needsLoopFix;
if (newPosition < swiper.maxTranslate()) {
if (params.freeMode.momentumBounce) {
if (newPosition + swiper.maxTranslate() < -bounceAmount) {
newPosition = swiper.maxTranslate() - bounceAmount;
}
afterBouncePosition = swiper.maxTranslate();
doBounce = true;
data.allowMomentumBounce = true;
} else {
newPosition = swiper.maxTranslate();
}
if (params.loop && params.centeredSlides) needsLoopFix = true;
} else if (newPosition > swiper.minTranslate()) {
if (params.freeMode.momentumBounce) {
if (newPosition - swiper.minTranslate() > bounceAmount) {
newPosition = swiper.minTranslate() + bounceAmount;
}
afterBouncePosition = swiper.minTranslate();
doBounce = true;
data.allowMomentumBounce = true;
} else {
newPosition = swiper.minTranslate();
}
if (params.loop && params.centeredSlides) needsLoopFix = true;
} else if (params.freeMode.sticky) {
let nextSlide;
for (let j = 0; j < snapGrid.length; j += 1) {
if (snapGrid[j] > -newPosition) {
nextSlide = j;
break;
}
}
if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
newPosition = snapGrid[nextSlide];
} else {
newPosition = snapGrid[nextSlide - 1];
}
newPosition = -newPosition;
}
if (needsLoopFix) {
once('transitionEnd', () => {
swiper.loopFix();
});
} // Fix duration
if (swiper.velocity !== 0) {
if (rtl) {
momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
} else {
momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
}
if (params.freeMode.sticky) {
// If freeMode.sticky is active and the user ends a swipe with a slow-velocity
// event, then durations can be 20+ seconds to slide one (or zero!) slides.
// It's easy to see this when simulating touch with mouse events. To fix this,
// limit single-slide swipes to the default slide duration. This also has the
// nice side effect of matching slide speed if the user stopped moving before
// lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
// For faster swipes, also apply limits (albeit higher ones).
const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
if (moveDistance < currentSlideSize) {
momentumDuration = params.speed;
} else if (moveDistance < 2 * currentSlideSize) {
momentumDuration = params.speed * 1.5;
} else {
momentumDuration = params.speed * 2.5;
}
}
} else if (params.freeMode.sticky) {
swiper.slideToClosest();
return;
}
if (params.freeMode.momentumBounce && doBounce) {
swiper.updateProgress(afterBouncePosition);
swiper.setTransition(momentumDuration);
swiper.setTranslate(newPosition);
swiper.transitionStart(true, swiper.swipeDirection);
swiper.animating = true;
$wrapperEl.transitionEnd(() => {
if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
emit('momentumBounce');
swiper.setTransition(params.speed);
setTimeout(() => {
swiper.setTranslate(afterBouncePosition);
$wrapperEl.transitionEnd(() => {
if (!swiper || swiper.destroyed) return;
swiper.transitionEnd();
});
}, 0);
});
} else if (swiper.velocity) {
emit('_freeModeNoMomentumRelease');
swiper.updateProgress(newPosition);
swiper.setTransition(momentumDuration);
swiper.setTranslate(newPosition);
swiper.transitionStart(true, swiper.swipeDirection);
if (!swiper.animating) {
swiper.animating = true;
$wrapperEl.transitionEnd(() => {
if (!swiper || swiper.destroyed) return;
swiper.transitionEnd();
});
}
} else {
swiper.updateProgress(newPosition);
}
swiper.updateActiveIndex();
swiper.updateSlidesClasses();
} else if (params.freeMode.sticky) {
swiper.slideToClosest();
return;
} else if (params.freeMode) {
emit('_freeModeNoMomentumRelease');
}
if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) {
swiper.updateProgress();
swiper.updateActiveIndex();
swiper.updateSlidesClasses();
}
}
Object.assign(swiper, {
freeMode: {
onTouchStart,
onTouchMove,
onTouchEnd
}
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | freeMode | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function onTouchStart() {
const translate = swiper.getTranslate();
swiper.setTranslate(translate);
swiper.setTransition(0);
swiper.touchEventsData.velocities.length = 0;
swiper.freeMode.onTouchEnd({
currentPos: swiper.rtl ? swiper.translate : -swiper.translate
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onTouchStart | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function onTouchMove() {
const {
touchEventsData: data,
touches
} = swiper; // Velocity
if (data.velocities.length === 0) {
data.velocities.push({
position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
time: data.touchStartTime
});
}
data.velocities.push({
position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
time: now()
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onTouchMove | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function onTouchEnd(_ref2) {
let {
currentPos
} = _ref2;
const {
params,
$wrapperEl,
rtlTranslate: rtl,
snapGrid,
touchEventsData: data
} = swiper; // Time diff
const touchEndTime = now();
const timeDiff = touchEndTime - data.touchStartTime;
if (currentPos < -swiper.minTranslate()) {
swiper.slideTo(swiper.activeIndex);
return;
}
if (currentPos > -swiper.maxTranslate()) {
if (swiper.slides.length < snapGrid.length) {
swiper.slideTo(snapGrid.length - 1);
} else {
swiper.slideTo(swiper.slides.length - 1);
}
return;
}
if (params.freeMode.momentum) {
if (data.velocities.length > 1) {
const lastMoveEvent = data.velocities.pop();
const velocityEvent = data.velocities.pop();
const distance = lastMoveEvent.position - velocityEvent.position;
const time = lastMoveEvent.time - velocityEvent.time;
swiper.velocity = distance / time;
swiper.velocity /= 2;
if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) {
swiper.velocity = 0;
} // this implies that the user stopped moving a finger then released.
// There would be no events with distance zero, so the last event is stale.
if (time > 150 || now() - lastMoveEvent.time > 300) {
swiper.velocity = 0;
}
} else {
swiper.velocity = 0;
}
swiper.velocity *= params.freeMode.momentumVelocityRatio;
data.velocities.length = 0;
let momentumDuration = 1000 * params.freeMode.momentumRatio;
const momentumDistance = swiper.velocity * momentumDuration;
let newPosition = swiper.translate + momentumDistance;
if (rtl) newPosition = -newPosition;
let doBounce = false;
let afterBouncePosition;
const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio;
let needsLoopFix;
if (newPosition < swiper.maxTranslate()) {
if (params.freeMode.momentumBounce) {
if (newPosition + swiper.maxTranslate() < -bounceAmount) {
newPosition = swiper.maxTranslate() - bounceAmount;
}
afterBouncePosition = swiper.maxTranslate();
doBounce = true;
data.allowMomentumBounce = true;
} else {
newPosition = swiper.maxTranslate();
}
if (params.loop && params.centeredSlides) needsLoopFix = true;
} else if (newPosition > swiper.minTranslate()) {
if (params.freeMode.momentumBounce) {
if (newPosition - swiper.minTranslate() > bounceAmount) {
newPosition = swiper.minTranslate() + bounceAmount;
}
afterBouncePosition = swiper.minTranslate();
doBounce = true;
data.allowMomentumBounce = true;
} else {
newPosition = swiper.minTranslate();
}
if (params.loop && params.centeredSlides) needsLoopFix = true;
} else if (params.freeMode.sticky) {
let nextSlide;
for (let j = 0; j < snapGrid.length; j += 1) {
if (snapGrid[j] > -newPosition) {
nextSlide = j;
break;
}
}
if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
newPosition = snapGrid[nextSlide];
} else {
newPosition = snapGrid[nextSlide - 1];
}
newPosition = -newPosition;
}
if (needsLoopFix) {
once('transitionEnd', () => {
swiper.loopFix();
});
} // Fix duration
if (swiper.velocity !== 0) {
if (rtl) {
momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
} else {
momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
}
if (params.freeMode.sticky) {
// If freeMode.sticky is active and the user ends a swipe with a slow-velocity
// event, then durations can be 20+ seconds to slide one (or zero!) slides.
// It's easy to see this when simulating touch with mouse events. To fix this,
// limit single-slide swipes to the default slide duration. This also has the
// nice side effect of matching slide speed if the user stopped moving before
// lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
// For faster swipes, also apply limits (albeit higher ones).
const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
if (moveDistance < currentSlideSize) {
momentumDuration = params.speed;
} else if (moveDistance < 2 * currentSlideSize) {
momentumDuration = params.speed * 1.5;
} else {
momentumDuration = params.speed * 2.5;
}
}
} else if (params.freeMode.sticky) {
swiper.slideToClosest();
return;
}
if (params.freeMode.momentumBounce && doBounce) {
swiper.updateProgress(afterBouncePosition);
swiper.setTransition(momentumDuration);
swiper.setTranslate(newPosition);
swiper.transitionStart(true, swiper.swipeDirection);
swiper.animating = true;
$wrapperEl.transitionEnd(() => {
if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
emit('momentumBounce');
swiper.setTransition(params.speed);
setTimeout(() => {
swiper.setTranslate(afterBouncePosition);
$wrapperEl.transitionEnd(() => {
if (!swiper || swiper.destroyed) return;
swiper.transitionEnd();
});
}, 0);
});
} else if (swiper.velocity) {
emit('_freeModeNoMomentumRelease');
swiper.updateProgress(newPosition);
swiper.setTransition(momentumDuration);
swiper.setTranslate(newPosition);
swiper.transitionStart(true, swiper.swipeDirection);
if (!swiper.animating) {
swiper.animating = true;
$wrapperEl.transitionEnd(() => {
if (!swiper || swiper.destroyed) return;
swiper.transitionEnd();
});
}
} else {
swiper.updateProgress(newPosition);
}
swiper.updateActiveIndex();
swiper.updateSlidesClasses();
} else if (params.freeMode.sticky) {
swiper.slideToClosest();
return;
} else if (params.freeMode) {
emit('_freeModeNoMomentumRelease');
}
if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) {
swiper.updateProgress();
swiper.updateActiveIndex();
swiper.updateSlidesClasses();
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onTouchEnd | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function Grid(_ref) {
let {
swiper,
extendParams
} = _ref;
extendParams({
grid: {
rows: 1,
fill: 'column'
}
});
let slidesNumberEvenToRows;
let slidesPerRow;
let numFullColumns;
const initSlides = slidesLength => {
const {
slidesPerView
} = swiper.params;
const {
rows,
fill
} = swiper.params.grid;
slidesPerRow = slidesNumberEvenToRows / rows;
numFullColumns = Math.floor(slidesLength / rows);
if (Math.floor(slidesLength / rows) === slidesLength / rows) {
slidesNumberEvenToRows = slidesLength;
} else {
slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows;
}
if (slidesPerView !== 'auto' && fill === 'row') {
slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows);
}
};
const updateSlide = (i, slide, slidesLength, getDirectionLabel) => {
const {
slidesPerGroup,
spaceBetween
} = swiper.params;
const {
rows,
fill
} = swiper.params.grid; // Set slides order
let newSlideOrderIndex;
let column;
let row;
if (fill === 'row' && slidesPerGroup > 1) {
const groupIndex = Math.floor(i / (slidesPerGroup * rows));
const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex;
const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup);
row = Math.floor(slideIndexInGroup / columnsInGroup);
column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup;
newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows;
slide.css({
'-webkit-order': newSlideOrderIndex,
order: newSlideOrderIndex
});
} else if (fill === 'column') {
column = Math.floor(i / rows);
row = i - column * rows;
if (column > numFullColumns || column === numFullColumns && row === rows - 1) {
row += 1;
if (row >= rows) {
row = 0;
column += 1;
}
}
} else {
row = Math.floor(i / slidesPerRow);
column = i - row * slidesPerRow;
}
slide.css(getDirectionLabel('margin-top'), row !== 0 ? spaceBetween && `${spaceBetween}px` : '');
};
const updateWrapperSize = (slideSize, snapGrid, getDirectionLabel) => {
const {
spaceBetween,
centeredSlides,
roundLengths
} = swiper.params;
const {
rows
} = swiper.params.grid;
swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows;
swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween;
swiper.$wrapperEl.css({
[getDirectionLabel('width')]: `${swiper.virtualSize + spaceBetween}px`
});
if (centeredSlides) {
snapGrid.splice(0, snapGrid.length);
const newSlidesGrid = [];
for (let i = 0; i < snapGrid.length; i += 1) {
let slidesGridItem = snapGrid[i];
if (roundLengths) slidesGridItem = Math.floor(slidesGridItem);
if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem);
}
snapGrid.push(...newSlidesGrid);
}
};
swiper.grid = {
initSlides,
updateSlide,
updateWrapperSize
};
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | Grid | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
initSlides = slidesLength => {
const {
slidesPerView
} = swiper.params;
const {
rows,
fill
} = swiper.params.grid;
slidesPerRow = slidesNumberEvenToRows / rows;
numFullColumns = Math.floor(slidesLength / rows);
if (Math.floor(slidesLength / rows) === slidesLength / rows) {
slidesNumberEvenToRows = slidesLength;
} else {
slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows;
}
if (slidesPerView !== 'auto' && fill === 'row') {
slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows);
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | initSlides | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
initSlides = slidesLength => {
const {
slidesPerView
} = swiper.params;
const {
rows,
fill
} = swiper.params.grid;
slidesPerRow = slidesNumberEvenToRows / rows;
numFullColumns = Math.floor(slidesLength / rows);
if (Math.floor(slidesLength / rows) === slidesLength / rows) {
slidesNumberEvenToRows = slidesLength;
} else {
slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows;
}
if (slidesPerView !== 'auto' && fill === 'row') {
slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows);
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | initSlides | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
updateSlide = (i, slide, slidesLength, getDirectionLabel) => {
const {
slidesPerGroup,
spaceBetween
} = swiper.params;
const {
rows,
fill
} = swiper.params.grid; // Set slides order
let newSlideOrderIndex;
let column;
let row;
if (fill === 'row' && slidesPerGroup > 1) {
const groupIndex = Math.floor(i / (slidesPerGroup * rows));
const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex;
const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup);
row = Math.floor(slideIndexInGroup / columnsInGroup);
column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup;
newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows;
slide.css({
'-webkit-order': newSlideOrderIndex,
order: newSlideOrderIndex
});
} else if (fill === 'column') {
column = Math.floor(i / rows);
row = i - column * rows;
if (column > numFullColumns || column === numFullColumns && row === rows - 1) {
row += 1;
if (row >= rows) {
row = 0;
column += 1;
}
}
} else {
row = Math.floor(i / slidesPerRow);
column = i - row * slidesPerRow;
}
slide.css(getDirectionLabel('margin-top'), row !== 0 ? spaceBetween && `${spaceBetween}px` : '');
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | updateSlide | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
updateSlide = (i, slide, slidesLength, getDirectionLabel) => {
const {
slidesPerGroup,
spaceBetween
} = swiper.params;
const {
rows,
fill
} = swiper.params.grid; // Set slides order
let newSlideOrderIndex;
let column;
let row;
if (fill === 'row' && slidesPerGroup > 1) {
const groupIndex = Math.floor(i / (slidesPerGroup * rows));
const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex;
const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup);
row = Math.floor(slideIndexInGroup / columnsInGroup);
column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup;
newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows;
slide.css({
'-webkit-order': newSlideOrderIndex,
order: newSlideOrderIndex
});
} else if (fill === 'column') {
column = Math.floor(i / rows);
row = i - column * rows;
if (column > numFullColumns || column === numFullColumns && row === rows - 1) {
row += 1;
if (row >= rows) {
row = 0;
column += 1;
}
}
} else {
row = Math.floor(i / slidesPerRow);
column = i - row * slidesPerRow;
}
slide.css(getDirectionLabel('margin-top'), row !== 0 ? spaceBetween && `${spaceBetween}px` : '');
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | updateSlide | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
updateWrapperSize = (slideSize, snapGrid, getDirectionLabel) => {
const {
spaceBetween,
centeredSlides,
roundLengths
} = swiper.params;
const {
rows
} = swiper.params.grid;
swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows;
swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween;
swiper.$wrapperEl.css({
[getDirectionLabel('width')]: `${swiper.virtualSize + spaceBetween}px`
});
if (centeredSlides) {
snapGrid.splice(0, snapGrid.length);
const newSlidesGrid = [];
for (let i = 0; i < snapGrid.length; i += 1) {
let slidesGridItem = snapGrid[i];
if (roundLengths) slidesGridItem = Math.floor(slidesGridItem);
if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem);
}
snapGrid.push(...newSlidesGrid);
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | updateWrapperSize | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
updateWrapperSize = (slideSize, snapGrid, getDirectionLabel) => {
const {
spaceBetween,
centeredSlides,
roundLengths
} = swiper.params;
const {
rows
} = swiper.params.grid;
swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows;
swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween;
swiper.$wrapperEl.css({
[getDirectionLabel('width')]: `${swiper.virtualSize + spaceBetween}px`
});
if (centeredSlides) {
snapGrid.splice(0, snapGrid.length);
const newSlidesGrid = [];
for (let i = 0; i < snapGrid.length; i += 1) {
let slidesGridItem = snapGrid[i];
if (roundLengths) slidesGridItem = Math.floor(slidesGridItem);
if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem);
}
snapGrid.push(...newSlidesGrid);
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | updateWrapperSize | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function appendSlide(slides) {
const swiper = this;
const {
$wrapperEl,
params
} = swiper;
if (params.loop) {
swiper.loopDestroy();
}
if (typeof slides === 'object' && 'length' in slides) {
for (let i = 0; i < slides.length; i += 1) {
if (slides[i]) $wrapperEl.append(slides[i]);
}
} else {
$wrapperEl.append(slides);
}
if (params.loop) {
swiper.loopCreate();
}
if (!params.observer) {
swiper.update();
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function prependSlide(slides) {
const swiper = this;
const {
params,
$wrapperEl,
activeIndex
} = swiper;
if (params.loop) {
swiper.loopDestroy();
}
let newActiveIndex = activeIndex + 1;
if (typeof slides === 'object' && 'length' in slides) {
for (let i = 0; i < slides.length; i += 1) {
if (slides[i]) $wrapperEl.prepend(slides[i]);
}
newActiveIndex = activeIndex + slides.length;
} else {
$wrapperEl.prepend(slides);
}
if (params.loop) {
swiper.loopCreate();
}
if (!params.observer) {
swiper.update();
}
swiper.slideTo(newActiveIndex, 0, false);
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function addSlide(index, slides) {
const swiper = this;
const {
$wrapperEl,
params,
activeIndex
} = swiper;
let activeIndexBuffer = activeIndex;
if (params.loop) {
activeIndexBuffer -= swiper.loopedSlides;
swiper.loopDestroy();
swiper.slides = $wrapperEl.children(`.${params.slideClass}`);
}
const baseLength = swiper.slides.length;
if (index <= 0) {
swiper.prependSlide(slides);
return;
}
if (index >= baseLength) {
swiper.appendSlide(slides);
return;
}
let newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer;
const slidesBuffer = [];
for (let i = baseLength - 1; i >= index; i -= 1) {
const currentSlide = swiper.slides.eq(i);
currentSlide.remove();
slidesBuffer.unshift(currentSlide);
}
if (typeof slides === 'object' && 'length' in slides) {
for (let i = 0; i < slides.length; i += 1) {
if (slides[i]) $wrapperEl.append(slides[i]);
}
newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer;
} else {
$wrapperEl.append(slides);
}
for (let i = 0; i < slidesBuffer.length; i += 1) {
$wrapperEl.append(slidesBuffer[i]);
}
if (params.loop) {
swiper.loopCreate();
}
if (!params.observer) {
swiper.update();
}
if (params.loop) {
swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
} else {
swiper.slideTo(newActiveIndex, 0, false);
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | addSlide | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function removeSlide(slidesIndexes) {
const swiper = this;
const {
params,
$wrapperEl,
activeIndex
} = swiper;
let activeIndexBuffer = activeIndex;
if (params.loop) {
activeIndexBuffer -= swiper.loopedSlides;
swiper.loopDestroy();
swiper.slides = $wrapperEl.children(`.${params.slideClass}`);
}
let newActiveIndex = activeIndexBuffer;
let indexToRemove;
if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) {
for (let i = 0; i < slidesIndexes.length; i += 1) {
indexToRemove = slidesIndexes[i];
if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove();
if (indexToRemove < newActiveIndex) newActiveIndex -= 1;
}
newActiveIndex = Math.max(newActiveIndex, 0);
} else {
indexToRemove = slidesIndexes;
if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove();
if (indexToRemove < newActiveIndex) newActiveIndex -= 1;
newActiveIndex = Math.max(newActiveIndex, 0);
}
if (params.loop) {
swiper.loopCreate();
}
if (!params.observer) {
swiper.update();
}
if (params.loop) {
swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
} else {
swiper.slideTo(newActiveIndex, 0, false);
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function removeAllSlides() {
const swiper = this;
const slidesIndexes = [];
for (let i = 0; i < swiper.slides.length; i += 1) {
slidesIndexes.push(i);
}
swiper.removeSlide(slidesIndexes);
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function Manipulation(_ref) {
let {
swiper
} = _ref;
Object.assign(swiper, {
appendSlide: appendSlide.bind(swiper),
prependSlide: prependSlide.bind(swiper),
addSlide: addSlide.bind(swiper),
removeSlide: removeSlide.bind(swiper),
removeAllSlides: removeAllSlides.bind(swiper)
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | Manipulation | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function effectInit(params) {
const {
effect,
swiper,
on,
setTranslate,
setTransition,
overwriteParams,
perspective,
recreateShadows,
getEffectParams
} = params;
on('beforeInit', () => {
if (swiper.params.effect !== effect) return;
swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`);
if (perspective && perspective()) {
swiper.classNames.push(`${swiper.params.containerModifierClass}3d`);
}
const overwriteParamsResult = overwriteParams ? overwriteParams() : {};
Object.assign(swiper.params, overwriteParamsResult);
Object.assign(swiper.originalParams, overwriteParamsResult);
});
on('setTranslate', () => {
if (swiper.params.effect !== effect) return;
setTranslate();
});
on('setTransition', (_s, duration) => {
if (swiper.params.effect !== effect) return;
setTransition(duration);
});
on('transitionEnd', () => {
if (swiper.params.effect !== effect) return;
if (recreateShadows) {
if (!getEffectParams || !getEffectParams().slideShadows) return; // remove shadows
swiper.slides.each(slideEl => {
const $slideEl = swiper.$(slideEl);
$slideEl.find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').remove();
}); // create new one
recreateShadows();
}
});
let requireUpdateOnVirtual;
on('virtualUpdate', () => {
if (swiper.params.effect !== effect) return;
if (!swiper.slides.length) {
requireUpdateOnVirtual = true;
}
requestAnimationFrame(() => {
if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) {
setTranslate();
requireUpdateOnVirtual = false;
}
});
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | effectInit | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function effectTarget(effectParams, $slideEl) {
if (effectParams.transformEl) {
return $slideEl.find(effectParams.transformEl).css({
'backface-visibility': 'hidden',
'-webkit-backface-visibility': 'hidden'
});
}
return $slideEl;
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | effectTarget | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function effectVirtualTransitionEnd(_ref) {
let {
swiper,
duration,
transformEl,
allSlides
} = _ref;
const {
slides,
activeIndex,
$wrapperEl
} = swiper;
if (swiper.params.virtualTranslate && duration !== 0) {
let eventTriggered = false;
let $transitionEndTarget;
if (allSlides) {
$transitionEndTarget = transformEl ? slides.find(transformEl) : slides;
} else {
$transitionEndTarget = transformEl ? slides.eq(activeIndex).find(transformEl) : slides.eq(activeIndex);
}
$transitionEndTarget.transitionEnd(() => {
if (eventTriggered) return;
if (!swiper || swiper.destroyed) return;
eventTriggered = true;
swiper.animating = false;
const triggerEvents = ['webkitTransitionEnd', 'transitionend'];
for (let i = 0; i < triggerEvents.length; i += 1) {
$wrapperEl.trigger(triggerEvents[i]);
}
});
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | effectVirtualTransitionEnd | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function EffectFade(_ref) {
let {
swiper,
extendParams,
on
} = _ref;
extendParams({
fadeEffect: {
crossFade: false,
transformEl: null
}
});
const setTranslate = () => {
const {
slides
} = swiper;
const params = swiper.params.fadeEffect;
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = swiper.slides.eq(i);
const offset = $slideEl[0].swiperSlideOffset;
let tx = -offset;
if (!swiper.params.virtualTranslate) tx -= swiper.translate;
let ty = 0;
if (!swiper.isHorizontal()) {
ty = tx;
tx = 0;
}
const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs($slideEl[0].progress), 0) : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0);
const $targetEl = effectTarget(params, $slideEl);
$targetEl.css({
opacity: slideOpacity
}).transform(`translate3d(${tx}px, ${ty}px, 0px)`);
}
};
const setTransition = duration => {
const {
transformEl
} = swiper.params.fadeEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl,
allSlides: true
});
};
effectInit({
effect: 'fade',
swiper,
on,
setTranslate,
setTransition,
overwriteParams: () => ({
slidesPerView: 1,
slidesPerGroup: 1,
watchSlidesProgress: true,
spaceBetween: 0,
virtualTranslate: !swiper.params.cssMode
})
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | EffectFade | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
slides
} = swiper;
const params = swiper.params.fadeEffect;
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = swiper.slides.eq(i);
const offset = $slideEl[0].swiperSlideOffset;
let tx = -offset;
if (!swiper.params.virtualTranslate) tx -= swiper.translate;
let ty = 0;
if (!swiper.isHorizontal()) {
ty = tx;
tx = 0;
}
const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs($slideEl[0].progress), 0) : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0);
const $targetEl = effectTarget(params, $slideEl);
$targetEl.css({
opacity: slideOpacity
}).transform(`translate3d(${tx}px, ${ty}px, 0px)`);
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
slides
} = swiper;
const params = swiper.params.fadeEffect;
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = swiper.slides.eq(i);
const offset = $slideEl[0].swiperSlideOffset;
let tx = -offset;
if (!swiper.params.virtualTranslate) tx -= swiper.translate;
let ty = 0;
if (!swiper.isHorizontal()) {
ty = tx;
tx = 0;
}
const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs($slideEl[0].progress), 0) : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0);
const $targetEl = effectTarget(params, $slideEl);
$targetEl.css({
opacity: slideOpacity
}).transform(`translate3d(${tx}px, ${ty}px, 0px)`);
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
transformEl
} = swiper.params.fadeEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl,
allSlides: true
});
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
transformEl
} = swiper.params.fadeEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl,
allSlides: true
});
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function EffectCube(_ref) {
let {
swiper,
extendParams,
on
} = _ref;
extendParams({
cubeEffect: {
slideShadows: true,
shadow: true,
shadowOffset: 20,
shadowScale: 0.94
}
});
const createSlideShadows = ($slideEl, progress, isHorizontal) => {
let shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
let shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
if (shadowBefore.length === 0) {
shadowBefore = $(`<div class="swiper-slide-shadow-${isHorizontal ? 'left' : 'top'}"></div>`);
$slideEl.append(shadowBefore);
}
if (shadowAfter.length === 0) {
shadowAfter = $(`<div class="swiper-slide-shadow-${isHorizontal ? 'right' : 'bottom'}"></div>`);
$slideEl.append(shadowAfter);
}
if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
};
const recreateShadows = () => {
// create new ones
const isHorizontal = swiper.isHorizontal();
swiper.slides.each(slideEl => {
const progress = Math.max(Math.min(slideEl.progress, 1), -1);
createSlideShadows($(slideEl), progress, isHorizontal);
});
};
const setTranslate = () => {
const {
$el,
$wrapperEl,
slides,
width: swiperWidth,
height: swiperHeight,
rtlTranslate: rtl,
size: swiperSize,
browser
} = swiper;
const params = swiper.params.cubeEffect;
const isHorizontal = swiper.isHorizontal();
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
let wrapperRotate = 0;
let $cubeShadowEl;
if (params.shadow) {
if (isHorizontal) {
$cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow');
if ($cubeShadowEl.length === 0) {
$cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
$wrapperEl.append($cubeShadowEl);
}
$cubeShadowEl.css({
height: `${swiperWidth}px`
});
} else {
$cubeShadowEl = $el.find('.swiper-cube-shadow');
if ($cubeShadowEl.length === 0) {
$cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
$el.append($cubeShadowEl);
}
}
}
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
let slideIndex = i;
if (isVirtual) {
slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10);
}
let slideAngle = slideIndex * 90;
let round = Math.floor(slideAngle / 360);
if (rtl) {
slideAngle = -slideAngle;
round = Math.floor(-slideAngle / 360);
}
const progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
let tx = 0;
let ty = 0;
let tz = 0;
if (slideIndex % 4 === 0) {
tx = -round * 4 * swiperSize;
tz = 0;
} else if ((slideIndex - 1) % 4 === 0) {
tx = 0;
tz = -round * 4 * swiperSize;
} else if ((slideIndex - 2) % 4 === 0) {
tx = swiperSize + round * 4 * swiperSize;
tz = swiperSize;
} else if ((slideIndex - 3) % 4 === 0) {
tx = -swiperSize;
tz = 3 * swiperSize + swiperSize * 4 * round;
}
if (rtl) {
tx = -tx;
}
if (!isHorizontal) {
ty = tx;
tx = 0;
}
const transform = `rotateX(${isHorizontal ? 0 : -slideAngle}deg) rotateY(${isHorizontal ? slideAngle : 0}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`;
if (progress <= 1 && progress > -1) {
wrapperRotate = slideIndex * 90 + progress * 90;
if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90;
}
$slideEl.transform(transform);
if (params.slideShadows) {
createSlideShadows($slideEl, progress, isHorizontal);
}
}
$wrapperEl.css({
'-webkit-transform-origin': `50% 50% -${swiperSize / 2}px`,
'transform-origin': `50% 50% -${swiperSize / 2}px`
});
if (params.shadow) {
if (isHorizontal) {
$cubeShadowEl.transform(`translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(90deg) rotateZ(0deg) scale(${params.shadowScale})`);
} else {
const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
const scale1 = params.shadowScale;
const scale2 = params.shadowScale / multiplier;
const offset = params.shadowOffset;
$cubeShadowEl.transform(`scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-90deg)`);
}
}
const zFactor = browser.isSafari || browser.isWebView ? -swiperSize / 2 : 0;
$wrapperEl.transform(`translate3d(0px,0,${zFactor}px) rotateX(${swiper.isHorizontal() ? 0 : wrapperRotate}deg) rotateY(${swiper.isHorizontal() ? -wrapperRotate : 0}deg)`);
$wrapperEl[0].style.setProperty('--swiper-cube-translate-z', `${zFactor}px`);
};
const setTransition = duration => {
const {
$el,
slides
} = swiper;
slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) {
$el.find('.swiper-cube-shadow').transition(duration);
}
};
effectInit({
effect: 'cube',
swiper,
on,
setTranslate,
setTransition,
recreateShadows,
getEffectParams: () => swiper.params.cubeEffect,
perspective: () => true,
overwriteParams: () => ({
slidesPerView: 1,
slidesPerGroup: 1,
watchSlidesProgress: true,
resistanceRatio: 0,
spaceBetween: 0,
centeredSlides: false,
virtualTranslate: true
})
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | EffectCube | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
createSlideShadows = ($slideEl, progress, isHorizontal) => {
let shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
let shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
if (shadowBefore.length === 0) {
shadowBefore = $(`<div class="swiper-slide-shadow-${isHorizontal ? 'left' : 'top'}"></div>`);
$slideEl.append(shadowBefore);
}
if (shadowAfter.length === 0) {
shadowAfter = $(`<div class="swiper-slide-shadow-${isHorizontal ? 'right' : 'bottom'}"></div>`);
$slideEl.append(shadowAfter);
}
if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | createSlideShadows | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
createSlideShadows = ($slideEl, progress, isHorizontal) => {
let shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
let shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
if (shadowBefore.length === 0) {
shadowBefore = $(`<div class="swiper-slide-shadow-${isHorizontal ? 'left' : 'top'}"></div>`);
$slideEl.append(shadowBefore);
}
if (shadowAfter.length === 0) {
shadowAfter = $(`<div class="swiper-slide-shadow-${isHorizontal ? 'right' : 'bottom'}"></div>`);
$slideEl.append(shadowAfter);
}
if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | createSlideShadows | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
recreateShadows = () => {
// create new ones
const isHorizontal = swiper.isHorizontal();
swiper.slides.each(slideEl => {
const progress = Math.max(Math.min(slideEl.progress, 1), -1);
createSlideShadows($(slideEl), progress, isHorizontal);
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | recreateShadows | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
recreateShadows = () => {
// create new ones
const isHorizontal = swiper.isHorizontal();
swiper.slides.each(slideEl => {
const progress = Math.max(Math.min(slideEl.progress, 1), -1);
createSlideShadows($(slideEl), progress, isHorizontal);
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | recreateShadows | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
$el,
$wrapperEl,
slides,
width: swiperWidth,
height: swiperHeight,
rtlTranslate: rtl,
size: swiperSize,
browser
} = swiper;
const params = swiper.params.cubeEffect;
const isHorizontal = swiper.isHorizontal();
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
let wrapperRotate = 0;
let $cubeShadowEl;
if (params.shadow) {
if (isHorizontal) {
$cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow');
if ($cubeShadowEl.length === 0) {
$cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
$wrapperEl.append($cubeShadowEl);
}
$cubeShadowEl.css({
height: `${swiperWidth}px`
});
} else {
$cubeShadowEl = $el.find('.swiper-cube-shadow');
if ($cubeShadowEl.length === 0) {
$cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
$el.append($cubeShadowEl);
}
}
}
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
let slideIndex = i;
if (isVirtual) {
slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10);
}
let slideAngle = slideIndex * 90;
let round = Math.floor(slideAngle / 360);
if (rtl) {
slideAngle = -slideAngle;
round = Math.floor(-slideAngle / 360);
}
const progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
let tx = 0;
let ty = 0;
let tz = 0;
if (slideIndex % 4 === 0) {
tx = -round * 4 * swiperSize;
tz = 0;
} else if ((slideIndex - 1) % 4 === 0) {
tx = 0;
tz = -round * 4 * swiperSize;
} else if ((slideIndex - 2) % 4 === 0) {
tx = swiperSize + round * 4 * swiperSize;
tz = swiperSize;
} else if ((slideIndex - 3) % 4 === 0) {
tx = -swiperSize;
tz = 3 * swiperSize + swiperSize * 4 * round;
}
if (rtl) {
tx = -tx;
}
if (!isHorizontal) {
ty = tx;
tx = 0;
}
const transform = `rotateX(${isHorizontal ? 0 : -slideAngle}deg) rotateY(${isHorizontal ? slideAngle : 0}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`;
if (progress <= 1 && progress > -1) {
wrapperRotate = slideIndex * 90 + progress * 90;
if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90;
}
$slideEl.transform(transform);
if (params.slideShadows) {
createSlideShadows($slideEl, progress, isHorizontal);
}
}
$wrapperEl.css({
'-webkit-transform-origin': `50% 50% -${swiperSize / 2}px`,
'transform-origin': `50% 50% -${swiperSize / 2}px`
});
if (params.shadow) {
if (isHorizontal) {
$cubeShadowEl.transform(`translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(90deg) rotateZ(0deg) scale(${params.shadowScale})`);
} else {
const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
const scale1 = params.shadowScale;
const scale2 = params.shadowScale / multiplier;
const offset = params.shadowOffset;
$cubeShadowEl.transform(`scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-90deg)`);
}
}
const zFactor = browser.isSafari || browser.isWebView ? -swiperSize / 2 : 0;
$wrapperEl.transform(`translate3d(0px,0,${zFactor}px) rotateX(${swiper.isHorizontal() ? 0 : wrapperRotate}deg) rotateY(${swiper.isHorizontal() ? -wrapperRotate : 0}deg)`);
$wrapperEl[0].style.setProperty('--swiper-cube-translate-z', `${zFactor}px`);
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
$el,
$wrapperEl,
slides,
width: swiperWidth,
height: swiperHeight,
rtlTranslate: rtl,
size: swiperSize,
browser
} = swiper;
const params = swiper.params.cubeEffect;
const isHorizontal = swiper.isHorizontal();
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
let wrapperRotate = 0;
let $cubeShadowEl;
if (params.shadow) {
if (isHorizontal) {
$cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow');
if ($cubeShadowEl.length === 0) {
$cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
$wrapperEl.append($cubeShadowEl);
}
$cubeShadowEl.css({
height: `${swiperWidth}px`
});
} else {
$cubeShadowEl = $el.find('.swiper-cube-shadow');
if ($cubeShadowEl.length === 0) {
$cubeShadowEl = $('<div class="swiper-cube-shadow"></div>');
$el.append($cubeShadowEl);
}
}
}
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
let slideIndex = i;
if (isVirtual) {
slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10);
}
let slideAngle = slideIndex * 90;
let round = Math.floor(slideAngle / 360);
if (rtl) {
slideAngle = -slideAngle;
round = Math.floor(-slideAngle / 360);
}
const progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
let tx = 0;
let ty = 0;
let tz = 0;
if (slideIndex % 4 === 0) {
tx = -round * 4 * swiperSize;
tz = 0;
} else if ((slideIndex - 1) % 4 === 0) {
tx = 0;
tz = -round * 4 * swiperSize;
} else if ((slideIndex - 2) % 4 === 0) {
tx = swiperSize + round * 4 * swiperSize;
tz = swiperSize;
} else if ((slideIndex - 3) % 4 === 0) {
tx = -swiperSize;
tz = 3 * swiperSize + swiperSize * 4 * round;
}
if (rtl) {
tx = -tx;
}
if (!isHorizontal) {
ty = tx;
tx = 0;
}
const transform = `rotateX(${isHorizontal ? 0 : -slideAngle}deg) rotateY(${isHorizontal ? slideAngle : 0}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`;
if (progress <= 1 && progress > -1) {
wrapperRotate = slideIndex * 90 + progress * 90;
if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90;
}
$slideEl.transform(transform);
if (params.slideShadows) {
createSlideShadows($slideEl, progress, isHorizontal);
}
}
$wrapperEl.css({
'-webkit-transform-origin': `50% 50% -${swiperSize / 2}px`,
'transform-origin': `50% 50% -${swiperSize / 2}px`
});
if (params.shadow) {
if (isHorizontal) {
$cubeShadowEl.transform(`translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(90deg) rotateZ(0deg) scale(${params.shadowScale})`);
} else {
const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
const scale1 = params.shadowScale;
const scale2 = params.shadowScale / multiplier;
const offset = params.shadowOffset;
$cubeShadowEl.transform(`scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-90deg)`);
}
}
const zFactor = browser.isSafari || browser.isWebView ? -swiperSize / 2 : 0;
$wrapperEl.transform(`translate3d(0px,0,${zFactor}px) rotateX(${swiper.isHorizontal() ? 0 : wrapperRotate}deg) rotateY(${swiper.isHorizontal() ? -wrapperRotate : 0}deg)`);
$wrapperEl[0].style.setProperty('--swiper-cube-translate-z', `${zFactor}px`);
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
$el,
slides
} = swiper;
slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) {
$el.find('.swiper-cube-shadow').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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
$el,
slides
} = swiper;
slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) {
$el.find('.swiper-cube-shadow').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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function createShadow(params, $slideEl, side) {
const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}`;
const $shadowContainer = params.transformEl ? $slideEl.find(params.transformEl) : $slideEl;
let $shadowEl = $shadowContainer.children(`.${shadowClass}`);
if (!$shadowEl.length) {
$shadowEl = $(`<div class="swiper-slide-shadow${side ? `-${side}` : ''}"></div>`);
$shadowContainer.append($shadowEl);
}
return $shadowEl;
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | createShadow | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function EffectFlip(_ref) {
let {
swiper,
extendParams,
on
} = _ref;
extendParams({
flipEffect: {
slideShadows: true,
limitRotation: true,
transformEl: null
}
});
const createSlideShadows = ($slideEl, progress, params) => {
let shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
let shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
if (shadowBefore.length === 0) {
shadowBefore = createShadow(params, $slideEl, swiper.isHorizontal() ? 'left' : 'top');
}
if (shadowAfter.length === 0) {
shadowAfter = createShadow(params, $slideEl, swiper.isHorizontal() ? 'right' : 'bottom');
}
if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
};
const recreateShadows = () => {
// Set shadows
const params = swiper.params.flipEffect;
swiper.slides.each(slideEl => {
const $slideEl = $(slideEl);
let progress = $slideEl[0].progress;
if (swiper.params.flipEffect.limitRotation) {
progress = Math.max(Math.min(slideEl.progress, 1), -1);
}
createSlideShadows($slideEl, progress, params);
});
};
const setTranslate = () => {
const {
slides,
rtlTranslate: rtl
} = swiper;
const params = swiper.params.flipEffect;
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
let progress = $slideEl[0].progress;
if (swiper.params.flipEffect.limitRotation) {
progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
}
const offset = $slideEl[0].swiperSlideOffset;
const rotate = -180 * progress;
let rotateY = rotate;
let rotateX = 0;
let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset;
let ty = 0;
if (!swiper.isHorizontal()) {
ty = tx;
tx = 0;
rotateX = -rotateY;
rotateY = 0;
} else if (rtl) {
rotateY = -rotateY;
}
$slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length;
if (params.slideShadows) {
createSlideShadows($slideEl, progress, params);
}
const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(transform);
}
};
const setTransition = duration => {
const {
transformEl
} = swiper.params.flipEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl
});
};
effectInit({
effect: 'flip',
swiper,
on,
setTranslate,
setTransition,
recreateShadows,
getEffectParams: () => swiper.params.flipEffect,
perspective: () => true,
overwriteParams: () => ({
slidesPerView: 1,
slidesPerGroup: 1,
watchSlidesProgress: true,
spaceBetween: 0,
virtualTranslate: !swiper.params.cssMode
})
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | EffectFlip | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
createSlideShadows = ($slideEl, progress, params) => {
let shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
let shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
if (shadowBefore.length === 0) {
shadowBefore = createShadow(params, $slideEl, swiper.isHorizontal() ? 'left' : 'top');
}
if (shadowAfter.length === 0) {
shadowAfter = createShadow(params, $slideEl, swiper.isHorizontal() ? 'right' : 'bottom');
}
if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | createSlideShadows | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
createSlideShadows = ($slideEl, progress, params) => {
let shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
let shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
if (shadowBefore.length === 0) {
shadowBefore = createShadow(params, $slideEl, swiper.isHorizontal() ? 'left' : 'top');
}
if (shadowAfter.length === 0) {
shadowAfter = createShadow(params, $slideEl, swiper.isHorizontal() ? 'right' : 'bottom');
}
if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0);
if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | createSlideShadows | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
recreateShadows = () => {
// Set shadows
const params = swiper.params.flipEffect;
swiper.slides.each(slideEl => {
const $slideEl = $(slideEl);
let progress = $slideEl[0].progress;
if (swiper.params.flipEffect.limitRotation) {
progress = Math.max(Math.min(slideEl.progress, 1), -1);
}
createSlideShadows($slideEl, progress, params);
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | recreateShadows | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
recreateShadows = () => {
// Set shadows
const params = swiper.params.flipEffect;
swiper.slides.each(slideEl => {
const $slideEl = $(slideEl);
let progress = $slideEl[0].progress;
if (swiper.params.flipEffect.limitRotation) {
progress = Math.max(Math.min(slideEl.progress, 1), -1);
}
createSlideShadows($slideEl, progress, params);
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | recreateShadows | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
slides,
rtlTranslate: rtl
} = swiper;
const params = swiper.params.flipEffect;
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
let progress = $slideEl[0].progress;
if (swiper.params.flipEffect.limitRotation) {
progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
}
const offset = $slideEl[0].swiperSlideOffset;
const rotate = -180 * progress;
let rotateY = rotate;
let rotateX = 0;
let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset;
let ty = 0;
if (!swiper.isHorizontal()) {
ty = tx;
tx = 0;
rotateX = -rotateY;
rotateY = 0;
} else if (rtl) {
rotateY = -rotateY;
}
$slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length;
if (params.slideShadows) {
createSlideShadows($slideEl, progress, params);
}
const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(transform);
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
slides,
rtlTranslate: rtl
} = swiper;
const params = swiper.params.flipEffect;
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
let progress = $slideEl[0].progress;
if (swiper.params.flipEffect.limitRotation) {
progress = Math.max(Math.min($slideEl[0].progress, 1), -1);
}
const offset = $slideEl[0].swiperSlideOffset;
const rotate = -180 * progress;
let rotateY = rotate;
let rotateX = 0;
let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset;
let ty = 0;
if (!swiper.isHorizontal()) {
ty = tx;
tx = 0;
rotateX = -rotateY;
rotateY = 0;
} else if (rtl) {
rotateY = -rotateY;
}
$slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length;
if (params.slideShadows) {
createSlideShadows($slideEl, progress, params);
}
const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(transform);
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
transformEl
} = swiper.params.flipEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl
});
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
transformEl
} = swiper.params.flipEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl
});
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function EffectCoverflow(_ref) {
let {
swiper,
extendParams,
on
} = _ref;
extendParams({
coverflowEffect: {
rotate: 50,
stretch: 0,
depth: 100,
scale: 1,
modifier: 1,
slideShadows: true,
transformEl: null
}
});
const setTranslate = () => {
const {
width: swiperWidth,
height: swiperHeight,
slides,
slidesSizesGrid
} = swiper;
const params = swiper.params.coverflowEffect;
const isHorizontal = swiper.isHorizontal();
const transform = swiper.translate;
const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2;
const rotate = isHorizontal ? params.rotate : -params.rotate;
const translate = params.depth; // Each slide offset from center
for (let i = 0, length = slides.length; i < length; i += 1) {
const $slideEl = slides.eq(i);
const slideSize = slidesSizesGrid[i];
const slideOffset = $slideEl[0].swiperSlideOffset;
const centerOffset = (center - slideOffset - slideSize / 2) / slideSize;
const offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier;
let rotateY = isHorizontal ? rotate * offsetMultiplier : 0;
let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; // var rotateZ = 0
let translateZ = -translate * Math.abs(offsetMultiplier);
let stretch = params.stretch; // Allow percentage to make a relative stretch for responsive sliders
if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) {
stretch = parseFloat(params.stretch) / 100 * slideSize;
}
let translateY = isHorizontal ? 0 : stretch * offsetMultiplier;
let translateX = isHorizontal ? stretch * offsetMultiplier : 0;
let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); // Fix for ultra small values
if (Math.abs(translateX) < 0.001) translateX = 0;
if (Math.abs(translateY) < 0.001) translateY = 0;
if (Math.abs(translateZ) < 0.001) translateZ = 0;
if (Math.abs(rotateY) < 0.001) rotateY = 0;
if (Math.abs(rotateX) < 0.001) rotateX = 0;
if (Math.abs(scale) < 0.001) scale = 0;
const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(${scale})`;
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(slideTransform);
$slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
if (params.slideShadows) {
// Set shadows
let $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
let $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
if ($shadowBeforeEl.length === 0) {
$shadowBeforeEl = createShadow(params, $slideEl, isHorizontal ? 'left' : 'top');
}
if ($shadowAfterEl.length === 0) {
$shadowAfterEl = createShadow(params, $slideEl, isHorizontal ? 'right' : 'bottom');
}
if ($shadowBeforeEl.length) $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
if ($shadowAfterEl.length) $shadowAfterEl[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
}
}
};
const setTransition = duration => {
const {
transformEl
} = swiper.params.coverflowEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
};
effectInit({
effect: 'coverflow',
swiper,
on,
setTranslate,
setTransition,
perspective: () => true,
overwriteParams: () => ({
watchSlidesProgress: true
})
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | EffectCoverflow | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
width: swiperWidth,
height: swiperHeight,
slides,
slidesSizesGrid
} = swiper;
const params = swiper.params.coverflowEffect;
const isHorizontal = swiper.isHorizontal();
const transform = swiper.translate;
const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2;
const rotate = isHorizontal ? params.rotate : -params.rotate;
const translate = params.depth; // Each slide offset from center
for (let i = 0, length = slides.length; i < length; i += 1) {
const $slideEl = slides.eq(i);
const slideSize = slidesSizesGrid[i];
const slideOffset = $slideEl[0].swiperSlideOffset;
const centerOffset = (center - slideOffset - slideSize / 2) / slideSize;
const offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier;
let rotateY = isHorizontal ? rotate * offsetMultiplier : 0;
let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; // var rotateZ = 0
let translateZ = -translate * Math.abs(offsetMultiplier);
let stretch = params.stretch; // Allow percentage to make a relative stretch for responsive sliders
if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) {
stretch = parseFloat(params.stretch) / 100 * slideSize;
}
let translateY = isHorizontal ? 0 : stretch * offsetMultiplier;
let translateX = isHorizontal ? stretch * offsetMultiplier : 0;
let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); // Fix for ultra small values
if (Math.abs(translateX) < 0.001) translateX = 0;
if (Math.abs(translateY) < 0.001) translateY = 0;
if (Math.abs(translateZ) < 0.001) translateZ = 0;
if (Math.abs(rotateY) < 0.001) rotateY = 0;
if (Math.abs(rotateX) < 0.001) rotateX = 0;
if (Math.abs(scale) < 0.001) scale = 0;
const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(${scale})`;
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(slideTransform);
$slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
if (params.slideShadows) {
// Set shadows
let $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
let $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
if ($shadowBeforeEl.length === 0) {
$shadowBeforeEl = createShadow(params, $slideEl, isHorizontal ? 'left' : 'top');
}
if ($shadowAfterEl.length === 0) {
$shadowAfterEl = createShadow(params, $slideEl, isHorizontal ? 'right' : 'bottom');
}
if ($shadowBeforeEl.length) $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
if ($shadowAfterEl.length) $shadowAfterEl[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
}
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
width: swiperWidth,
height: swiperHeight,
slides,
slidesSizesGrid
} = swiper;
const params = swiper.params.coverflowEffect;
const isHorizontal = swiper.isHorizontal();
const transform = swiper.translate;
const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2;
const rotate = isHorizontal ? params.rotate : -params.rotate;
const translate = params.depth; // Each slide offset from center
for (let i = 0, length = slides.length; i < length; i += 1) {
const $slideEl = slides.eq(i);
const slideSize = slidesSizesGrid[i];
const slideOffset = $slideEl[0].swiperSlideOffset;
const centerOffset = (center - slideOffset - slideSize / 2) / slideSize;
const offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier;
let rotateY = isHorizontal ? rotate * offsetMultiplier : 0;
let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; // var rotateZ = 0
let translateZ = -translate * Math.abs(offsetMultiplier);
let stretch = params.stretch; // Allow percentage to make a relative stretch for responsive sliders
if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) {
stretch = parseFloat(params.stretch) / 100 * slideSize;
}
let translateY = isHorizontal ? 0 : stretch * offsetMultiplier;
let translateX = isHorizontal ? stretch * offsetMultiplier : 0;
let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); // Fix for ultra small values
if (Math.abs(translateX) < 0.001) translateX = 0;
if (Math.abs(translateY) < 0.001) translateY = 0;
if (Math.abs(translateZ) < 0.001) translateZ = 0;
if (Math.abs(rotateY) < 0.001) rotateY = 0;
if (Math.abs(rotateX) < 0.001) rotateX = 0;
if (Math.abs(scale) < 0.001) scale = 0;
const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(${scale})`;
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(slideTransform);
$slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
if (params.slideShadows) {
// Set shadows
let $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top');
let $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom');
if ($shadowBeforeEl.length === 0) {
$shadowBeforeEl = createShadow(params, $slideEl, isHorizontal ? 'left' : 'top');
}
if ($shadowAfterEl.length === 0) {
$shadowAfterEl = createShadow(params, $slideEl, isHorizontal ? 'right' : 'bottom');
}
if ($shadowBeforeEl.length) $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
if ($shadowAfterEl.length) $shadowAfterEl[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
}
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
transformEl
} = swiper.params.coverflowEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
transformEl
} = swiper.params.coverflowEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function EffectCreative(_ref) {
let {
swiper,
extendParams,
on
} = _ref;
extendParams({
creativeEffect: {
transformEl: null,
limitProgress: 1,
shadowPerProgress: false,
progressMultiplier: 1,
perspective: true,
prev: {
translate: [0, 0, 0],
rotate: [0, 0, 0],
opacity: 1,
scale: 1
},
next: {
translate: [0, 0, 0],
rotate: [0, 0, 0],
opacity: 1,
scale: 1
}
}
});
const getTranslateValue = value => {
if (typeof value === 'string') return value;
return `${value}px`;
};
const setTranslate = () => {
const {
slides,
$wrapperEl,
slidesSizesGrid
} = swiper;
const params = swiper.params.creativeEffect;
const {
progressMultiplier: multiplier
} = params;
const isCenteredSlides = swiper.params.centeredSlides;
if (isCenteredSlides) {
const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0;
$wrapperEl.transform(`translateX(calc(50% - ${margin}px))`);
}
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
const slideProgress = $slideEl[0].progress;
const progress = Math.min(Math.max($slideEl[0].progress, -params.limitProgress), params.limitProgress);
let originalProgress = progress;
if (!isCenteredSlides) {
originalProgress = Math.min(Math.max($slideEl[0].originalProgress, -params.limitProgress), params.limitProgress);
}
const offset = $slideEl[0].swiperSlideOffset;
const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0];
const r = [0, 0, 0];
let custom = false;
if (!swiper.isHorizontal()) {
t[1] = t[0];
t[0] = 0;
}
let data = {
translate: [0, 0, 0],
rotate: [0, 0, 0],
scale: 1,
opacity: 1
};
if (progress < 0) {
data = params.next;
custom = true;
} else if (progress > 0) {
data = params.prev;
custom = true;
} // set translate
t.forEach((value, index) => {
t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`;
}); // set rotates
r.forEach((value, index) => {
r[index] = data.rotate[index] * Math.abs(progress * multiplier);
});
$slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length;
const translateString = t.join(', ');
const rotateString = `rotateX(${r[0]}deg) rotateY(${r[1]}deg) rotateZ(${r[2]}deg)`;
const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`;
const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier;
const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`; // Set shadows
if (custom && data.shadow || !custom) {
let $shadowEl = $slideEl.children('.swiper-slide-shadow');
if ($shadowEl.length === 0 && data.shadow) {
$shadowEl = createShadow(params, $slideEl);
}
if ($shadowEl.length) {
const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress;
$shadowEl[0].style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1);
}
}
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(transform).css({
opacity: opacityString
});
if (data.origin) {
$targetEl.css('transform-origin', data.origin);
}
}
};
const setTransition = duration => {
const {
transformEl
} = swiper.params.creativeEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl,
allSlides: true
});
};
effectInit({
effect: 'creative',
swiper,
on,
setTranslate,
setTransition,
perspective: () => swiper.params.creativeEffect.perspective,
overwriteParams: () => ({
watchSlidesProgress: true,
virtualTranslate: !swiper.params.cssMode
})
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | EffectCreative | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
getTranslateValue = value => {
if (typeof value === 'string') return value;
return `${value}px`;
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | getTranslateValue | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
getTranslateValue = value => {
if (typeof value === 'string') return value;
return `${value}px`;
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | getTranslateValue | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
slides,
$wrapperEl,
slidesSizesGrid
} = swiper;
const params = swiper.params.creativeEffect;
const {
progressMultiplier: multiplier
} = params;
const isCenteredSlides = swiper.params.centeredSlides;
if (isCenteredSlides) {
const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0;
$wrapperEl.transform(`translateX(calc(50% - ${margin}px))`);
}
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
const slideProgress = $slideEl[0].progress;
const progress = Math.min(Math.max($slideEl[0].progress, -params.limitProgress), params.limitProgress);
let originalProgress = progress;
if (!isCenteredSlides) {
originalProgress = Math.min(Math.max($slideEl[0].originalProgress, -params.limitProgress), params.limitProgress);
}
const offset = $slideEl[0].swiperSlideOffset;
const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0];
const r = [0, 0, 0];
let custom = false;
if (!swiper.isHorizontal()) {
t[1] = t[0];
t[0] = 0;
}
let data = {
translate: [0, 0, 0],
rotate: [0, 0, 0],
scale: 1,
opacity: 1
};
if (progress < 0) {
data = params.next;
custom = true;
} else if (progress > 0) {
data = params.prev;
custom = true;
} // set translate
t.forEach((value, index) => {
t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`;
}); // set rotates
r.forEach((value, index) => {
r[index] = data.rotate[index] * Math.abs(progress * multiplier);
});
$slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length;
const translateString = t.join(', ');
const rotateString = `rotateX(${r[0]}deg) rotateY(${r[1]}deg) rotateZ(${r[2]}deg)`;
const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`;
const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier;
const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`; // Set shadows
if (custom && data.shadow || !custom) {
let $shadowEl = $slideEl.children('.swiper-slide-shadow');
if ($shadowEl.length === 0 && data.shadow) {
$shadowEl = createShadow(params, $slideEl);
}
if ($shadowEl.length) {
const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress;
$shadowEl[0].style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1);
}
}
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(transform).css({
opacity: opacityString
});
if (data.origin) {
$targetEl.css('transform-origin', data.origin);
}
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
slides,
$wrapperEl,
slidesSizesGrid
} = swiper;
const params = swiper.params.creativeEffect;
const {
progressMultiplier: multiplier
} = params;
const isCenteredSlides = swiper.params.centeredSlides;
if (isCenteredSlides) {
const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0;
$wrapperEl.transform(`translateX(calc(50% - ${margin}px))`);
}
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
const slideProgress = $slideEl[0].progress;
const progress = Math.min(Math.max($slideEl[0].progress, -params.limitProgress), params.limitProgress);
let originalProgress = progress;
if (!isCenteredSlides) {
originalProgress = Math.min(Math.max($slideEl[0].originalProgress, -params.limitProgress), params.limitProgress);
}
const offset = $slideEl[0].swiperSlideOffset;
const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0];
const r = [0, 0, 0];
let custom = false;
if (!swiper.isHorizontal()) {
t[1] = t[0];
t[0] = 0;
}
let data = {
translate: [0, 0, 0],
rotate: [0, 0, 0],
scale: 1,
opacity: 1
};
if (progress < 0) {
data = params.next;
custom = true;
} else if (progress > 0) {
data = params.prev;
custom = true;
} // set translate
t.forEach((value, index) => {
t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`;
}); // set rotates
r.forEach((value, index) => {
r[index] = data.rotate[index] * Math.abs(progress * multiplier);
});
$slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length;
const translateString = t.join(', ');
const rotateString = `rotateX(${r[0]}deg) rotateY(${r[1]}deg) rotateZ(${r[2]}deg)`;
const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`;
const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier;
const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`; // Set shadows
if (custom && data.shadow || !custom) {
let $shadowEl = $slideEl.children('.swiper-slide-shadow');
if ($shadowEl.length === 0 && data.shadow) {
$shadowEl = createShadow(params, $slideEl);
}
if ($shadowEl.length) {
const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress;
$shadowEl[0].style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1);
}
}
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(transform).css({
opacity: opacityString
});
if (data.origin) {
$targetEl.css('transform-origin', data.origin);
}
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
transformEl
} = swiper.params.creativeEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl,
allSlides: true
});
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
transformEl
} = swiper.params.creativeEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl,
allSlides: true
});
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function EffectCards(_ref) {
let {
swiper,
extendParams,
on
} = _ref;
extendParams({
cardsEffect: {
slideShadows: true,
transformEl: null,
rotate: true,
perSlideRotate: 2,
perSlideOffset: 8
}
});
const setTranslate = () => {
const {
slides,
activeIndex
} = swiper;
const params = swiper.params.cardsEffect;
const {
startTranslate,
isTouched
} = swiper.touchEventsData;
const currentTranslate = swiper.translate;
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
const slideProgress = $slideEl[0].progress;
const progress = Math.min(Math.max(slideProgress, -4), 4);
let offset = $slideEl[0].swiperSlideOffset;
if (swiper.params.centeredSlides && !swiper.params.cssMode) {
swiper.$wrapperEl.transform(`translateX(${swiper.minTranslate()}px)`);
}
if (swiper.params.centeredSlides && swiper.params.cssMode) {
offset -= slides[0].swiperSlideOffset;
}
let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset;
let tY = 0;
const tZ = -100 * Math.abs(progress);
let scale = 1;
let rotate = -params.perSlideRotate * progress;
let tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75;
const slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i;
const isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate;
const isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate;
if (isSwipeToNext || isSwipeToPrev) {
const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5;
rotate += -28 * progress * subProgress;
scale += -0.5 * subProgress;
tXAdd += 96 * subProgress;
tY = `${-25 * subProgress * Math.abs(progress)}%`;
}
if (progress < 0) {
// next
tX = `calc(${tX}px + (${tXAdd * Math.abs(progress)}%))`;
} else if (progress > 0) {
// prev
tX = `calc(${tX}px + (-${tXAdd * Math.abs(progress)}%))`;
} else {
tX = `${tX}px`;
}
if (!swiper.isHorizontal()) {
const prevY = tY;
tY = tX;
tX = prevY;
}
const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`;
const transform = `
translate3d(${tX}, ${tY}, ${tZ}px)
rotateZ(${params.rotate ? rotate : 0}deg)
scale(${scaleString})
`;
if (params.slideShadows) {
// Set shadows
let $shadowEl = $slideEl.find('.swiper-slide-shadow');
if ($shadowEl.length === 0) {
$shadowEl = createShadow(params, $slideEl);
}
if ($shadowEl.length) $shadowEl[0].style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1);
}
$slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length;
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(transform);
}
};
const setTransition = duration => {
const {
transformEl
} = swiper.params.cardsEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl
});
};
effectInit({
effect: 'cards',
swiper,
on,
setTranslate,
setTransition,
perspective: () => true,
overwriteParams: () => ({
watchSlidesProgress: true,
virtualTranslate: !swiper.params.cssMode
})
});
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | EffectCards | javascript | cabloy/cabloy | src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
slides,
activeIndex
} = swiper;
const params = swiper.params.cardsEffect;
const {
startTranslate,
isTouched
} = swiper.touchEventsData;
const currentTranslate = swiper.translate;
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
const slideProgress = $slideEl[0].progress;
const progress = Math.min(Math.max(slideProgress, -4), 4);
let offset = $slideEl[0].swiperSlideOffset;
if (swiper.params.centeredSlides && !swiper.params.cssMode) {
swiper.$wrapperEl.transform(`translateX(${swiper.minTranslate()}px)`);
}
if (swiper.params.centeredSlides && swiper.params.cssMode) {
offset -= slides[0].swiperSlideOffset;
}
let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset;
let tY = 0;
const tZ = -100 * Math.abs(progress);
let scale = 1;
let rotate = -params.perSlideRotate * progress;
let tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75;
const slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i;
const isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate;
const isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate;
if (isSwipeToNext || isSwipeToPrev) {
const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5;
rotate += -28 * progress * subProgress;
scale += -0.5 * subProgress;
tXAdd += 96 * subProgress;
tY = `${-25 * subProgress * Math.abs(progress)}%`;
}
if (progress < 0) {
// next
tX = `calc(${tX}px + (${tXAdd * Math.abs(progress)}%))`;
} else if (progress > 0) {
// prev
tX = `calc(${tX}px + (-${tXAdd * Math.abs(progress)}%))`;
} else {
tX = `${tX}px`;
}
if (!swiper.isHorizontal()) {
const prevY = tY;
tY = tX;
tX = prevY;
}
const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`;
const transform = `
translate3d(${tX}, ${tY}, ${tZ}px)
rotateZ(${params.rotate ? rotate : 0}deg)
scale(${scaleString})
`;
if (params.slideShadows) {
// Set shadows
let $shadowEl = $slideEl.find('.swiper-slide-shadow');
if ($shadowEl.length === 0) {
$shadowEl = createShadow(params, $slideEl);
}
if ($shadowEl.length) $shadowEl[0].style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1);
}
$slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length;
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(transform);
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTranslate = () => {
const {
slides,
activeIndex
} = swiper;
const params = swiper.params.cardsEffect;
const {
startTranslate,
isTouched
} = swiper.touchEventsData;
const currentTranslate = swiper.translate;
for (let i = 0; i < slides.length; i += 1) {
const $slideEl = slides.eq(i);
const slideProgress = $slideEl[0].progress;
const progress = Math.min(Math.max(slideProgress, -4), 4);
let offset = $slideEl[0].swiperSlideOffset;
if (swiper.params.centeredSlides && !swiper.params.cssMode) {
swiper.$wrapperEl.transform(`translateX(${swiper.minTranslate()}px)`);
}
if (swiper.params.centeredSlides && swiper.params.cssMode) {
offset -= slides[0].swiperSlideOffset;
}
let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset;
let tY = 0;
const tZ = -100 * Math.abs(progress);
let scale = 1;
let rotate = -params.perSlideRotate * progress;
let tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75;
const slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i;
const isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate;
const isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate;
if (isSwipeToNext || isSwipeToPrev) {
const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5;
rotate += -28 * progress * subProgress;
scale += -0.5 * subProgress;
tXAdd += 96 * subProgress;
tY = `${-25 * subProgress * Math.abs(progress)}%`;
}
if (progress < 0) {
// next
tX = `calc(${tX}px + (${tXAdd * Math.abs(progress)}%))`;
} else if (progress > 0) {
// prev
tX = `calc(${tX}px + (-${tXAdd * Math.abs(progress)}%))`;
} else {
tX = `${tX}px`;
}
if (!swiper.isHorizontal()) {
const prevY = tY;
tY = tX;
tX = prevY;
}
const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`;
const transform = `
translate3d(${tX}, ${tY}, ${tZ}px)
rotateZ(${params.rotate ? rotate : 0}deg)
scale(${scaleString})
`;
if (params.slideShadows) {
// Set shadows
let $shadowEl = $slideEl.find('.swiper-slide-shadow');
if ($shadowEl.length === 0) {
$shadowEl = createShadow(params, $slideEl);
}
if ($shadowEl.length) $shadowEl[0].style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1);
}
$slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length;
const $targetEl = effectTarget(params, $slideEl);
$targetEl.transform(transform);
}
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
transformEl
} = swiper.params.cardsEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl
});
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
setTransition = duration => {
const {
transformEl
} = swiper.params.cardsEffect;
const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides;
$transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration);
effectVirtualTransitionEnd({
swiper,
duration,
transformEl
});
} | 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/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/backend/static/vendor/swiper/8.4.5/swiper-bundle.js | MIT |
function slideToLoop(index, speed, runCallbacks, internal) {
if (index === void 0) {
index = 0;
}
if (speed === void 0) {
speed = this.params.speed;
}
if (runCallbacks === void 0) {
runCallbacks = true;
}
if (typeof index === 'string') {
/**
* The `index` argument converted from `string` to `number`.
* @type {number}
*/
const indexAsNumber = parseInt(index, 10);
/**
* Determines whether the `index` argument is a valid `number`
* after being converted from the `string` type.
* @type {boolean}
*/
const isValidNumber = isFinite(indexAsNumber);
if (!isValidNumber) {
throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`);
} // Knowing that the converted `index` is a valid number,
// we can update the original argument's value.
index = indexAsNumber;
}
const swiper = this;
let newIndex = index;
if (swiper.params.loop) {
newIndex += swiper.loopedSlides;
}
return swiper.slideTo(newIndex, speed, runCallbacks, internal);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | slideToLoop | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function slideNext(speed, runCallbacks, internal) {
if (speed === void 0) {
speed = this.params.speed;
}
if (runCallbacks === void 0) {
runCallbacks = true;
}
const swiper = this;
const {
animating,
enabled,
params
} = swiper;
if (!enabled) return swiper;
let perGroup = params.slidesPerGroup;
if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
}
const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;
if (params.loop) {
if (animating && params.loopPreventsSlide) return false;
swiper.loopFix(); // eslint-disable-next-line
swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
}
if (params.rewind && swiper.isEnd) {
return swiper.slideTo(0, speed, runCallbacks, internal);
}
return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | slideNext | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function slidePrev(speed, runCallbacks, internal) {
if (speed === void 0) {
speed = this.params.speed;
}
if (runCallbacks === void 0) {
runCallbacks = true;
}
const swiper = this;
const {
params,
animating,
snapGrid,
slidesGrid,
rtlTranslate,
enabled
} = swiper;
if (!enabled) return swiper;
if (params.loop) {
if (animating && params.loopPreventsSlide) return false;
swiper.loopFix(); // eslint-disable-next-line
swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;
}
const translate = rtlTranslate ? swiper.translate : -swiper.translate;
function normalize(val) {
if (val < 0) return -Math.floor(Math.abs(val));
return Math.floor(val);
}
const normalizedTranslate = normalize(translate);
const normalizedSnapGrid = snapGrid.map(val => normalize(val));
let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
if (typeof prevSnap === 'undefined' && params.cssMode) {
let prevSnapIndex;
snapGrid.forEach((snap, snapIndex) => {
if (normalizedTranslate >= snap) {
// prevSnap = snap;
prevSnapIndex = snapIndex;
}
});
if (typeof prevSnapIndex !== 'undefined') {
prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
}
}
let prevIndex = 0;
if (typeof prevSnap !== 'undefined') {
prevIndex = slidesGrid.indexOf(prevSnap);
if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;
prevIndex = Math.max(prevIndex, 0);
}
}
if (params.rewind && swiper.isBeginning) {
const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
}
return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | slidePrev | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function normalize(val) {
if (val < 0) return -Math.floor(Math.abs(val));
return Math.floor(val);
} | 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.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function slideReset(speed, runCallbacks, internal) {
if (speed === void 0) {
speed = this.params.speed;
}
if (runCallbacks === void 0) {
runCallbacks = true;
}
const swiper = this;
return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | slideReset | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function slideToClosest(speed, runCallbacks, internal, threshold) {
if (speed === void 0) {
speed = this.params.speed;
}
if (runCallbacks === void 0) {
runCallbacks = true;
}
if (threshold === void 0) {
threshold = 0.5;
}
const swiper = this;
let index = swiper.activeIndex;
const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
if (translate >= swiper.snapGrid[snapIndex]) {
// The current translate is on or after the current snap index, so the choice
// is between the current index and the one after it.
const currentSnap = swiper.snapGrid[snapIndex];
const nextSnap = swiper.snapGrid[snapIndex + 1];
if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
index += swiper.params.slidesPerGroup;
}
} else {
// The current translate is before the current snap index, so the choice
// is between the current index and the one before it.
const prevSnap = swiper.snapGrid[snapIndex - 1];
const currentSnap = swiper.snapGrid[snapIndex];
if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) {
index -= swiper.params.slidesPerGroup;
}
}
index = Math.max(index, 0);
index = Math.min(index, swiper.slidesGrid.length - 1);
return swiper.slideTo(index, speed, runCallbacks, internal);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | slideToClosest | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function slideToClickedSlide() {
const swiper = this;
const {
params,
$wrapperEl
} = swiper;
const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
let slideToIndex = swiper.clickedIndex;
let realIndex;
if (params.loop) {
if (swiper.animating) return;
realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10);
if (params.centeredSlides) {
if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
swiper.loopFix();
slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index();
nextTick(() => {
swiper.slideTo(slideToIndex);
});
} else {
swiper.slideTo(slideToIndex);
}
} else if (slideToIndex > swiper.slides.length - slidesPerView) {
swiper.loopFix();
slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index();
nextTick(() => {
swiper.slideTo(slideToIndex);
});
} else {
swiper.slideTo(slideToIndex);
}
} else {
swiper.slideTo(slideToIndex);
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | slideToClickedSlide | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function loopCreate() {
const swiper = this;
const document = getDocument();
const {
params,
$wrapperEl
} = swiper; // Remove duplicated slides
const $selector = $wrapperEl.children().length > 0 ? $($wrapperEl.children()[0].parentNode) : $wrapperEl;
$selector.children(`.${params.slideClass}.${params.slideDuplicateClass}`).remove();
let slides = $selector.children(`.${params.slideClass}`);
if (params.loopFillGroupWithBlank) {
const blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup;
if (blankSlidesNum !== params.slidesPerGroup) {
for (let i = 0; i < blankSlidesNum; i += 1) {
const blankNode = $(document.createElement('div')).addClass(`${params.slideClass} ${params.slideBlankClass}`);
$selector.append(blankNode);
}
slides = $selector.children(`.${params.slideClass}`);
}
}
if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length;
swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10));
swiper.loopedSlides += params.loopAdditionalSlides;
if (swiper.loopedSlides > slides.length && swiper.params.loopedSlidesLimit) {
swiper.loopedSlides = slides.length;
}
const prependSlides = [];
const appendSlides = [];
slides.each((el, index) => {
const slide = $(el);
slide.attr('data-swiper-slide-index', index);
});
for (let i = 0; i < swiper.loopedSlides; i += 1) {
const index = i - Math.floor(i / slides.length) * slides.length;
appendSlides.push(slides.eq(index)[0]);
prependSlides.unshift(slides.eq(slides.length - index - 1)[0]);
}
for (let i = 0; i < appendSlides.length; i += 1) {
$selector.append($(appendSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass));
}
for (let i = prependSlides.length - 1; i >= 0; i -= 1) {
$selector.prepend($(prependSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass));
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | loopCreate | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function loopFix() {
const swiper = this;
swiper.emit('beforeLoopFix');
const {
activeIndex,
slides,
loopedSlides,
allowSlidePrev,
allowSlideNext,
snapGrid,
rtlTranslate: rtl
} = swiper;
let newIndex;
swiper.allowSlidePrev = true;
swiper.allowSlideNext = true;
const snapTranslate = -snapGrid[activeIndex];
const diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding
if (activeIndex < loopedSlides) {
newIndex = slides.length - loopedSlides * 3 + activeIndex;
newIndex += loopedSlides;
const slideChanged = swiper.slideTo(newIndex, 0, false, true);
if (slideChanged && diff !== 0) {
swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
}
} else if (activeIndex >= slides.length - loopedSlides) {
// Fix For Positive Oversliding
newIndex = -slides.length + activeIndex + loopedSlides;
newIndex += loopedSlides;
const slideChanged = swiper.slideTo(newIndex, 0, false, true);
if (slideChanged && diff !== 0) {
swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);
}
}
swiper.allowSlidePrev = allowSlidePrev;
swiper.allowSlideNext = allowSlideNext;
swiper.emit('loopFix');
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | loopFix | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function loopDestroy() {
const swiper = this;
const {
$wrapperEl,
params,
slides
} = swiper;
$wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass},.${params.slideClass}.${params.slideBlankClass}`).remove();
slides.removeAttr('data-swiper-slide-index');
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | loopDestroy | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function setGrabCursor(moving) {
const swiper = this;
if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;
el.style.cursor = 'move';
el.style.cursor = moving ? 'grabbing' : 'grab';
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | setGrabCursor | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function unsetGrabCursor() {
const swiper = this;
if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
return;
}
swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | unsetGrabCursor | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function closestElement(selector, base) {
if (base === void 0) {
base = this;
}
function __closestFrom(el) {
if (!el || el === getDocument() || el === getWindow()) return null;
if (el.assignedSlot) el = el.assignedSlot;
const found = el.closest(selector);
if (!found && !el.getRootNode) {
return null;
}
return found || __closestFrom(el.getRootNode().host);
}
return __closestFrom(base);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | closestElement | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function __closestFrom(el) {
if (!el || el === getDocument() || el === getWindow()) return null;
if (el.assignedSlot) el = el.assignedSlot;
const found = el.closest(selector);
if (!found && !el.getRootNode) {
return null;
}
return found || __closestFrom(el.getRootNode().host);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | __closestFrom | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function onTouchStart(event) {
const swiper = this;
const document = getDocument();
const window = getWindow();
const data = swiper.touchEventsData;
const {
params,
touches,
enabled
} = swiper;
if (!enabled) return;
if (swiper.animating && params.preventInteractionOnTransition) {
return;
}
if (!swiper.animating && params.cssMode && params.loop) {
swiper.loopFix();
}
let e = event;
if (e.originalEvent) e = e.originalEvent;
let $targetEl = $(e.target);
if (params.touchEventsTarget === 'wrapper') {
if (!$targetEl.closest(swiper.wrapperEl).length) return;
}
data.isTouchEvent = e.type === 'touchstart';
if (!data.isTouchEvent && 'which' in e && e.which === 3) return;
if (!data.isTouchEvent && 'button' in e && e.button > 0) return;
if (data.isTouched && data.isMoved) return; // change target el for shadow root component
const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; // eslint-disable-next-line
const eventPath = event.composedPath ? event.composedPath() : event.path;
if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
$targetEl = $(eventPath[0]);
}
const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;
const isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element
if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, $targetEl[0]) : $targetEl.closest(noSwipingSelector)[0])) {
swiper.allowClick = true;
return;
}
if (params.swipeHandler) {
if (!$targetEl.closest(params.swipeHandler)[0]) return;
}
touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
const startX = touches.currentX;
const startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
if (edgeSwipeDetection === 'prevent') {
event.preventDefault();
} else {
return;
}
}
Object.assign(data, {
isTouched: true,
isMoved: false,
allowTouchCallbacks: true,
isScrolling: undefined,
startMoving: undefined
});
touches.startX = startX;
touches.startY = startY;
data.touchStartTime = now();
swiper.allowClick = true;
swiper.updateSize();
swiper.swipeDirection = undefined;
if (params.threshold > 0) data.allowThresholdMove = false;
if (e.type !== 'touchstart') {
let preventDefault = true;
if ($targetEl.is(data.focusableElements)) {
preventDefault = false;
if ($targetEl[0].nodeName === 'SELECT') {
data.isTouched = false;
}
}
if (document.activeElement && $(document.activeElement).is(data.focusableElements) && document.activeElement !== $targetEl[0]) {
document.activeElement.blur();
}
const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) {
e.preventDefault();
}
}
if (swiper.params.freeMode && swiper.params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) {
swiper.freeMode.onTouchStart();
}
swiper.emit('touchStart', e);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onTouchStart | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function onTouchMove(event) {
const document = getDocument();
const swiper = this;
const data = swiper.touchEventsData;
const {
params,
touches,
rtlTranslate: rtl,
enabled
} = swiper;
if (!enabled) return;
let e = event;
if (e.originalEvent) e = e.originalEvent;
if (!data.isTouched) {
if (data.startMoving && data.isScrolling) {
swiper.emit('touchMoveOpposite', e);
}
return;
}
if (data.isTouchEvent && e.type !== 'touchmove') return;
const targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]);
const pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX;
const pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY;
if (e.preventedByNestedSwiper) {
touches.startX = pageX;
touches.startY = pageY;
return;
}
if (!swiper.allowTouchMove) {
if (!$(e.target).is(data.focusableElements)) {
swiper.allowClick = false;
}
if (data.isTouched) {
Object.assign(touches, {
startX: pageX,
startY: pageY,
currentX: pageX,
currentY: pageY
});
data.touchStartTime = now();
}
return;
}
if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) {
if (swiper.isVertical()) {
// Vertical
if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
data.isTouched = false;
data.isMoved = false;
return;
}
} else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
return;
}
}
if (data.isTouchEvent && document.activeElement) {
if (e.target === document.activeElement && $(e.target).is(data.focusableElements)) {
data.isMoved = true;
swiper.allowClick = false;
return;
}
}
if (data.allowTouchCallbacks) {
swiper.emit('touchMove', e);
}
if (e.targetTouches && e.targetTouches.length > 1) return;
touches.currentX = pageX;
touches.currentY = pageY;
const diffX = touches.currentX - touches.startX;
const diffY = touches.currentY - touches.startY;
if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return;
if (typeof data.isScrolling === 'undefined') {
let touchAngle;
if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
data.isScrolling = false;
} else {
// eslint-disable-next-line
if (diffX * diffX + diffY * diffY >= 25) {
touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
}
}
}
if (data.isScrolling) {
swiper.emit('touchMoveOpposite', e);
}
if (typeof data.startMoving === 'undefined') {
if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
data.startMoving = true;
}
}
if (data.isScrolling) {
data.isTouched = false;
return;
}
if (!data.startMoving) {
return;
}
swiper.allowClick = false;
if (!params.cssMode && e.cancelable) {
e.preventDefault();
}
if (params.touchMoveStopPropagation && !params.nested) {
e.stopPropagation();
}
if (!data.isMoved) {
if (params.loop && !params.cssMode) {
swiper.loopFix();
}
data.startTranslate = swiper.getTranslate();
swiper.setTransition(0);
if (swiper.animating) {
swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend');
}
data.allowMomentumBounce = false; // Grab Cursor
if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
swiper.setGrabCursor(true);
}
swiper.emit('sliderFirstMove', e);
}
swiper.emit('sliderMove', e);
data.isMoved = true;
let diff = swiper.isHorizontal() ? diffX : diffY;
touches.diff = diff;
diff *= params.touchRatio;
if (rtl) diff = -diff;
swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
data.currentTranslate = diff + data.startTranslate;
let disableParentSwiper = true;
let resistanceRatio = params.resistanceRatio;
if (params.touchReleaseOnEdges) {
resistanceRatio = 0;
}
if (diff > 0 && data.currentTranslate > swiper.minTranslate()) {
disableParentSwiper = false;
if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio;
} else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {
disableParentSwiper = false;
if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio;
}
if (disableParentSwiper) {
e.preventedByNestedSwiper = true;
} // Directions locks
if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
data.currentTranslate = data.startTranslate;
}
if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
data.currentTranslate = data.startTranslate;
}
if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
data.currentTranslate = data.startTranslate;
} // Threshold
if (params.threshold > 0) {
if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
if (!data.allowThresholdMove) {
data.allowThresholdMove = true;
touches.startX = touches.currentX;
touches.startY = touches.currentY;
data.currentTranslate = data.startTranslate;
touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
return;
}
} else {
data.currentTranslate = data.startTranslate;
return;
}
}
if (!params.followFinger || params.cssMode) return; // Update active index in free mode
if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {
swiper.updateActiveIndex();
swiper.updateSlidesClasses();
}
if (swiper.params.freeMode && params.freeMode.enabled && swiper.freeMode) {
swiper.freeMode.onTouchMove();
} // Update progress
swiper.updateProgress(data.currentTranslate); // Update translate
swiper.setTranslate(data.currentTranslate);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onTouchMove | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function onTouchEnd(event) {
const swiper = this;
const data = swiper.touchEventsData;
const {
params,
touches,
rtlTranslate: rtl,
slidesGrid,
enabled
} = swiper;
if (!enabled) return;
let e = event;
if (e.originalEvent) e = e.originalEvent;
if (data.allowTouchCallbacks) {
swiper.emit('touchEnd', e);
}
data.allowTouchCallbacks = false;
if (!data.isTouched) {
if (data.isMoved && params.grabCursor) {
swiper.setGrabCursor(false);
}
data.isMoved = false;
data.startMoving = false;
return;
} // Return Grab Cursor
if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
swiper.setGrabCursor(false);
} // Time diff
const touchEndTime = now();
const timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click
if (swiper.allowClick) {
const pathTree = e.path || e.composedPath && e.composedPath();
swiper.updateClickedSlide(pathTree && pathTree[0] || e.target);
swiper.emit('tap click', e);
if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
swiper.emit('doubleTap doubleClick', e);
}
}
data.lastClickTime = now();
nextTick(() => {
if (!swiper.destroyed) swiper.allowClick = true;
});
if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
data.isTouched = false;
data.isMoved = false;
data.startMoving = false;
return;
}
data.isTouched = false;
data.isMoved = false;
data.startMoving = false;
let currentPos;
if (params.followFinger) {
currentPos = rtl ? swiper.translate : -swiper.translate;
} else {
currentPos = -data.currentTranslate;
}
if (params.cssMode) {
return;
}
if (swiper.params.freeMode && params.freeMode.enabled) {
swiper.freeMode.onTouchEnd({
currentPos
});
return;
} // Find current slide
let stopIndex = 0;
let groupSize = swiper.slidesSizesGrid[0];
for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
if (typeof slidesGrid[i + increment] !== 'undefined') {
if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
stopIndex = i;
groupSize = slidesGrid[i + increment] - slidesGrid[i];
}
} else if (currentPos >= slidesGrid[i]) {
stopIndex = i;
groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
}
}
let rewindFirstIndex = null;
let rewindLastIndex = null;
if (params.rewind) {
if (swiper.isBeginning) {
rewindLastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
} else if (swiper.isEnd) {
rewindFirstIndex = 0;
}
} // Find current slide size
const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
if (timeDiff > params.longSwipesMs) {
// Long touches
if (!params.longSwipes) {
swiper.slideTo(swiper.activeIndex);
return;
}
if (swiper.swipeDirection === 'next') {
if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex);
}
if (swiper.swipeDirection === 'prev') {
if (ratio > 1 - params.longSwipesRatio) {
swiper.slideTo(stopIndex + increment);
} else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) {
swiper.slideTo(rewindLastIndex);
} else {
swiper.slideTo(stopIndex);
}
}
} else {
// Short swipes
if (!params.shortSwipes) {
swiper.slideTo(swiper.activeIndex);
return;
}
const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
if (!isNavButtonTarget) {
if (swiper.swipeDirection === 'next') {
swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment);
}
if (swiper.swipeDirection === 'prev') {
swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex);
}
} else if (e.target === swiper.navigation.nextEl) {
swiper.slideTo(stopIndex + increment);
} else {
swiper.slideTo(stopIndex);
}
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onTouchEnd | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function onResize() {
const swiper = this;
const {
params,
el
} = swiper;
if (el && el.offsetWidth === 0) return; // Breakpoints
if (params.breakpoints) {
swiper.setBreakpoint();
} // Save locks
const {
allowSlideNext,
allowSlidePrev,
snapGrid
} = swiper; // Disable locks on resize
swiper.allowSlideNext = true;
swiper.allowSlidePrev = true;
swiper.updateSize();
swiper.updateSlides();
swiper.updateSlidesClasses();
if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {
swiper.slideTo(swiper.slides.length - 1, 0, false, true);
} else {
swiper.slideTo(swiper.activeIndex, 0, false, true);
}
if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
swiper.autoplay.run();
} // Return locks after resize
swiper.allowSlidePrev = allowSlidePrev;
swiper.allowSlideNext = allowSlideNext;
if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
swiper.checkOverflow();
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onResize | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function onClick(e) {
const swiper = this;
if (!swiper.enabled) return;
if (!swiper.allowClick) {
if (swiper.params.preventClicks) e.preventDefault();
if (swiper.params.preventClicksPropagation && swiper.animating) {
e.stopPropagation();
e.stopImmediatePropagation();
}
}
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onClick | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
function onScroll() {
const swiper = this;
const {
wrapperEl,
rtlTranslate,
enabled
} = swiper;
if (!enabled) return;
swiper.previousTranslate = swiper.translate;
if (swiper.isHorizontal()) {
swiper.translate = -wrapperEl.scrollLeft;
} else {
swiper.translate = -wrapperEl.scrollTop;
} // eslint-disable-next-line
if (swiper.translate === 0) swiper.translate = 0;
swiper.updateActiveIndex();
swiper.updateSlidesClasses();
let newProgress;
const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
if (translatesDiff === 0) {
newProgress = 0;
} else {
newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
}
if (newProgress !== swiper.progress) {
swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
}
swiper.emit('setTranslate', swiper.translate, false);
} | Determines whether the `index` argument is a valid `number`
after being converted from the `string` type.
@type {boolean} | onScroll | javascript | cabloy/cabloy | src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
events = (swiper, method) => {
const document = getDocument();
const {
params,
touchEvents,
el,
wrapperEl,
device,
support
} = swiper;
const capture = !!params.nested;
const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
const swiperMethod = method; // Touch Events
if (!support.touch) {
el[domMethod](touchEvents.start, swiper.onTouchStart, false);
document[domMethod](touchEvents.move, swiper.onTouchMove, capture);
document[domMethod](touchEvents.end, swiper.onTouchEnd, false);
} else {
const passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? {
passive: true,
capture: false
} : false;
el[domMethod](touchEvents.start, swiper.onTouchStart, passiveListener);
el[domMethod](touchEvents.move, swiper.onTouchMove, support.passiveListener ? {
passive: false,
capture
} : capture);
el[domMethod](touchEvents.end, swiper.onTouchEnd, passiveListener);
if (touchEvents.cancel) {
el[domMethod](touchEvents.cancel, swiper.onTouchEnd, passiveListener);
}
} // Prevent Links Clicks
if (params.preventClicks || params.preventClicksPropagation) {
el[domMethod]('click', swiper.onClick, true);
}
if (params.cssMode) {
wrapperEl[domMethod]('scroll', swiper.onScroll);
} // Resize handler
if (params.updateOnWindowResize) {
swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
} else {
swiper[swiperMethod]('observerUpdate', onResize, true);
}
} | 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.esm.browser.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-swiper/dist/staticBackend/vendor/swiper/8.4.5/swiper-bundle.esm.browser.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.