1var EleCustomSkinSlider = elementorModules.frontend.handlers.Base.extend({ 2 3 getSkinPrefix: function getSkinPrefix() { 4 return 'custom_'; 5 }, 6 getDefaultSettings: function getDefaultSettings() { 7 return { 8 selectors: { 9 carousel: '.swiper-container', 10 slideContent: '.swiper-slide' 11 } 12 }; 13 }, 14 15 getDefaultElements: function getDefaultElements() { 16 var selectors = this.getSettings('selectors'); 17 var elements = { 18 $carousel: this.$element.find(selectors.carousel) 19 }; 20 elements.$swiperSlides = elements.$carousel.find(selectors.slideContent); 21 return elements; 22 }, 23 24 getSlidesCount: function getSlidesCount() { 25 return this.elements.$swiperSlides.length; 26 }, 27/***** start new getSwipperSettings function *******************/ 28 getSwiperSettings: function getSwiperSettings() { 29 const elementSettings = this.getElementSettings(), 30 slidesToShow = +elementSettings[this.getSkinPrefix() + 'slides_to_show'] || 3, 31 isSingleSlide = 1 === slidesToShow, 32 elementorBreakpoints = elementorFrontend.config.responsive.activeBreakpoints, 33 defaultSlidesToShowMap = { 34 mobile: 1, 35 tablet: isSingleSlide ? 1 : 2 36 }; 37 const swiperOptions = { 38 slidesPerView: slidesToShow, 39 loop: 'yes' === elementSettings[this.getSkinPrefix() + 'infinite'], 40 speed: elementSettings[this.getSkinPrefix() + 'speed'], 41 handleElementorBreakpoints: true 42 }; 43 swiperOptions.breakpoints = {}; 44 let lastBreakpointSlidesToShowValue = slidesToShow; 45 Object.keys(elementorBreakpoints).reverse().forEach(breakpointName => { 46 // Tablet has a specific default `slides_to_show`. 47 const defaultSlidesToShow = defaultSlidesToShowMap[breakpointName] ? defaultSlidesToShowMap[breakpointName] : lastBreakpointSlidesToShowValue; 48 swiperOptions.breakpoints[elementorBreakpoints[breakpointName].value] = { 49 slidesPerView: +elementSettings[this.getSkinPrefix() + 'slides_to_show_' + breakpointName] || defaultSlidesToShow, 50 slidesPerGroup: +elementSettings[this.getSkinPrefix() + 'slides_to_scroll_' + breakpointName] || 1 51 }; 52 lastBreakpointSlidesToShowValue = +elementSettings[this.getSkinPrefix() + 'slides_to_show_' + breakpointName] || defaultSlidesToShow; 53 }); 54 55 if ('yes' === elementSettings[this.getSkinPrefix() + 'autoplay']) { 56 swiperOptions.autoplay = { 57 delay: elementSettings[this.getSkinPrefix() + 'autoplay_speed'], 58 disableOnInteraction: 'yes' === elementSettings[this.getSkinPrefix() + 'pause_on_interaction'] 59 }; 60 } 61 62 if (isSingleSlide) { 63 swiperOptions.effect = elementSettings[this.getSkinPrefix() + 'effect']; 64 65 if ('fade' === elementSettings[this.getSkinPrefix() + 'effect']) { 66 swiperOptions.fadeEffect = { 67 crossFade: true 68 }; 69 } 70 } else { 71 swiperOptions.slidesPerGroup = +elementSettings[this.getSkinPrefix() + 'slides_to_scroll'] || 1; 72 } 73 74 75 if (elementSettings[this.getSkinPrefix() + 'slide_gap']['size']) { 76 swiperOptions.spaceBetween = elementSettings[this.getSkinPrefix() + 'slide_gap']['size']; 77 } 78 79 const showArrows = 'arrows' === elementSettings[this.getSkinPrefix() + 'navigation'] || 'both' === elementSettings[this.getSkinPrefix() + 'navigation'], 80 showDots = 'dots' === elementSettings[this.getSkinPrefix() + 'navigation'] || 'both' === elementSettings[this.getSkinPrefix() + 'navigation']; 81 82 if (showArrows) { 83 swiperOptions.navigation = { 84 prevEl: '.elementor-swiper-button-prev', 85 nextEl: '.elementor-swiper-button-next' 86 }; 87 } 88 89 if (showDots) { 90 swiperOptions.pagination = { 91 el: '.swiper-pagination', 92 type: 'bullets', 93 clickable: true 94 }; 95 } 96 97 return swiperOptions; 98 }, 99 100 101 /***** end new getSwipperSettings function *******************/ 102 103 getSwiperSettingss: function getSwiperSettingss() { 104 105 var elementSettings = this.getElementSettings(), 106 slidesToShow = +elementSettings[this.getSkinPrefix() + 'slides_to_show'] || 3, // this.getElementSettings(this.getSkinPrefix() + 'slides_to_show'); 107 isSingleSlide = 1 === slidesToShow, 108 defaultLGDevicesSlidesCount = isSingleSlide ? 1 : 2, 109 //elementorBreakpoints = elementorFrontend.config.breakpoints; 110 elementorBreakpoints = elementorFrontend.config.responsive.activeBreakpoints; 111 112 var swiperOptions = { 113 slidesPerView: slidesToShow,
114 loop: 'yes' === elementSettings[this.getSkinPrefix() + 'infinite'], 115 speed: elementSettings[this.getSkinPrefix() + 'speed'], 116 handleElementorBreakpoints: true 117 }; 118 swiperOptions.breakpoints = {}; 119 swiperOptions.breakpoints[elementorBreakpoints.mobile.value] = { 120 slidesPerView: +elementSettings[this.getSkinPrefix() + 'slides_to_show_mobile'] || 1, 121 slidesPerGroup: +elementSettings[this.getSkinPrefix() + 'slides_to_scroll_mobile'] || 1 122 }; 123 swiperOptions.breakpoints[elementorBreakpoints.tablet.value] = { 124 slidesPerView: +elementSettings[this.getSkinPrefix() + 'slides_to_show_tablet'] || defaultLGDevicesSlidesCount, 125 slidesPerGroup: +elementSettings[this.getSkinPrefix() + 'slides_to_scroll_tablet'] || defaultLGDevicesSlidesCount 126 }; 127 if (!this.isEdit && 'yes' === elementSettings[this.getSkinPrefix() + 'autoplay']) { 128 swiperOptions.autoplay = { 129 delay: elementSettings[this.getSkinPrefix() + 'autoplay_speed'], 130 pause_on_hover:'yes', 131 disableOnInteraction: true, //!!elementSettings[this.getSkinPrefix() + 'pause_on_hover'], 132 pauseOnMouseEnter: true//!!elementSettings[this.getSkinPrefix() + 'pause_on_hover'] 133 }; 134 } 135 136 if (true === swiperOptions.loop) { 137 swiperOptions.loopedSlides = this.getSlidesCount(); 138 } 139 140 if (isSingleSlide) { 141 swiperOptions.effect = elementSettings[this.getSkinPrefix() + 'effect']; 142 } else { 143 swiperOptions.slidesPerGroup = +elementSettings[this.getSkinPrefix() + 'slides_to_scroll'] || defaultLGDevicesSlidesCount; 144 } 145 146 if (elementSettings[this.getSkinPrefix() + 'slide_gap'].size) { 147 swiperOptions.spaceBetween = elementSettings[this.getSkinPrefix() + 'slide_gap'].size; 148 } 149 150 var showArrows = 'arrows' === elementSettings[this.getSkinPrefix() + 'navigation'] || 'both' === elementSettings[this.getSkinPrefix() + 'navigation'], 151 showDots = 'dots' === elementSettings[this.getSkinPrefix() + 'navigation'] || 'both' === elementSettings[this.getSkinPrefix() + 'navigation']; 152 153 if (showArrows) { 154 swiperOptions.navigation = { 155 prevEl: '.elementor-swiper-button-prev', 156 nextEl: '.elementor-swiper-button-next' 157 }; 158 } 159 160 if (showDots) { 161 swiperOptions.pagination = { 162 el: '.swiper-pagination', 163 type: 'bullets', 164 clickable: true 165 }; 166 } 167 168 return swiperOptions; 169 }, 170 171 updateSpaceBetween: function updateSpaceBetween() { 172 this.swiper.params.spaceBetween = this.getElementSettings(this.getSkinPrefix() + 'slide_gap') || 0; 173 this.swiper.update(); 174 }, 175 isSliderEnabled: function isSliderEnabled() { 176 return !!this.getElementSettings(this.getSkinPrefix() + 'post_slider'); 177 }, 178 togglePauseOnHover: function togglePauseOnHover(toggleOn) { 179 if (toggleOn) { 180 this.elements.$carousel.on({ 181 mouseenter: () => { 182 //this.swiper.autoplay.stop(); 183 }, 184 mouseleave: () => { 185 //this.swiper.autoplay.start(); 186 } 187 }); 188 } else { 189 this.elements.$carousel.off('mouseenter mouseleave'); 190 } 191 //console.log(this.swiper.classNames);// ------------------------comment this 192 193 }, 194 run: function run(){ 195 if(!this.isSliderEnabled()) return; 196 197 if (!this.elements.$carousel.length) { 198 return; 199 } 200/* new way to call the swiper*/ 201 const Swiper = elementorFrontend.utils.swiper; 202 this.swiper = new Swiper(this.elements.$carousel, this.getSwiperSettings()); // Expose the swiper instance in the frontend 203 204 this.elements.$carousel.data('swiper', this.swiper); 205 206 if ('yes' === this.getElementSettings(this.getSkinPrefix() + 'pause_on_hover') ) { 207 this.togglePauseOnHover(true);//search for the function to add it here 208 } 209 210 211 //add reinitilze for swiper 212 ECScarousel = this.elements.$carousel; 213 ECSswiperSettings = this.getSwiperSettings(); 214 215 ECS_add_action("swiper", function(){ 216 ECSswiper = new Swiper(ECScarousel, ECSswiperSettings); 217 }); 218 219 //console.log(this.getSwiperSettings());// ------------------------comment this 220 }, 221 onInit: function onInit(...arguments) { 222 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 223 this.run(); 224 }, 225 226 onElementChange: function onElementChange(propertyName) { 227 // console.log(this.swiper); 228 if (0 === propertyName.indexOf(this.getSkinPrefix() + 'slide_gap')) { 229 this.updateSpaceBetween(); 230 } 231 }, 232 233 onEditSettingsChange: function onEditSettingsChange(propertyName) { // here you need to refresh stuff when it 234 if(!this.isSliderEnabled()) return; 235 if ('activeItemIndex' === propertyName) { 236 // this.swiper.slideToLoop(this.getEditSettings('activeItemIndex') - 1);//no need, can you delete this? 237 } 238 } 239} 240 241 242); 243 244var EleCustomSkinSliderArchive = EleCustomSkinSlider.extend({
245 getSkinPrefix: function getSkinPrefix() { 246 return 'archive_custom_'; 247 } 248}); 249 250//now let's see if we can call it 251jQuery(window).on('elementor/frontend/init', () => { 252 253 const addHandler = ($element) => { 254 elementorFrontend.elementsHandler.addHandler(EleCustomSkinSlider, { 255 $element, 256 }); 257 }; 258 259 260 elementorFrontend.hooks.addAction('frontend/element_ready/posts.custom', addHandler); 261 262 const addHandlerArchive = ($element) => { 263 elementorFrontend.elementsHandler.addHandler(EleCustomSkinSliderArchive, { 264 $element, 265 }); 266 }; 267 268 269 elementorFrontend.hooks.addAction('frontend/element_ready/archive-posts.archive_custom', addHandlerArchive); 270 271}); 272 273 274function ECS_reset_masonry(element){ 275 element.children(".ecs-post-loop").css('margin-top', ''); 276} 277 278var EleCustomSkinMasonry = elementorModules.frontend.handlers.Base.extend({ 279 getSkinPrefix: function getSkinPrefix() { 280 return 'custom_'; 281 }, 282 283 bindEvents: function bindEvents() { 284 var cid = this.getModelCID(); 285 286 elementorFrontend.addListenerOnce(cid, 'resize', this.onWindowResize); 287 }, 288 289 getClosureMethodsNames: function getClosureMethodsNames() { 290 return elementorModules.frontend.handlers.Base.prototype.getClosureMethodsNames.apply(this, arguments).concat(['fitImages', 'onWindowResize', 'runMasonry']); 291 }, 292 293 getDefaultSettings: function getDefaultSettings() { 294 return { 295 classes: { 296 fitHeight: 'elementor-fit-height', 297 hasItemRatio: 'elementor-has-item-ratio' 298 }, 299 selectors: { 300 postsContainer: '.elementor-posts-container', 301 post: '.elementor-post', 302 postThumbnail: '.elementor-post__thumbnail', 303 postThumbnailImage: '.elementor-post__thumbnail img' 304 } 305 }; 306 }, 307 308 getDefaultElements: function getDefaultElements() { 309 var selectors = this.getSettings('selectors'); 310 311 return { 312 $postsContainer: this.$element.find(selectors.postsContainer), 313 $posts: this.$element.find(selectors.post) 314 }; 315 }, 316 317 fitImage: function fitImage($post) { 318 var settings = this.getSettings(), 319 $imageParent = $post.find(settings.selectors.postThumbnail), 320 $image = $imageParent.find('img'), 321 image = $image[0]; 322 323 if (!image) { 324 return; 325 } 326 327 var imageParentRatio = $imageParent.outerHeight() / $imageParent.outerWidth(), 328 imageRatio = image.naturalHeight / image.naturalWidth; 329 330 $imageParent.toggleClass(settings.classes.fitHeight, imageRatio < imageParentRatio); 331 }, 332 333 fitImages: function fitImages() { 334 var $ = jQuery, 335 self = this, 336 itemRatio = getComputedStyle(this.$element[0], ':after').content, 337 settings = this.getSettings(); 338 339 this.elements.$postsContainer.toggleClass(settings.classes.hasItemRatio, !!itemRatio.match(/\d/)); 340 341 if (self.isMasonryEnabled()) { 342 return; 343 } 344 345 this.elements.$posts.each(function() { 346 var $post = $(this), 347 $image = $post.find(settings.selectors.postThumbnailImage); 348 349 self.fitImage($post); 350 351 $image.on('load', function() { 352 self.fitImage($post); 353 }); 354 }); 355 }, 356 357 setColsCountSettings: function setColsCountSettings() { 358 var currentDeviceMode = elementorFrontend.getCurrentDeviceMode(), 359 settings = this.getElementSettings(), 360 skinPrefix = this.getSkinPrefix(), 361 colsCount; 362 363 switch (currentDeviceMode) { 364 case 'mobile': 365 colsCount = settings[skinPrefix + 'columns_mobile']; 366 break; 367 case 'tablet': 368 colsCount = settings[skinPrefix + 'columns_tablet']; 369 break; 370 default: 371 colsCount = settings[skinPrefix + 'columns']; 372 } 373 374 this.setSettings('colsCount', colsCount); 375 }, 376 377 isMasonryEnabled: function isMasonryEnabled() { 378 return !!this.getElementSettings(this.getSkinPrefix() + 'masonrys'); 379 }, 380 381 initMasonry: function initMasonry() { 382 imagesLoaded(this.elements.$posts, this.runMasonry); 383 }, 384 385 runMasonry: function runMasonry() { 386 var elements = this.elements; 387 388 elements.$posts.css({ 389 marginTop: '', 390 transitionDuration: '' 391 }); 392 393 this.setColsCountSettings(); 394
395 var colsCount = this.getSettings('colsCount'), 396 hasMasonry = this.isMasonryEnabled(); 397 398 elements.$postsContainer.toggleClass('elementor-posts-masonry', hasMasonry); 399 400 if (!hasMasonry) { 401 elements.$postsContainer.height(''); 402 403 return; 404 } 405 406 /* The `verticalSpaceBetween` variable is setup in a way that supports older versions of the portfolio widget */ 407 408 var verticalSpaceBetween = this.getElementSettings(this.getSkinPrefix() + 'row_gap.size'); 409 410 if ('' === this.getSkinPrefix() && '' === verticalSpaceBetween) { 411 verticalSpaceBetween = this.getElementSettings(this.getSkinPrefix() + 'item_gap.size'); 412 } 413 414 var masonry = new elementorModules.utils.Masonry({ 415 container: elements.$postsContainer, 416 items: elements.$postsContainer.children( ".ecs-post-loop" ),//elements.$posts.filter(':visible'), 417 columnsCount: this.getSettings('colsCount'), 418 verticalSpaceBetween: verticalSpaceBetween 419 }); 420 masonry.run(); 421 422 ECS_Columns_Count = this.getSettings('colsCount'); 423 ECS_add_action("ajax", function(){//add reinitilze to ajax 424 ECS_reset_masonry(elements.$postsContainer); 425 mymasonry = new elementorModules.utils.Masonry({ 426 container: elements.$postsContainer, 427 items: elements.$postsContainer.children( ".ecs-post-loop" ), 428 columnsCount: ECS_Columns_Count, 429 verticalSpaceBetween: verticalSpaceBetween 430 }); 431 mymasonry.run(); 432 433 }); 434 435 }, 436 437 run: function run() { 438 // For slow browsers 439 setTimeout(this.fitImages, 0); 440 441 this.initMasonry(); 442 }, 443 444 onInit: function onInit() { 445 446 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 447 448 this.bindEvents(); 449 450 this.run(); 451 }, 452 453 onWindowResize: function onWindowResize() { 454 this.fitImages(); 455 ECS_reset_masonry(this.elements.$postsContainer); 456 this.runMasonry(); 457 }, 458 459 onElementChange: function onElementChange() { 460 this.fitImages(); 461 462 setTimeout(this.runMasonry); 463 } 464}); 465 466var EleCustomSkinMasonryArchive = EleCustomSkinMasonry.extend({ 467 getSkinPrefix: function getSkinPrefix() { 468 return 'archive_custom_'; 469 } 470});
471//now let's see if we can call it 472jQuery(window).on('elementor/frontend/init', () => { 473 474 const addHandler = ($element) => { 475 elementorFrontend.elementsHandler.addHandler(EleCustomSkinMasonry, { 476 $element, 477 }); 478 }; 479 480 elementorFrontend.hooks.addAction('frontend/element_ready/posts.custom', addHandler); 481 482 const addHandlerArchive = ($element) => { 483 elementorFrontend.elementsHandler.addHandler(EleCustomSkinMasonryArchive, { 484 $element, 485 }); 486 }; 487 488 489 elementorFrontend.hooks.addAction('frontend/element_ready/archive-posts.archive_custom', addHandlerArchive); 490 491}); 492 493//make item clickable 494 495 496function EleCustomSkinItemLink() { 497 // jQuery(".ecs-link-wrapper").attr("tabindex","0"); 498 jQuery(".ecs-link-wrapper") 499 .on("click", function (event) { 500 loc = jQuery(this).attr("data-href"); 501 aTarget = jQuery(this).attr("data-target"); 502 if ( 503 !jQuery(event.target).closest( 504 ".elementor-swiper-button, .swiper-pagination, .ecs-ignore-link" 505 ).length 506 ) { 507 if (aTarget == "_blank" || event.ctrlKey || event.metaKey) { 508 window.open(loc); 509 } else { 510 window.location = loc; 511 } 512 } 513 514 }) 515 .on("click", ".ecs-ignore-link", function (e) { 516 if(!jQuery(e.target).find('.elementor-button-wrapper')){ 517 e.stopPropagation(); 518 } 519 }); 520} 521 522/*function EleCustomSkinItemLink(){ 523 // jQuery(".ecs-link-wrapper").attr("tabindex","0"); 524 jQuery(".ecs-link-wrapper").click(function(event) { 525 loc = jQuery(this).attr("data-href"); 526 aTarget = jQuery(this).attr("data-target"); 527 if (!jQuery(event.target).closest('.elementor-swiper-button, .swiper-pagination, .ecs-ignore-link').length) { 528 if(aTarget == "_blank" || event.ctrlKey || event.metaKey){ 529 window.open(loc); 530 } else { 531 window.location = loc; 532 } 533 } 534 return false; 535 }); 536}*/ 537 538jQuery( document ).ready(function() { 539 EleCustomSkinItemLink(); 540 541 ECS_add_action("ajax", function(){EleCustomSkinItemLink()}); 542 543}); 544 545jQuery.fn.inView = function(){ 546 if(!this.length) 547 return false; 548 var rect = this.get(0).getBoundingClientRect(); 549 var loadOffset=0; 550 return ( 551 rect.top >= 0 && 552 rect.left >= 0 && 553 rect.bottom - loadOffset <= (window.innerHeight || document.documentElement.clientHeight) && 554 rect.right <= (window.innerWidth || document.documentElement.clientWidth) 555 ); 556 557}; 558 559function ECScheckInView(){ 560 jQuery('.ecs-lazyload').each(function(){ 561 if (jQuery(this).inView()){ 562 id = jQuery(this).attr("data-targetid"); 563 //console.log(id); 564 jQuery(this).removeClass("animation-hidden"); 565 ECS_load_next_page(id); 566 } 567 }); 568} 569 570jQuery(function($){ 571 if(!$( "body" ).hasClass( "elementor-editor-active" ) && !$( "body" ).hasClass( "elementor-editor-preview" ) ) { 572 ECScheckInView(); 573 $(window).scroll(function(){ 574 if(canBeLoaded == true ){ 575 ECScheckInView(); 576 } 577 }); 578 } 579});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.