pos-gis/public/js/plugins.swiper.js

208 lines
151 KiB
JavaScript
Raw Permalink Normal View History

2024-10-07 06:13:42 +00:00
/**
* Swiper 6.6.2
* Most modern mobile touch slider and framework with hardware accelerated transitions
* https://swiperjs.com
*
* Copyright 2014-2021 Vladimir Kharlampidi
*
* Released under the MIT License
*
* Released on: May 19, 2021
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Swiper=t()}(this,(function(){"use strict";function e(e,t){for(var a=0;a<t.length;a++){var i=t[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i])}return e}).apply(this,arguments)}function a(e){return null!==e&&"object"==typeof e&&"constructor"in e&&e.constructor===Object}function i(e,t){void 0===e&&(e={}),void 0===t&&(t={}),Object.keys(t).forEach((function(s){void 0===e[s]?e[s]=t[s]:a(t[s])&&a(e[s])&&Object.keys(t[s]).length>0&&i(e[s],t[s])}))}var s={body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},createElementNS:function(){return{}},importNode:function(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function r(){var e="undefined"!=typeof document?document:{};return i(e,s),e}var n={document:s,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState:function(){},pushState:function(){},go:function(){},back:function(){}},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){},matchMedia:function(){return{}},requestAnimationFrame:function(e){return"undefined"==typeof setTimeout?(e(),null):setTimeout(e,0)},cancelAnimationFrame:function(e){"undefined"!=typeof setTimeout&&clearTimeout(e)}};function l(){var e="undefined"!=typeof window?window:{};return i(e,n),e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,a){return(u=p()?Reflect.construct:function(e,t,a){var i=[null];i.push.apply(i,t);var s=new(Function.bind.apply(e,i));return a&&d(s,a.prototype),s}).apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||(a=e,-1===Function.toString.call(a).indexOf("[native code]")))return e;var a;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return u(e,arguments,o(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),d(i,e)})(e)}var h=function(e){var t,a;function i(t){var a,i,s;return a=e.call.apply(e,[this].concat(t))||this,i=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(a),s=i.__proto__,Object.defineProperty(i,"__proto__",{get:function(){return s},set:function(e){s.__proto__=e}}),a}return a=e,(t=i).prototype=Object.create(a.prototype),t.prototype.constructor=t,t.__proto__=a,i}(c(Array));function v(e){void 0===e&&(e=[]);var t=[];return e.forEach((function(e){Array.isArray(e)?t.push.apply(t,v(e)):t.push(e)})),t}function f(e,t){return Array.prototype.fil
window.SEMICOLON_swiperInit = function( $sliderEl ){
$sliderEl = $sliderEl.filter(':not(.customjs)');
if( $sliderEl.length < 1 ){
return true;
}
$sliderEl.each( function(){
if( !$(this).hasClass('swiper_wrapper') ) {
return true;
}
if( $(this).find('.swiper-slide').length < 1 ) {
return true;
}
let element = $(this).filter('.swiper_wrapper'),
elDirection = element.attr('data-direction') || 'horizontal',
elSpeed = element.attr('data-speed') || 300,
elAutoPlay = element.attr('data-autoplay'),
elLoop = element.attr('data-loop'),
elStart = element.attr('data-start') || 1,
elEffect = element.attr('data-effect') || 'slide',
elGrabCursor = element.attr('data-grab'),
elParallax = element.attr('data-parallax'),
slideNumberTotal = element.find('.slide-number-total'),
slideNumberCurrent = element.find('.slide-number-current'),
elVideoAutoPlay = element.attr('data-video-autoplay'),
elSettings = element.attr('data-settings'),
elPagination, elPaginationClickable;
if( elAutoPlay ) { elAutoPlay = Number( elAutoPlay ); } else { elAutoPlay = 999999999; }
if( elLoop == 'true' ) { elLoop = true; } else { elLoop = false; }
if( elParallax == 'true' ) { elParallax = true; } else { elParallax = false; }
if( elGrabCursor == 'false' ) { elGrabCursor = false; } else { elGrabCursor = true; }
if( elVideoAutoPlay == 'false' ) { elVideoAutoPlay = false; } else { elVideoAutoPlay = true; }
if( elStart === 'random' ) {
elStart = Math.floor( Math.random() * element.find('.swiper-slide:not(.swiper-slide-duplicate)').length );
} else {
elStart = Number( elStart ) - 1;
}
if( element.find('.swiper-pagination').length > 0 ) {
elPagination = element.find('.swiper-pagination').get(0);
elPaginationClickable = true;
} else {
elPagination = '';
elPaginationClickable = false;
}
let elementNavNext = element.find('.slider-arrow-right').get(0),
elementNavPrev = element.find('.slider-arrow-left').get(0),
elementScollBar = element.find('.swiper-scrollbar').get(0);
let scwSwiperSlider = new Swiper( element.find('.swiper-parent').get(0) ,{
direction: elDirection,
speed: Number( elSpeed ),
autoplay: {
delay: elAutoPlay
},
loop: elLoop,
initialSlide: elStart,
effect: elEffect,
parallax: elParallax,
slidesPerView: 1,
grabCursor: elGrabCursor,
pagination: {
el: elPagination,
clickable: elPaginationClickable
},
navigation: {
prevEl: elementNavPrev,
nextEl: elementNavNext
},
scrollbar: {
el: elementScollBar
},
on: {
afterInit: function(swiper){
SEMICOLON.slider.sliderDimensions();
element.find('.yt-bg-player').attr('data-autoplay', 'false').removeClass('customjs');
SEMICOLON.widget.youtubeBgVideo({ parent: swiper });
let activeYTVideo = $('.swiper-slide-active').find('.yt-bg-player.mb_YTPlayer:not(.customjs)');
activeYTVideo.on( 'YTPReady', function(){
setTimeout( function(){
activeYTVideo.YTPPlay();
}, 1000);
});
$('.swiper-slide-active [data-animate]').each(function(){
let $toAnimateElement = $(this),
toAnimateDelay = $toAnimateElement.attr('data-delay'),
toAnimateDelayTime = 0;
if( toAnimateDelay ) { toAnimateDelayTime = Number( toAnimateDelay ) + 750; } else { toAnimateDelayTime = 750; }
if( !$toAnimateElement.hasClass('animated') ) {
$toAnimateElement.addClass('not-animated');
let elementAnimation = $toAnimateElement.attr('data-animate');
setTimeout(function() {
$toAnimateElement.removeClass('not-animated').addClass( elementAnimation + ' animated');
}, toAnimateDelayTime);
}
});
element.find('[data-animate]').each(function(){
let $toAnimateElement = $(this),
elementAnimation = $toAnimateElement.attr('data-animate');
if( $toAnimateElement.parents('.swiper-slide').hasClass('swiper-slide-active') ) { return true; }
$toAnimateElement.removeClass('animated').removeClass(elementAnimation).addClass('not-animated');
});
SEMICOLON.slider.swiperSliderMenu();
},
transitionStart: function(swiper){
if( slideNumberCurrent.length > 0 ){
if( elLoop == true ) {
slideNumberCurrent.html( Number( element.find('.swiper-slide.swiper-slide-active').attr('data-swiper-slide-index') ) + 1 );
} else {
slideNumberCurrent.html( scwSwiperSlider.activeIndex + 1 );
}
}
element.find('[data-animate]').each(function(){
let $toAnimateElement = $(this),
elementAnimation = $toAnimateElement.attr('data-animate');
if( $toAnimateElement.parents('.swiper-slide').hasClass('swiper-slide-active') ) { return true; }
$toAnimateElement.removeClass('animated').removeClass(elementAnimation).addClass('not-animated');
});
SEMICOLON.slider.swiperSliderMenu();
},
transitionEnd: function(swiper){
element.find('.swiper-slide').each(function(){
let slideEl = $(this);
if( slideEl.find('video').length > 0 && elVideoAutoPlay == true ) {
slideEl.find('video').get(0).pause();
}
if( slideEl.find('.yt-bg-player.mb_YTPlayer:not(.customjs)').length > 0 ) {
slideEl.find('.yt-bg-player.mb_YTPlayer:not(.customjs)').YTPPause();
}
});
element.find('.swiper-slide:not(".swiper-slide-active")').each(function(){
let slideEl = $(this);
if( slideEl.find('video').length > 0 ) {
if( slideEl.find('video').get(0).currentTime != 0 ) {
slideEl.find('video').get(0).currentTime = 0;
}
}
if( slideEl.find('.yt-bg-player.mb_YTPlayer:not(.customjs)').length > 0 ) {
slideEl.find('.yt-bg-player.mb_YTPlayer:not(.customjs)').YTPSeekTo( slideEl.find('.yt-bg-player.mb_YTPlayer:not(.customjs)').attr('data-start') );
}
});
if( element.find('.swiper-slide.swiper-slide-active').find('video').length > 0 && elVideoAutoPlay == true ) {
element.find('.swiper-slide.swiper-slide-active').find('video').get(0).play();
}
if( element.find('.swiper-slide.swiper-slide-active').find('.yt-bg-player.mb_YTPlayer:not(.customjs)').length > 0 && elVideoAutoPlay == true ) {
element.find('.swiper-slide.swiper-slide-active').find('.yt-bg-player.mb_YTPlayer:not(.customjs)').YTPPlay();
}
element.find('.swiper-slide.swiper-slide-active [data-animate]').each(function(){
let $toAnimateElement = $(this),
toAnimateDelay = $toAnimateElement.attr('data-delay'),
toAnimateDelayTime = 0;
if( toAnimateDelay ) { toAnimateDelayTime = Number( toAnimateDelay ) + 300; } else { toAnimateDelayTime = 300; }
if( !$toAnimateElement.hasClass('animated') ) {
$toAnimateElement.addClass('not-animated');
let elementAnimation = $toAnimateElement.attr('data-animate');
setTimeout(function() {
$toAnimateElement.removeClass('not-animated').addClass( elementAnimation + ' animated');
}, toAnimateDelayTime);
}
});
}
}
});
if( slideNumberCurrent.length > 0 ) {
if( elLoop == true ) {
slideNumberCurrent.html( scwSwiperSlider.realIndex + 1 );
} else {
slideNumberCurrent.html( scwSwiperSlider.activeIndex + 1 );
}
}
if( slideNumberTotal.length > 0 ) {
slideNumberTotal.html( element.find('.swiper-slide:not(.swiper-slide-duplicate)').length );
}
if( elSettings ){
elSettings = Function( 'return ' + elSettings )();
Object.keys(elSettings).forEach( function( key, index ){
scwSwiperSlider.params[key] = elSettings[key];
scwSwiperSlider.update();
});
}
});
};