PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.0.11
UiCore Elements – Free widgets and templates for Elementor v1.0.11
1.3.18 1.3.17 1.3.16 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.2.0 1.2.1 1.2.2 1.2.3 All 42 releases
uicore-elements / assets / js / utils / global-carousel.js

global-carousel.js in UiCore Elements – Free widgets and templates for Elementor 1.0.11, at assets/js/utils/global-carousel.js

1 lines 16.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var c,a={},e=Object.prototype,u=e.hasOwnProperty,l=Object.defineProperty||function(e,t,r){e[t]=r.value},t="function"==typeof Symbol?Symbol:{},n=t.iterator||"@@iterator",r=t.asyncIterator||"@@asyncIterator",o=t.toStringTag||"@@toStringTag";function i(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},"")}catch(c){i=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o,i,a,s,t=t&&t.prototype instanceof v?t:v,t=Object.create(t.prototype),n=new O(n||[]);return l(t,"_invoke",{value:(o=e,i=r,a=n,s=d,function(e,t){if(s===p)throw new Error("Generator is already running");if(s===y){if("throw"===e)throw t;return{value:c,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r){r=function e(t,r){var n=r.method,o=t.iterator[n];if(o===c)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=c,e(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;n=f(o,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,m;o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=c),r.delegate=null,m):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}(r,a);if(r){if(r===m)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(s===d)throw s=y,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s=p;r=f(o,i,a);if("normal"===r.type){if(s=a.done?y:h,r.arg===m)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s=y,a.method="throw",a.arg=r.arg)}})}),t}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}a.wrap=s;var d="suspendedStart",h="suspendedYield",p="executing",y="completed",m={};function v(){}function g(){}function b(){}var t={},w=(i(t,n,function(){return this}),Object.getPrototypeOf),w=w&&w(w(P([]))),_=(w&&w!==e&&u.call(w,n)&&(t=w),b.prototype=v.prototype=Object.create(t));function E(e){["next","throw","return"].forEach(function(t){i(e,t,function(e){return this._invoke(t,e)})})}function k(a,s){var t;l(this,"_invoke",{value:function(r,n){function e(){return new s(function(e,t){!function t(e,r,n,o){var i,e=f(a[e],a,r);if("throw"!==e.type)return(r=(i=e.arg).value)&&"object"==_typeof(r)&&u.call(r,"__await")?s.resolve(r.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):s.resolve(r).then(function(e){i.value=e,n(i)},function(e){return t("throw",e,n,o)});o(e.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}})}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function P(t){if(t||""===t){var r,e=t[n];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return r=-1,(e=function e(){for(;++r<t.length;)if(u.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=c,e.done=!0,e}).next=e}throw new TypeError(_typeof(t)+" is not iterable")}return l(_,"constructor",{value:g.prototype=b,configurable:!0}),l(b,"constructor",{value:g,configurable:!0}),g.displayName=i(b,o,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,i(e,o,"GeneratorFunction")),e.prototype=Object.create(_),e},a.awrap=function(e){return{__await:e}},E(k.prototype),i(k.prototype,r,function(){return this}),a.AsyncIterator=k,a.async=function(e,t,r,n,o){void 0===o&&(o=Promise);var i=new k(s(e,t,r,n),o);return a.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},E(_),i(_,o,"Generator"),i(_,n,function(){return this}),i(_,"toString",function(){return"[object Generator]"}),a.keys=function(e){var t,r=Object(e),n=[];for(t in r)n.push(t);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=P,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&u.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=c)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function e(e,t){return i.type="throw",i.arg=r,n.next=e,t&&(n.method="next",n.arg=c),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),s=u.call(o,"finallyLoc");if(a&&s){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&u.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,o=this.tryEntries[t];if(o.tryLoc===e)return"throw"===(r=o.completion).type&&(n=r.arg,x(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=c),m}},a}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(s){return function(){var e=this,a=arguments;return new Promise(function(t,r){var n=s.apply(e,a);function o(e){asyncGeneratorStep(n,t,r,o,i,"next",e)}function i(e){asyncGeneratorStep(n,t,r,o,i,"throw",e)}o(void 0)})}}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var n=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(r);return _possibleConstructorReturn(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}window.addEventListener("DOMContentLoaded",function(){var t=function(){_inherits(t,elementorModules.frontend.handlers.Base);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.apply(this,arguments)}return _createClass(t,[{key:"getDefaultElements",value:function(){return{$carousel:this.$element.find(".ui-e-carousel"),$dots:this.$element.find(".ui-e-dots"),$next:this.$element.find(".ui-e-next"),$prev:this.$element.find(".ui-e-previous"),$fraction:this.$element.find(".ui-e-fraction")}}},{key:"buildCarousel",value:function(){var t,r=this,e=this.getElementSettings("navigation"),n=this.getElementSettings("animation_style"),a="yes"==this.getElementSettings("observer"),o=this.getElementSettings("show_hidden"),i=this.getElementSettings("carousel_gap")?this.getElementSettings("carousel_gap").size:0,s=(!this.hasNesting()||!elementorFrontend.isEditMode())&&Boolean(this.getElementSettings("loop")),c=(document.documentElement.clientWidth<1024&&(elementorFrontend.config.experimentalFeatures.hasOwnProperty("container")?this.$element.closest('[data-element_type="container"]'):this.$element.closest('[data-element_type="column"]')).css("overflow-x","hidden"),{slidesPerView:elementorFrontend.getCurrentDeviceSetting(this.getElementSettings(),"slides_per_view")||1,spaceBetween:i,loop:s,grabCursor:"yes"==this.getElementSettings("grab_cursor"),speed:300,slideActiveClass:"is-selected",shownSide:o||"hidden"}),i=("hidden"!=o&&(c.shownSide=o),"yes"==this.getElementSettings("autoplay")&&(c.autoplay={delay:this.getElementSettings("autoplay_speed"),pauseOnMouseEnter:Boolean(this.getElementSettings("pause_on_hover"))}),["arrows","arrows-fraction","arrows-dots"].includes(e)&&(c.navigation={nextEl:this.elements.$next[0],prevEl:this.elements.$prev[0]}),["dots","arrows-dots"].includes(e)&&(c.pagination={el:this.elements.$dots[0],type:"bullets",clickable:!0,bulletClass:"dot",bulletActiveClass:"is-selected"}),["fraction","arrows-fraction"].includes(e)&&(c.pagination={el:this.elements.$fraction[0],type:"fraction"}),this.getBreakpoints());switch(c.breakpoints={},Object.entries(i).forEach(function(e){e=_slicedToArray(e,2),e[0],e=e[1];t="desktop"==e.label?r.getElementSettings("slides_per_view")||1:r.getElementSettings("slides_per_view_".concat(e.label))||1,c.breakpoints[e.value]={slidesPerView:t}}),n){case"circular":c.modules=[circularEffect];break;case"fade_blur":c.modules=[fadeAndBlurEffect];break;case"stacked":c.direction="vertical",c.slidesPerView=1,c.modules=[stackedEffect],c.autoHeight=!0,c.spaceBetween=0;break;case"cards":c.effect="cards",c.cardsEffect={slideShadows:!1};break;case"circular_avatar":c.slidesPerView=1,c.modules=[circularAvatar],c.spaceBetween=0,c.speed=850;var u=this.getElementSettings("layout");c.enableAvatarTranslate="layout_5"===u||"layout_6"===u,c.avatarClassName=".ui-e-testimonial-avatar",c.contentClassNames=[".ui-e-testimonial-text",".ui-e-testimonial-name",".ui-e-testimonial-job-title",".ui-e-testimonial-rating",".ui-e-testimonial-image"];break;default:c.watchSlidesProgress=!0,c.speed=500,c.effect=n,c.customEffect={slideShadows:!1},c.creativewEffect={slideShadows:!1,prev:{shadow:!0,translate:[0,0,-400]},next:{translate:["100%",0,0]}}}var l=elementorFrontend.utils.swiper;function f(){return d.apply(this,arguments)}function d(){return(d=_asyncToGenerator(_regeneratorRuntime().mark(function e(o){var i;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:!a||elementorFrontend.isEditMode()?e.next=5:(new IntersectionObserver(function(){var r=_asyncToGenerator(_regeneratorRuntime().mark(function e(t,r){var n;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=_slicedToArray(t,1),n[0].isIntersecting)return e.next=4,new l(o,c);e.next=6;break;case 4:i=e.sent,r.unobserve(o);case 6:case"end":return e.stop()}},e)}));return function(e,t){return r.apply(this,arguments)}}(),{threshold:.7}).observe(o),e.next=9);break;case 5:return e.next=7,new l(o,c);case 7:return i=e.sent,e.abrupt("return",i);case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}f(this.elements.$carousel[0]),this.hasNesting()&&_asyncToGenerator(_regeneratorRuntime().mark(function e(){var t;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f(r.elements.$carousel[0]);case 2:t=e.sent,r.triggerElements(t);case 4:case"end":return e.stop()}},e)}))()}},{key:"getBreakpoints",value:function(){for(var e=elementorFrontend.breakpoints.getActiveBreakpointsList(),t=elementorFrontend.breakpoints.getBreakpointValues(),r=[],n=-1,o=0;o<e.length;o++){var i=e[o],a=0==o?0:t[n];o==e.length-1&&(a=("widescreen"===e[o]?r.push({label:"desktop",value:a}):(r.push({label:i,value:a}),i="desktop"),t[++n])),r.push({label:i,value:a}),n++}return r}},{key:"hasNesting",value:function(){return["uicore-custom-carousel","uicore-custom-slider"].includes(this.getWidgetType())}},{key:"wrapNestedContainers",value:function(){this.hasNesting()&&elementorFrontend.isEditMode()&&this.getDefaultElements().$carousel.find(".e-con").each(function(){jQuery(this).wrap('<div class="ui-e-wrp swiper-slide"> </div>')})}},{key:"triggerElements",value:function(t){t.on("slideChange",function(){var e=t.slides[t.activeIndex];jQuery(e).find(".elementor-element").each(function(){elementorFrontend.elementsHandler.runReadyTrigger(jQuery(this))})})}},{key:"bindEvents",value:function(){this.buildCarousel()}},{key:"onInit",value:function(){this.wrapNestedContainers(),elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments)}}]),t}();jQuery(window).on("elementor/frontend/init",function(){function e(e){elementorFrontend.elementsHandler.addHandler(t,{$element:e})}elementorFrontend.hooks.addAction("frontend/element_ready/uicore-testimonial-carousel.default",e),elementorFrontend.hooks.addAction("frontend/element_ready/uicore-testimonial-slider.default",e),elementorFrontend.hooks.addAction("frontend/element_ready/uicore-logo-carousel.default",e),elementorFrontend.hooks.addAction("frontend/element_ready/uicore-advanced-post-carousel.default",e),elementorFrontend.hooks.addAction("frontend/element_ready/uicore-custom-carousel.default",e),elementorFrontend.hooks.addAction("frontend/element_ready/uicore-custom-slider.default",e)})});