1"use strict"; 2// Toggle/Accordion 3function wglAccordionInit() { 4 var items = jQuery('.wgl-accordion'); 5 6 items.each( function() { 7 const $this = jQuery(this), 8 header = $this.find('.wgl-accordion_header'), 9 acc_type = $this.data('type'), 10 acc_trigger = $this.data('trigger'), 11 trigger = 'toggle' === acc_type && 'hover' === acc_trigger ? 'mouseenter click' : 'click', 12 speed = 400; 13 14 header.each( function() { 15 const $panel = jQuery(this).parent().parent(); 16 if ($panel.data('default') === 'yes') { 17 $panel.addClass('active').find('.wgl-accordion_content').slideDown(speed); 18 } 19 }) 20 21 header.on(trigger, function(e) { 22 const $panel = jQuery(this).parent().parent(); 23 24 if ( 'accordion' === acc_type ) { 25 $panel.toggleClass('active').find('.wgl-accordion_content').slideToggle(speed); 26 } else if ( 'toggle' === acc_type ) { 27 // Stop the animation on mouse enter 28 $panel.siblings().find('.wgl-accordion_content').stop(true, false).slideUp(speed); 29 30 $panel.addClass('active').find('.wgl-accordion_content').slideDown(speed); 31 $panel.siblings().removeClass('active').find('.wgl-accordion_content').slideUp(speed); 32 } 33 }) 34 }) 35} 36 37// Accordion Services 38function wglServicesAccordionInit() { 39 var widgetList = jQuery('.wgl-accordion-services'); 40 41 widgetList.each(function () { 42 var itemClass = '.service__item'; 43 44 jQuery(this).find(itemClass + ':first-child').addClass('active'); 45 46 var item = jQuery(this).find(itemClass); 47 item.on('mouseover', function () { 48 jQuery(this).addClass('active').siblings().removeClass('active'); 49 }); 50 }); 51} 52 53(function($) { 54 jQuery(document).ready(function() { 55 wglAjaxLoad(); 56 }); 57 58 function wglAjaxLoad() { 59 var i, section; 60 var sections = document.getElementsByClassName('wgl_cpt_section'); 61 for (i = 0; i < sections.length; i++) { 62 section = sections[i]; 63 var infinity_item = section.getElementsByClassName('infinity_item'); 64 var load_more = section.getElementsByClassName('load_more_item'); 65 if (infinity_item.length || load_more.length) { 66 wglAjaxInit(section); 67 } 68 } 69 } 70 71 var wait_load = false; 72 var offset_items = 0; 73 var infinity_item; 74 var js_offset; 75 76 function wglAjaxQuery(grid, section, request_data) { 77 if (wait_load) return; 78 wait_load = true; 79 request_data['offset_items'] = request_data.js_offset 80 ? request_data.js_offset 81 : offset_items; 82 83 request_data['remainings_loading_btn_items_amount'] = request_data.remainings_loading_btn_items_amount; 84 85 request_data['js_offset'] = request_data.js_offset 86 ? request_data.js_offset 87 : offset_items; 88 89 // For the mode_security enabled, removed sql request 90 if (request_data.query && request_data.query.request) { 91 delete request_data.query.request; 92 } 93 94 $.post( 95 wgl_core.ajaxurl, 96 { 97 action: 'wgl_ajax', 98 data: request_data, 99 nonce: wgl_core.nonce 100 }, 101 function(response, status) { 102 var resp, new_items, load_more_hidden, count_products; 103 resp = document.createElement('div'); 104 resp.innerHTML = response; 105 new_items = $('.item', resp); 106 count_products = $('.woocommerce-result-count', resp); 107 108 load_more_hidden = $('.hidden_load_more', resp); 109 110 if (load_more_hidden.length) { 111 jQuery(section) 112 .find('.load_more_wrapper') 113 .fadeOut(300, function() { 114 $(this).remove(); 115 }); 116 } else { 117 jQuery(section) 118 .find('.load_more_wrapper .load_more_item') 119 .removeClass('loading'); 120 } 121 122 jQuery(section) 123 .find('.woocommerce-result-count') 124 .html(jQuery(count_products).html()); 125 126 if ($(grid).hasClass('carousel')) { 127 $(grid) 128 .find('.swiper-wrapper') 129 .append(new_items); 130 $(grid) 131 .find('.swiper-pagination') 132 .remove(); 133 $(grid) 134 .find('.wgl-carousel_swiper')
135 .update(); 136 } else if ($(grid).hasClass('grid')) { 137 new_items = new_items.hide(); 138 $(grid).append(new_items); 139 new_items.fadeIn('slow'); 140 wglCursorInit(); 141 } else { 142 const $items = jQuery(new_items); 143 const $grid = jQuery(grid); 144 145 $items.imagesLoaded(() => { 146 $grid.append($items) 147 .isotope('appended', $items) 148 .isotope('reloadItems'); 149 150 $grid.isotope('once', 'arrangeComplete', () => { 151 $grid.isotope('layout'); 152 }); 153 154 $grid.isotope('layout'); 155 156 setTimeout(function () { 157 wglScrollAnimation(); 158 updateFilter(grid); 159 updateCarousel(grid); 160 wglCursorInit(); 161 }, 100); 162 }); 163 } 164 165 // Call video background settings 166 if (typeof jarallax === 'function') { 167 wglParallaxVideo(); 168 } else { 169 jQuery(grid) 170 .find('.parallax-video') 171 .each(function() { 172 jQuery(this).jarallax({ 173 loop: true, 174 speed: 1, 175 videoSrc: jQuery(this).data('video'), 176 videoStartTime: jQuery(this).data('start'), 177 videoEndTime: jQuery(this).data('end') 178 }); 179 }); 180 } 181 182 // Call swiper settings 183 updateCarousel(grid); 184 185 wglScrollAnimation(); 186 // Update Items 187 188 var offset_data = $('.js_offset_items', resp); 189 request_data.js_offset = parseInt(offset_data.data('offset')); 190 191 wait_load = false; 192 } 193 ); 194 } 195 196 function updateCarousel(grid) { 197 if ( jQuery(grid).find('.wgl-carousel_swiper').size() > 0 ) { 198 jQuery(grid) 199 .find('.wgl-carousel_swiper') 200 .each(function() { 201 swiperCarousel(jQuery(this)); 202 if (jQuery(grid).hasClass('blog_masonry')) { 203 jQuery(grid).isotope('layout'); 204 } 205 }); 206 } 207 } 208 209 function wglAjaxInit(section) { 210 offset_items = 0; 211 var grid, form, data_field, data, request_data, load_more; 212 213 if (section == undefined) { 214 return; 215 } 216 217 // Get grid CPT 218 grid = section.getElementsByClassName('container-grid'); 219 if (!grid.length) { return; } 220 grid = grid[0]; 221 222 // Get form CPT 223 form = section.getElementsByClassName('posts_grid_ajax'); 224 if (!form.length) { return; } 225 form = form[0]; 226 227 // Get field form ajax 228 data_field = form.getElementsByClassName('ajax_data'); 229 if (!data_field.length) { return; } 230 data_field = data_field[0]; 231 232 data = data_field.value; 233 data = JSON.parse(data); 234 request_data = data; 235 236 // Add pagination 237 offset_items += request_data.post_count; 238 239 infinity_item = section.getElementsByClassName('infinity_item'); 240 241 if (infinity_item.length) { 242 infinity_item = infinity_item[0]; 243 if (jQuery(infinity_item).wglIsVisible()) { 244 wglAjaxQuery(grid, section, request_data); 245 } 246 var lastScrollTop = 0; 247 248 jQuery(window).on('resize scroll', function() { 249 if (jQuery(infinity_item).wglIsVisible()) { 250 var st = jQuery(this).scrollTop(); 251 if (st > lastScrollTop) { 252 wglAjaxQuery(grid, section, request_data); 253 } 254 lastScrollTop = st; 255 } 256 }); 257 } 258 259 load_more = section.getElementsByClassName('load_more_item'); 260 if (load_more.length) { 261 load_more = load_more[0]; 262 load_more.addEventListener( 263 'click', 264 function(e) { 265 e.preventDefault(); 266 jQuery(this).addClass('loading'); 267 wglAjaxQuery(grid, section, request_data); 268 }, 269 false 270 ); 271 } 272 } 273 274 function swiperCarousel(grid) { 275 276 var wglSwiper = {}; 277 278 var configData = grid.data('swiper') ? grid.data('swiper')
278: {}; 279 var paginationType = configData.paginationType ? configData.paginationType : false; 280 var itemID = grid.data('item-carousel') ? '[data-carousel="' + grid.data('item-carousel') + '"]' : ''; 281 var pagination = undefined !== grid.data('pagination') ? grid.data('pagination') : '.swiper-pagination' + itemID; 282 var arrow_next = undefined !== grid.data('arrow-next') ? grid.data('arrow-next') : '.elementor-swiper-button-next' + itemID; 283 var arrow_prev = undefined !== grid.data('arrow-prev') ? grid.data('arrow-prev') : '.elementor-swiper-button-prev' + itemID; 284 285 var config = { 286 effect: "fade", 287 speed: 900, 288 navigation: { 289 nextEl: arrow_next, 290 prevEl: arrow_prev 291 }, 292 }; 293 294 if ('undefined' === typeof Swiper) { 295 const asyncSwiper = window.elementorFrontend.utils.swiper; 296 new asyncSwiper(grid, config).then((newSwiperInstance) => { 297 wglSwiper = newSwiperInstance; 298 wglSwiper.update(); 299 }); 300 } else { 301 wglSwiper = new Swiper(grid[0], config); 302 wglSwiper.init(); 303 } 304 } 305 306 function updateFilter(grid) { 307 jQuery(grid).isotope({ sortBy : 'original-order' }); 308 jQuery('.isotope-filter a').each(function() { 309 var $this = jQuery(this); 310 var data_filter = this.getAttribute('data-filter'); 311 var num; 312 313 if ($this.parent().parent().parent().hasClass('product__filter')) { 314 num = $this 315 .closest('.wgl-products-grid') 316 .find('.product') 317 .filter(data_filter).length; 318 $this 319 .find('.filter_counter') 320 .text(num); 321 } else { 322 num = $this 323 .closest('.wgl-portfolio') 324 .find('.portfolio__item') 325 .filter(data_filter).length; 326 $this 327 .find('.filter_counter') 328 .text(num); 329 } 330 331 if ( 332 num !== 0 333 && $this.hasClass('empty') 334 ) { 335 $this.removeClass('empty').addClass('swiper-slide').parent().parent().trigger('slides_added'); 336 } 337 }); 338 } 339})(jQuery); 340 341function wglScrollAnimation() { 342 let portfolio = jQuery('.wgl-portfolio_container.appear-animation'), 343 gallery = jQuery('.wgl-gallery_items.appear-animation'), 344 shop = jQuery('.wgl-products.appear-animation, .wgl-carousel.appear-animation'); 345 346 //Scroll Animation 347 (function ($) { 348 349 var docElem = window.document.documentElement; 350 351 function getViewportH() { 352 var client = docElem['clientHeight'], 353 inner = window['innerHeight']; 354 355 if (client < inner) 356 return inner; 357 else 358 return client; 359 } 360 361 function scrollY() { 362 return window.pageYOffset || docElem.scrollTop; 363 } 364 365 // http://stackoverflow.com/a/5598797/989439 366 function getOffset(el) { 367 var offsetTop = 0, offsetLeft = 0; 368 do { 369 if (!isNaN(el.offsetTop)) { 370 offsetTop += el.offsetTop; 371 } 372 if (!isNaN(el.offsetLeft)) { 373 offsetLeft += el.offsetLeft; 374 } 375 } while (el = el.offsetParent) 376 377 return { 378 top: offsetTop, 379 left: offsetLeft 380 } 381 } 382 383 function inViewport(el, h) { 384 var elH = el.offsetHeight, 385 scrolled = scrollY(), 386 viewed = scrolled + getViewportH(), 387 elTop = getOffset(el).top, 388 elBottom = elTop + elH, 389 h = h || 0; 390 391 return (elTop + elH * h) <= viewed && (elBottom - elH * h) >= scrolled; 392 } 393 394 function extend(a, b) { 395 for (var key in b) { 396 if (b.hasOwnProperty(key)) { 397 a[key] = b[key]; 398 } 399 } 400 return a; 401 } 402 403 function AnimOnScroll(el, options) { 404 this.el = el; 405 this.options = extend(this.defaults, options); 406 if (this.el.length) { 407 this._init(); 408 } 409 } 410 411 AnimOnScroll.prototype = { 412 defaults: { 413 viewportFactor: 0 414 }, 415 _init: function () { 416 this.items = Array.prototype.slice.call(jQuery(this.el).children()); 417 this.itemsCount = this.items.length; 418 this.itemsRenderedCount = 0; 419 this.didScroll = false;
420 this.delay = 100; 421 422 423 var self = this; 424 425 if (typeof imagesLoaded === 'function') { 426 imagesLoaded(this.el, this._imgLoaded(self)); 427 } else { 428 this._imgLoaded(self); 429 } 430 431 }, 432 _imgLoaded: function (self) { 433 434 var interval; 435 436 // the items already shown... 437 self.items.forEach(function (el, i) { 438 if (inViewport(el)) { 439 440 self._checkTotalRendered(); 441 if (!jQuery(el).hasClass('show') && !jQuery(el).hasClass('animate') && inViewport(el, self.options.viewportFactor)) { 442 self._itemClass(jQuery(el), self.delay, interval); 443 self.delay += 200; 444 setTimeout(function () { 445 self.delay = 100; 446 }, 200); 447 } 448 } 449 }); 450 451 // animate on scroll the items inside the viewport 452 window.addEventListener('scroll', function () { 453 self._onScrollFn(); 454 }, false); 455 window.addEventListener('resize', function () { 456 self._resizeHandler(); 457 }, false); 458 }, 459 460 _onScrollFn: function () { 461 var self = this; 462 if (!this.didScroll) { 463 this.didScroll = true; 464 setTimeout(function () { 465 self._scrollPage(); 466 }, 60); 467 } 468 }, 469 _itemClass: function (item_array, delay, interval) { 470 471 interval = setTimeout(function () { 472 if (item_array.length) { 473 jQuery(item_array).addClass('animate'); 474 } else { 475 clearTimeout(interval); 476 } 477 }, delay); 478 479 }, 480 481 _scrollPage: function () { 482 var self = this; 483 var interval; 484 485 this.items.forEach(function (el, i) { 486 if (!jQuery(el).hasClass('show') && !jQuery(el).hasClass('animate') && inViewport(el, self.options.viewportFactor)) { 487 setTimeout(function () { 488 var perspY = scrollY() + getViewportH() / 2; 489 490 self._checkTotalRendered(); 491 self._itemClass(jQuery(el), self.delay, interval); 492 self.delay += 200; 493 setTimeout(function () { 494 self.delay = 100; 495 }, 200); 496 497 }, 25); 498 } 499 }); 500 this.didScroll = false; 501 }, 502 _resizeHandler: function () { 503 var self = this; 504 505 function delayed() { 506 self._scrollPage(); 507 self.resizeTimeout = null; 508 } 509 510 if (this.resizeTimeout) { 511 clearTimeout(this.resizeTimeout); 512 } 513 this.resizeTimeout = setTimeout(delayed, 1000); 514 }, 515 _checkTotalRendered: function () { 516 ++this.itemsRenderedCount; 517 if (this.itemsRenderedCount === this.itemsCount) { 518 window.removeEventListener('scroll', this._onScrollFn); 519 } 520 } 521 } 522 523 // add to global namespace 524 window.AnimOnScroll = AnimOnScroll; 525 526 })(jQuery); 527 528 new AnimOnScroll(portfolio, {}); 529 new AnimOnScroll(gallery, {}); 530 531 if (shop.length) { 532 shop.each(function () { 533 let $this = jQuery(this); 534 if ($this.find('.swiper-wrapper').length) { 535 new AnimOnScroll($this.find('.swiper-wrapper'), {}); 536 } else { 537 new AnimOnScroll($this, {}); 538 } 539 }) 540 } 541} 542
543jQuery(document).on("berocket_ajax_products_loaded", wglScrollAnimation); 544function wglAppear(item) { 545 let widgetSelector = '.hotspots__container.appear_animation .hotspots__item', 546 widgetEl = item ? jQuery(item).find(widgetSelector) : jQuery(widgetSelector); 547 548 widgetEl.each(function () { 549 jQuery(this).appear(() => jQuery(this).addClass('appeared')); 550 }); 551} 552 553// Scroll Up button 554function wglScrollUp() { 555 (function($) { 556 $.fn.goBack = function(options) { 557 var defaults = { 558 scrollTop: jQuery(window).height(), 559 scrollSpeed: 600, 560 fadeInSpeed: 1000, 561 fadeOutSpeed: 500 562 }; 563 var options = $.extend(defaults, options); 564 var $this = $(this); 565 $(window).on('scroll', function() { 566 if ($(window).scrollTop() > options.scrollTop) { 567 $this.addClass('active'); 568 } else { 569 $this.removeClass('active'); 570 } 571 }); 572 $this.on('click', function() { 573 $('html,body').animate( 574 { 575 scrollTop: 0 576 }, 577 options.scrollSpeed 578 ); 579 }); 580 }; 581 })(jQuery); 582 583 jQuery('#scroll_up').goBack(); 584} 585 586function wglBlogMasonryInit() { 587 var blog = jQuery('.blog-posts > .masonry, .event_masonry'); 588 if (blog.length) { 589 var blog_dom = blog.get(0); 590 var $grid = imagesLoaded(blog_dom, function () { 591 // initialize masonry 592 //* Wrapped in a short timeout function because $grid.imagesLoaded doesn't reliably lay out correctly 593 setTimeout(function(){ 594 blog.isotope({ 595 layoutMode: 'masonry', 596 masonry: { 597 columnWidth: '.item', 598 }, 599 itemSelector: '.item', 600 percentPosition: true 601 }); 602 jQuery(window).trigger('resize'); 603 }, 250); 604 }); 605 } 606} 607function wglButton() { 608 609 (function ($) { 610 const magneticButton = $('.has-magnetic .wgl-button, .has-magnetic .wpcf7-submit'); 611 612 function updateMagneticEffect(e) { 613 const mouseX = e.pageX; 614 const mouseY = e.pageY; 615 616 magneticButton.each(function () { 617 const magneticButton = $(this); 618 const magneticWrapper = $(this).closest('.has-magnetic'); 619 620 let magneticStrength, 621 magneticStrong; 622 623 if (magneticButton.hasClass('wgl-button')){ 624 magneticStrength = magneticButton.data('magnetic-threshold') ?? 500; 625 magneticStrong = magneticButton.data('magnetic-strong') ?? 0.5; 626 }else{ 627 magneticStrength = magneticWrapper.data('magnetic-threshold') ?? 500; 628 magneticStrong = magneticWrapper.data('magnetic-strong') ?? 0.5; 629 } 630 631 const targetX = magneticButton.offset().left + magneticButton.width() / 2; 632 const targetY = magneticButton.offset().top + magneticButton.height() / 2; 633 634 const deltaX = mouseX - targetX; 635 const deltaY = mouseY - targetY; 636 637 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 638 639 if (distance < magneticStrength) { 640 const angle = Math.atan2(deltaY, deltaX); 641 const magnetX = targetX + Math.cos(angle) * distance * magneticStrong; 642 const magnetY = targetY + Math.sin(angle) * distance * magneticStrong; 643 644 magneticButton.css('transform', `translate(${Math.round(magnetX - targetX)}px, ${Math.round(magnetY - targetY)}px)`); 645 } else { 646 magneticButton.css('transform', 'translate(0, 0)'); 647 } 648 }); 649 } 650 651 // Initial setup 652 updateMagneticEffect({ pageX: 0, pageY: 0 }); 653 654 // Event listeners 655 $(document).on('mousemove', updateMagneticEffect); 656 $(window).on('resize', function () { 657 // Update the magnetic effect on window resize 658 updateMagneticEffect({ pageX: 0, pageY: 0 }); 659 }); 660 661 })(jQuery); 662 663} 664 665// WGL Carousel
666function wglCarouselSwiper() { 667 const carousel_2D = jQuery('.wgl-carousel_swiper[data-item-carousel]'), 668 carousel_3D = jQuery('.wgl-carousel.animation-style-3d') 669 670 if (carousel_2D.length) { 671 carousel_2D.each(function (item, value) { 672 const swiperContainer = jQuery(this), 673 itemID = jQuery(this).data('item-carousel') ? '[data-carousel="' + jQuery(this).data('item-carousel') + '"]' : '', 674 effect = jQuery(this).hasClass('fade_swiper') ? 'fade' : 'slide'; 675 676 const configData = jQuery(this).data('swiper') ? jQuery(this).data('swiper') : {}, 677 direction = configData.direction ? configData.direction : 'horizontal', 678 speed = configData.slidesTransition ? configData.slidesTransition : 800, 679 autoplay = configData.autoplaySpeed ? configData.autoplaySpeed : 3000, 680 autoplayEnable = configData.autoplay ? configData.autoplay : false, 681 adaptiveHeight = 'vertical' === direction ? true : configData.adaptiveHeight ? configData.adaptiveHeight : false, 682 loop = configData.infinite ? configData.infinite : false, 683 pause_on_hover = configData.autoplayPause ? configData.autoplayPause : false, 684 centeredSlides = configData.centerMode ? configData.centerMode : false, 685 mousewheel = configData.mousewheel ? configData.mousewheel : false, 686 freeMode = configData.freeMode ? configData.freeMode : false, 687 reverseDirection = configData.autoplayReverse ? configData.autoplayReverse : false, 688 variableWidth = configData.variableWidth; 689 690 const dynamicBullets = configData.dynamicBullets ? configData.dynamicBullets : false, 691 pagination = swiperContainer.data('pagination') !== undefined ? swiperContainer.data('pagination') : '.swiper-pagination' + itemID, 692 arrow_next = swiperContainer.data('arrow-next') !== undefined ? swiperContainer.data('arrow-next') : '.elementor-swiper-button-next' + itemID, 693 arrow_prev = swiperContainer.data('arrow-prev') !== undefined ? swiperContainer.data('arrow-prev') : '.elementor-swiper-button-prev' + itemID; 694 695 let pagination_type = 'bullets'; 696 if (swiperContainer.hasClass('pagination_fraction')){ 697 pagination_type = 'fraction'; 698 }else if(swiperContainer.hasClass('pagination_progress')){ 699 pagination_type = 'progressbar'; 700 } 701 702 let config = { 703 direction: direction, 704 loop: loop, 705 speed: speed, 706 effect: effect, 707 slidesPerView: !!variableWidth || 'vertical' === direction ? 'auto' : 1, 708 slidesPerGroup: 1, 709 watchOverflow: true, 710 autoHeight: adaptiveHeight, 711 grabCursor: false, 712 paginationClickable: true, 713 centeredSlides: centeredSlides, 714 autoplay: { 715 delay: autoplay, 716 reverseDirection: reverseDirection, 717 }, 718 pagination: { 719 el: pagination, 720 clickable: true, 721 type: pagination_type, 722 dynamicBullets: dynamicBullets, 723 formatFractionCurrent: (index) => index > 9 ? '' + index: '0' + index, 724 formatFractionTotal: (index) => index > 9 ? '' + index: '0' + index, 725 renderBullet: (index, className) => '<li class="' + className + '" role="presentation"><button type="button" role="tab" tabindex="-1">' + (index + 1) + '</button></li>', 726 }, 727 navigation: { 728 nextEl: arrow_next, 729 prevEl: arrow_prev 730 }, 731 breakpoints: {}, 732 autoplayEnable: autoplayEnable, 733 pause_on_hover: pause_on_hover, 734 freeMode: freeMode, 735 }; 736 737 if (jQuery(this).hasClass('fade_swiper')) { 738 config.fadeEffect = { 739 crossFade: true 740 }; 741 } 742 743 if (!!mousewheel) { 744 config.mousewheel = { 745 releaseOnEdges: true, 746 }; 747 } 748 749 if (configData.responsive && 'vertical' !== direction) { 750 let obj = { 751 0: { 752 slidesPerView: 1, 753 slidesPerGroup: 1, 754 spaceBetween: 20 755 } 756 }; 757 configData.responsive.forEach(function (item) { 758 if (item.breakpoint) { 759 obj[item.breakpoint] = { 760 slidesPerView: !!variableWidth ? 'auto' : parseInt(item.slidesToShow), 761 slidesPerGroup: parseInt(item.slidesToScroll) ?? 1, 762 }; 763 764 if (item.gap) { 765 obj[item.breakpoint].spaceBetween = parseInt(item.gap); 766 } 767 } 768 }); 769 770 config.breakpoints = obj; 771 } 772 773 wglInitSwiper(swiperContainer, config); 774 }); 775 } 776 777 /* @see https://3dtransforms.desandro.com/carousel */ 778 if (carousel_3D.length) { 779 carousel_3D.each(function () { 780 const container = jQuery(this), 781 carousel_wrapper = container.find('.wgl-carousel_wrap'), 782 cells = carousel_wrapper.find('.testimonials__wrapper, .wgl-item'), 783 direction = container.hasClass('animation-direction-vertical') ? 'rotateX' : 'rotateY'; 784 785 let cell, 786 cellCount = cells.length, 787 cellHeight = carousel_wrapper.outerHeight(), 788 angle, 789 cellAngle, 790 currentCell, 791 selectedIndex = 0, 792 radius, 793 theta; 794 795 function initHeightCarousel() { 796 if ('rotateY' === direction) { 797 let maxHeight = 0; 798 cells.each(function () { 799 let thisH = jQuery(this).outerHeight(); 800 if (thisH > maxHeight) { 801 maxHeight = thisH; 802 } 803 }); 804 container.css({'height': maxHeight}); 805 } 806 } 807 initHeightCarousel(); 808 809 function rotateCarousel() { 810 angle = theta * selectedIndex * -1; 811 carousel_wrapper.css({ 'transform': 'translateZ(' + -radius + 'px) ' + direction + '(' + angle + 'deg)' }); 812 } 813 814 container.find('.motion-prev').on('click', function () {
815 throttleFunction(changeCarousel_prev, 200) 816 }); 817 container.find('.motion-next').on('click', function () { 818 throttleFunction(changeCarousel_next, 200) 819 }); 820 821 function changeCarousel_prev() { 822 selectedIndex--; 823 changeCarousel(selectedIndex); 824 } 825 function changeCarousel_next() { 826 selectedIndex++; 827 changeCarousel(selectedIndex); 828 } 829 830 if (container.hasClass('animated-by-mouse-wheel')) { 831 container.on('wheel', function (e) { 832 if (e.originalEvent.deltaY < 0) throttleFunction(changeCarousel_next, 400); 833 else throttleFunction(changeCarousel_prev, 400); 834 e.preventDefault ? e.preventDefault() : (e.returnValue = false); 835 }); 836 } 837 838 function changeCarousel() { 839 cells.removeClass('active current next prev'); 840 theta = 360 / cellCount; 841 842 if ('rotateX' === direction) { 843 radius = Math.round( 844 (cellHeight / cellCount) * 0.7 * Math.sqrt(cellCount / 1.5) 845 ); 846 } else { 847 if (jQuery('#main').width() <= 992) { 848 radius = Math.round( 849 (cellHeight / cellCount) * 0.5 * Math.sqrt(cellCount / 1.2) 850 ); 851 } else { 852 radius = Math.round( 853 (cellHeight / cellCount) * 1.3 * Math.sqrt(cellCount / 1.2) 854 ); 855 } 856 } 857 858 cells.each(function (i) { 859 cell = jQuery(this); 860 cellAngle = theta * i; 861 angle = (theta * selectedIndex * -1) + cellAngle; 862 cell.css({ 'transform': direction + '(' + cellAngle + 'deg) translateZ(' + radius + 'px)' + direction + '(' + (angle * -1) + 'deg) ' }); 863 864 if (selectedIndex < 0) { 865 currentCell = cellCount - (Math.abs(selectedIndex + 1) % cellCount) - 1; 866 } else { 867 currentCell = selectedIndex % cellCount; 868 } 869 870 if (currentCell === i) { 871 cell.addClass('active current'); 872 if (currentCell === 0) cells.last().addClass('active prev'); 873 if (currentCell === cellCount - 1) cells.first().addClass('active next'); 874 } else if (i === (currentCell - 1)) { 875 cell.addClass('active prev') 876 } else if (i === (currentCell + 1)) { 877 cell.addClass('active next') 878 } 879 }); 880 881 rotateCarousel(); 882 883 cells.children().off(); 884 container.find('.prev').children().on('click', changeCarousel_prev); 885 container.find('.next').children().on('click', changeCarousel_next); 886 } 887 888 function throttleFunction(func, interval) { 889 if (!func.lastRunTime || func.lastRunTime < Date.now() - interval) { 890 func.lastRunTime = Date.now(); 891 892 return func.apply(arguments); 893 } 894 } 895 896 // set initials 897 changeCarousel(); 898 jQuery(window).resize(function () { 899 initHeightCarousel(); 900 changeCarousel(); 901 }); 902 }); 903 } 904} 905 906function wglInitSwiper(swiperContainer, config) { 907 if ( 908 window.elementorFrontend 909 && window.elementorFrontend.utils 910 && window.elementorFrontend.utils.swiper 911 ) { 912 const asyncSwiper = window.elementorFrontend.utils.swiper; 913 new asyncSwiper(swiperContainer, config).then((newSwiperInstance) => { 914 wglSwiperControl(newSwiperInstance, swiperContainer, config); 915 }); 916 } else if ('undefined' !== typeof Swiper) { 917 let wglSwiper = new Swiper(swiperContainer[0], config); 918 wglSwiperControl(wglSwiper, swiperContainer, config); 919 920 if (!!config.autoHeight){ 921 setTimeout(() => wglSwiper.updateAutoHeight(true), 500); 922 } 923 } 924} 925 926function wglSwiperControl(element, swiperContainer, config){
927 if (!config.autoplayEnable) { 928 element.autoplay.stop(); 929 } 930 931 if (config.pause_on_hover && config.autoplayEnable) { 932 swiperContainer.on('mouseenter', function () { 933 element.autoplay.stop(); 934 }); 935 swiperContainer.on('mouseleave', function () { 936 element.autoplay.start(); 937 }); 938 } 939} 940 941function wglCircuitService() { 942 if (jQuery('.wgl-circuit-service').length) { 943 jQuery('.wgl-circuit-service').each(function(){ 944 var $circle = jQuery(this).find('.wgl-services_icon-wrap'); 945 946 var agle = 360 / $circle.length; 947 var agleCounter = -1; 948 949 $circle.each(function() { 950 var $this = jQuery(this); 951 952 jQuery(this).parents('.wgl-services_item:first-child').addClass('active'); 953 $this.on('mouseover', function(){ 954 jQuery(this).parents('.wgl-services_item').addClass('active').siblings().removeClass('active'); 955 }) 956 957 var percentWidth = (100 * parseFloat($this.css('width')) / parseFloat($this.parent().css('width'))); 958 var curAgle = agleCounter * agle; 959 var radAgle = curAgle * Math.PI / 180; 960 var x = (50 + ((50 - (percentWidth / 2)) * Math.cos(radAgle))) - (percentWidth / 2); 961 var y = (50 + ((50 - (percentWidth / 2)) * Math.sin(radAgle))) - (percentWidth / 2); 962 963 $this.css({ 964 left: x + '%', 965 top: y + '%' 966 }); 967 968 agleCounter++; 969 }); 970 971 }); 972 } 973} 974// WGL Content Min Height 975function wglContentMinHeight() { 976 var header = jQuery('header.wgl-theme-header'), 977 footer = jQuery('footer.footer'), 978 pt = jQuery('.page-header'), 979 header_height = 0, 980 footer_height = 0, 981 pt_height = 0; 982 if (header.length) { 983 header_height = header.outerHeight(true); 984 document.querySelector('html').style.setProperty('--header-height', header_height + 'px'); 985 } 986 if (footer.length) { 987 footer_height = footer.outerHeight(true); 988 document.querySelector('html').style.setProperty('--footer-height', footer_height + 'px'); 989 } 990 if (pt.length) { 991 pt_height = pt.outerHeight(true); 992 document.querySelector('html').style.setProperty('--pt-height', pt_height + 'px'); 993 } 994} 995 996// wgl Countdown function init 997function wglCountdownInit () { 998 var countdown = jQuery('.wgl-countdown'); 999 if (countdown.length !== 0 ) { 1000 countdown.each(function () { 1001 var data_atts = jQuery(this).data('atts'); 1002 var time = new Date(+data_atts.year, +data_atts.month-1, +data_atts.day, +data_atts.hours, +data_atts.minutes); 1003 jQuery(this).countdown({ 1004 until: time, 1005 padZeroes: true, 1006 digits: [ 1007 '<span>0</span>', 1008 '<span>1</span>', 1009 '<span>2</span>', 1010 '<span>3</span>', 1011 '<span>4</span>', 1012 '<span>5</span>', 1013 '<span>6</span>', 1014 '<span>7</span>', 1015 '<span>8</span>', 1016 '<span>9</span>', 1017 ], 1018 format: data_atts.format ? data_atts.format : 'yowdHMS', 1019 labels: [data_atts.labels[0],data_atts.labels[1],data_atts.labels[2],data_atts.labels[3],data_atts.labels[4],data_atts.labels[5], data_atts.labels[6], data_atts.labels[7]], 1020 labels1: [data_atts.labels[0],data_atts.labels[1],data_atts.labels[2], data_atts.labels[3], data_atts.labels[4], data_atts.labels[5], data_atts.labels[6], data_atts.labels[7]] 1021 }); 1022 }); 1023 } 1024} 1025// WGL Counter 1026function wglCounterInit() {
1027 let counters = jQuery('.wgl-counter__value'); 1028 if (counters.length) { 1029 counters.appear(function() { 1030 let from = jQuery(this).data('start-value'), 1031 max = jQuery(this).data('end-value'), 1032 speed = jQuery(this).data('speed'), 1033 sep = jQuery(this).data('sep'); 1034 1035 jQuery(this).countTo({ 1036 from: from, 1037 to: max, 1038 speed: speed, 1039 refreshInterval: 10, 1040 separator: sep 1041 }); 1042 }); 1043 } 1044} 1045// WGL Cursor Message 1046jQuery(window).on('elementor/frontend/init', function() { 1047 wglSectionCursor(); 1048}); 1049 1050function wglCursorInit() { 1051 var $device_mode = jQuery('body').attr('data-elementor-device-mode'); 1052 if ($device_mode !== 'desktop' && $device_mode !== 'laptop' && $device_mode !== 'widescreen') { 1053 return; 1054 } 1055 1056 var cursorPointerWrap = jQuery('#wgl-cursor'); 1057 var cursorPointer = jQuery('#wgl-cursor-pointer'); 1058 var cursorText = jQuery('.wgl-cursor-text'); 1059 1060 jQuery(document).on('pointermove mousemove', function (e) { 1061 cursorPointerWrap.css("transform", `translate(-50%,-50%) translate3d(${e.clientX}px, ${e.clientY}px , 0)`); 1062 }) 1063 1064 if (cursorText.length) { 1065 cursorText.each(function() { 1066 var $this = jQuery(this), 1067 append = wglCursorAppend($this), 1068 cursorColorBg = $this.attr('data-cursor-color-bg'), 1069 cursorEvent = $this.attr('data-cursor-event'), 1070 cursorEventHtml = ''; 1071 1072 if ( $this.hasClass('additional-cursor') ) { 1073 $this = $this.parent() 1074 } 1075 1076 if (cursorEvent) { 1077 cursorEventHtml = jQuery(cursorEvent); 1078 } else { 1079 cursorEventHtml = $this; 1080 } 1081 1082 const appendElement = 'undefined' !== jQuery.type(append) && '' !== jQuery.type(append); 1083 let timerId; 1084 1085 cursorEventHtml.on('mouseenter', function () { 1086 if (appendElement) { 1087 cursorPointer 1088 .empty() 1089 .append(jQuery(append)) 1090 timerId = setTimeout(() => { 1091 cursorPointer.addClass('visible') 1092 }, 20); 1093 }else{ 1094 cursorPointer.css('color',cursorColorBg) 1095 } 1096 }).on('mouseleave', function(e) { 1097 if (appendElement) { 1098 clearTimeout(timerId); 1099 cursorPointer.removeClass('visible') 1100 }else{ 1101 if ( e.relatedTarget ) { 1102 var newTarget = jQuery(e.relatedTarget); 1103 if (!newTarget.hasClass('wgl-cursor-text')) { 1104 newTarget = newTarget.parents('[data-cursor-color-bg]').eq(0); 1105 } 1106 if (newTarget.length > 0 && newTarget.hasClass('wgl-cursor-text')) { 1107 setTimeout( function() { 1108 newTarget.trigger('mouseenter'); 1109 }, 0 ); 1110 } else { 1111 cursorPointer.css('color','var(--mindy-cursor-point-color)') 1112 } 1113 } 1114 } 1115 }) 1116 }) 1117 } 1118} 1119 1120var wglCursorAppend = $this => { 1121 1122 var custom_class = $this.attr('data-cursor-class') ?? '', 1123 text = $this.attr('data-cursor-text'), 1124 image = $this.attr('data-cursor-image'), 1125 newAppend = []; 1126 1127 if ( 'undefined' !== jQuery.type(image) ) { 1128 newAppend = jQuery('<div class="cursor-content cursor-content-image ' + custom_class + '">' + image + '</div>') 1129 } else if ( 'undefined' !== jQuery.type(text) ) { 1130 newAppend = jQuery('<div class="cursor-content cursor-content-text ' + custom_class + '">
1130' + text + '</div>') 1131 } 1132 1133 return newAppend[0]; 1134 1135} 1136 1137function wglSectionCursor(){ 1138 window.elementorFrontend.hooks.addAction('frontend/element_ready/section', wglCursorElementor); 1139 window.elementorFrontend.hooks.addAction('frontend/element_ready/container', wglCursorElementor); 1140 1141 function wglCursorElementor( $scope ){ 1142 return $scope.each(function () { 1143 let self = jQuery(this), 1144 itemId = jQuery(this).data('id'); 1145 1146 let settings = {}, 1147 hasProperty = false, 1148 arr = [], 1149 tooltip_bg = '', 1150 cursor_prop = ''; 1151 1152 let init = function(){ 1153 if (!window.elementorFrontend.isEditMode()) { 1154 settings = wgl_section_settings[0][itemId]; 1155 1156 hasProperty = checkEnabledCursor(settings); 1157 1158 settings = wgl_section_settings[0]; 1159 1160 } else { 1161 if (!window.elementor.elements && 1162 !window.elementor.elements.models 1163 ) { 1164 return; 1165 } 1166 1167 window.elementor.elements.models.forEach(function (value) { 1168 if (itemId === value.id) { 1169 settings = value.attributes.settings.attributes; 1170 arr[value.id] = value.attributes.settings.attributes; 1171 } 1172 }); 1173 1174 hasProperty = checkEnabledCursor(settings); 1175 settings = arr; 1176 } 1177 1178 settings = settings[jQuery(self).data('id')] 1179 if (hasProperty) { 1180 1181 if (jQuery('#wgl-cursor').length === 0) { 1182 jQuery('body').append('<div id="wgl-cursor"><div id="wgl-cursor-pointer"></div></div>'); 1183 } 1184 var $self = jQuery(self); 1185 $self.addClass('wgl-cursor-text'); 1186 1187 if ('custom' === settings['cursor_tooltip_type']) { 1188 let $attr = '<h6>' + (settings['tooltip_text'] ?? '') + '</h6>'; 1189 $self.attr('data-cursor-text', $attr) 1190 if (settings['cursor_tooltip_bg']) { 1191 tooltip_bg = ' tooltip_bg'; 1192 } 1193 $self.removeAttr('data-cursor-image data-cursor-color-bg'); 1194 } else if ('image' === settings['cursor_tooltip_type']) { 1195 settings['cursor_thumbnail']['url'].length ? $self.attr('data-cursor-image', '<img src=\'' + settings['cursor_thumbnail']['url'] + '\' alt=\'' + settings['cursor_thumbnail']['alt'] + '\'>') : ''; 1196 $self.removeAttr('data-cursor-text data-cursor-color-bg'); 1197 } else if ('simple' === settings['cursor_tooltip_type']) { 1198 settings['cursor_color_bg'].length ? $self.attr('data-cursor-color-bg', settings['cursor_color_bg']) : ''; 1199 $self.removeAttr('data-cursor-image data-cursor-text'); 1200 } 1201 1202 if (settings['cursor_prop']) { 1203 cursor_prop = ' cursor_center'; 1204 $self.attr('data-cursor-prop', 'none'); 1205 } 1206 $self.attr('data-cursor-class', 'wgl-element-' + itemId + ' cursor-from-js' + tooltip_bg + cursor_prop); 1207 1208 if (window.elementorFrontend.isEditMode()) { 1209 wglCursorInit(); 1210 } 1211 } else { 1212 self.off().removeClass('wgl-cursor-text').removeAttr('data-cursor-text data-cursor-image data-cursor-color-bg') 1213 jQuery('#wgl-cursor-pointer').empty() 1214 } 1215 } 1216 1217 var checkEnabledCursor = function (settings) { 1218 return !!(settings 1219 && settings.hasOwnProperty('cursor_tooltip') 1220 && '' !== settings.cursor_tooltip); 1221 } 1222 1223 /*Init*/ 1224 init(); 1225 }); 1226 } 1227} 1228 1229// WGL Double Heading 1230 1231function wglInitDblhAppear() { 1232 let $dblh = jQuery('.elementor-widget-wgl-double-heading.appear_anim-yes'); 1233 $dblh.each(function() { 1234 jQuery(this).appear(function() { 1235 jQuery(this).addClass('show_curve'); 1236 }); 1237 }); 1238} 1239function wglDynamicStyles() { 1240 var style = jQuery('#mindy-footer-inline-css'); 1241 1242 (function ($) { 1243 $.fn.wglAddDynamicStyles = function () { 1244 if (this.length === 0) { 1245 return this; 1246 } 1247 1248 return this.each(function () { 1249 var $style = '', 1250 self = jQuery(this); 1251 1252 var init = function () { 1253 $style += self.text(); 1254 self.remove(); 1255 appendStyle(); 1256 }, 1257 appendStyle = function () { 1258 jQuery('head').append('<style>' + $style + '</style>'); 1259 }; 1260 1261 // Init 1262 init(); 1263 }); 1264 }; 1265 })(jQuery); 1266 1267 style.wglAddDynamicStyles(); 1268} 1269 1270// wgl Filter Swiper 1271function wglFilterSwiper() { 1272 let filter_swiper = document.querySelectorAll('.wgl-filter_swiper_wrapper, .wgl-tabs_swiper-wrapper .wgl-tabs_headings-wrap'); 1273 filter_swiper.forEach((slider, index)=>{ 1274 if (window.elementorFrontend) { 1275 if (window.elementorFrontend.isEditMode()) { 1276 wglFilterSwiperInit(slider); 1277 }else{ 1278 elementorFrontend.on('components:init', () => {wglFilterSwiperInit(slider)}); 1279 } 1280 } 1281 }); 1282} 1283 1284function wglFilterSwiperInit(self) { 1285 if ('undefined' === typeof Swiper) { 1286 const asyncSwiper = window.elementorFrontend.utils.swiper; 1287 new asyncSwiper(self, { 1288 slidesPerView: 'auto', 1289 slideActiveClass: 'slide-active', 1290 }).then((newSwiperInstance) => { 1291 newSwiperInstance.init(); 1292 jQuery(self).on( 'slides_added', function () {
1293 newSwiperInstance.update(); 1294 }); 1295 }); 1296 } else { 1297 const wglSwiper = new Swiper(self, { 1298 slidesPerView: 'auto', 1299 slideActiveClass: 'slide-active', 1300 }); 1301 jQuery(self).on( 'slides_added', function () { 1302 wglSwiper.update(); 1303 }); 1304 } 1305} 1306//https://gist.github.com/chriswrightdesign/7955464 1307function mobilecheck() { 1308 var check = false; 1309 (function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); 1310 return check; 1311} 1312 1313//Add Click event for the mobile device 1314var click = mobilecheck() ? ('ontouchstart' in document.documentElement ? 'touchstart' : 'click') : 'click'; 1315 1316function initClickEvent(){ 1317 click = mobilecheck() ? ('ontouchstart' in document.documentElement ? 'touchstart' : 'click') : 'click'; 1318} 1319jQuery(window).on('resize', initClickEvent); 1320 1321/* 1322 ** Plugin for counter shortcode 1323 */ 1324(function($) { 1325 "use strict"; 1326 1327 $.fn.countTo = function(options) { 1328 // merge the default plugin settings with the custom options 1329 options = $.extend({}, $.fn.countTo.defaults, options || {}); 1330 1331 // how many times to update the value, and how much to increment the value on each update 1332 var loops = Math.ceil(options.speed / options.refreshInterval), 1333 increment = (options.to - options.from) / loops; 1334 1335 return $(this).each(function() { 1336 var _this = this, 1337 loopCount = 0, 1338 value = options.from, 1339 interval = setInterval(updateTimer, options.refreshInterval), 1340 separator = options.separator; 1341 1342 function updateTimer() { 1343 value += increment; 1344 loopCount++; 1345 $(_this).html(value.toFixed(options.decimals).toString().replace(/\B(?=(\d{3})+(?!\d))/g, separator)); 1346 1347 if (typeof(options.onUpdate) === 'function') { 1348 options.onUpdate.call(_this, value); 1349 } 1350 1351 if (loopCount >= loops) { 1352 clearInterval(interval); 1353 value = options.to; 1354 1355 if (typeof(options.onComplete) === 'function') { 1356 options.onComplete.call(_this, value); 1357 } 1358 } 1359 } 1360 }); 1361 }; 1362 1363 $.fn.countTo.defaults = { 1364 from: 0, // the number the element should start at 1365 to: 100, // the number the element should end at 1366 speed: 1000, // how long it should take to count between the target numbers 1367 refreshInterval: 100, // how often the element should be updated
1368 decimals: 0, // the number of decimal places to show 1369 onUpdate: null, // callback method for every time the element is updated, 1370 onComplete: null, // callback method for when the element finishes updating 1371 separator: '' // thousand separator 1372 }; 1373})(jQuery); 1374 1375/* 1376 ** Plugin IF visible element 1377 */ 1378function wglIsVisibleInit (){ 1379 jQuery.fn.wglIsVisible = function (){ 1380 var elementTop = jQuery(this).offset().top; 1381 var elementBottom = elementTop + jQuery(this).outerHeight(); 1382 var viewportTop = jQuery(window).scrollTop(); 1383 var viewportBottom = viewportTop + jQuery(window).height(); 1384 return elementBottom > viewportTop && elementTop < viewportBottom; 1385 } 1386} 1387 1388/* 1389 ** Preloader 1390 */ 1391jQuery(window).load(function(){ 1392 jQuery('#preloader-wrapper').fadeOut(); 1393}); 1394// wgl image comparison 1395function wglImageComparison() { 1396 var item = jQuery('.wgl-image_comparison.cocoen'); 1397 if (item.length !== 0) { 1398 item.each(function() { 1399 jQuery(this).cocoen(); 1400 }); 1401 } 1402} 1403 1404// Images Gallery 1405function wglImagesGallery() { 1406 let item = '.wgl-gallery_item-wrapper', 1407 gallery_masonry = '.gallery-masonry', 1408 $gallery_justified = jQuery('.gallery-justified'), 1409 $main = jQuery('#main'); 1410 1411 if (jQuery(gallery_masonry).length) { 1412 let dom = jQuery(gallery_masonry).get(0), 1413 iso = jQuery(gallery_masonry).isotope({ 1414 layoutMode: 'masonry', 1415 percentPosition: true, 1416 itemSelector: item 1417 }); 1418 1419 imagesLoaded(dom, function () { 1420 iso.isotope('layout'); 1421 }); 1422 1423 jQuery(window).on('resize', function () { 1424 iso.isotope(); 1425 }); 1426 } 1427 1428 if ($gallery_justified.length) { 1429 let dom = $gallery_justified.get(0), 1430 jus = $gallery_justified.justifiedGallery({ 1431 rowHeight: deviceData('height'), 1432 maxRowHeight: deviceData('max-height'), 1433 margins: deviceData('gap'), 1434 lastRow: $gallery_justified.data('last-row'), 1435 captions: false, 1436 }); 1437 1438 imagesLoaded(dom, function () { 1439 jus.justifiedGallery(); 1440 }); 1441 1442 jQuery(window).on('resize', function () { 1443 jus.justifiedGallery({ 1444 rowHeight: deviceData('height'), 1445 maxRowHeight: deviceData('max-height'), 1446 margins: deviceData('gap'), 1447 }); 1448 }); 1449 } 1450 1451 function deviceData(option) { 1452 let data = $gallery_justified.data(option); 1453 if ($main.width() <= 767) { 1454 data = $gallery_justified.data('mobile-' + option); 1455 } else if ($main.width() <= 1024) { 1456 data = $gallery_justified.data('tablet-' + option); 1457 } 1458 return data; 1459 } 1460} 1461 1462// Image Layers 1463function wglImgLayers() { 1464 jQuery('.wgl-image-layers').each(function() { 1465 var container = jQuery(this); 1466 var initImageLayers = function() { 1467 container.appear( 1468 function() { 1469 container.addClass('img-layer_animate'); 1470 }, 1471 { done: true } 1472 ); 1473 }; 1474 initImageLayers(); 1475 }); 1476} 1477 1478function wglIsotope() { 1479 jQuery('.isotope').each(function () { 1480 var $isotope = jQuery(this), 1481 rtl = !jQuery('body').hasClass('rtl'); 1482 var properties = { 1483 layoutMode: $isotope.hasClass('fit_rows') ? 'fitRows' : 'masonry', 1484 percentPosition: true, 1485 originLeft: rtl, 1486 itemSelector: '.portfolio__item, .listing__item, .item, .product', 1487 masonry: { 1488 columnWidth: '.pf_item_size, .portfolio__item, .listing__item, .item, .product', 1489 } 1490 }; 1491 1492 $isotope.imagesLoaded().isotope(properties); 1493 wglIsotopeFilterHandler(this); 1494 }); 1495} 1496 1497function wglIsotopeFilterHandler(self) { 1498 var filterNode = jQuery(self).closest('.elementor-widget-container').find('.isotope-filter a'); 1499 1500 filterNode.each(function () { 1501 var $this = jQuery(this), 1502 num,
1503 dataFilter = this.dataset.filter; 1504 1505 if ($this.parent().parent().parent().hasClass('product__filter')) { 1506 num = $this 1507 .closest('.wgl-products-grid') 1508 .find('.product') 1509 .filter(dataFilter).length; 1510 } 1511 else if($this.parent().parent().parent().hasClass('listing__filter')) { 1512 num = $this 1513 .closest('.wgl-listing') 1514 .find('.listing__item') 1515 .filter(dataFilter).length; 1516 } else if($this.parent().parent().parent().hasClass('event__filter')) { 1517 num = $this 1518 .closest('.wgl-events') 1519 .find('.item') 1520 .filter(dataFilter).length; 1521 } else { 1522 num = $this 1523 .closest('.wgl-portfolio') 1524 .find('.portfolio__item') 1525 .filter(dataFilter).length; 1526 } 1527 $this.find('.filter_counter').text(num); 1528 1529 if (0 === num) { 1530 // mark empty categories 1531 $this.addClass('empty').removeClass('swiper-slide').parent().parent().trigger('slides_added'); 1532 } 1533 }); 1534 1535 filterNode.on('click', function (e) { 1536 e.preventDefault(); 1537 var $this = jQuery(this); 1538 $this.addClass('active').siblings().removeClass('active'); 1539 1540 var dataFilter = $this.attr('data-filter'), 1541 isotopeNode = $this.closest('.elementor-widget-container').find('.isotope'); 1542 1543 isotopeNode.isotope({ filter: dataFilter }); 1544 1545 if (isotopeNode.hasClass('appear-animation')) { 1546 isotopeNode.find('.portfolio__item').addClass('animate'); 1547 } 1548 }); 1549} 1550 1551function wglMenuLavalamp() { 1552 let lavalamp = jQuery( 1553 // menu 1554 '.menu_line_enable > ul' 1555 // woocommerce 1556 + ',.wc-tabs' 1557 ); 1558 lavalamp.each(function () { 1559 jQuery(this).lavalamp(); 1560 }); 1561 1562 setTimeout(function(){ 1563 jQuery('.wgl-tabs.has-lavalamp .wgl-tabs_headings, .wgl-tabs-horizontal.has-lavalamp .wgl-tabs-horizontal_headings').lavalamp(); 1564 },600); 1565} 1566 1567(function($, window) { 1568 let Lavalamp = function(element, options) { 1569 this.element = $(element).data('lavalamp', this); 1570 this.options = $.extend({}, this.options, options); 1571 1572 this.init(); 1573 }; 1574 1575 Lavalamp.prototype = { 1576 options: { 1577 current: 1578 '.current-menu-ancestor,.current-menu-item,.current-category-ancestor,.current-page-ancestor,.current_page_parent' // menu 1579 + ',.wgl-tabs_header.active' // wgl-tabs 1580 + ',.wgl-tabs-horizontal_header_wrap.active' // wgl-horizontal-tabs 1581 + ',.active', // wc-tabs 1582 items: 1583 'li' // menu 1584 + ',.wgl-tabs_header' // wgl-tabs 1585 + ',.wgl-tabs-horizontal_header_wrap', // wgl-horizontal-tabs 1586 bubble: '<div class="lavalamp-object"></div>', 1587 animation: false, 1588 blur: $.noop, 1589 focus: $.noop, 1590 easing: 'easeInOutCubic', // transition timing function 1591 duration: '0.6s' // animation duration 1592 }, 1593 element: null, 1594 current: null, 1595 bubble: null, 1596 _focus: null, 1597 init: function() { 1598 let resizeTimer, 1599 self = this, 1600 child = self.element.children( 1601 'li' // menu 1602 + ',.wgl-tabs_header' // wgl-tabs 1603 + ',.wgl-tabs-horizontal_header_wrap' // wgl-horizontal-tabs 1604 ); 1605 1606 this.onWindowResize = function() { 1607 if (resizeTimer) { 1608 clearTimeout(resizeTimer); 1609 } 1610 1611 resizeTimer = setTimeout(function() { 1612 self.reload(); 1613 }, 100); 1614 }; 1615 1616 $(window).on('resize.lavalamp', this.onWindowResize); 1617 1618 $(child).addClass('lavalamp-item'); 1619 1620 if ( 1621 (this.element.hasClass('wgl-tabs_headings') 1622 || this.element.parent().hasClass('wgl-tabs_headings')) 1623 || 1624 (this.element.hasClass('wgl-tabs-horizontal_headings') 1625 || this.element.parent().hasClass('wgl-tabs-horizontal_headings')) 1626 || 1627 (this.element.hasClass('wc-tabs') 1628 || this.element.parent().hasClass('wc-tabs')) 1629 1630 ) { 1631 // ↓ Tabs widget 1632 this.element.on('click.lavalamp', '.lavalamp-item', function() { 1633 self._move($(this)); 1634 }); 1635 } else { 1636 // ↓ Menu 1637 this.element 1638 .on('mouseenter.lavalamp', '.lavalamp-item', function() { 1639 self.current.each(function() { 1640 self.options.blur.call(this, self); 1641 }); 1642 1643 self._move($(this)); 1644 }) 1645 .on('mouseleave.lavalamp', function() { 1646 if (self.current.index(self._focus) < 0) { 1647 self._focus = null; 1648 1649 self.current.each(function() { 1650 self.options.focus.call(this, self); 1651 }); 1652 1653 self._move(self.current); 1654 } 1655 }); 1656 } 1657 1658 this.bubble = $.isFunction(this.options.bubble) 1659 ? this.options.bubble.call(this, this.element) 1660 : $(this.options.bubble).prependTo(this.element); 1661 1662 self.element.addClass('lavalamp'); 1663 self.element.find('.lavalamp-object').addClass(self.options.easing); 1664 1665 this.reload(); 1666 1667 setTimeout(function(){ 1668 self.element.addClass("lavalamp_animate") 1669 },500); 1670 }, 1671 reload: function() { 1672 this.current = this.element.children(this.options.current); 1673 1674 if (this.current.size() === 0) { 1675 this.current = this.element 1676 .children() 1677 .not('.lavalamp-object') 1678 .eq(0); 1679 } 1680 1681 this._move(this.current, false); 1682 }, 1683 destroy: function() { 1684 if (this.bubble) { 1685 this.bubble.remove(); 1686 } 1687 1688 this.element.off('.lavalamp'); 1689 $(window).off('resize.lavalamp', this.onWindowResize); 1690 }, 1691 _move: function(el, animate) { 1692 let pos = el.position(), 1693 cssProperties; 1694 1695 if (el.hasClass('wgl-tabs_header') || el.parent().hasClass('wc-tabs')) { 1696 // ↓ Tabs widget 1697 cssProperties = { 1698 WebkitTransitionDuration: this.options.duration, 1699 MozTransitionDuration: this.options.duration, 1700 transitionDuration: this.options.duration, 1701 transform: 'translate('+Math.round(pos.left)+'px)', 1702 width: Math.round(el.outerWidth()), 1703 opacity: 1, 1704 left: '0px', 1705 }; 1706 1707 } else if (el.hasClass('wgl-tabs-horizontal_header_wrap')) { 1708 // ↓ Horizontal Tabs widget 1709 cssProperties = { 1710 WebkitTransitionDuration: this.options.duration, 1711 MozTransitionDuration: this.options.duration, 1712 transitionDuration: this.options.duration, 1713 transform: 'translateY('+Math.round(pos.top)+'px)', 1714 height: Math.round(el.outerHeight(true)), 1715 opacity: 1, 1716 }; 1717 1718 }else{ 1719 // ↓ Menu 1720 let child_width = el.children('a').children('span').width() - 2; 1721 1722 pos.left = pos.left + parseInt(el.children('a').css('marginLeft')) + 1; 1723 1724 cssProperties = { 1725 WebkitTransitionDuration: this.options.duration, 1726 MozTransitionDuration: this.options.duration, 1727 transitionDuration: this.options.duration, 1728 transform: 'translate(' + pos.left + 'px)', 1729 width: 'calc(' + el.children().outerWidth() + 'px)', 1730 marginLeft: 'calc(-' + el.parent().css('border-left-width') + ')', 1731 marginTop: 'calc(' + (el.children().outerHeight() - 56) / 2 + 'px)', 1732 }; 1733 } 1734 1735 this._focus = el; 1736 // Animate bubble 1737 this.bubble.css(cssProperties); 1738 1739 } 1740 }; 1741 1742 $.fn.lavalamp = function(options) { 1743 if (typeof options === 'string') { 1744 let instance = $(this).data('lavalamp'); 1745 return instance[options].apply( 1746 instance, 1747 Array.prototype.slice.call(arguments, 1) 1748 ); 1749 } else { 1750 return this.each(function() { 1751 let instance = $(this).data('lavalamp'); 1752 1753 if (instance) { 1754 $.extend(instance.options, options || {}); 1755 instance.reload(); 1756 } else { 1757 new Lavalamp(this, options); 1758 } 1759 }); 1760 } 1761 }; 1762})(jQuery, window); 1763 1764(function( $ ) { 1765 1766 $(document).on('click', '.sl-button', function() { 1767 var button = $(this), 1768 post_id = button.attr('data-post-id'), 1769 security = button.attr('data-nonce'), 1770 iscomment = button.attr('data-iscomment'), 1771 allbuttons; 1772 1773 if (iscomment === '1') { /* Comments can have same id */ 1774 allbuttons = $('.sl-comment-button-'+post_id); 1775 } else { 1776 allbuttons = $('.sl-button-'+post_id); 1777 } 1778 var loader = allbuttons.next('#sl-loader'); 1779 if (post_id !== '') { 1780 $.ajax({ 1781 type: 'POST', 1782 url: wgl_core.ajaxurl, 1783 data : { 1784 action : 'wgl_theme_like', 1785 post_id : post_id, 1786 nonce : security, 1787 is_comment : iscomment, 1788 }, 1789 beforeSend: function() { 1790 loader.html(' <div class="loader">Loading...</div>'); 1791 }, 1792 success: function(response) { 1793 var icon = response.icon; 1794 var count = response.count; 1795 allbuttons.html(icon+count); 1796 if (response.status === 'unliked') { 1797 allbuttons.prop('title', button.data('title-like')); 1798 allbuttons.removeClass('liked'); 1799 } else { 1800 allbuttons.prop('title', button.data('title-unlike')); 1801 allbuttons.addClass('liked'); 1802 } 1803 loader.empty(); 1804 } 1805 }); 1806 1807 } 1808 return false;
1809 }); 1810 1811})( jQuery ); 1812// Select Wrapper 1813function wglLinkOverlay() { 1814 jQuery('.wgl-link-overlay').each(function() { 1815 let $this = jQuery(this); 1816 let wrapper = $this.closest('.elementor-widget'); 1817 let zIndexItem = 'auto' !== wrapper.css('z-index') ? wrapper.css('z-index') : false; 1818 let position = $this.data('link-position'); 1819 let $link = false; 1820 1821 if (!zIndexItem) { 1822 $this.css('z-index', zIndexItem); 1823 } 1824 1825 switch (position) { 1826 case "1st": 1827 $link = wrapper.parent(); 1828 break; 1829 case "2nd": 1830 $link = wrapper.parent().parent(); 1831 break; 1832 case "3rd": 1833 $link = wrapper.parent().parent().parent(); 1834 break; 1835 case "column": 1836 $link = wrapper.closest(".elementor-column"); 1837 break; 1838 default: 1839 $link = wrapper.closest(".elementor-section"); 1840 } 1841 1842 if ($link) { 1843 $this.prependTo($link); 1844 wrapper.remove(); 1845 } 1846 }); 1847} 1848function wglLinkScroll() { 1849 jQuery('a.smooth-scroll, .smooth-scroll').on('click', function(event) { 1850 var href; 1851 if (this.tagName == 'A') { 1852 href = jQuery.attr(this, 'href'); 1853 } else { 1854 var that = jQuery(this).find('a'); 1855 href = jQuery(that).attr('href'); 1856 } 1857 jQuery('html, body').animate( 1858 { 1859 scrollTop: jQuery(href).offset().top 1860 }, 1861 500 1862 ); 1863 event.preventDefault(); 1864 }); 1865} 1866 1867// wgl Listings Search 1868function wglListingsSearch() { 1869 let select2 = jQuery('.wgl-listings .wgl-listings_search .select2'); 1870 if (select2.length) { 1871 select2.each(function () { 1872 if (!jQuery(this).hasClass('select2-location')) { 1873 jQuery(this).select2({ 1874 placeholder: jQuery(this).data('placeholder'), 1875 allowClear: true, 1876 }); 1877 } else { 1878 jQuery(this).select2({ 1879 placeholder: jQuery(this).data('placeholder'), 1880 ajax: { 1881 url: wgl_core.ajaxurl, 1882 dataType: 'json', 1883 delay: 250, 1884 data: function (data) { 1885 return { 1886 action: 'search_location', 1887 searchTerm: data.term, 1888 }; 1889 }, 1890 processResults: function (response) { 1891 return { 1892 results: response, 1893 }; 1894 }, 1895 minimumInputLength: 1, 1896 cache: true, 1897 }, 1898 }); 1899 } 1900 }); 1901 } 1902 1903 jQuery('.wgl-listings_search.elementor-search .advanced_btn').on( 1904 'click tap', 1905 function () { 1906 jQuery(this) 1907 .closest('.wgl-listings_search') 1908 .find('.wgl-listings_search-advanced') 1909 .toggleClass('active-search'); 1910 jQuery(this).toggleClass('active'); 1911 } 1912 ); 1913 1914 jQuery(document).on('click', function (event) { 1915 if ( 1916 !jQuery(event.target).closest( 1917 '.elementor-search .wgl-listings_search-advanced' 1918 ).length && 1919 !jQuery(event.target).closest('.elementor-search .advanced_btn') 1920 .length && 1921 !jQuery(event.target).closest( 1922 '.elementor-search .send_button button' 1923 ).length 1924 ) { 1925 jQuery( 1926 '.elementor-search .wgl-listings_search-advanced' 1927 ).removeClass('active-search'); 1928 } 1929 }); 1930 1931 const form_search = jQuery('.form-search-listings'); 1932 if (form_search.length) { 1933 jQuery(form_search).on('submit', function (e) { 1934 e.preventDefault(); 1935 1936 helperCheckbox(jQuery(this), 'doors'); 1937 helperCheckbox(jQuery(this), 'seats'); 1938 helperCheckbox(jQuery(this), 'features'); 1939 helperCheckbox(jQuery(this), 'categories'); 1940 1941 helperDecimal(jQuery(this), 'price'); 1942 helperDecimal(jQuery(this), 'mileage'); 1943 helperDecimal(jQuery(this), 'year'); 1944 1945 helperSelect(jQuery(this), 'make'); 1946 helperSelect(jQuery(this), 'model'); 1947 helperSelect(jQuery(this), 'category'); 1948 helperSelect(jQuery(this), 'condition'); 1949 helperSelect(jQuery(this), 'type'); 1950 helperSelect(jQuery(this), 'fuel_type'); 1951 helperSelect(jQuery(this), 'transmission'); 1952 helperSelect(jQuery(this), 'color'); 1953 1954 helperSelectMultiple(jQuery(this), 'location'); 1955 1956 if (window.elementorFrontend) { 1957 if (!window.elementorFrontend.isEditMode()) { 1958 jQuery(this)[0].submit(); 1959 } 1960 } else { 1961 jQuery(this)[0].submit(); 1962 } 1963 }); 1964 } 1965 1966 const helperCheckbox = (self, name) => { 1967 const activeCheckboxes = self.find('input[name="' + name + '[]"]'); 1968 1969 const selectedCheckboxes = self 1970 .find('input[name="' + name + '[]"]:checked') 1971 .map(function () { 1972 return jQuery(this).val(); 1973 }) 1974 .get() 1975 .join(','); 1976 1977 jQuery(activeCheckboxes).attr('disabled', true); 1978 1979 if (selectedCheckboxes.length > 0) {
1980 self.find('.' + name + '-input').val(selectedCheckboxes); 1981 } else { 1982 self.find('.' + name + '-input').attr('disabled', true); 1983 } 1984 }; 1985 1986 const helperDecimal = (self, name) => { 1987 const min = self.find('input[name="min_' + name + '"]'); 1988 const max = self.find('input[name="max_' + name + '"]'); 1989 1990 if(min.length && max.length){ 1991 if (!min.val().length && !max.val().length) { 1992 min.attr('disabled', true); 1993 max.attr('disabled', true); 1994 } 1995 } 1996 }; 1997 1998 const helperSelect = (self, name) => { 1999 const select = self.find('select[name="' + name + '"]'); 2000 2001 if (select.length && !select.val().length) { 2002 select.attr('disabled', true); 2003 } 2004 }; 2005 2006 const helperSelectMultiple = (self, name) => { 2007 const select = self.find('select[name="' + name + '"]'); 2008 const selectedItems = select.val().join(','); 2009 if (selectedItems.length) { 2010 self.find('.' + name + '-input').val(selectedItems); 2011 } else { 2012 self.find('.' + name + '-input').attr('disabled', true); 2013 } 2014 2015 select.attr('disabled', true); 2016 }; 2017 2018 let clonedTax = {}; 2019 2020 jQuery('.select2-model').each(function () { 2021 clonedTax[jQuery(this).attr('name')] = jQuery(this).clone(); 2022 }); 2023 2024 const filterTax = (element, selectedMake = '') => { 2025 2026 if (jQuery(element).hasClass('select2-hidden-accessible')) { 2027 jQuery(element).select2('destroy'); 2028 } 2029 2030 jQuery(element).empty(); 2031 2032 if('return_cloned' !== selectedMake){ 2033 jQuery(element).append( 2034 jQuery('option[data-condition="all"]', clonedTax[jQuery(element).attr('name')]).clone() 2035 ); 2036 2037 jQuery(element).append( 2038 jQuery('option[data-condition="' + selectedMake + '"]', clonedTax[jQuery(element).attr('name')]).clone() 2039 ); 2040 }else{ 2041 jQuery(element).append( 2042 jQuery('option', clonedTax[jQuery(element).attr('name')]).clone() 2043 ); 2044 } 2045 2046 jQuery(element).select2({ 2047 allowClear: true, 2048 width: '100%', 2049 }).trigger('change'); 2050 } 2051 2052 jQuery('.select2-make').on('change', function () { 2053 var value = jQuery(this).val(); 2054 var self = jQuery(this); 2055 if (value) { 2056 self.closest('.form-search-listings') 2057 .find('.select2-model') 2058 .each(function () { 2059 filterTax(this, value); 2060 }); 2061 } 2062 }); 2063 2064 jQuery('.select2-make').on("select2:unselecting", function(e) { 2065 var self = jQuery(this); 2066 2067 self.closest('.form-search-listings') 2068 .find('.select2-model') 2069 .each(function () { 2070 filterTax(this, 'return_cloned'); 2071 }); 2072 2073 }); 2074} 2075 2076function wglMessageAnimInit() { 2077 jQuery('body').on('click', '.message_close_button', function (e) { 2078 jQuery(this).parents('.closable').slideUp(350); 2079 }); 2080} 2081 2082function wglMobileHeader() { 2083 var menu = jQuery('.wgl-mobile-header .mobile_nav_wrapper .wgl-menu-outer_content'); 2084 var elementorEditormenu = jQuery('.elementor-editor-active .mobile_nav_wrapper .wgl-menu-outer_content'); 2085 var verticalMenu = jQuery('.menu_vertical.elementor-widget-wgl-menu .primary-nav > ul').filter(function() { 2086 return !jQuery(this).closest('.wgl-menu-outer_content').length; 2087 }); 2088 2089 // Create Mobile Menu plugin 2090 (function ($) { 2091 $.fn.wglMobileMenu = function (options) { 2092 var defaults = { 2093 toggleBtn: '.hamburger-box', 2094 switcher: '.button_switcher', 2095 back: '.back', 2096 overlay: '.wgl-menu_overlay', 2097 anchor: '.menu-item > a[href*=\\#]', 2098 }; 2099 2100 if (this.length === 0) return this; 2101 2102 return this.each(function () { 2103 var wglMenu = {}, 2104 ds = $(this).find('.primary-nav > ul'), 2105 sub_menu = jQuery('.mobile_nav_wrapper .primary-nav > ul ul, .mobile_nav_wrapper .primary-nav > ul .wgl-e-container'), 2106 m_width = jQuery('.mobile_nav_wrapper').data('mobileWidth'), 2107 m_toggle = jQuery('.hamburger-box'), 2108 body = jQuery('body'), 2109 stickyMobile = jQuery('.wgl-mobile-header.wgl-sticky-element'), 2110 window_width = jQuery(window).width(), 2111 mobile_width = body.data('mobileWidth') ?? 1200; 2112 2113 var mobile = window_width <= mobile_width; 2114 2115 // Helper Menu 2116 var open = 'is-active', 2117 openSubMenu = 'show_sub_menu', 2118 mobile_on = 'mobile_switch_on', 2119 mobile_off = 'mobile_switch_off', 2120 mobile_switcher = 'button_switcher'; 2121 2122 var init = function () { 2123 wglMenu.settings = $.extend({}, defaults, options); 2124 createButton(); 2125 showMenu(); 2126 elementorAnimation(); 2127 }; 2128 var showMenu = function () { 2129 if (jQuery(window).width() <= m_width) { 2130 if (!m_toggle.hasClass(open)) { 2131 createNavMobileMenu(); 2132 } 2133 } else { 2134 resetNavMobileMenu(); 2135 } 2136 }; 2137 var showMenuAfterResize = function(e) { 2138 window_width = jQuery(window).width(); 2139 if (window_width >= mobile_width){ 2140 mobile = false;
2141 showMenu(); 2142 motionEffect(true); 2143 }else if(window_width <= mobile_width && !mobile){ 2144 mobile = true; 2145 showMenu(); // init once on mobile 2146 motionEffect(true); 2147 } 2148 }; 2149 var createNavMobileMenu = function () { 2150 sub_menu.removeClass(openSubMenu); 2151 ds.hide().addClass(mobile_on); 2152 body.removeClass(mobile_on); 2153 }; 2154 var resetNavMobileMenu = function () { 2155 sub_menu.removeClass(openSubMenu); 2156 body.removeClass(mobile_on); 2157 ds.show().removeClass(mobile_on); 2158 m_toggle.removeClass(open); 2159 jQuery('.' + mobile_switcher).removeClass('is-active'); 2160 }; 2161 var createButton = function () { 2162 ds.find('.menu-item-has-children').each(function () { 2163 jQuery(this) 2164 .find('> a') 2165 .append('<span class="' + mobile_switcher + '"></span>'); 2166 }); 2167 }; 2168 var toggleMobileMenu = function (e) { 2169 ds.toggleClass(openSubMenu); 2170 body.toggleClass(mobile_on); 2171 2172 if (body.hasClass(mobile_on)){ 2173 body.removeClass(mobile_off); 2174 wglDisableBodyScroll(true, '.wgl-menu-outer_content'); 2175 }else{ 2176 body.addClass(mobile_off); 2177 wglDisableBodyScroll(false, '.wgl-menu-outer_content'); 2178 } 2179 2180 motionEffect(); 2181 }; 2182 2183 var elementorAnimation = function () { 2184 const mobileDrawer = menu.find('div[data-elementor-type="wgl-mobile-drawer"]'); 2185 const settings = mobileDrawer.data('elementor-settings'); 2186 if (!settings) return; 2187 const animation = settings.mobile_drawer_animation; 2188 if (!animation) return; 2189 2190 mobileDrawer.addClass('elementor-invisible'); 2191 }; 2192 2193 var motionEffect = function (resize = false) { 2194 const mobileDrawer = menu.find('div[data-elementor-type="wgl-mobile-drawer"]'); 2195 const settings = mobileDrawer.data('elementor-settings'); 2196 if (!settings) return; 2197 const animation = settings.mobile_drawer_animation; 2198 const delay = settings.mobile_drawer_animation_delay; 2199 let timerID; 2200 2201 if (!animation) return; 2202 2203 if((mobileDrawer.hasClass('animated') || resize) && !body.hasClass(mobile_on)){ 2204 mobileDrawer.removeClass('animated'); 2205 mobileDrawer.addClass('elementor-invisible'); 2206 mobileDrawer.removeClass(animation); 2207 if (timerID) { 2208 clearTimeout(timerID); 2209 } 2210 }else{ 2211 let animationClass = 'animated ' + animation; 2212 timerID = setTimeout(() => { 2213 mobileDrawer.removeClass('elementor-invisible'); 2214 mobileDrawer.addClass(animationClass); 2215 }, delay); 2216 } 2217 }; 2218 2219 var hideSubMenu = function (e) { 2220 if (!jQuery('.button_switcher').is(e.target)) { 2221 jQuery('.mobile_nav_wrapper .menu-item-has-children') 2222 .find('.sub-menu, div.wgl-e-container') 2223 .stop(true) 2224 .slideUp(450) 2225 .removeClass(openSubMenu); 2226 2227 jQuery('.mobile_nav_wrapper .menu-item-has-children') 2228 .find('.button_switcher') 2229 .removeClass(open); 2230 2231 if (jQuery(e.target).closest('.wgl-mobile-header').length && body.hasClass(mobile_on)) { 2232 toggleMobileMenu(); 2233 } 2234 } 2235 }; 2236 var showSubMenu = function (e) { 2237 e.preventDefault(); 2238 var item = jQuery(this).parents('li'); 2239 2240 if (!jQuery(this).hasClass(open)) { 2241 jQuery('.mobile_nav_wrapper .menu-item-has-children') 2242 .not(item) 2243 .find('.sub-menu, div.wgl-e-container') 2244 .stop(true) 2245 .slideUp(450) 2246 .removeClass(openSubMenu); 2247 jQuery('.mobile_nav_wrapper .menu-item-has-children') 2248 .not(item) 2249 .find('.button_switcher') 2250 .removeClass(open); 2251 jQuery('.mobile_nav_wrapper .menu-item-has-children') 2252 .not(item) 2253 .find('a[href*=\\#]') 2254 .removeClass(open); 2255 2256 jQuery(this) 2257 .parent() 2258 .prevAll('.sub-menu, div.wgl-e-container') 2259 .stop(true) 2260 .slideDown(450) 2261 .addClass(openSubMenu); 2262 jQuery(this) 2263 .parent() 2264 .nextAll('.sub-menu, div.wgl-e-container') 2265 .stop(true) 2266 .slideDown(450) 2267 .addClass(openSubMenu); 2268 } else { 2269 jQuery(this) 2270 .parent() 2271 .prevAll('.sub-menu, div.wgl-e-container') 2272 .stop(true) 2273 .slideUp(450) 2274 .removeClass(openSubMenu); 2275 jQuery(this) 2276 .parent() 2277 .nextAll('.sub-menu, div.wgl-e-container') 2278 .stop(true) 2279 .slideUp(450) 2280 .removeClass(openSubMenu); 2281 } 2282 2283 jQuery(this).toggleClass(open); 2284 }; 2285 var eventClose = function (e) { 2286 var container = $('.wgl-menu_outer'); 2287 2288 if ( 2289 !container.is(e.target) && 2290 container.has(e.target).length === 0 && 2291 $('body').hasClass(mobile_on) 2292 ) { 2293 toggleMobileMenu(); 2294 } 2295 }; 2296 var goBack = function (e) { 2297 e.preventDefault(); 2298 jQuery(this).closest('.sub-menu').removeClass(openSubMenu); 2299 jQuery(this).closest('.sub-menu').prev('a').removeClass(open); 2300 jQuery(this) 2301 .closest('.sub-menu') 2302 .prev('a') 2303 .find('.' + mobile_switcher) 2304 .removeClass(open); 2305 }; 2306 var mobileSticky = function(){ 2307 var top = jQuery(stickyMobile).height(); 2308 var y = jQuery(window).scrollTop(); 2309 if(jQuery(stickyMobile).hasClass('wgl-elementor-builder')){ 2310 top = stickyMobile.parent().height(); 2311 } 2312 if ( y >= top ) { 2313 jQuery(stickyMobile).addClass( 'sticky_mobile' ); 2314 } else { 2315 jQuery(stickyMobile).removeClass('sticky_mobile'); 2316 } 2317 }; 2318 2319 var startX, startY, startTime; 2320 2321 var touchStartHandler = function(e) { 2322 var touch = e.originalEvent.touches[0]; 2323 startX = touch.pageX; 2324 startY = touch.pageY; 2325 startTime = new Date().getTime(); 2326 }; 2327 2328 var touchEndHandler = function(e) { 2329 var touch = e.originalEvent.changedTouches[0]; 2330 var endX = touch.pageX; 2331 var endY = touch.pageY; 2332 var endTime = new Date().getTime(); 2333 var timeDiff = endTime - startTime; 2334 var xDiff = Math.abs(endX - startX); 2335 var yDiff = Math.abs(endY - startY); 2336 var swipeThreshold = 30; 2337 var swipeTimeThreshold = 500; 2338 2339 if (timeDiff < swipeTimeThreshold && xDiff < swipeThreshold && yDiff < swipeThreshold) { 2340 showSubMenu.call(this, e); 2341 } 2342 }; 2343 2344 // Init 2345 init(); 2346 2347 jQuery(wglMenu.settings.toggleBtn).on(click, toggleMobileMenu); 2348 jQuery(wglMenu.settings.overlay).on(click, eventClose); 2349 2350 // Switcher menu 2351 var switcherSelector = jQuery(wglMenu.settings.switcher); 2352 switcherSelector.on('touchstart', touchStartHandler); 2353 switcherSelector.on('touchend', touchEndHandler); 2354 switcherSelector.on('click', showSubMenu); 2355 2356 jQuery(wglMenu.settings.anchor).on('touchend mouseup', hideSubMenu); 2357 2358 // Go back menu 2359 jQuery(wglMenu.settings.back).on(click, goBack); 2360 2361 let delay_timer; 2362 jQuery( window ).resize( 2363 function() { 2364 clearTimeout(delay_timer); 2365 delay_timer = setTimeout(showMenuAfterResize, 100); 2366 } 2367 ); 2368 2369 if ( stickyMobile.length !== 0 && body.hasClass('admin-bar') ) { 2370 mobileSticky(); 2371 2372 jQuery( window ).scroll( 2373 function() { 2374 if (jQuery(window).width() <= stickyMobile.find('.mobile_nav_wrapper').data('mobileWidth')) { 2375 mobileSticky(); 2376 } 2377 } 2378 ); 2379 jQuery( window ).resize( 2380 function() { 2381 if (jQuery(window).width() <= stickyMobile.find('.mobile_nav_wrapper').data('mobileWidth')) { 2382 mobileSticky(); 2383 } 2384 } 2385 ); 2386 } 2387 }); 2388 }; 2389 })(jQuery); 2390 2391 (function($) { 2392 $.fn.wglVerticalMenu = function(options) { 2393 var defaults = { 2394 "switcher" : ".button_switcher_vertical", 2395 "anchor" : ".menu-item > a[href*=\\#]" 2396 }; 2397 2398 if (this.length === 0) { return this; } 2399 2400 return this.each(function () { 2401 var wglMenu = {}, ds = $(this); 2402 2403 //Helper Menu 2404 var open = "is-active", 2405 openSubMenu = "show_sub_menu", 2406 mobile_on = "menu_vertical_switch_on", 2407 mobile_switcher = "button_switcher_vertical"; 2408 2409 var init = function() { 2410 wglMenu.settings = $.extend({}, defaults, options); 2411 createButton(); 2412 }, 2413 createButton = function() { 2414 ds.find('.menu-item-has-children').each(function() { 2415 jQuery(this).find('> a').append('<span class="'+ mobile_switcher +'"></span>'); 2416 }); 2417 }, 2418 toggleMobileMenu = function (e) { 2419 ds.toggleClass(openSubMenu); 2420 body.toggleClass(mobile_on); 2421 2422 if (body.hasClass(mobile_on)){ 2423 wglDisableBodyScroll(true, '.wgl-menu-outer_content'); 2424 }else{ 2425 wglDisableBodyScroll(false, '.wgl-menu-outer_content'); 2426 } 2427 }, 2428 showSubMenu = function(e) { 2429 e.preventDefault(); 2430 var item = jQuery(this).parents('li'); 2431 2432 if (!jQuery(this).hasClass(open)) { 2433 ds.find('.menu-item-has-children') 2434 .not(item) 2435 .find('.sub-menu, div.wgl-e-container') 2436 .stop(true) 2437 .slideUp(450) 2438 .removeClass(openSubMenu); 2439 ds.find('.menu-item-has-children') 2440 .not(item) 2441 .find('.button_switcher') 2442 .removeClass(open); 2443 ds.find('.menu-item-has-children') 2444 .not(item) 2445 .find('a[href*=\\#]') 2446 .removeClass(open); 2447 2448 jQuery(this) 2449 .parent() 2450 .prevAll('.sub-menu, div.wgl-e-container') 2451 .stop(true) 2452 .slideDown(450) 2453 .addClass(openSubMenu); 2454 jQuery(this) 2455 .parent() 2456 .nextAll('.sub-menu, div.wgl-e-container') 2457 .stop(true) 2458 .slideDown(450) 2459 .addClass(openSubMenu); 2460 } else { 2461 jQuery(this) 2462 .parent() 2463 .prevAll('.sub-menu, div.wgl-e-container') 2464 .stop(true) 2465 .slideUp(450) 2466 .removeClass(openSubMenu); 2467 jQuery(this) 2468 .parent() 2469 .nextAll('.sub-menu, div.wgl-e-container') 2470 .stop(true) 2471 .slideUp(450) 2472 .removeClass(openSubMenu); 2473 } 2474 2475 jQuery(this).toggleClass(open); 2476 }, 2477 hideSubMenu = function(e) { 2478 let switcherTarget = ds.find('.button_switcher_vertical'); 2479 if(!switcherTarget.is(e.target)){ 2480 ds.find('.menu-item-has-children') 2481 .find('.sub-menu, div.wgl-e-container') 2482 .stop(true) 2483 .slideUp(450) 2484 .removeClass(openSubMenu); 2485 2486 ds.find('.menu-item-has-children') 2487 .find('.button_switcher') 2488 .removeClass(open); 2489 2490 if (jQuery(e.target).closest('.wgl-mobile-header').length) { 2491 toggleMobileMenu(); 2492 } 2493 } 2494 }; 2495 2496 /*Init*/ 2497 init(); 2498 2499 //switcher menu 2500 ds.find(wglMenu.settings.switcher).on(click, showSubMenu); 2501 ds.find(wglMenu.settings.anchor).on(click, hideSubMenu); 2502 2503 }); 2504 2505 }; 2506 })(jQuery); 2507 2508 menu.wglMobileMenu(); 2509 elementorEditormenu.wglVerticalMenu(); 2510 verticalMenu.wglVerticalMenu(); 2511} 2512 2513var wglDisableBodyScroll = (function () { 2514 2515 var _selector = false, 2516 _element = false, 2517 _clientY; 2518 2519 if (!Element.prototype.matches) 2520 Element.prototype.matches = Element.prototype.msMatchesSelector || 2521 Element.prototype.webkitMatchesSelector; 2522 2523 if (!Element.prototype.closest) 2524 Element.prototype.closest = function (s) { 2525 var ancestor = this; 2526 if (!document.documentElement.contains(el)) return null; 2527 do { 2528 if (ancestor.matches(s)) return ancestor; 2529 ancestor = ancestor.parentElement; 2530 } while (ancestor !== null); 2531 return el; 2532 }; 2533 2534 var preventBodyScroll = function (event) { 2535 if (false === _element || !event.target.closest(_selector)) { 2536 event.preventDefault(); 2537 } 2538 }; 2539 2540 var captureClientY = function (event) { 2541 if (event.ta
2541rgetTouches.length === 1) { 2542 _clientY = event.targetTouches[0].clientY; 2543 } 2544 }; 2545 2546 var preventOverscroll = function (event) { 2547 if (event.targetTouches.length !== 1) { 2548 return; 2549 } 2550 2551 var clientY = event.targetTouches[0].clientY - _clientY; 2552 2553 if (_element.scrollTop === 0 && clientY > 0) { 2554 event.preventDefault(); 2555 } 2556 2557 if ((_element.scrollHeight - _element.scrollTop <= _element.clientHeight) && clientY < 0) { 2558 event.preventDefault(); 2559 } 2560 }; 2561 2562 return function (allow, selector) { 2563 if (typeof selector !== "undefined") { 2564 _selector = selector; 2565 _element = document.querySelector(selector); 2566 } 2567 2568 if (true === allow) { 2569 if (false !== _element) { 2570 _element.addEventListener('touchstart', captureClientY, false); 2571 _element.addEventListener('touchmove', preventOverscroll, false); 2572 } 2573 document.body.addEventListener("touchmove", preventBodyScroll, false); 2574 } else { 2575 if (false !== _element) { 2576 _element.removeEventListener('touchstart', captureClientY, false); 2577 _element.removeEventListener('touchmove', preventOverscroll, false); 2578 } 2579 document.body.removeEventListener("touchmove", preventBodyScroll, false); 2580 } 2581 }; 2582}()); 2583function wglPageTransition(options = {}) { 2584 2585 const element = document.querySelector('[wgl-page-transition]'); 2586 2587 // Check if the element exists 2588 if (!element) { 2589 return; 2590 } 2591 // Utility functions for link property checks 2592 const utils = { 2593 isDisabled: (el) => el.dataset.eDisablePageTransition !== undefined, 2594 isEmptyHref: (el) => !el.getAttribute('href'), 2595 isTargetBlank: (el) => el.target === '_blank', 2596 notSameOrigin: (el) => !el.href.startsWith(window.location.origin), 2597 hasFragment: (el) => /.*#[\w\-/$.+()*@?~!&',;=:%]*$/.test(el.href), 2598 isPopup: (el) => 2599 el.getAttribute('aria-haspopup') === 'true' && 2600 el.getAttribute('aria-expanded') === 'false', 2601 isWoocommerce: (el) => { 2602 const href = el.href; 2603 return ( 2604 [ 2605 /\?add-to-cart=/, 2606 /\?remove_item=/, 2607 /\?undo_item=/, 2608 /\?product-page=/, 2609 /\?elementor_wc_logout=/, 2610 ].some((regex) => regex.test(href)) || 2611 el.closest('.woocommerce-MyAccount-navigation-link') 2612 ); 2613 }, 2614 isExcluded: (el, exclude) => exclude && new RegExp(exclude).test(el.href), 2615 }; 2616 2617 const classes = { 2618 entering: 'wgl-page-transition--entering', 2619 exiting: 'wgl-page-transition--exiting', 2620 entered: 'wgl-page-transition--entered', 2621 }; 2622 2623 const settings = { 2624 triggers: 2625 options.triggers || 'a:not([data-elementor-open-lightbox="yes"])', 2626 exclude: options.exclude || null, 2627 disabled: options.disabled || false, 2628 }; 2629 2630 function getLinks() { 2631 return document.querySelectorAll(settings.triggers); 2632 } 2633 2634 function shouldTriggerTransition(el) {
2635 return !Object.values(utils).some((fn) => fn(el, settings.exclude)); 2636 } 2637 2638 function handlePageShow() { 2639 if (element.classList.contains(classes.exiting)) { 2640 element.classList.add(classes.entered); 2641 element.classList.remove(classes.exiting); 2642 } 2643 2644 animateState('entering').then(() => { 2645 element.classList.add(classes.entered); 2646 }); 2647 } 2648 2649 // Handle clicks on links 2650 function handleClick(event) { 2651 const target = event.currentTarget; 2652 if (!shouldTriggerTransition(target)) return; 2653 2654 event.preventDefault(); 2655 const url = target.href; 2656 2657 element.classList.remove(classes.entered); 2658 animateState('exiting').then(() => { 2659 element.classList.add(classes.exiting); 2660 location.href = url; 2661 }); 2662 } 2663 2664 // Preload a link 2665 function prerenderLink(href) { 2666 if (document.querySelector(`link[href="${href}"]`)) return; 2667 2668 const link = document.createElement('link'); 2669 link.rel = 'prerender'; 2670 link.href = href; 2671 document.head.appendChild(link); 2672 } 2673 2674 // Handle hover or touch for preloading 2675 function handleMouseEnter(event) { 2676 const target = event.currentTarget; 2677 if (shouldTriggerTransition(target)) { 2678 prerenderLink(target.href); 2679 } 2680 } 2681 2682 // Animate between states 2683 function animateState(state) { 2684 const className = classes[state]; 2685 if (!className) return Promise.resolve(); 2686 2687 element.classList.add(className); 2688 const duration = 2689 parseInt( 2690 getComputedStyle(element).getPropertyValue( 2691 '--wgl-page-transition-animation-duration' 2692 ) 2693 ) || 500; 2694 2695 return new Promise((resolve) => { 2696 setTimeout(() => { 2697 element.classList.remove(className); 2698 resolve(); 2699 }, duration); 2700 }); 2701 } 2702 2703 // Bind events to links 2704 function bindEvents() { 2705 const links = getLinks(); 2706 2707 window.addEventListener('pageshow', handlePageShow); 2708 2709 links.forEach((link) => { 2710 link.addEventListener('click', handleClick); 2711 link.addEventListener('mouseenter', handleMouseEnter); 2712 link.addEventListener('touchstart', handleMouseEnter); 2713 }); 2714 } 2715 2716 // Initialize the transitions 2717 function init() { 2718 if (settings.disabled) return; 2719 bindEvents(); 2720 } 2721 2722 init(); 2723} 2724// wgl Page Title Parallax 2725function wglPageTitleParallax() { 2726 var page_title = jQuery('.page-header.page_title_parallax') 2727 if (page_title.length !== 0) { 2728 if ( !/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i.test(navigator.userAgent || navigator.vendor || window.opera) ) { 2729 page_title.paroller(); 2730 } 2731 } 2732} 2733 2734// wgl Extended Parallax 2735function wglExtendedParallax() { 2736 var item = jQuery('.extended-parallax') 2737 if (item.length !== 0) { 2738 if ( !/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i.test(navigator.userAgent || navigator.vendor || window.opera) ) { 2739 item.each(function () { 2740 jQuery(this).paroller(); 2741 }) 2742 } 2743 } 2744} 2745 2746// wgl Portfolio Single Parallax 2747function wglPortfolioParallax() { 2748 var portfolio = jQuery('.wgl-portfolio-item_bg.portfolio_parallax') 2749 if (portfolio.length !== 0 ) { 2750 portfolio.paroller(); 2751 } 2752} 2753// wgl Portfolio Single Parallax 2754function wglPortfolioParallax() { 2755 var portfolio = jQuery('.wgl-portfolio-item_bg.portfolio_parallax') 2756 if (portfolio.length !== 0 ) { 2757 portfolio.paroller(); 2758 } 2759} 2760 2761function wglParallaxVideo() { 2762 jQuery('.parallax-video').each(function() { 2763 jQuery(this).jarallax({ 2764 loop: true, 2765 speed: 1, 2766 videoSrc: jQuery(this).data('video'), 2767 videoStartTime: jQuery(this).data('start'), 2768 videoEndTime: jQuery(this).data('end') 2769 }); 2770 }); 2771} 2772 2773function wglParticlesCustom() { 2774 jQuery('.wgl-particles-js').each(function() { 2775 var id = jQuery(this).attr('id'); 2776 var type = jQuery(this).data('particles-type'); 2777 var color_type = jQuery(this).data('particles-colors-type'); 2778 var color = jQuery(this).data('particles-color'); 2779 var color_line = jQuery(this).data('particles-color'); 2780 var number = jQuery(this).data('particles-number'); 2781 var lines = jQuery(this).data('particles-line'); 2782 var size = jQuery(this).data('particles-size'); 2783 var speed = jQuery(this).data('particles-speed'); 2784 var hover = jQuery(this).data('particles-hover'); 2785 var hover_mode = jQuery(this).data('particles-hover-mode'); 2786 switch (type) { 2787 case 'particles': 2788 default: 2789 type = 'circle'; 2790 break; 2791 case 'hexagons': 2792 type = 'polygon'; 2793 break; 2794 } 2795 if (color_type == 'random_colors') { 2796 color = color.split(','); 2797 color_line = color[0]; 2798 } 2799 2800 tsParticles.load(id, { 2801 particles: { 2802 number: { 2803 value: number, 2804 density: { 2805 enable: true, 2806 value_area: 800 2807 } 2808 }, 2809 color: { 2810 value: color 2811 }, 2812 shape: { 2813 type: type, 2814 polygon: { 2815 nb_sides: 6 2816 } 2817 }, 2818 opacity: { 2819 value: 1, 2820 random: true, 2821 anim: { 2822 enable: false, 2823 speed: 1, 2824 opacity_min: 0.1, 2825 sync: false 2826 } 2827 }, 2828 size: { 2829 value: size, 2830 random: true, 2831 anim: { 2832 enable: false, 2833 speed: 30, 2834 size_min: 1, 2835 sync: false 2836 } 2837 }, 2838 line_linked: { 2839 enable: lines, 2840 distance: 150, 2841 color: color_line, 2842 opacity: 0.4, 2843 width: 1 2844 }, 2845 move: { 2846 enable: true, 2847 speed: speed, 2848 direction: 'none', 2849 random: false, 2850 straight: false, 2851 out_mode: 'out', 2852 bounce: false, 2853 attract: { 2854 enable: false, 2855 rotateX: 600, 2856 rotateY: 1200 2857 } 2858 } 2859 }, 2860 interactivity: { 2861 detect_on: 'canvas', 2862 events: { 2863 onhover: { 2864 enable: hover, 2865 mode: hover_mode 2866 }, 2867 onclick: { 2868 enable: true, 2869 mode: 'push' 2870 }, 2871 resize: true 2872 }, 2873 modes: { 2874 grab: { 2875 distance: 150, 2876 line_linked: { 2877 opacity: 1 2878 } 2879 }, 2880 bubble: { 2881 distance: 200, 2882 size: size * 1.6, 2883 duration: 20, 2884 opacity: 1, 2885 speed: 30 2886 }, 2887 repulse: { 2888 distance: 80, 2889 duration: 0.4 2890 }, 2891 push: { particles_nb: 4 }, 2892 remove: { particles_nb: 2 } 2893 } 2894 }, 2895 retina_detect: true 2896 }); 2897 var update; 2898 update = function() { 2899 requestAnimationFrame(update); 2900 }; 2901 requestAnimationFrame(update); 2902 }); 2903} 2904 2905function wglParticlesImageCustom() { 2906 2907 jQuery('.wgl-particles-img-js').each(function () { 2908 var id = jQuery(this).attr('id'); 2909 var color = jQuery(this).data('particles-color') || "#000000"; 2910 2911 var number = jQuery(this).data('particles-number'); 2912 var lines = jQuery(this).data('particles-line'); 2913 var size = jQuery(this).data('particles-size'); 2914 var speed = jQuery(this).data('particles-speed'); 2915 var hover = jQuery(this).data('particles-hover'); 2916 var hover_mode = jQuery(this).data('particles-hover-mode'); 2917 var rotate = jQuery(this).data('particles-rotate'); 2918 rotate = rotate === 'yes' ? true : false;
2919 var rotate_speed = jQuery(this).data('particles-rotate-animation') || 0; 2920 2921 var img_src = jQuery(this).data('image').split(","); 2922 2923 var imageElement = []; 2924 2925 img_src.forEach(function (item, i, arr) { 2926 var url = new URL(item); 2927 var element = {}; 2928 element.height = url.searchParams.get('height'); 2929 element.replaceColor = true; 2930 element.src = item.split('?')[0]; 2931 element.width = url.searchParams.get('width'); 2932 element.fill = true; 2933 element.close = true; 2934 imageElement.push(element); 2935 }); 2936 2937 tsParticles.load(id, { 2938 "detectRetina": true, 2939 "fpsLimit": 60, 2940 "particles": { 2941 "number": { 2942 "value": number, 2943 "density": { 2944 "enable": true, 2945 "area": 800 2946 }, 2947 "limit": 0, 2948 }, 2949 "color": { 2950 "value": color 2951 }, 2952 "shape": { 2953 "image": imageElement, 2954 "polygon": { 2955 "close": true, 2956 "fill": true, 2957 "sides": 5 2958 }, 2959 "type": "image", 2960 "custom": {} 2961 }, 2962 "opacity": { 2963 "animation": { 2964 "enable": false, 2965 "minimumValue": 0.1, 2966 "speed": 1, 2967 "sync": false 2968 }, 2969 "random": { 2970 "enable": false, 2971 "minimumValue": 1 2972 }, 2973 "value": 1 2974 }, 2975 "size": { 2976 "animation": { 2977 "enable": false, 2978 "minimumValue": 1, 2979 "speed": 40, 2980 "sync": false 2981 }, 2982 "random": { 2983 "enable": false, 2984 "minimumValue": 1 2985 }, 2986 "value": size 2987 }, 2988 2989 "lineLinked": { 2990 "blink": false, 2991 "color": { 2992 "value": color 2993 }, 2994 "consent": false, 2995 "distance": 150, 2996 "enable": lines, 2997 "opacity": 0.4, 2998 "width": 1 2999 }, 3000 "move": { 3001 "collisions": false, 3002 "direction": "none", 3003 "enable": true, 3004 "outMode": "out", 3005 "random": false, 3006 "speed": speed, 3007 "straight": false, 3008 "attract": { 3009 "enable": false, 3010 "rotate": { 3011 "x": 600, 3012 "y": 1200 3013 } 3014 }, 3015 }, 3016 "rotate": { 3017 "animation": { 3018 "enable": rotate, 3019 "speed": rotate_speed, 3020 "sync": false 3021 }, 3022 "direction": "random", 3023 "random": true, 3024 "value": 0 3025 }, 3026 "stroke": { 3027 "color": { 3028 "value": color 3029 }, 3030 "width": 0, 3031 "opacity": 1 3032 } 3033 }, 3034 "interactivity": { 3035 "detectsOn": "canvas", 3036 "events": { 3037 "onClick": { 3038 "enable": false, 3039 "mode": "push" 3040 }, 3041 "onHover": { 3042 "enable": hover, 3043 "mode": hover_mode, 3044 "parallax": { 3045 "enable": false, 3046 "force": 60, 3047 "smooth": 10 3048 } 3049 }, 3050 "resize": true 3051 }, 3052 "modes": { 3053 "bubble": { 3054 "distance": 200, 3055 "duration": 20, 3056 "opacity": 1, 3057 "size": size * 1.6, 3058 }, 3059 "connect": { 3060 "distance": 80, 3061 "lineLinked": { 3062 "opacity": 0.5 3063 }, 3064 "radius": 60 3065 }, 3066 "grab": { 3067 "distance": 150, 3068 "lineLinked": { 3069 "opacity": 1, 3070 } 3071 }, 3072 "push": { 3073 "quantity": 4 3074 }, 3075 "remove": { 3076 "quantity": 2 3077 }, 3078 "repulse": { 3079 "distance": 200, 3080 "duration": 0.4 3081 }, 3082 "slow": { 3083 "factor": 1, 3084 "radius": 0 3085 } 3086 } 3087 }, 3088 "backgroundMask": { 3089 "cover": { 3090 "color": { 3091 "value": "#fff" 3092 }, 3093 "opacity": 1 3094 }, 3095 "enable": false 3096 }, 3097 "pauseOnBlur": true, 3098 "background": {} 3099 }); 3100 3101 var update; 3102 update = function () { 3103 requestAnimationFrame(update); 3104 }; 3105 requestAnimationFrame(update); 3106 3107 3108 3109 }); 3110} 3111 3112function wglPhysicsButton($scope = false) { 3113 let buttonPhysics = jQuery('.wgl-button_physics'); 3114 if (buttonPhysics.length) { 3115 buttonPhysics.each(function () { 3116 let self = jQuery(this);
3117 self.appear(function() { 3118 var Engine = Matter.Engine, 3119 Render = Matter.Render, 3120 Events = Matter.Events, 3121 MouseConstraint = Matter.MouseConstraint, 3122 Mouse = Matter.Mouse, 3123 Bodies = Matter.Bodies, 3124 Query = Matter.Query; 3125 3126 // create an engine 3127 var engine = Engine.create(); 3128 3129 // .wglPhysics-view 3130 const content = this.querySelector('.wgl-physics_canvas'); 3131 let wglPhysicsArea = this.querySelector('.wgl-physics_elements'); 3132 3133 let wglPhysicsAmount = 3134 wglPhysicsArea.querySelectorAll('.wgl-physics_item').length; 3135 3136 const delay = Number(this.querySelector('.wgl-physics_elements').getAttribute('data-delay')) * 1000; 3137 var w = self.find('.wgl-physics_matter').width(); 3138 var h = self.find('.wgl-physics_matter').height(); 3139 let numCircles = wglPhysicsAmount; 3140 3141 let elements = []; 3142 let wglPhysicsCircles = []; 3143 const scaleFactor = 'yes' === this.querySelector('.wgl-physics_elements').getAttribute('data-increase-active') ? 1.2 : 1; 3144 const restitution = Number(this.querySelector('.wgl-physics_elements').getAttribute('data-restitution')); 3145 const friction = Number(this.querySelector('.wgl-physics_elements').getAttribute('data-friction')); 3146 const density = Number(this.querySelector('.wgl-physics_elements').getAttribute('data-density')); 3147 3148 var render = Render.create({ 3149 element: content, 3150 engine: engine, 3151 options: { 3152 width: w, 3153 height: h, 3154 pixelRatio: 2, 3155 background: 'transparent', 3156 wireframes: false, 3157 }, 3158 }); 3159 3160 var mouse = Mouse.create(render.canvas), 3161 mouseConstraint = MouseConstraint.create(engine, { 3162 mouse: mouse, 3163 constraint: { 3164 stiffness: 0.2, 3165 render: { 3166 visible: false, 3167 }, 3168 }, 3169 }); 3170 3171 class wglPhysicsCircle { 3172 constructor(itemElement) { 3173 this.element = wglPhysicsArea.querySelector( 3174 `.wgl-physics_item[data-item-id="${itemElement.getAttribute('data-item-id')}"]` 3175 ); 3176 3177 if (!this.element.classList.contains('visible')) { 3178 this.element.classList.add('visible'); 3179 } 3180 3181 const size = parseInt( 3182 getComputedStyle(this.element).getPropertyValue( 3183 '--size-circle' 3184 ) 3185 ); 3186 const link = this.element 3187 .querySelector('.wgl-button_physics_link') ? this.element 3188 .querySelector('.wgl-button_physics_link') 3189 .getAttribute('href') : '#'; 3190 3191 const target = this.element 3192 .querySelector('.wgl-button_physics_link') ? this.element 3193 .querySelector('.wgl-button_physics_link') 3194 .getAttribute('target') : '_self'; 3195 3196 let x = Math.floor(Math.random() * w); 3197 let y = 0; 3198 3199 this.radius = size * 0.5; 3200 this.body = Matter.Bodies.circle(x, y, this.radius, { 3201 render: { 3202 fillStyle: 'transparent', 3203 }, 3204 url: link, 3205 target: target, 3206 idItem: this.element.getAttribute('data-item-id'), 3207 restitution: restitution, // Adjust this value to control bounce on collisions 3208 friction: friction, // Adjust this value to control friction 3209 density: density, // Adjust this value to control mass 3210 }); 3211 3212 this.element.style.width = size * 2 + 'px'; 3213 this.element.style.height = size * 2 + 'px'; 3214 this.cornea = document.createElement('div'); 3215 this.element.appendChild(this.cornea); 3216 } 3217 3218 update() { 3219 this.pos = { 3220 x: this.body.position.x, 3221 y: this.body.position.y, 3222 }; 3223 3224 if ( 3225 activeCircle && 3226 activeCircle.idItem === 3227 this.element.getAttribute('data-item-id') 3228 ) { 3229 const xOffset = (this.radius * (scaleFactor - 1)) / 2; 3230 const yOffset = (this.radius * (scaleFactor - 1)) / 2; 3231 3232 this.element.style.width = 3233 this.radius * 2 * scaleFactor + 'px'; 3234 this.element.style.height = 3235 this.radius * 2 * scaleFactor + 'px'; 3236 this.element.style.transform = `translate(${ 3237 this.pos.x - this.radius - xOffset 3238 }px, ${ 3239 this.pos.y - this.radius - yOffset 3240 }
3240px) scale(${scaleFactor})`; 3241 } else { 3242 this.element.style.width = this.radius * 2 + 'px'; 3243 this.element.style.height = this.radius * 2 + 'px'; 3244 this.element.style.transform = `translate(${ 3245 this.pos.x - this.radius 3246 }px, ${this.pos.y - this.radius}px) scale(1)`; 3247 } 3248 } 3249 3250 lookAt(pos) { 3251 let diff = {x: pos.x - this.pos.x, y: pos.y - this.pos.y}; 3252 let polar = [ 3253 Math.sqrt(diff.x * diff.x + diff.y * diff.y), 3254 Math.atan2(diff.y, diff.x), 3255 ]; 3256 let dist = 3257 polar[0] < this.radius * 0.5 3258 ? polar[0] 3259 : this.radius * 0.5; 3260 this.cornea.style.transform = `translate(${ 3261 Math.cos(polar[1]) * dist 3262 }px, ${Math.sin(polar[1]) * dist}px)`; 3263 3264 window.cornea = `translate(${ 3265 Math.cos(polar[1]) * dist 3266 }px, ${Math.sin(polar[1]) * dist}px)`; 3267 window.polar = polar; 3268 } 3269 } 3270 3271 window.render = render; 3272 3273 // create bounds 3274 var ground = Bodies.rectangle(w / 2 + 160, h + 80, w + 320, 160, { 3275 isStatic: true, 3276 }); 3277 var wallLeft = Bodies.rectangle(-80, 0, 160, h * 2, { 3278 isStatic: true, 3279 }); 3280 var wallRight = Bodies.rectangle(w + 80, 0, 160, h * 2, { 3281 isStatic: true, 3282 }); 3283 var roof = Bodies.rectangle(w / 2 + 160, -80, w + 320, 160, { 3284 isStatic: true, 3285 }); 3286 3287 let mousepos = {x: 0, y: 0}; 3288 3289 window.addEventListener('pointermove', (e) => { 3290 mousepos = {x: e.clientX, y: e.clientY}; 3291 }); 3292 3293 elements.push(ground); 3294 elements.push(wallLeft); 3295 elements.push(wallRight); 3296 elements.push(roof); 3297 3298 const items = wglPhysicsArea.querySelectorAll('.wgl-physics_item'); 3299 const filteredItems = []; 3300 3301 items.forEach((itemElement) => { 3302 if ( 3303 !(itemElement.classList.contains('hide_mobile') && 3304 itemElement.getAttribute('data-resolution') && 3305 window.innerWidth <= itemElement.getAttribute('data-resolution')) 3306 ) { 3307 filteredItems.push(itemElement); 3308 } 3309 }); 3310 3311 filteredItems.forEach((itemElement, i) => { 3312 setTimeout(() => { 3313 wglPhysicsCircles.push(new wglPhysicsCircle(itemElement)); 3314 Matter.World.add(engine.world, wglPhysicsCircles[i].body); 3315 }, i * delay); 3316 }); 3317 Matter.World.add(engine.world, elements); 3318 3319 Matter.World.add(engine.world, mouseConstraint); 3320 3321 render.mouse = mouse; 3322 3323 let click = false; 3324 3325 mouseConstraint.mouse.element.removeEventListener( 3326 'mousewheel', 3327 mouseConstraint.mouse.mousewheel 3328 ); 3329 mouseConstraint.mouse.element.removeEventListener( 3330 'DOMMouseScroll', 3331 mouseConstraint.mouse.mousewheel 3332 ); 3333 3334 document.addEventListener('mousedown', () => (click = true)); 3335 document.addEventListener('mousemove', () => (click = false)); 3336 3337 Events.on(mouseConstraint, 'mousedown', function (event) { 3338 var mouseConstraint = event.source; 3339 var bodies = engine.world.bodies; 3340 if (!mouseConstraint.bodyB) { 3341 for (var i = 0; i < bodies.length; i++) { 3342 var body = bodies[i]; 3343 if ( 3344 Matter.Bounds.contains( 3345 body.bounds, 3346 mouseConstraint.mouse.position 3347 ) 3348 ) { 3349 jQuery(self).find('[data-item-id="' + body.idItem + '"]').addClass('active'); 3350 break; 3351 } 3352 } 3353 } 3354 }); 3355 3356 Events.on(mouseConstraint, 'mouseup', function (event) { 3357 var mouseConstraint = event.source; 3358 var bodies = engine.world.bodies; 3359 if (!mouseConstraint.bodyB) { 3360 for (var i = 0; i < bodies.length; i++) { 3361 var body = bodies[i]; 3362 jQuery(self).find('[data-item-id="' + body.idItem + '"]').removeClass('active'); 3363 if (true === click) { 3364 if ( 3365 Matter.Bounds.contains( 3366 body.bounds, 3367 mouseConstraint.mouse.position 3368 ) 3369 ) { 3370 var bodyUrl = body.url; 3371 if (undefined !== bodyUrl && '#' !== bodyUrl) { 3372 try { 3373 let target = body.target; 3374 if(!target || '_self' === target){ 3375 window.location.href = bodyUrl; 3376 }else{ 3377 let newWindow = window.open(bodyUrl, target); 3378 if (!newWindow || newWindow.closed || 'undefined' === typeof newWindow.closed) { 3379 window.location.href = bodyUrl; 3380 } 3381 } 3382 } catch (e) { 3383 window.location.href = bodyUrl; 3384 } 3385 } 3386 break; 3387 } 3388 } 3389 } 3390 } 3391 }); 3392 3393 let activeCircle = null; 3394 3395 Events.on(mouseConstraint, 'startdrag', (event) => { 3396 activeCircle = event.body; 3397 Matter.Body.scale(activeCircle, scaleFactor, scaleFactor); 3398 }); 3399 3400 Events.on(mouseConstraint, 'enddrag', (event) => { 3401 Matter.Body.scale( 3402 activeCircle, 3403 1 / scaleFactor, 3404 1 / scaleFactor 3405 ); 3406 activeCircle = null; 3407 }); 3408 3409 Events.on(mouseConstraint, 'mousemove', function (event) { 3410 var foundPhysics = Query.point(wglPhysicsCircles.map(circle => circle.body), event.mouse.position); 3411
3412 wglPhysicsCircles.forEach((wglPhysicscirc) => { 3413 jQuery(wglPhysicscirc.element).removeClass('hover'); 3414 render.canvas.style.cursor = "default"; 3415 }); 3416 3417 if ( 3418 foundPhysics[0] 3419 ) { 3420 jQuery(self).find('[data-item-id="' + foundPhysics[0].idItem + '"]').addClass('hover'); 3421 render.canvas.style.cursor = "pointer"; 3422 } 3423 }); 3424 3425 this.addEventListener('mouseleave', () => { 3426 wglPhysicsCircles.forEach((wglPhysicscirc) => { 3427 jQuery(wglPhysicscirc.element).removeClass('hover'); 3428 }); 3429 }); 3430 3431 // run the engine 3432 Matter.Runner.run(engine); 3433 3434 // run the renderer 3435 Render.run(render); 3436 3437 Matter.Events.on(engine, 'afterUpdate', () => { 3438 wglPhysicsCircles.forEach((wglPhysicscirc) => { 3439 wglPhysicscirc.update(); 3440 wglPhysicscirc.lookAt(mousepos); 3441 }); 3442 }); 3443 3444 let elementsHasVisible = false; 3445 3446 const hideMobile = function () { 3447 const item = wglPhysicsArea.querySelectorAll('.wgl-physics_item'); 3448 3449 item.forEach(function (value) { 3450 3451 if (value.classList.contains('hide_mobile') && value.getAttribute('data-resolution')) { 3452 if (window.innerWidth <= value.getAttribute('data-resolution')) { 3453 value.style.display = 'none'; 3454 } else { 3455 elementsHasVisible = true; 3456 value.style.display = 'flex'; 3457 } 3458 } 3459 }); 3460 } 3461 3462 hideMobile(); 3463 3464 mouseConstraint.mouse.element.removeEventListener('touchstart', mouseConstraint.mouse.mousedown); 3465 mouseConstraint.mouse.element.removeEventListener('touchmove', mouseConstraint.mouse.mousemove); 3466 mouseConstraint.mouse.element.removeEventListener('touchend', mouseConstraint.mouse.mouseup); 3467 3468 if(elementsHasVisible){ 3469 mouseConstraint.mouse.element.addEventListener('touchstart', mouseConstraint.mouse.mousedown, { passive: true }); 3470 3471 mouseConstraint.mouse.element.addEventListener('touchmove', (e) => { 3472 if (mouseConstraint.body && e.cancelable) { 3473 mouseConstraint.mouse.mousemove(e); 3474 } 3475 }); 3476 mouseConstraint.mouse.element.addEventListener('touchend', (e) => { 3477 if (mouseConstraint.body && e.cancelable) { 3478 mouseConstraint.mouse.mouseup(e); 3479 } 3480 }); 3481 } 3482 3483 window.addEventListener('resize', hideMobile); 3484 }); 3485 }); 3486 } 3487} 3488 3489// wgl Pie Chart 3490function wglPieChartInit() { 3491 3492 var item = jQuery('.wgl-pie_chart'); 3493 3494 if (item.length) { 3495 item.each(function() { 3496 var chart = item.find('.chart'); 3497 3498 item.appear(function() { 3499 jQuery(chart).easyPieChart({ 3500 barColor: jQuery(this).data("barColor"), 3501 trackColor: jQuery(this).data("trackColor"), 3502 scaleColor: false, 3503 lineCap: 'square', 3504 lineWidth: jQuery(this).data("lineWidth"), 3505 animate: { duration: 1400, enabled: true }, 3506 size: jQuery(this).data("size"), 3507 onStep: function(from, to, percent) { 3508 jQuery(this.el).find('.chart__percent').text(Math.round(percent) + '%'); 3509 } 3510 }); 3511 }); 3512 }); 3513 } 3514} 3515// http://brutaldesign.github.io/swipebox/ 3516function wglVideoboxInit() { 3517 var gallery = jQuery(".videobox, .swipebox, .gallery a[href$='.jpg'], .gallery a[href$='.jpeg'], .gallery a[href$='.JPEG'], .gallery a[href$='.gif'], .gallery a[href$='.png']"); 3518 if (gallery.length !== 0 ) { 3519 gallery.each(function() { 3520 jQuery(this).attr('data-elementor-open-lightbox', 'yes'); 3521 }); 3522 } 3523} 3524// wgl Single Portfolio Image Wide 3525function wglPageTitleParallax() { 3526 var imgWide = jQuery('.item__image.item__image-wide') 3527 var init = function () { 3528 if (imgWide.length !== 0) { 3529 var containerWidth = imgWide.parent().innerWidth(), 3530 windowWidth = window.innerWidth,
3531 correctOffset = 0, 3532 dataWidth = imgWide.data('img-width'); 3533 3534 if (windowWidth != containerWidth) { 3535 correctOffset = (windowWidth - containerWidth) / 2; 3536 } 3537 3538 imgWide.css('--pf-width', windowWidth + 'px'); 3539 imgWide.css('--pf-content-width', dataWidth ); 3540 imgWide.css('max-width', windowWidth + 'px'); 3541 imgWide.css('left', '-' + correctOffset + 'px'); 3542 } else { 3543 imgWide.css('--pf-width', ''); 3544 imgWide.css('--pf-content-width', ''); 3545 imgWide.css('max-width', ''); 3546 imgWide.css('left', ''); 3547 } 3548 } 3549 3550 /*Init*/ 3551 init(); 3552 window.addEventListener('resize', () => { 3553 init(); 3554 }); 3555} 3556function wglProfile(){ 3557 let body = jQuery('body'); 3558 3559 body.on('click tap', '.wgl-mobile-header .wgl-dashboard-profile .nav > li > a', function(e){ 3560 e.preventDefault(); 3561 jQuery(this).closest('.nav').find('.sub-menu').toggleClass('active'); 3562 }); 3563 3564 body.on('click tap', function(e) { 3565 var profile_container = jQuery('.wgl-mobile-header .wgl-dashboard-profile'); 3566 if (!jQuery(e.target).closest(profile_container).length) { 3567 profile_container.find('.sub-menu').removeClass('active'); 3568 } 3569 }); 3570} 3571// WGL Progress Bar 3572 3573function wglProgressBarsInit(item) { 3574 let widgetSelector = '.wgl-progress-bar', 3575 widgetEl = item ? jQuery(item).find(widgetSelector) : jQuery(widgetSelector); 3576 3577 widgetEl.each(function () { 3578 let $_this = jQuery(this), 3579 bar = $_this.find('.bar__filled'), 3580 3581 value = bar.data('value'), 3582 max = bar.data('max-value'), 3583 speed = bar.data('speed'), 3584 sep = bar.data('sep'), 3585 3586 progressWidth = (value / max) * 100; 3587 3588 $_this.appear(function() { 3589 $_this.find('.value__digit').countTo({ 3590 from: 0, 3591 to: value, 3592 speed: speed, 3593 refreshInterval: 10, 3594 separator: sep 3595 }); 3596 bar.css({ 3597 'width': progressWidth + '%', 3598 'transitionDuration': speed + 'ms', 3599 }); 3600 3601 if ($_this.hasClass('layout-dynamic')) { 3602 $_this.find('.progress__content').css({ 3603 'width': progressWidth + '%', 3604 'transitionDuration': speed + 'ms', 3605 }); 3606 }else if ($_this.hasClass('layout-dynamic_middle')) { 3607 $_this.addClass('init'); 3608 } 3609 }); 3610 }); 3611} 3612 3613function wglSearchInit() { 3614 3615 // Create plugin Search 3616 (function($) { 3617 3618 $.fn.wglSearch = function(options) { 3619 var defaults = { 3620 'toggleID' : '.header_search-button', 3621 'closeID' : '.header_search-close', 3622 'searchField' : '.header_search-field', 3623 'body' : 'body > *:not(header)', 3624 }; 3625 3626 if (this.length === 0) { return this; } 3627 3628 return this.each(function() { 3629 var wglSearch = {}, 3630 s = $(this), 3631 openClass = 'header_search-open', 3632 searchClass = '.header_search', 3633 3634 init = function() { 3635 wglSearch.settings = $.extend({}, defaults, options); 3636 }, 3637 open = function() { 3638 $(s).addClass(openClass); 3639 setTimeout(function() { 3640 $(s) 3641 .find('input.search-field') 3642 .focus(); 3643 }, 400); 3644 return false; 3645 }, 3646 close = function() { 3647 $(s).removeClass(openClass); 3648 }, 3649 toggleSearch = function(e) { 3650 if (! $(s).closest(searchClass).hasClass(openClass)) { 3651 open(); 3652 } else { 3653 close(); 3654 } 3655 }, 3656 eventClose = function(e) { 3657 if (! $(e.target).closest('.search-form').length) { 3658 if ($(searchClass).hasClass(openClass)) { 3659 close(); 3660 } 3661 } 3662 }; 3663 $(document).on('keydown', function(e) { 3664 if (e.which === 27 && $(searchClass).hasClass(openClass)) close(); 3665 }); 3666 3667 // Init 3668 init(); 3669 3670 if ($(this).hasClass('search_standard') || $(this).hasClass('search_standard_fw')) { 3671 $(this).find(wglSearch.settings.toggleID).on(click, toggleSearch); 3672 $(this).find(wglSearch.settings.closeID).on(click, eventClose); 3673 } else { 3674 $(wglSearch.settings.toggleID).on(click, toggleSearch); 3675 $(wglSearch.settings.searchField).on(click, eventClose); 3676 } 3677 3678 $(wglSearch.settings.body).on(click, eventClose); 3679 3680 }); 3681 3682 }; 3683 3684 })(jQuery); 3685 3686 jQuery('.header_search').wglSearch(); 3687 3688} 3689// WGL Service 1 3690 3691function wglServiceInit() { 3692 const selector = ".toggling_content .wgl-service_wrapper_description, " + 3693 ".toggling_image .wgl-service_media, " + 3694 ".animation_toggling .wgl-infobox-content_wrapper"; 3695
3696 const setMaxHeight = (elements) => { 3697 elements.forEach(el => { 3698 el.style.setProperty('--max-height', el.scrollHeight + 'px'); 3699 }); 3700 }; 3701 3702 const updateAll = () => { 3703 const allElements = document.querySelectorAll(selector); 3704 setMaxHeight(allElements); 3705 }; 3706 3707 setMaxHeight([...document.querySelectorAll(selector)].filter(el => !el.closest('.swiper'))); 3708 3709 document.querySelectorAll('.swiper').forEach(swiperEl => { 3710 const updateSwiperElements = () => { 3711 setMaxHeight(swiperEl.querySelectorAll(selector)); 3712 }; 3713 3714 const attach = () => { 3715 if (!swiperEl.swiper) return; 3716 swiperEl.swiper.on('init', updateSwiperElements); 3717 swiperEl.swiper.on('slideChangeTransitionEnd', updateSwiperElements); 3718 updateSwiperElements(); 3719 }; 3720 3721 if (swiperEl.swiper) { 3722 attach(); 3723 } else { 3724 const observer = new MutationObserver(() => { 3725 if (swiperEl.swiper) { 3726 attach(); 3727 observer.disconnect(); 3728 } 3729 }); 3730 observer.observe(swiperEl, { childList: true, subtree: true }); 3731 } 3732 }); 3733 3734 window.addEventListener('resize', () => { 3735 requestAnimationFrame(updateAll); 3736 }); 3737} 3738// Showcase-2 3739 3740function wglShowcase2Init() { 3741 let $showcase_init = jQuery('.wgl-showcase-2'); 3742 if ($showcase_init.length) { 3743 3744 $showcase_init.each(function() { 3745 let $this = jQuery(this), 3746 breakpoint = $this.data('breakpoint'), 3747 item = $this.find('.showcase-2__item'), 3748 content = $this.find('.showcase-2__content_wrapper'), 3749 titles = $this.find('.showcase-2__title'), 3750 itemInner = $this.find('.showcase-2__item_inner'), 3751 active = $this.find('.active'); 3752 3753 let mouse_timer; 3754 mouse_timer = setTimeout(function () { 3755 item.on('mouseenter tap', function(){ 3756 clearTimeout(mouse_timer); 3757 3758 let obj = jQuery(this); 3759 if(!obj.hasClass('active')){ 3760 item.removeClass('active'); 3761 obj.addClass('active'); 3762 3763 if($this.hasClass('content_animation-yes')) { 3764 if ($this.hasClass('mobile_view_enable')) { 3765 content.stop(true, true).slideUp(800); 3766 obj.find('.showcase-2__content_wrapper').slideDown(800); 3767 } else { 3768 content.show(); 3769 } 3770 } 3771 } 3772 }); 3773 }, 100); 3774 3775 if (0 === active.length){ 3776 $this.on('mouseleave', function(){ 3777 if (!$this.hasClass('mobile_view_enable')){ 3778 item.removeClass('active'); 3779 } 3780 }); 3781 } 3782 3783 let resize_timer; 3784 jQuery( window ).resize( 3785 function() { 3786 clearTimeout(resize_timer); 3787 resize_timer = setTimeout(responsive, 100); 3788 } 3789 ); 3790 3791 function responsive() { 3792 if ( jQuery(window).outerWidth() <= breakpoint ) { 3793 active = $this.find('.active'); 3794 $this.removeClass('mobile_view_disable').addClass('mobile_view_enable'); 3795 active.find('.showcase-2__content_wrapper').slideDown(800).parent().parent().siblings().find('.showcase-2__content_wrapper').slideUp(800); 3796 }else{ 3797 titles.each(function() { 3798 let title = jQuery(this); 3799 title.parent().css({ '--sc2-title-width': Math.floor(title.outerWidth()) + 'px' }); 3800 }); 3801 item.css({ '--sc2-inner-width': Math.floor(itemInner.outerWidth()) + 'px' }); 3802 3803 $this.addClass('mobile_view_disable').removeClass('mobile_view_enable'); 3804 } 3805 } 3806 responsive(); 3807 }) 3808 } 3809} 3810 3811// Showcase 3812 3813function wglShowcaseInit() { 3814 let $showcase = jQuery('.wgl-showcase.slide-showcase'); 3815 if ($showcase.length) { 3816 $showcase.each(function(){
3817 let $this = jQuery(this), 3818 image = $this.find('.showcase__image'), 3819 title = $this.find('.showcase__item'); 3820 3821 image.eq(0).addClass('active'); 3822 title.eq(0).addClass('active'); 3823 3824 let indexItem = $this.find('.wgl-double-heading'); 3825 indexItem = indexItem.length > 0 ? 1 : 0; 3826 title.on('touchstart mouseenter', function(){ 3827 let obj = jQuery(this); 3828 if(!obj.hasClass('active')){ 3829 image.removeClass('active').eq(obj.index() - indexItem).addClass('active'); 3830 title.removeClass('active').eq(obj.index() - indexItem).addClass('active'); 3831 } 3832 }).on('touchend mouseleave', function () { 3833 let obj = jQuery(this); 3834 if(!obj.hasClass('active')){ 3835 image.removeClass('active').eq(obj.index() - indexItem).addClass('active'); 3836 title.removeClass('active').eq(obj.index() - indexItem).addClass('active'); 3837 } 3838 }); 3839 3840 $this.addClass('showcase__init'); 3841 }) 3842 } 3843 3844 let $showcase_int = jQuery('.wgl-showcase.interactive-showcase'); 3845 if ($showcase_int.length) { 3846 3847 $showcase_int.each(function() { 3848 let $this = jQuery(this), 3849 content = $this.find('.showcase__item'), 3850 active = $this.find('.active'); 3851 3852 content.on('mouseenter', function(){ 3853 let obj = jQuery(this); 3854 if(!obj.hasClass('active')){ 3855 content.removeClass('active'); 3856 obj.addClass('active'); 3857 } 3858 }); 3859 if (0 === active.length){ 3860 $this.on('mouseleave', function(){ 3861 content.removeClass('active'); 3862 }); 3863 } 3864 }) 3865 } 3866} 3867function wglSidePanelInit() { 3868 3869 // Create plugin Side Panel 3870 (function($) { 3871 3872 $.fn.wglSidePanel = function(options) { 3873 var defaults = { 3874 "toggleID" : ".side_panel-toggle", 3875 "closeID" : ".side-panel_close", 3876 "closeOverlay" : ".side-panel_overlay", 3877 "body" : "body > *:not(header)", 3878 "sidePanel" : "#side-panel .side-panel_sidebar" 3879 }; 3880 3881 if (this.length === 0) { return this; } 3882 3883 return this.each(function () { 3884 var wglSidePanel = {}, 3885 s = $(this), 3886 openClass = 'side-panel_open', 3887 wglScroll, 3888 sidePanelClass = '.side_panel', 3889 $side_panel = $('#side-panel'), 3890 3891 init = function() { 3892 wglSidePanel.settings = $.extend({}, defaults, options); 3893 }, 3894 open = function () { 3895 if (! $side_panel.hasClass('side-panel_active')) { 3896 $side_panel.addClass('side-panel_active'); 3897 } 3898 3899 $side_panel.addClass(openClass); 3900 $(s).addClass(openClass); 3901 $('body').removeClass('side-panel--closed').addClass('side-panel--opened'); 3902 3903 var wglClassAnimated = $side_panel.find('section.elementor-element').data('settings'); 3904 if (wglClassAnimated && wglClassAnimated.animation) { 3905 $side_panel.find('section.elementor-element').removeClass('elementor-invisible').addClass('animated').addClass(wglClassAnimated.animation); 3906 } 3907 }, 3908 close = function () { 3909 $(s).removeClass(openClass); 3910 $side_panel.removeClass(openClass); 3911 $('body').removeClass('side-panel--opened').addClass('side-panel--closed'); 3912 var wglClassAnimated = $side_panel.find('section.elementor-element').data('settings'); 3913 if (wglClassAnimated && wglClassAnimated.animation) { 3914 $side_panel.find('section.elementor-element').removeClass(wglClassAnimated.animation); 3915 } 3916 }, 3917 togglePanel = function(e) { 3918 e.preventDefault(); 3919 wglScroll = $(window).scrollTop(); 3920 3921 if (! $(s).closest(sidePanelClass).hasClass(openClass)) { 3922 open(); 3923 $(window).scroll(function() { 3924 if (450 < Math.abs($(this).scrollTop() - wglScroll)) { 3925 close(); 3926 } 3927 }); 3928 } else { 3929 3930 } 3931 }, 3932 closePanel = function(e) { 3933 e.preventDefault(); 3934 if ($(s).closest(sidePanelClass).hasClass(openClass)) { 3935 close(); 3936 } 3937 }, 3938 eventClose = function(e) { 3939 var element = $(sidePanelClass); 3940 3941 if (! $side_panel.is(e.target) && $side_panel.has(e.target).length === 0) { 3942 if ($(element).hasClass(openClass)) { 3943 close(); 3944 } 3945 } 3946 }; 3947 3948 init(); 3949 3950 $(wglSidePanel.settings.toggleID).on(click, togglePanel); 3951 $(wglSidePanel.settings.body).on(click, eventClose); 3952 $(wglSidePanel.settings.closeID).on(click, closePanel); 3953 $(wglSidePanel.settings.closeOverlay).on(click, closePanel); 3954 3955 $(document).on('keydown', function(e) { 3956 if (e.which === 27 && $(sidePanelClass).hasClass(openClass)) close(); 3957 }); 3958 }); 3959 }; 3960 3961 })(jQuery); 3962 3963 if (jQuery('#side-panel').length) { 3964 jQuery('.side_panel').wglSidePanel(); 3965 } 3966} 3967function wglSkrollrInit() { 3968 var blog_scroll = jQuery('.blog_skrollr_init'); 3969 if (blog_scroll.length) {
3970 if ( !/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i.test(navigator.userAgent || navigator.vendor || window.opera) ) { 3971 // wgl Skrollr 3972 skrollr.init({ 3973 smoothScrolling: false, 3974 forceHeight: false 3975 }); 3976 } 3977 } 3978} 3979 3980function wglStickyInit() { 3981 3982 var $header = jQuery('.wgl-theme-header'), 3983 $stickyHeader = jQuery('.wgl-sticky-header'), 3984 $noticesWrapper = jQuery('.wgl_notices_wrapper'), 3985 $mobileSticky = $header.find('.wgl-mobile-header.wgl-sticky-element'), 3986 hDefaultHeight = $header.height(), 3987 stickyHeight = $stickyHeader.length !== 0 ? $stickyHeader.height() : 0, 3988 data = $stickyHeader.length !== 0 ? $stickyHeader.data('style') : 'none', 3989 m_width = jQuery('body').data( "mobileWidth" ), 3990 previousScroll = 0, 3991 previousScrollNotice = 0, 3992 elementorHeader = $header.find('.wgl-mobile-header').hasClass('wgl-elementor-builder'); 3993 3994 const scrollSize = jQuery(window).scrollTop(); 3995 3996 function init(element) { 3997 if ( ! element || m_width >= jQuery(window).prop("clientWidth")) { 3998 $stickyHeader.removeClass('sticky_active'); 3999 return; 4000 } 4001 4002 let scrollSize = jQuery(window).scrollTop(); 4003 if ( data === 'standard' ) { 4004 if ( scrollSize >= stickyHeight && 0 !== stickyHeight ) { 4005 $stickyHeader.addClass( 'sticky_active' ); 4006 } else { 4007 $stickyHeader.removeClass( 'sticky_active' ); 4008 } 4009 } else { 4010 if ( scrollSize > stickyHeight ) { 4011 if ( scrollSize > previousScroll ) { 4012 $stickyHeader.removeClass( 'sticky_active' ); 4013 } else { 4014 $stickyHeader.addClass( 'sticky_active' ); 4015 } 4016 } else { 4017 $stickyHeader.removeClass('sticky_active'); 4018 } 4019 } 4020 previousScroll = scrollSize; 4021 }; 4022 function initNoticeSticky(element) { 4023 let scrollSize = jQuery(window).scrollTop(); 4024 if ( scrollSize > stickyHeight && scrollSize > hDefaultHeight ) { 4025 $noticesWrapper.removeClass( 'stick_default' ); 4026 if ( scrollSize > previousScrollNotice || 0 === stickyHeight || m_width >= jQuery(window).width() ) { 4027 $noticesWrapper.addClass( 'stick_top' ); 4028 } else { 4029 $noticesWrapper.removeClass( 'stick_top' ); 4030 } 4031 } else { 4032 $noticesWrapper.addClass( 'stick_default' ).removeClass( 'stick_top' ); 4033 } 4034 previousScrollNotice = scrollSize; 4035 } 4036 4037 if ( $noticesWrapper.length !== 0 ) { 4038 function setCss() { 4039 let heightElement = $header.height(); 4040 if(elementorHeader){ 4041 var totalHeight = 0; 4042 $header.find('.wgl-site-header > .container-wrapper > .elementor').children().each(function() { 4043 if('none' !== jQuery(this).css('display')){ 4044 totalHeight += jQuery(this).height(); 4045 } 4046 }); 4047 heightElement = totalHeight; 4048 } 4049 $noticesWrapper.css({ 4050 '--height': heightElement + 'px', 4051 '--sticky-height': stickyHeight + 'px', 4052 '--mobile-sticky-height': $mobileSticky.length !== 0 ? $mobileSticky.height() + 'px' : '0', 4053 'opacity': 1 4054 }); 4055 } 4056 if (scrollSize === 0) { 4057 $noticesWrapper.addClass('stick_default'); 4058 }else if(scrollSize >= stickyHeight) { 4059 $noticesWrapper.addClass( 'stick_top' ); 4060 } 4061 4062 setCss(); 4063 jQuery( window ).scroll( function() { 4064 initNoticeSticky(jQuery(this)); 4065 } ); 4066 jQuery( window ).resize( function() { 4067 initNoticeSticky(jQuery(this)); 4068 setCss(); 4069 } ); 4070 } 4071 4072 if ( $stickyHeader.length !== 0 ) { 4073 jQuery( window ).scroll( function() { 4074 init(jQuery(this)); 4075 } ); 4076 4077 jQuery( window ).resize( function() { 4078 init(jQuery(this)); 4079 } ); 4080 } 4081} 4082function wglStickySidebar() { 4083 if (jQuery('.sticky-sidebar').length) { 4084 jQuery('body').addClass('sticky-sidebar_init'); 4085 jQuery('.sticky-sidebar').each(function() { 4086 const $this = jQuery(this), 4087 stickyOffsetTop = $this.css('--wgl-sticky-offset-t') ?? 150; 4088 4089 $this.theiaStickySidebar({ 4090 additionalMarginTop: stickyOffsetTop, 4091 additionalMarginBottom: 30 4092 }); 4093 }); 4094 } 4095 4096 if (jQuery('.sticky_layout .info-wrapper').length) { 4097 jQuery('.sticky_layout .info-wrapper').each(function() { 4098 jQuery(this).theiaStickySidebar({ 4099 additionalMarginTop: 150, 4100 additionalMarginBottom: 150 4101 }); 4102 }); 4103 } 4104} 4105 4106function wglStripedServicesInit() { 4107 let item_wrap = jQuery('.wgl-striped-services'); 4108 if (item_wrap.length) { 4109 item_wrap.each(function() { 4110 let item = jQuery(this).find('.wgl-striped'); 4111 item.on('mouseenter', function() { 4112 item_wrap.addClass('onhover'); 4113 item.removeClass('active'); 4114 jQuery(this).addClass('active'); 4115 }); 4116 item.on('mouseleave', function() { 4117 item_wrap.removeClass('onhover'); 4118 }); 4119 }); 4120 } 4121} 4122 4123// Tabs 4124
4125function wglTabsInit() { 4126 let $tabs = jQuery('.wgl-tabs'); 4127 if ($tabs.length) { 4128 $tabs.each(function(){ 4129 let $this = jQuery(this); 4130 let tab = $this.find('.wgl-tabs_headings .wgl-tabs_header'); 4131 let data = $this.find('.wgl-tabs_content-wrap .wgl-tabs_content'); 4132 let $contentWrap = $this.find('.wgl-tabs_content-wrap'); 4133 let height = data.filter(':first').outerHeight(); 4134 4135 tab.filter(':first').addClass('active'); 4136 4137 data.filter(':first').addClass('active'); 4138 data.filter(':not(:first)').hide(); 4139 4140 data.not('.active').each(function(){ 4141 jQuery(this).find('.wgl-image-layers').removeClass('img-layer_animate'); 4142 }); 4143 4144 $contentWrap.css({ 'height': height }); 4145 tab.each(function(){ 4146 let currentTab = jQuery(this); 4147 4148 currentTab.on('click tap', function(){ 4149 let id = currentTab.data('tab-id'); 4150 let currentData = jQuery('.wgl-tabs .wgl-tabs_content[data-tab-id='+id+']'); 4151 height = currentData.outerHeight(); 4152 4153 $contentWrap.css({ 'height': height }); 4154 currentTab.addClass('active').siblings().removeClass('active'); 4155 currentData.addClass('active').slideDown().siblings().removeClass('active').slideUp(); 4156 4157 data.not('.active').each(function(){ 4158 jQuery(this).find('.wgl-image-layers').removeClass('img-layer_animate'); 4159 }); 4160 4161 currentData.find('.wgl-image-layers').addClass('img-layer_animate'); 4162 }); 4163 }); 4164 }) 4165 } 4166} 4167 4168// Tabs Horizontal 4169 4170function wglTabsHorizontalInit() { 4171 let $tabs_horizontal = jQuery('.wgl-tabs-horizontal'); 4172 if ($tabs_horizontal.length) { 4173 $tabs_horizontal.each(function(){ 4174 let $this = jQuery(this), 4175 tab = $this.find('.wgl-tabs-horizontal_headings .wgl-tabs-horizontal_header_wrap'), 4176 data = $this.find('.wgl-tabs-horizontal_content-wrap .wgl-tabs-horizontal_content'), 4177 mh = Math.max.apply(Math, data.map(function(){ 4178 return jQuery(this).height(); 4179 }).get()); 4180 4181 $this.css({'min-height': mh }); 4182 4183 tab.filter(':first').addClass('active'); 4184 4185 data.filter(':not(:first)').hide(); 4186 tab.each(function(){ 4187 let currentTab = jQuery(this); 4188 4189 currentTab.on('click tap', function(){ 4190 let id = currentTab.data('tab-id'), 4191 contentTab = jQuery('.wgl-tabs-horizontal .wgl-tabs-horizontal_content[data-tab-id='+id+']'); 4192 4193 currentTab.addClass('active').siblings().removeClass('active'); 4194 if ($tabs_horizontal.hasClass('effect-fade')){ 4195 contentTab.siblings().fadeOut(200); 4196 contentTab.delay(201).fadeIn(); 4197 } else{ 4198 contentTab.slideDown().siblings().slideUp(); 4199 } 4200 }); 4201 }); 4202 }) 4203 } 4204} 4205 4206function wglTextBackground() { 4207 var anim_text = jQuery('.wgl-animation-background-text'); 4208 if (anim_text.length) { 4209 anim_text.each(function(index) { 4210 var paralax_text = jQuery('<div class="wgl-background-text"/>'); 4211 4212 jQuery(this) 4213 .find('>div:eq(0)') 4214 .before(paralax_text); 4215 var text = window.getComputedStyle(this, ':before').content; 4216 4217 text = text.slice(1, -1); 4218 4219 paralax_text.addClass('element-' + index); 4220 paralax_text.attr('data-info', index); 4221 4222 jQuery(this) 4223 .find(paralax_text) 4224 .html(text.replace(/([^\x00-\x80]|\w)/g, "<span class='letter'>$&</span>")) 4225 .appear(function() { 4226 if (typeof anime === 'function') { 4227 var item_anime = jQuery(this) 4228 .data('info'); 4229 4230 if (item_anime === index) { 4231 anime.timeline({ loop: false }).add({ 4232 targets: '.element-' + index + ' .letter', 4233 translateY: [100, 0], 4234 translateZ: 0, 4235 opacity: [0, 1], 4236 easing: 'easeOutExpo', 4237 duration: 1400, 4238 delay: function(el, i) { 4239 return 0 + 350 * i; 4240 } 4241 }); 4242 } 4243 } 4244 }); 4245 }); 4246 } 4247} 4248 4249function wglTextEditor() { 4250 4251 // Mask Effect 4252 let $mask_effect = jQuery('.wgl-text-editor.mask_effect'); 4253 if ($mask_effect.length) { 4254 $mask_effect.each(function () { 4255 var $this = jQuery(this), 4256 cloneText = $this.find('.text-editor_wrapper-clone'); 4257 4258 if ($this.find('.text-editor_outer-clone').length == 0) { 4259 jQuery(cloneText).wrap('<div class="text-editor_outer-clone"></div>'); 4260 } 4261 var cloneOuter = $this.find('.text-editor_outer-clone'); 4262 4263 var init = function () { 4264 cloneText.css('width', $this.outerWidth() + 'px'); 4265 } 4266 4267 $this.mousemove(function (e) { 4268 var x = e.offsetX; 4269 var y = e.offsetY; 4270 jQuery(cloneText).css({ 4271 transform: 'translate(' + -x + 'px,' + -y + 'px)', 4272 }); 4273 jQuery(cloneOuter).css({ 4274 transform: 'translate(' + x + 'px,' + y + 'px)', 4275 }); 4276 }); 4277 4278 init(); 4279 var resizeTimer; 4280 window.addEventListener('resize', function () { 4281 clearTimeout(resizeTimer); 4282 resizeTimer = setTimeout(function () { 4283 init(); 4284 }, 10); 4285 }); 4286 }) 4287 } 4288 4289 // Text Parallax 4290 let $text_parallax = jQuery('.wgl-text-editor.text_parallax'); 4291 if ($text_parallax.length) { 4292 $text_parallax.each(function () { 4293 jQuery(this).paroller({ 4294 type: 'foreground' 4295 }); 4296 }) 4297 } 4298 4299 // Text Appear 4300 let $text_appear = jQuery('.wgl-text-editor.text_appear'); 4301 if ($text_appear.length) { 4302 $text_appear.appear(function() { 4303 jQuery(this).addClass('appear'); 4304 }) 4305 } 4306 4307 // Scroll Text Appear 4308 let $scroll_text_appear = jQuery('.wgl-text-editor.scroll_text_appear'); 4309 if ($scroll_text_appear.length) { 4310 $scroll_text_appear.each(function () { 4311 4312 const animationStartPercent = jQuery(this).data('start-percent'); 4313 const animationDurationFactor = jQuery(this).data('duration-factor'); 4314 const delayWords = jQuery(this).data('delay-words'); 4315 const initialOpacity = jQuery(this).data('text-opacity'); 4316 4317 if (jQuery(this).hasClass('appear-opacity')) { 4318 var $scroll_text = jQuery(this).find('.text-editor_wrapper > span'); 4319 $scroll_text.css("opacity", 1); 4320 function wrapWordsInSpans($element) { 4321 const words = $element.text().split(" "); 4322 const wrappedWords = words.map((word) => `<span>${word}</span>`).join(" "); 4323 $element.html(wrappedWords); 4324 } 4325 4326 $scroll_text.each(function () { 4327 wrapWordsInSpans(jQuery(this)); 4328 }); 4329 4330 const $spans = $scroll_text.find("span"); 4331 4332 jQuery(window).on("scroll resize", function () { 4333 const rect = $scroll_text[0].getBoundingClientRect(); 4334 const elementHeight = rect.height; 4335 const windowHeight = jQuery(window).height(); 4336 4337 const start = (windowHeight * animationStartPercent) / 100; 4338 const end = start + animationDurationFactor * elementHeight; 4339 4340 let progress = Math.max(0, Math.min(1, (windowHeight - rect.top - start) / (end - start))); 4341 4342 const step = 1 / $spans.length; 4343 const delayStep = step * delayWords; 4344 4345 $spans.each(function (index) { 4346 const wordStart = index * step; 4347 const wordEnd = wordStart + delayStep; 4348 const localProgress = Math.max(0, Math.min(1, (progress - wordStart) / (wordEnd - wordStart))); 4349 const easedProgress = Math.pow(localProgress, 2) * (3 - 2 * localProgress); 4350 const opacity = Math.min(1, (initialOpacity + easedProgress * (1 - initialOpacity))).toFixed(4); 4351 4352 jQuery(this).css("opacity", opacity); 4353 }); 4354 4355 if (progress === 1) { 4356 $spans.css("opacity", 1); 4357 } 4358 }); 4359 } else if (jQuery(this).hasClass('appear-color')) { 4360 4361 var $scroll_text = jQuery(this).find('.text-editor_wrapper'); 4362 4363 jQuery(window).on("scroll resize", function () { 4364 const rect = $scroll_text[0].getBoundingClientRect(); 4365 const elementHeight = rect.height; 4366 const windowHeight = jQuery(window).height(); 4367 4368 const start = (windowHeight * animationStartPercent) / 100; 4369 const end = start + animationDurationFactor * elementHeight; 4370 4371 let progress = Math.max(0, Math.min(1, (windowHeight - rect.top - start) / (end - start))); 4372 4373 const backgroundSize = `${progress * 100}% 100%`; 4374 $scroll_text.css("background-size", backgroundSize); 4375 }); 4376 } 4377 4378 jQuery(window).trigger("scroll"); 4379 }) 4380 } 4381} 4382// WGL Time Line Vertical appear 4383function wglInitTimelineAppear(item) { 4384 let widgetSelector = '.wgl-timeline-vertical', 4385 widgetEl = item ? jQuery(item).find(widgetSelector) : jQuery(widgetSelector); 4386 4387 widgetEl.each(function () { 4388 if (widgetEl.hasClass('appear_animation')) { 4389 let items_appear = widgetEl.find('[class*="tlv__items-"]'); 4390 if (items_appear.length) { 4391 items_appear.each(function () { 4392 let item = jQuery(this); 4393 item.appear(function () { 4394 item.addClass('show'); 4395 }); 4396 }); 4397 } 4398 } 4399 }); 4400} 4401// WGL Time Line Horizontal 4402 4403function wglTimelineHorizontal() { 4404 var timeline_swiper = jQuery('.wgl-timeline-horizontal'); 4405 if (timeline_swiper.length) { 4406 timeline_swiper.each(function () { 4407 if (window.elementorFrontend) { 4408 if (window.elementorFrontend.isEditMode()) { 4409 wglTimilineSwiperInit(jQuery(this)); 4410 } else { 4411 elementorFrontend.on('components:init', () => { 4412 wglTimilineSwiperInit(jQuery(this)) 4413 }); 4414 } 4415 } 4416 }); 4417 } 4418} 4419function wglTimilineSwiperInit(self) { 4420 4421 const $container = self.find('.time_line_h-date_container'), 4422 $date_swiper = self.find('.time_line_h-date_container'), 4423 $content_swiper = self.find('.time_line_h-content_container'); 4424 4425 let wglDateSwiper, 4426 wglContentSwiper; 4427 4428 const configData = $container.data('swiper') ? $container.data('swiper')
4428: {}; 4429 const itemID = $container.data('item-carousel') ? '[data-carousel="' + $container.data('item-carousel') + '"]' : ''; 4430 4431 const initial_slide = configData.initial_slide !== undefined ? configData.initial_slide : 0; 4432 const pagination = configData.pagination !== undefined ? configData.pagination : '.swiper-pagination' + itemID; 4433 const arrow_next = '.elementor-swiper-button-next' + itemID; 4434 const arrow_prev = '.elementor-swiper-button-prev' + itemID; 4435 4436 if ('undefined' === typeof Swiper) { 4437 4438 const asyncSwiper = window.elementorFrontend.utils.swiper; 4439 4440 wglDateSwiper = new asyncSwiper($date_swiper, { 4441 slidesPerView: 'auto', 4442 slideActiveClass: 'slide-active', 4443 centeredSlides: true, 4444 slideToClickedSlide: true, 4445 initialSlide: initial_slide, 4446 navigation: { 4447 nextEl: arrow_next, 4448 prevEl: arrow_prev 4449 }, 4450 pagination: { 4451 el: pagination, 4452 clickable: true, 4453 type: 'bullets', 4454 renderBullet: (index, className) => '<li class="' + className + '" role="presentation"><button type="button" role="tab" tabindex="-1">' + (index + 1) + '</button></li>', 4455 }, 4456 }); 4457 wglContentSwiper = new asyncSwiper($content_swiper, { 4458 slidesPerView: 'auto', 4459 slideActiveClass: 'slide-active', 4460 centeredSlides: true, 4461 slideToClickedSlide: true, 4462 initialSlide: initial_slide, 4463 }); 4464 4465 wglDateSwiper.then((newSwiperInstance) => { 4466 wglDateSwiper = newSwiperInstance; 4467 }); 4468 wglContentSwiper.then((newSwiperInstance) => { 4469 wglContentSwiper = newSwiperInstance; 4470 4471 wglDateSwiper.controller.control = wglContentSwiper; 4472 wglContentSwiper.controller.control = wglDateSwiper; 4473 }); 4474 4475 } else { 4476 4477 wglDateSwiper = new Swiper($date_swiper[0], { 4478 slidesPerView: 'auto', 4479 slideActiveClass: 'slide-active', 4480 centeredSlides: true, 4481 slideToClickedSlide: true, 4482 initialSlide: initial_slide, 4483 navigation: { 4484 nextEl: arrow_next, 4485 prevEl: arrow_prev 4486 }, 4487 pagination: { 4488 el: pagination, 4489 clickable: true, 4490 type: 'bullets', 4491 renderBullet: (index, className) => '<li class="' + className + '" role="presentation"><button type="button" role="tab" tabindex="-1">' + (index + 1) + '</button></li>', 4492 }, 4493 }); 4494 4495 wglContentSwiper = new Swiper($content_swiper[0], { 4496 slidesPerView: 'auto', 4497 slideActiveClass: 'slide-active', 4498 centeredSlides: true, 4499 slideToClickedSlide: true, 4500 initialSlide: initial_slide, 4501 }); 4502 4503 wglDateSwiper.controller.control = wglContentSwiper; 4504 wglContentSwiper.controller.control = wglDateSwiper; 4505 } 4506} 4507 4508function wglWoocommerceHelper(){ 4509 let body = jQuery('body'); 4510 body.on('click', '.quantity.number-input span.minus', function(e){ 4511 this.parentNode.querySelector('input[type=number]').stepDown(); 4512 if(document.querySelector('.woocommerce-cart-form [name=update_cart]')){ 4513 document.querySelector('.woocommerce-cart-form [name=update_cart]').disabled = false; 4514 } 4515 }); 4516 4517 body.on('click', '.quantity.number-input span.plus', function(e){ 4518 this.parentNode.querySelector('input[type=number]').stepUp(); 4519 if(document.querySelector('.woocommerce-cart-form [name=update_cart]')){ 4520 document.querySelector('.woocommerce-cart-form [name=update_cart]').disabled = false; 4521 } 4522 }); 4523 4524 jQuery('.wgl-products .product a.add_to_cart_button.ajax_add_to_cart').on( "click", function() { 4525 jQuery(this).closest('.product').addClass('added_to_cart_item'); 4526 }); 4527 4528 let actionWrapper = jQuery('.action__wrapper'); 4529 if (actionWrapper.length) { 4530 jQuery('.cart_totals').css({'min-height': actionWrapper.height() }); 4531 jQuery(window).resize(function () { 4532 jQuery('.cart_totals').css({'min-height': actionWrapper.height() }); 4533 }); 4534 } 4535 4536 let button_reset = jQuery('.wgl-reset-filter'), 4537 filter_button = jQuery('.wgl-filter-button'), 4538 filter_wrapper = jQuery('.wgl-filter-products'), 4539 inner_wrapper = filter_wrapper.find('.sidebar-container'); 4540 if (button_reset.length && inner_wrapper.length) { 4541 inner_wrapper.append( button_reset ); 4542 } 4543 4544 body.on('click tap', '.wgl-filter-button', function(e){ 4545 if (!filter_button.hasClass('active')) { 4546 wglFilterAreaOpen(); 4547 }else { 4548 wglFilterAreaClose(); 4549 } 4550 }); 4551 4552 body.on('click tap', '.wgl-filter-overlay, .wgl-filter-close, .wgl-reset-filter', function(e){ 4553 wglFilterAreaClose(); 4554 }); 4555 4556 body.on('click tap',function(e) { 4557 if (e.target !== filter_wrapper[0] && !filter_wrapper.has(e.target).length && e.target !== filter_button[0] && !filter_button.has(e.target).length) { 4558 wglFilterAreaClose(); 4559 } 4560 }); 4561 4562 jQuery(document).on('keydown', function(e) { 4563 if (e.which === 27 && filter_button.hasClass('active')) { 4564 wglFilterAreaClose(); 4565 } 4566 }); 4567 4568 function wglFilterAreaOpen(){ 4569 filter_button.addClass('active'); 4570 filter_wrapper.animate({ 4571 paddingBottom: "show", 4572 height: "show", 4573 opacity: "show" 4574 }, "slow").addClass('active'); 4575 } 4576 function wglFilterAreaClose(){ 4577 filter_button.removeClass('active'); 4578 filter_wrapper.animate({ 4579 paddingBottom: "hide", 4580 height: "hide", 4581 opacity: "hide" 4582 }, "slow").removeClass('active'); 4583 } 4584 4585 /* WooCommerce Tabs */ 4586 let tabsWrapper = jQuery('.tabs.wc-tabs'); 4587 if (tabsWrapper.length) { 4588 tabsWrapper.addClass('swiper-wrapper').wrap('<div class="swiper"></div>'); 4589 tabsWrapper.children().addClass('swiper-slide'); 4590 const swiper = new Swiper('.wc-tabs-wrapper .swiper', { 4591 slidesPerView: 'auto', 4592 freeMode: true, 4593 }); 4594 } 4595} 4596 4597function wglWoocommerceLoginIn() { 4598 var login_in = jQuery('.login-in'); 4599 if (login_in.length) {
4600 var mc = login_in, 4601 icon = mc.find('a.login-in_link'), 4602 overlay = mc.find('div.overlay'); 4603 4604 icon.on('click tap', function(e) { 4605 e.preventDefault(); 4606 mc.toggleClass('open_login'); 4607 }); 4608 4609 var eventClose = function(e) { 4610 if ( 4611 !jQuery(e.target).closest('.modal_content').length && 4612 !jQuery(e.target).is('.modal_content') 4613 ) { 4614 mc.removeClass('open_login'); 4615 } 4616 }; 4617 4618 overlay.on('click tap', eventClose); 4619 4620 jQuery(document).on('keydown', function(e) { 4621 if (e.which === 27) eventClose(e); 4622 }); 4623 } 4624} 4625function wglWoocommerceMiniCart(){ 4626 var mini_cart = jQuery('header .wgl-cart-header .mini-cart'); 4627 if (mini_cart.length) { 4628 mini_cart.each(function(){ 4629 var overlay = jQuery('div.mini_cart-overlay'), 4630 eventClose = function(e) { 4631 jQuery('.wgl-theme-header').removeClass('open_cart'); 4632 }; 4633 4634 jQuery('a.woo_icon').on('click tap', function() { 4635 jQuery('.wgl-theme-header').toggleClass('open_cart'); 4636 }); 4637 overlay.on('click tap', eventClose); 4638 4639 jQuery(document).on('keydown', function(e) { 4640 if (e.which === 27) eventClose(e); 4641 }); 4642 }); 4643 } 4644} 4645// Select Wrapper 4646function wglSelectWrap() { 4647 jQuery('select').each(function () { 4648 var $select = jQuery(this); 4649 if ($select.hasClass('first-disable')){ 4650 jQuery('option:first-child', $select).attr('disabled',true); 4651 } 4652 }); 4653} 4654 4655function wglButtonAnimation() { 4656 jQuery('.wgl-button.with-border:not(.load_more_item)').each(function () { 4657 let $_this = jQuery(this); 4658 $_this.on('click tap', function(){ 4659 $_this.addClass('animated'); 4660 setTimeout(function(){ 4661 $_this.removeClass('animated'); 4662 },600) 4663 }); 4664 }); 4665 jQuery('.wgl-button').each(function () { 4666 jQuery(this).on('touchstart mouseenter', function(){ 4667 jQuery(this).find('.highlight_svg').removeClass('hide-highlight').addClass('active') 4668 }).on("touchend mouseleave", function () { 4669 jQuery(this).find('.highlight_svg').addClass('hide-highlight').removeClass('active') 4670 }); 4671 }); 4672} 4673 4674// WGL Zoom Init 4675 4676function wglInitZoom() { 4677 const zoom = document.querySelectorAll('.wgl-zoom'); 4678 const viewportHeight = window.innerHeight; 4679 4680 if (zoom.length) { 4681 zoom.forEach(wglZoomInit); 4682 } 4683 4684 function wglZoomInit(self) { 4685 const animatedSection = self; 4686 const wrapper = animatedSection.querySelector('.wgl-zoom_wrapper'); 4687 const items = Array.from(animatedSection.querySelectorAll('.wgl-zoom_item__wrapper')); 4688 const speed = animatedSection.getAttribute('data-speed'); 4689 4690 const itemsData = items.map( item => { 4691 const deviceMode = document.body.getAttribute('data-elementor-device-mode'), 4692 configData = JSON.parse(item.dataset.zoom); 4693 4694 const getResponsiveValue = (value) => { 4695 const tabletValue = configData[value + '_tablet'], 4696 mobileValue = configData[value + '_mobile']; 4697 4698 if (deviceMode === 'tablet') { 4699 return tabletValue !== '' ? tabletValue : configData[value]; 4700 } else if (deviceMode === 'mobile') { 4701 return mobileValue !== '' ? mobileValue : tabletValue !== '' ? tabletValue : configData[value]; 4702 } else { 4703 return configData[value]; 4704 } 4705 }; 4706 const getResponsiveUnit = (unit) => { 4707 const desktopUnit = configData[unit + '_unit'], 4708 tabletUnit = configData[unit + '_tablet_unit'], 4709 mobileUnit = configData[unit + '_mobile_unit']; 4710 4711 if (deviceMode === 'tablet') { 4712 return tabletUnit !== '' ? tabletUnit : desktopUnit; 4713 } else if (deviceMode === 'mobile') { 4714 return mobileUnit !== '' ? mobileUnit : tabletUnit !== '' ? tabletUnit : desktopUnit; 4715 } else { 4716 return desktopUnit; 4717 } 4718 }; 4719 4720 return { 4721 item: item, 4722 timeFrom: configData['time_from'], 4723 timeTo: configData['time_to'], 4724 scaleFrom: getResponsiveValue('scale_from'), 4725 scaleTo: getResponsiveValue('scale_to'), 4726 opacityFrom: configData['opacity_from'], 4727 opacityTo: configData['opacity_to'], 4728 blurFrom: getResponsiveValue['blur_from'], 4729 blurTo: getResponsiveValue['blur_to'], 4730 vPosFrom: getResponsiveValue('vert_pos_from'), 4731 vPosTo: getResponsiveValue('vert_pos_to'),
4732 hPosFrom: getResponsiveValue('hor_pos_from'), 4733 hPosTo: getResponsiveValue('hor_pos_to'), 4734 vPosUnit: getResponsiveUnit('vert_pos_from'), 4735 hPosUnit: getResponsiveUnit('hor_pos_from'), 4736 4737 bgTimeFrom: configData['bg_time_from'], 4738 bgTimeTo: configData['bg_time_to'], 4739 bgScaleFrom: getResponsiveValue('bg_scale_from'), 4740 bgScaleTo: getResponsiveValue('bg_scale_to'), 4741 bgOpacityFrom: configData['bg_opacity_from'], 4742 bgOpacityTo: configData['bg_opacity_to'], 4743 }; 4744 }); 4745 4746 let isView = 0, 4747 isViewBG = 0; 4748 4749 function onScroll() { 4750 isView = wglZoomIsView(); 4751 wglZoomWrapperRender(wrapper, animatedSection, viewportHeight, isView); 4752 itemsData.forEach(data => { 4753 wglZoomItemRender(data, isView, isViewBG); 4754 }); 4755 } 4756 4757 document.addEventListener('scroll', onScroll, { passive: true }); 4758 onScroll(); 4759 4760 function wglZoomItemRender(data, isView) { 4761 4762 const item = data.item; 4763 let timeFrom = data.timeFrom ?? '', 4764 timeTo = data.timeTo ?? '', 4765 scaleFrom = data.scaleFrom ?? '', 4766 scaleTo = data.scaleTo ?? '', 4767 opacityFrom = data.opacityFrom ?? '', 4768 opacityTo = data.opacityTo ?? '', 4769 blurFrom = data.blurFrom ?? '', 4770 blurTo = data.blurTo ?? '', 4771 vPosFrom = data.vPosFrom ?? '', 4772 vPosUnit = data.vPosUnit ?? '%', 4773 vPosTo = data.vPosTo ?? '', 4774 hPosFrom = data.hPosFrom ?? '', 4775 hPosTo = data.hPosTo ?? '', 4776 hPosUnit = data.hPosUnit ?? '%', 4777 4778 bgTimeFrom = data.bgTimeFrom ?? '', 4779 bgTimeTo = data.bgTimeTo ?? '', 4780 bgScaleFrom = data.bgScaleFrom ?? '', 4781 bgScaleTo = data.bgScaleTo ?? '', 4782 bgOpacityFrom = data.bgOpacityFrom ?? '', 4783 bgOpacityTo = data.bgOpacityTo ?? ''; 4784 4785 const lerp = (x, y, a) => x * (1 - a) + y * a, 4786 clamp = (a, min = 0, max = 1) => Math.min(max, Math.max(min, a)), 4787 invlerp = (x, y, a) => clamp((a - x) / (y - x)), 4788 range = (x1, y1, x2, y2, a) => lerp(x2, y2, invlerp(x1, y1, a)); 4789 4790 if (scaleFrom !== '') { 4791 scaleTo = scaleTo !== '' ? scaleTo : scaleFrom; 4792 let scale = range(timeFrom, timeTo,scaleFrom, scaleTo, isView).toFixed(3); 4793 item.style.setProperty('--wgl-zoom-scale', (scale < 0 ? 0 : scale)); 4794 } 4795 if (opacityFrom !== '') { 4796 opacityTo = opacityTo !== '' ? opacityTo : opacityFrom; 4797 let opacity = range(timeFrom, timeTo,opacityFrom, opacityTo, isView).toFixed(3); 4798 item.style.setProperty('--wgl-zoom-opacity', (opacity < 0 ? 0 : (opacity > 1 ? 1 : opacity))); 4799 } 4800 if (blurFrom !== '') { 4801 blurTo = blurTo !== '' ? blurTo : blurFrom; 4802 let blur = range(timeFrom, timeTo,blurFrom, blurTo, isView).toFixed(3); 4803 item.style.setProperty('--wgl-zoom-blur', ((blur < 0 ? 0 : blur) + 'px)')); 4804 } 4805 if (vPosFrom !== '') { 4806 vPosTo = vPosTo !== '' ? vPosTo : vPosFrom; 4807 let vPos = range(timeFrom, timeTo,vPosFrom, vPosTo, isView).toFixed(3); 4808 item.style.setProperty('--wgl-zoom-v-pos', vPos + vPosUnit); 4809 } 4810 if (hPosFrom !== '') { 4811 hPosTo = hPosTo !== '' ? hPosTo : hPosFrom; 4812 let hPos = range(timeFrom, timeTo,hPosFrom, hPosTo, isView).toFixed(3); 4813 item.style.setProperty('--wgl-zoom-h-pos', hPos + hPosUnit); 4814 } 4815 4816 if (bgScaleFrom !== '') { 4817 bgScaleTo = bgScaleTo !== '' ? bgScaleTo : bgScaleFrom; 4818 let scale = range(bgTimeFrom, bgTimeTo,bgScaleFrom, bgScaleTo, isView).toFixed(5); 4819 item.style.setProperty('--wgl-zoom-bg-scale', (scale < 0 ? 0 : scale)); 4820 } 4821 if (bgOpacityFrom !== '') { 4822 bgOpacityTo = bgOpacityTo !== '' ? bgOpacityTo : bgOpacityFrom; 4823 let opacity = range(bgTimeFrom, bgTimeTo,bgOpacityFrom, bgOpacityTo, isView).toFixed(5); 4824 item.style.setProperty('--wgl-zoom-bg-opacity', (opacity < 0 ? 0 : (opacity > 1 ? 1 : opacity))); 4825 } 4826 } 4827 4828 function wglZoomWrapperRender(wrapper, animatedSection, viewportHe
4828ight, isView) { 4829 jQuery(animatedSection).toggleClass('zoom_fixed', isView > 0 && isView < 1); 4830 jQuery(animatedSection).toggleClass('zoom_completed', isView >= 1); 4831 } 4832 4833 function wglZoomIsView(bg = false) { 4834 let rect = animatedSection.getBoundingClientRect(), 4835 parameter = (viewportHeight - rect.top) / rect.height - 1; 4836 4837 parameter = parameter / speed; 4838 return parameter < -1 ? -1 : (parameter > 2 ? 2 : parameter); 4839 } 4840 } 4841}
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.