1"use strict"; 2 3function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 4window.Happy = window.Happy || {}; 5(function ($, Happy, w) { 6 var $window = $(w); 7 $(function () { 8 var $container = $('.ha-fsb-container'); 9 if ($container.length > 0) { 10 if (window.history && window.history.pushState) { 11 ha_manage_fsb(); 12 } 13 ; 14 $(document.body).on("added_to_cart", function (event, fragments, cart_hash, $button) { 15 ha_manage_fsb(); 16 }); 17 $(document.body).on("removed_from_cart", function (event, fragments, cart_hash, $button) { 18 ha_manage_fsb(); 19 }); 20 } 21 function ha_manage_fsb() { 22 $.ajax({ 23 url: HappyProLocalize.ajax_url, 24 type: "POST", 25 data: { 26 action: "ha_get_cart_subtotal_action", 27 security: HappyProLocalize.nonce 28 }, 29 success: function success(response) { 30 var $data = JSON.parse(response); 31 var $subTotalAmount = $data.subTotalAmount; 32 if ($data.status == 'true' && $subTotalAmount >= 0) { 33 var $container = $('.ha-fsb-container'); 34 var $elem = $container.find('.ha-fsb-size'); 35 var $settings = $container.data('fsb_settings'); 36 if ($settings != undefined) { 37 var $aimationSpeed = $settings.hasOwnProperty('ha_fsb_animation_speed') ? $settings.ha_fsb_animation_speed : 15; 38 var $progressType = $settings.hasOwnProperty('progress_type') ? $settings.progress_type : 'percent'; 39 var $currencySymbol = $settings.hasOwnProperty('currencySymbol') && $progressType == 'percent' ? '%' : $settings.currencySymbol; 40 var $targetAmount = $settings.hasOwnProperty('target_amount') ? $settings.target_amount : 0; 41 var $totalPercent = 0; 42 if (parseFloat($subTotalAmount) >= parseFloat($targetAmount)) { 43 $totalPercent = 100; 44 } else { 45 if (parseFloat($targetAmount) == 0) { 46 $totalPercent = 0; 47 } else { 48 $totalPercent = parseFloat($subTotalAmount) * 100 / parseFloat($targetAmount); 49 } 50 } 51 $totalPercent = parseFloat(Math.round($totalPercent)) >= 100 ? 100 : parseFloat(Math.round($totalPercent)); 52 var $progressText = $progressType == 'percent' ? $totalPercent : $subTotalAmount; 53 var defaultWidth = $(window).width() <= 768 ? 12 : 5; 54 if ($totalPercent > 0) { 55 $elem.text($progressText + $currencySymbol); 56 $elem.css({ 57 'width': $totalPercent + "%", 58 'transition': 'width ' + $aimationSpeed + 'ms ease-in-out' 59 }); 60 } 61 fsbMessageControl($totalPercent); 62 if ($progressText <= 0) { 63 $elem.css('width', +defaultWidth + "%"); 64 $elem.text('0' + $currencySymbol); 65 } 66 } 67 } 68 }, 69 error: function error(_error) {} 70 }); 71 } 72 ; 73 function fsbMessageControl() { 74 var totalPercent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 75 var fsbContainer = $('.ha-fsb-container'); 76 var settings = fsbContainer.data('fsb_settings'); 77 if (fsbContainer && settings) { 78 if (totalPercent >= 100) { 79 $('.ha-fsb-inner-content').html(settings.fsb_success_message); 80 } else { 81 $('.ha-fsb-inner-content').html(settings.announcement); 82 } 83 } 84 } 85 ; 86 function log(event, item, level) { 87 $(document).on(event, item, level); 88 } 89 var e; 90 e = $(".ha-menu-container"); 91 $(e).each(function () { 92 var button = $(this); 93 if ("yes" != button.attr("ha-dom-added")) { 94 if (0 === button.parents(".elementor-widget-ha-nav-menu").length) { 95 button.parents(".ha-wid-con").addClass("ha_menu_responsive_tablet"); 96 } 97 button.attr("ha-dom-added", "yes"); 98 } 99 }); 100 101 /* 102 $(".ha-dropdown-has > a").on("click", function(event) { 103 if (!$(this).parents(".ha-navbar-nav, .ha-vertical-navbar-nav").hasClass("submenu-click-on-icon") || $(event.target).hasClass("ha-submenu-indicator-wrap")) { 104 event.preventDefault(); 105 var $oElemDragged = $(this).parent().find(">.ha-dropdown, >.ha-megamenu-panel"); 106 $oElemDragged.find(".ha-dropdown-open").removeClass("ha-dropdown-open"); 107 if ($oElemDragged.hasClass("ha-dropdown-open")) { 108 $oElemDragged.removeClass("ha-dropdown-open"); 109 } else { 110 $oElemDragged.addClass("ha-dropdown-open"); 111 } 112 } 113 }); */ 114 115 $(".ha-dropdown-has > a").on("click", function (event) { 116 var dropdownHref = $(this).attr("href"); 117 if (dropdownHref === "#" || typeof dropdownHref === "undefined") { 118 event.preventDefault(); 119 var $oElemDragged = $(this).parent().find(">.ha-dropdown, >.ha-megamenu-panel"); 120 $oElemDragged.find(".ha-dropdown-open").removeClass("ha-dropdown-open"); 121 if ($oElemDragged.hasClass("ha-dropdown-open")) { 122 $oElemDragged.removeClass("ha-dropdown-open"); 123 } else { 124 $oElemDragged.addClass("ha-dropdown-open"); 125 } 126 } else { 127 if (!$(this).parents(".ha-navbar-nav, .ha-vertical-navbar-nav").hasClass("submenu-click-on-icon") || $(event.target).hasClass("ha-submenu-indicator-wrap")) { 128 event.preventDefault(); 129 var $oElemDragged = $(this).parent().find(">.ha-dropdown, >.ha-megamenu-panel"); 130 $oElemDragged.find(".ha-dropdown-open").removeClass("ha-dropdown-open"); 131 if ($oElemDragged.hasClass("ha-dropdown-open")) { 132 $oElemDragged.removeClass("ha-dropdown-open"); 133 } else { 134 $oElemDragged.addClass("ha-dropdown-open"); 135 } 136 } 137 } 138 }); 139 140 // $(".ha-menu-toggler").on("click", function(event) { 141 // event.preventDefault(); 142 143 // var el_form_group = $(this).parents(".ha-menu-container").parent(); 144 // if (el_form_group.length < 1) { 145 // el_form_group = $(this).parent(); 146 // } 147 // var $wrapElement = el_form_group.find(".ha-menu-offcanvas-elements"); 148 // if ($wrapElement.hasClass("active")) { 149 // $wrapElement.removeClass("active"); 150 // } else { 151 // $wrapElement.addClass("active"); 152 // } 153 // }); 154 155 $(".ha-navbar-nav li a").on("click", function (event) { 156 if (!$(this).attr("href") && "ha-submenu-indicator-wrap" == event.target.className) { 157 var thirdItem = $(this); 158 var lnk = thirdItem.get(0); 159 var oldUrl = lnk.href; 160 var sepor = oldUrl.indexOf("#"); 161 var s = thirdItem.parents(".ha-menu-container").hasClass("ha-nav-menu-one-page-yes"); 162 if (-1 !== sepor && oldUrl.length > 1 && s && lnk.pathname == window.location.pathname) { 163 event.preventDefault(); 164 thirdItem.parents(".ha-wid-con").find(".ha-menu-close").trigger("click"); 165 } 166 } 167 }); 168 }); 169 function debounce(func, wait, immediate) { 170 var timeout; 171 return function () { 172 var context = this, 173 args = arguments; 174 var later = function later() { 175 timeout = null;
176 if (!immediate) func.apply(context, args); 177 }; 178 var callNow = immediate && !timeout; 179 clearTimeout(timeout); 180 timeout = setTimeout(later, wait); 181 if (callNow) func.apply(context, args); 182 }; 183 } 184 $window.on("elementor/frontend/init", function () { 185 if (typeof haDisplayCondition != "undefined" && haDisplayCondition.status == "true") { 186 // Set user time in cookie 187 var HappyLocalTimeZone = new Date().toString().match(/([A-Z]+[\+-][0-9]+.*)/)[1]; 188 var ha_secure = document.location.protocol === "https:" ? "secure" : ""; 189 document.cookie = "HappyLocalTimeZone=" + HappyLocalTimeZone + ";SameSite=Strict;" + ha_secure; 190 } else { 191 var now = new Date(); 192 now.setTime(now.getTime() - 1000 * 3600); 193 document.cookie = "HappyLocalTimeZone=;expires=" + now.toUTCString() + ";"; 194 } 195 if (typeof haDisplayConditionInitialLoad != "undefined" && haDisplayConditionInitialLoad.status == true) { 196 if (typeof haDisplayConditionInitialLoad.date != "undefined" && haDisplayConditionInitialLoad.date != "") { 197 var ha_secure = document.location.protocol === "https:" ? "secure" : ""; 198 document.cookie = haDisplayConditionInitialLoad.name_1 + "=" + haDisplayConditionInitialLoad.value_1 + ";expires=" + haDisplayConditionInitialLoad.date + ";" + ha_secure; 199 document.cookie = haDisplayConditionInitialLoad.name + "=" + haDisplayConditionInitialLoad.value + ";expires=" + haDisplayConditionInitialLoad.date + ";" + ha_secure; 200 } else { 201 var ha_secure = document.location.protocol === "https:" ? "secure" : ""; 202 document.cookie = haDisplayConditionInitialLoad.name_1 + "=" + haDisplayConditionInitialLoad.value_1 + ";" + ha_secure; 203 document.cookie = haDisplayConditionInitialLoad.name + "=" + haDisplayConditionInitialLoad.value + ";" + ha_secure; 204 } 205 } 206 var CountDown = function CountDown($scope) { 207 var $item = $scope.find(".ha-countdown"); 208 var $countdown_item = $item.find(".ha-countdown-item"); 209 var $end_action = $item.data("end-action"); 210 var $redirect_link = $item.data("redirect-link"); 211 var $end_action_div = $item.find(".ha-countdown-end-action"); 212 var $editor_mode_on = $scope.hasClass("elementor-element-edit-mode"); 213 $item.countdown({ 214 end: function end() { 215 if (("message" === $end_action || "img" === $end_action) && $end_action_div !== undefined) { 216 $countdown_item.css("display", "none"); 217 $end_action_div.css("display", "block"); 218 } else if ("url" === $end_action && $redirect_link !== undefined && $editor_mode_on !== true) { 219 window.location.replace($redirect_link); 220 } 221 } 222 }); 223 }; 224 var SliderBase = elementorModules.frontend.handlers.Base.extend({ 225 onInit: function onInit() { 226 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 227 this.run(); 228 }, 229 getDefaultSettings: function getDefaultSettings() { 230 return { 231 selectors: { 232 container: ".ha-slider-container" 233 } 234 }; 235 }, 236 getDefaultElements: function getDefaultElements() { 237 var selectors = this.getSettings("selectors"); 238 return { 239 $container: this.$element.find(selectors.container) 240 }; 241 }, 242 getReadySettings: function getReadySettings() { 243 var $this = this; 244 var slidesPerView = parseInt(this.getElementSettings("slides_per_view")) || 1; 245 if (this.getElementSettings("thumbs_navigation") == "yes") { 246 var selectorThumbs = this.elements.$container.find(".ha-slider-gallery-thumbs"); 247 var haGallaryThumbs = new HaSwiper(selectorThumbs[0], { 248 spaceBetween: this.getElementSettings("space_between_thumbs"), 249 freeMode: true, 250 watchSlidesVisibility: true, 251 watchSlidesProgress: true 252 }); 253 } 254 // TODO: Need to fix that in future. Currently, Disabled 255 var tempEffect = this.getElementSettings("effect"); 256 if (tempEffect == 'cube') { 257 tempEffect = false;
258 } 259 var settings = { 260 direction: this.getElementSettings("slider_direction"), 261 slidesPerView: slidesPerView || 1, 262 spaceBetween: parseInt(this.getElementSettings("space_between_slides")) || 0, 263 loop: !!(this.getElementSettings("infinity_loop") || false), 264 speed: parseInt(this.getElementSettings("effect_speed")), 265 effect: this.getElementSettings("slider_type") == "multiple" ? this.getElementSettings("effect_multiple") : tempEffect, 266 ha_animation: this.getElementSettings("slider_content_animation"), 267 sliderType: this.getElementSettings("slider_type") 268 }; 269 if (this.getElementSettings("effect") == "flip") { 270 settings.flipEffect = { 271 limitRotation: true, 272 slideShadows: true 273 }; 274 } 275 // TODO: Need to fix that in future. Currently, Disabled 276 // if (this.getElementSettings("effect") == "cube") { 277 // settings.cubeEffect = { 278 // shadow: true, 279 // slideShadows: true, 280 // shadowOffset: 20, 281 // shadowScale: 0.94, 282 // }; 283 // } 284 if (this.getElementSettings("effect_multiple") == "coverflow") { 285 settings.coverflowEffect = { 286 rotate: 50, 287 stretch: 0, 288 depth: 100, 289 modifier: 1, 290 slideShadows: true 291 }; 292 } 293 if (this.getElementSettings("slider_type") == "multiple") { 294 var bpObj = { 295 desktop: { 296 slidesPerView: slidesPerView || 1, 297 spaceBetween: parseInt(this.getElementSettings("space_between_slides")) || 0 298 } 299 }; 300 var breakpoints = elementorFrontend.config.responsive.breakpoints; 301 $.each(breakpoints, function (idx, val) { 302 if (val.is_enabled) { 303 bpObj[idx] = { 304 screenSize: val.value, 305 slidesPerView: parseInt($this.getElementSettings("slides_per_view_" + idx)) || slidesPerView, 306 spaceBetween: parseInt($this.getElementSettings("space_between_slides_" + idx)) || 0 307 }; 308 } 309 }); 310 settings.customBreakpoints = bpObj; 311 settings.customMultiple = true; 312 } 313 if (this.getElementSettings("autoplay") == "yes") { 314 settings.autoplay = { 315 delay: this.getElementSettings("autoplay_speed"), 316 disableOnInteraction: false, 317 stopOnLastSlide: !(this.getElementSettings("infinity_loop") || false) 318 }; 319 } 320 if (this.getElementSettings("arrow_navigation") == "yes") { 321 var selectorNext = this.elements.$container.find(".ha-slider-next"); 322 var selectorPrev = this.elements.$container.find(".ha-slider-prev"); 323 settings.navigation = { 324 nextEl: selectorNext[0], 325 prevEl: selectorPrev[0] 326 }; 327 } 328 if (this.getElementSettings("pagination_type") == "dots") { 329 var selectorPagi = this.elements.$container.find(".ha-slider-pagination"); 330 settings.pagination = { 331 el: selectorPagi[0], 332 clickable: true 333 }; 334 } 335 if (this.getElementSettings("pagination_type") == "progressbar") { 336 var selectorPagi = this.elements.$container.find(".ha-slider-pagination"); 337 settings.pagination = { 338 el: selectorPagi[0], 339 clickable: true, 340 type: "progressbar" 341 }; 342 } 343 if (this.getElementSettings("pagination_type") == "numbers") { 344 var selectorPagi = this.elements.$container.find(".ha-slider-pagination"); 345 settings.pagination = { 346 el: selectorPagi[0], 347 clickable: true, 348 type: this.getElementSettings("number_pagination_type"), 349 renderBullet: function renderBullet(index, className) { 350 return '<span class="' + className + '">' + (index + 1) + "</span>"; 351 }, 352 renderFraction: function renderFraction(currentClass, totalClass) { 353 return '<span class="' + currentClass + '"></span>' + "<span>/</span>" + '<span class="' + totalClass + '"></span>'; 354 } 355 }; 356 } 357 if (this.getElementSettings("scroll_bar") == "yes") { 358 var selectorScroll = this.elements.$container.find(".ha-slider-scrollbar"); 359 settings.scrollbar = { 360 el: selectorScroll[0], 361 hide: this.getElementSettings("scroll_bar_visibility") == "true", 362 draggable: true 363 }; 364 } 365 if (this.getElementSettings("thumbs_navigation") == "yes") { 366 settings.thumbs = { 367 swiper: haGallaryThumbs 368 }; 369 } 370 return $.extend({}, settings); 371 }, 372 run: function run() { 373 var elContainer = this.elements.$container; 374 var slider = elContainer.find(".ha-slider-container"); 375 var readySettings = this.getReadySettings(); 376 var sliderObj = new HaSwiper(slider[0], readySettings); 377 if (readySettings.customMultiple) { 378 $(window).on('resize', function () { 379 var mode = $('body').attr('data-elementor-device-mode'); 380 sliderObj.params.slidesPerView = readySettings.customBreakpoints[mode].slidesPerView; 381 sliderObj.params.spaceBetween = readySettings.customBreakpoints[mode].spaceBetween; 382 sliderObj.update(); 383 }).resize(); 384 } 385 sliderObj.on("slideChange", function () { 386 if (readySettings.sliderType == "multiple") { 387 return; 388 } 389 var aI = sliderObj.activeIndex; 390 var elSlide = elContainer.find(".ha-slider-slide"); 391 var elSlideContent = elContainer.find(".ha-slider-content"); 392 var currentSlide = elSlideContent.eq(aI); 393 currentSlide.hide(); 394 if (currentSlide.length <= 0) {} 395 setTimeout(function () { 396 currentSlide.show(); 397 }, readySettings.speed); 398 elSlide.eq(aI).find(".elementor-invisible, .animated").each(function (e, t) { 399 var i = $(this).data("settings"); 400 if (i && (i._animation || i.animation)) { 401 var n = i._animation_delay ? i._animation_delay : 0, 402 a = i._animation || i.animation; 403 $(this).removeClass("elementor-invisible"); 404 $(this).addClass(a + " animated"); 405 } 406 }); 407 }); 408 sliderObj.on("transitionEnd", function () { 409 var aI = sliderObj.activeIndex; 410 var elSlide = elContainer.find(".ha-slider-slide"); 411 var elSlideContent = elContainer.find(".ha-slider-content"); 412 var currentSlide = elSlideContent.eq(aI); 413 setTimeout(function () { 414 elSlide.eq(aI).find(".animated").each(function (e, t) { 415 var i = $(this).data("settings"); 416 if (i && (i._animation || i.animation)) { 417 var n = i._animation_delay ? i._animation_delay : 0, 418 a = i._animation || i.animation; 419 $(this).removeClass(a); 420 } 421 }); 422 }, readySettings.speed); 423 }); 424 } 425 }); 426 var CarouselBase = elementorModules.frontend.handlers.Base.extend({ 427 onInit: function onInit() { 428 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 429 this.run(); 430 }, 431 getDefaultSettings: function getDefaultSettings() { 432 return { 433 selectors: { 434 container: ".ha-carousel-container" 435 },
436 arrows: false, 437 dots: false, 438 checkVisible: false, 439 infinite: true, 440 slidesToShow: 3, 441 rows: 0, 442 prevArrow: '<button type="button" class="slick-prev"><i class="fa fa-chevron-left"></i></button>', 443 nextArrow: '<button type="button" class="slick-next"><i class="fa fa-chevron-right"></i></button>' 444 }; 445 }, 446 getDefaultElements: function getDefaultElements() { 447 var selectors = this.getSettings("selectors"); 448 return { 449 $container: this.findElement(selectors.container) 450 }; 451 }, 452 onElementChange: function onElementChange() { 453 this.elements.$container.slick("unslick"); 454 this.run(); 455 }, 456 getReadySettings: function getReadySettings() { 457 var $rtl = $('html[dir="rtl"]').length == 1 || $('body').hasClass('rtl'); 458 if ('yes' == this.getElementSettings('vertical')) { 459 $rtl = false; // for vertical direction rtl is off 460 } 461 var settings = { 462 infinite: !!this.getElementSettings("loop"), 463 autoplay: !!this.getElementSettings("autoplay"), 464 autoplaySpeed: this.getElementSettings("autoplay_speed"), 465 speed: this.getElementSettings("animation_speed"), 466 centerMode: !!this.getElementSettings("center"), 467 vertical: !!this.getElementSettings("vertical"), 468 //slidesToScroll: 1, 469 rtl: $rtl 470 }; 471 switch (this.getElementSettings("navigation")) { 472 case "arrow": 473 settings.arrows = true; 474 break; 475 case "dots": 476 settings.dots = true; 477 break; 478 case "both": 479 settings.arrows = true; 480 settings.dots = true; 481 break; 482 } 483 var slides_to_scroll = !!this.getElementSettings('slides_to_scroll'); 484 settings.slidesToShow = parseInt(this.getElementSettings("slides_to_show")) || 1; 485 settings.slidesToScroll = slides_to_scroll ? parseInt(this.getElementSettings('slides_to_show')) || 1 : 1; 486 settings.responsive = [{ 487 breakpoint: elementorFrontend.config.breakpoints.lg, 488 settings: { 489 slidesToShow: parseInt(this.getElementSettings("slides_to_show_tablet")) || settings.slidesToShow, 490 slidesToScroll: slides_to_scroll ? parseInt(this.getElementSettings('slides_to_show_tablet')) || settings.slidesToShow : 1 491 } 492 }, { 493 breakpoint: elementorFrontend.config.breakpoints.md, 494 settings: { 495 slidesToShow: parseInt(this.getElementSettings("slides_to_show_mobile")) || parseInt(this.getElementSettings("slides_to_show_tablet")) || settings.slidesToShow, 496 slidesToScroll: slides_to_scroll ? parseInt(this.getElementSettings('slides_to_show_mobile')) || parseInt(this.getElementSettings('slides_to_show_tablet')) || settings.slidesToShow : 1 497 } 498 }]; 499 return $.extend({}, this.getSettings(), settings); 500 }, 501 run: function run() { 502 this.elements.$container.slick(this.getReadySettings()); 503 } 504 }); 505 506 // Source Code 507 var SourceCode = function SourceCode($scope) { 508 var $item = $scope.find('.ha-source-code'); 509 var $lng_type = $item.data('lng-type'); 510 var $after_copy_text = $item.data('after-copy'); 511 var $code = $item.find('code.language-' + $lng_type); 512 var $copy_btn = $scope.find('.ha-copy-code-button'); 513 $copy_btn.on('click', function () { 514 var $temp = $("<textarea>"); 515 $(this).append($temp); 516 $temp.val($code.text()).select(); 517 document.execCommand("copy"); 518 $temp.remove(); 519 if ($after_copy_text.length) { 520 $(this).text($after_copy_text); 521 } 522 }); 523 if ($lng_type !== undefined && $code !== undefined) { 524 Prism.highlightElement($code.get(0)); 525 } 526 }; 527 528 // Animated text 529 var AnimatedText = function AnimatedText($scope) { 530 var $item = $scope.find(".cd-headline"), 531 $animationDelay = $item.data("animation-delay"); 532 happyAnimatedText({ 533 selector: $item, 534 animationDelay: $animationDelay 535 }); 536 }; 537 //Instagram Feed 538 var InstagramFeed = function InstagramFeed($scope) { 539 var button = $scope.find(".ha-insta-load-more"); 540 var instagram_wrap = $scope.find(".ha-insta-default"); 541 button.on("click", function (e) { 542 e.preventDefault(); 543 var $self = $(this), 544 query_settings = $self.data("settings"), 545 total = $self.data("total"), 546 items = $scope.find(".ha-insta-item").length; 547 $.ajax({ 548 url: HappyProLocalize.ajax_url, 549 type: "POST", 550 data: { 551 action: "ha_instagram_feed_action", 552 security: HappyProLocalize.nonce, 553 query_settings: query_settings, 554 loaded_item: items 555 }, 556 success: function success(response) { 557 if (total > items) { 558 $(response).appendTo(instagram_wrap); 559 } else { 560 $self.text("All Loaded").addClass("loaded"); 561 setTimeout(function () { 562 $self.css({ 563 display: "none" 564 }); 565 }, 800); 566 } 567 }, 568 error: function error(_error2) {} 569 }); 570 }); 571 }; 572 //Scrolling Image 573 var ScrollingImage = elementorModules.frontend.handlers.Base.extend({ 574 onInit: function onInit() { 575 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 576 this.wrapper = this.$element.find(".ha-scrolling-image-wrapper"); 577 this.run(); 578 }, 579 onElementChange: function onElementChange() { 580 this.run(); 581 }, 582 run: function run() {
583 var container_height = this.wrapper.innerHeight(), 584 container_width = this.wrapper.innerWidth(), 585 image_align = this.wrapper.data("align"), 586 scroll_direction = this.wrapper.data("scroll-direction"), 587 items = this.wrapper.find(".ha-scrolling-image-container"), 588 single_image_box = items.find(".ha-scrolling-image-item"), 589 scroll = "scroll" + image_align + scroll_direction + parseInt(container_height) + parseInt(container_width), 590 duration = this.wrapper.data("duration"), 591 direction = "normal", 592 horizontal_align_width = 10, 593 vertical_align_height = 10; 594 var start = { 595 transform: "translateY(" + container_height + "px)" 596 }, 597 end = { 598 transform: "translateY(-101%)" 599 }; 600 if ("bottom" === scroll_direction || "right" === scroll_direction) { 601 direction = "reverse"; 602 } 603 if ("ha-horizontal" === image_align) { 604 start = { 605 transform: "translateX(" + container_width + "px)" 606 }; 607 end = { 608 transform: "translateX(-101%)" 609 }; 610 single_image_box.each(function () { 611 horizontal_align_width += $(this).outerWidth(true); 612 }); 613 items.css({ 614 width: horizontal_align_width, 615 display: "flex" 616 }); 617 items.find("img").css({ 618 "max-width": "100%" 619 }); 620 single_image_box.css({ 621 display: "inline-flex" 622 }); 623 } 624 if ("ha-vertical" === image_align) { 625 single_image_box.each(function () { 626 vertical_align_height += $(this).outerHeight(true); 627 }); 628 } 629 $.keyframe.define([{ 630 name: scroll, 631 "0%": start, 632 "100%": end 633 }]); 634 items.playKeyframe({ 635 name: scroll, 636 duration: duration.toString() + "ms", 637 timingFunction: "linear", 638 delay: "0s", 639 iterationCount: "infinite", 640 direction: direction, 641 fillMode: "none", 642 complete: function complete() {} 643 }); 644 } 645 }); 646 //Pricing Table ToolTip 647 var PricingTableToolTip = function PricingTableToolTip($scope) { 648 var tooltip_area = $scope.find(".ha-pricing-table-feature-tooltip"); 649 tooltip_area.on({ 650 mouseenter: function mouseenter(e) { 651 var $this = $(this), 652 direction = $this[0].getBoundingClientRect(), 653 tooltip = $this.find(".ha-pricing-table-feature-tooltip-text"), 654 tooltipW = tooltip.outerWidth(true), 655 tooltipH = tooltip.outerHeight(true), 656 W_width = $(window).width(), 657 W_height = $(window).height(); 658 tooltip.css({ 659 left: "0", 660 right: "auto", 661 top: "calc(100% + 1px)", 662 bottom: "auto" 663 }); 664 if (W_width - direction.left < tooltipW && direction.right < tooltipW) { 665 tooltip.css({ 666 left: "calc(50% - (" + tooltipW + "px/2))" 667 }); 668 } else if (W_width - direction.left < tooltipW) { 669 tooltip.css({ 670 left: "auto", 671 right: "0" 672 }); 673 } 674 if (W_height - direction.bottom < tooltipH) { 675 tooltip.css({ 676 top: "auto", 677 bottom: "calc(100% + 1px)" 678 }); 679 } 680 } 681 }); 682 }; 683 var TabHandlerBase = elementorModules.frontend.handlers.Base.extend({ 684 $activeContent: null, 685 getDefaultSettings: function getDefaultSettings() { 686 return { 687 selectors: { 688 tabTitle: ".ha-tab__title", 689 tabContent: ".ha-tab__content" 690 }, 691 classes: { 692 active: "ha-tab--active" 693 }, 694 showTabFn: "show", 695 hideTabFn: "hide", 696 toggleSelf: false, 697 hidePrevious: true, 698 autoExpand: true 699 }; 700 }, 701 getDefaultElements: function getDefaultElements() {
702 var selectors = this.getSettings("selectors"); 703 return { 704 $tabTitles: this.findElement(selectors.tabTitle), 705 $tabContents: this.findElement(selectors.tabContent) 706 }; 707 }, 708 activateDefaultTab: function activateDefaultTab() { 709 var settings = this.getSettings(); 710 if (!settings.autoExpand || "editor" === settings.autoExpand && !this.isEdit) { 711 return; 712 } 713 var defaultActiveTab = this.getEditSettings("activeItemIndex") || 1, 714 originalToggleMethods = { 715 showTabFn: settings.showTabFn, 716 hideTabFn: settings.hideTabFn 717 }; 718 // Toggle tabs without animation to avoid jumping 719 this.setSettings({ 720 showTabFn: "show", 721 hideTabFn: "hide" 722 }); 723 this.changeActiveTab(defaultActiveTab); 724 // Return back original toggle effects 725 this.setSettings(originalToggleMethods); 726 }, 727 deactivateActiveTab: function deactivateActiveTab(tabIndex) { 728 var settings = this.getSettings(), 729 activeClass = settings.classes.active, 730 activeFilter = tabIndex ? '[data-tab="' + tabIndex + '"]' : "." + activeClass, 731 $activeTitle = this.elements.$tabTitles.filter(activeFilter), 732 $activeContent = this.elements.$tabContents.filter(activeFilter); 733 $activeTitle.add($activeContent).removeClass(activeClass); 734 $activeContent[settings.hideTabFn](); 735 }, 736 activateTab: function activateTab(tabIndex) { 737 var settings = this.getSettings(), 738 activeClass = settings.classes.active, 739 $requestedTitle = this.elements.$tabTitles.filter('[data-tab="' + tabIndex + '"]'), 740 $requestedContent = this.elements.$tabContents.filter('[data-tab="' + tabIndex + '"]'); 741 $requestedTitle.add($requestedContent).addClass(activeClass); 742 $requestedContent[settings.showTabFn](); 743 }, 744 isActiveTab: function isActiveTab(tabIndex) { 745 return this.elements.$tabTitles.filter('[data-tab="' + tabIndex + '"]').hasClass(this.getSettings("classes.active")); 746 }, 747 bindEvents: function bindEvents() { 748 var _this = this; 749 this.elements.$tabTitles.on({ 750 keydown: function keydown(event) { 751 if ("Enter" === event.key) { 752 if ('A' == event.currentTarget.tagName && event.currentTarget.classList.contains('ha-tab__title')) { 753 //this conditional scope in only for advance tab widget 754 return; 755 } 756 event.preventDefault(); 757 _this.changeActiveTab(event.currentTarget.getAttribute("data-tab")); 758 } 759 }, 760 click: function click(event) { 761 if ('A' == event.currentTarget.tagName && event.currentTarget.classList.contains('ha-tab__title')) { 762 //this conditional scope in only for advance tab widget 763 return; 764 } 765 event.preventDefault(); 766 _this.changeActiveTab(event.currentTarget.getAttribute("data-tab")); 767 // iphone specific scroll to top 768 if (/iPhone/i.test(navigator.userAgent)) { 769 $("body,html,document").scrollTop($(this).offset().top); 770 } 771 } 772 }); 773 this.smoothScrollTabs(); 774 }, 775 onInit: function onInit() { 776 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 777 this.activateDefaultTab(); 778 this.smoothScrollTabs(); 779 }, 780 onEditSettingsChange: function onEditSettingsChange(propertyName) { 781 if ("activeItemIndex" === propertyName) { 782 this.activateDefaultTab(); 783 } 784 }, 785 changeActiveTab: function changeActiveTab(tabIndex) { 786 var isActiveTab = this.isActiveTab(tabIndex), 787 settings = this.getSettings(); 788 if ((settings.toggleSelf || !isActiveTab) && settings.hidePrevious) { 789 this.deactivateActiveTab(); 790 } 791 if (!settings.hidePrevious && isActiveTab) { 792 this.deactivateActiveTab(tabIndex); 793 } 794 if (!isActiveTab) { 795 this.activateTab(tabIndex); 796 } 797 $(window).trigger("resize"); 798 }, 799 smoothScrollTabs: function smoothScrollTabs() { 800 var that = this; 801 var tabTitles = this.$element.find('.ha-tabs__nav .ha-tab__title'); 802 $(window).on("resize", function () { 803 // Check if the screen width is less than or equal to 768px 804 if (window.innerWidth <= 768) { 805 tabTitles.each(function () { 806 $(this).on('click', function () { 807 var container = that.$element.find('.ha-tabs__nav')[0]; 808 if (container) { 809 var containerRect = container.getBoundingClientRect(); 810 var itemRect = this.getBoundingClientRect(); 811 // Calculate the scroll position to center the clicked item 812 var scrollPosition = container.scrollLeft + (itemRect.left - containerRect.left) - containerRect.width / 2 + itemRect.width / 2; 813 814 // Smoothly scroll to the calculated position 815 container.scrollTo({ 816 left: scrollPosition, 817 behavior: 'smooth' 818 }); 819 } 820 }); 821 }); 822 } 823 }).trigger("resize"); 824 } 825 }); 826 var TimeLine = function TimeLine($scope) { 827 var T_ID = $scope.data("id"); 828 var timeline = $scope.find(".ha-timeline-wrap"); 829 var dataScroll = timeline.data("scroll"); 830 var timeline_block = timeline.find(".ha-timeline-block"); 831 var event = "scroll.timelineScroll" + T_ID + " resize.timelineScroll" + T_ID; 832 function scroll_tree() { 833 timeline_block.each(function () { 834 var block_height = $(this).outerHeight(true); 835 var $offsetTop = $(this).offset().top;
836 var window_middle_p = $window.scrollTop() + $window.height() / 2; 837 if ($offsetTop < window_middle_p) { 838 $(this).addClass("ha-timeline-scroll-tree"); 839 } else { 840 $(this).removeClass("ha-timeline-scroll-tree"); 841 } 842 var scroll_tree_wrap = $(this).find(".ha-timeline-tree-inner"); 843 var scroll_height = $window.scrollTop() - scroll_tree_wrap.offset().top + $window.outerHeight() / 2; 844 if ($offsetTop < window_middle_p && timeline_block.hasClass("ha-timeline-scroll-tree")) { 845 if (block_height > scroll_height) { 846 scroll_tree_wrap.css({ 847 height: scroll_height * 1.5 + "px" 848 }); 849 } else { 850 scroll_tree_wrap.css({ 851 height: block_height * 1.2 + "px" 852 }); 853 } 854 } else { 855 scroll_tree_wrap.css("height", "0px"); 856 } 857 }); 858 } 859 if ("yes" === dataScroll) { 860 scroll_tree(); 861 $window.on(event, scroll_tree); 862 } else { 863 $window.off(event); 864 } 865 }; 866 var HotSpots = elementorModules.frontend.handlers.Base.extend({ 867 onInit: function onInit() { 868 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 869 this.init(); 870 }, 871 bindEvents: function bindEvents() { 872 if (!this.isEdit) { 873 this.elements.$items.on("click.spotClick", function (e) { 874 e.preventDefault(); 875 }); 876 } 877 }, 878 getDefaultSettings: function getDefaultSettings() { 879 return { 880 selectors: { 881 item: ".ha-hotspots__item" 882 } 883 }; 884 }, 885 getDefaultElements: function getDefaultElements() { 886 return { 887 $items: this.findElement(this.getSettings("selectors.item")) 888 }; 889 }, 890 onElementChange: function onElementChange(changedProp) { 891 if (!this.hasTipso()) { 892 return; 893 } 894 if (changedProp.indexOf("tooltip_") === 0) { 895 this.elements.$items.tipso("destroy"); 896 this.init(); 897 } 898 }, 899 hasTipso: function hasTipso() { 900 return $.fn["tipso"]; 901 }, 902 init: function init() { 903 var position = this.getElementSettings("tooltip_position"), 904 width = this.getElementSettings("tooltip_width"), 905 background = this.getElementSettings("tooltip_bg_color"), 906 color = this.getElementSettings("tooltip_color"), 907 speed = this.getElementSettings("tooltip_speed"), 908 delay = this.getElementSettings("tooltip_delay"), 909 hideDelay = this.getElementSettings("tooltip_hide_delay"), 910 hideArrow = this.getElementSettings("tooltip_hide_arrow"), 911 hover = this.getElementSettings("tooltip_hover"), 912 elementId = this.getID(); 913 if (!this.hasTipso()) { 914 return; 915 } 916 this.elements.$items.each(function (index, item) { 917 var $item = $(item), 918 target = $item.data("target"), 919 settings = $item.data("settings"), 920 classes = ["ha-hotspots--" + elementId, "elementor-repeater-item-" + target]; 921 $item.tipso({ 922 color: color, 923 width: width.size || 200, 924 position: settings.position || position, 925 speed: speed, 926 delay: delay, 927 showArrow: !hideArrow, 928 tooltipHover: !!hover, 929 hideDelay: hideDelay, 930 background: background, 931 useTitle: false, 932 content: $("#ha-" + target).html(), 933 onBeforeShow: function onBeforeShow($e, e, tooltip) { 934 $(document).find('.elementor-repeater-item-' + target).remove();
935 tooltip.tipso_bubble.addClass(classes.join(" ")); 936 } 937 }); 938 }); 939 } 940 }); 941 var LineChart = function LineChart($scope) { 942 haObserveTarget($scope[0], function () { 943 var $container = $scope.find(".ha-line-chart-container"), 944 $chart_canvas = $scope.find("#ha-line-chart"), 945 settings = $container.data("settings"); 946 if ($container.length) { 947 var chart = new Chart($chart_canvas, settings); 948 } 949 }); 950 }; 951 var RadarChart = function RadarChart($scope) { 952 haObserveTarget($scope[0], function () { 953 var $container = $scope.find(".ha-radar-chart-container"), 954 $chart_canvas = $scope.find("#ha-radar-chart"), 955 settings = $container.data("settings"); 956 if ($container.length) { 957 var chart = new Chart($chart_canvas, settings); 958 } 959 }); 960 }; 961 var PolarChart = function PolarChart($scope) { 962 haObserveTarget($scope[0], function () { 963 var $container = $scope.find(".ha-polar-chart-container"), 964 $chart_canvas = $scope.find("#ha-polar-chart"), 965 settings = $container.data("settings"); 966 if ($container.length) { 967 var chart = new Chart($chart_canvas, settings); 968 } 969 }); 970 }; 971 var PieChart = function PieChart($scope) { 972 haObserveTarget($scope[0], function () { 973 var $container = $scope.find(".ha-pie-chart-container"), 974 $chart_canvas = $scope.find("#ha-pie-chart"), 975 settings = $container.data("settings"); 976 if ($container.length) { 977 var chart = new Chart($chart_canvas, settings); 978 } 979 }); 980 }; 981 var StickyVideoArray = []; 982 var StickyVideo = function StickyVideo($scope) { 983 var $id = "#ha-sticky-video-player-" + $scope.data("id"), 984 $wrap = $scope.find(".ha-sticky-video-wrap"), 985 $settting = $wrap.data("ha-player"), 986 $box = $wrap.find(".ha-sticky-video-box"), 987 $overlay_box = $wrap.find(".ha-sticky-video-overlay"), 988 $overlay_play = $overlay_box.find(".ha-sticky-video-overlay-icon"), 989 $sticky_close = $wrap.find(".ha-sticky-video-close i"), 990 $all_box = $(".ha-sticky-video-box"), 991 event = "scroll.haStickyVideo" + $scope.data("id"), 992 set; 993 var playerAbc = new Plyr($id); 994 var StickyVideoObject = { 995 player: playerAbc, 996 event: event, 997 player_box: $box 998 }; 999 StickyVideoArray.push(StickyVideoObject); 1000 1001 //on ready 1002 playerAbc.on("ready", function (e) { 1003 var $box_plyr = $box.find('.plyr.plyr--video'); 1004 if (true == $settting.autoplay) { 1005 $box_plyr.trigger("click"); 1006 } 1007 }); 1008 1009 //on overlay click 1010 if (0 !== $overlay_box.length) { 1011 var $el = 0 !== $overlay_play.length ? $overlay_play : $overlay_box; 1012 $el.on("click", function () { 1013 playerAbc.play(); 1014 }); 1015 } 1016 //on close sticky 1017 $sticky_close.on("click", function () { 1018 $box.removeClass("sticky"); 1019 $box.addClass("sticky-close"); 1020 playerAbc.pause(); 1021 }); 1022 //on Play 1023 playerAbc.on("play", function (e) { 1024 $overlay_box.css("display", "none"); 1025 if ($box.hasClass("sticky-close")) { 1026 $box.removeClass("sticky-close"); 1027 } 1028 StickyVideoArray.forEach(function (item, index) { 1029 if (item.player !== playerAbc) { 1030 item.player.pause(); 1031 } 1032 if (item.event !== event) { 1033 $window.off(item.event); 1034 } 1035 if (item.player_box !== $box) { 1036 item.player_box.removeClass("sticky"); 1037 } 1038 }); 1039 if (true === $settting.sticky) { 1040 $window.on(event, function () { 1041 var height = $box.outerHeight(true); 1042 var $offsetTop = $wrap.offset().top; 1043 var videoBoxTopPoint = $window.scrollTop(); 1044 var videoBoxMiddlePoint = $offsetTop + height / 2; 1045 if (!$box.hasClass("sticky-close")) { 1046 if (videoBoxMiddlePoint < videoBoxTopPoint) { 1047 $box.addClass("sticky"); 1048 } else { 1049 $box.removeClass("sticky"); 1050 } 1051 } 1052 }); 1053 } else { 1054 $window.off(event); 1055 } 1056 }); 1057 // on pause 1058 playerAbc.on("pause", function (e) { 1059 $window.off(event); 1060 }); 1061 $window.on("load resize", debounce(function () { 1062 var height = $box.find(".plyr").height(); 1063 $wrap.css("min-height", height + "px"); 1064 }, 100)); 1065 }; 1066 1067 //facebook feed 1068 var FacebookFeed = function FacebookFeed($scope) { 1069 var button = $scope.find(".ha-facebook-load-more"); 1070 var facebook_wrap = $scope.find(".ha-facebook-items"); 1071 button.on("click", function (e) { 1072 e.preventDefault(); 1073 var $self = $(this), 1074 query_settings = $self.data("settings"), 1075 total = $self.data("total"), 1076 items = $scope.find(".ha-facebook-item").length; 1077 $.ajax({ 1078 url: HappyProLocalize.ajax_url, 1079 type: "POST", 1080 data: { 1081 action: "ha_facebook_feed_action", 1082 security: HappyProLocalize.nonce, 1083 query_settings: query_settings, 1084 loaded_item: items 1085 }, 1086 success: function success(response) { 1087 if (total > items) { 1088 $(response).appendTo(facebook_wrap); 1089 } else { 1090 $self.text("All Loaded").addClass("loaded"); 1091 setTimeout(function () { 1092 $self.css({ 1093 display: "none" 1094 }); 1095 }, 800); 1096 } 1097 }, 1098 error: function error(_error3) {} 1099 }); 1100 }); 1101 }; 1102 //SmartPostList 1103 var SmartPostList = function SmartPostList($scope) { 1104 var filterWrap = $scope.find(".ha-spl-filter"), 1105 customSelect = $scope.find(".ha-spl-custom-select"),
1106 gridWrap = $scope.find(".ha-spl-grid-area"), 1107 mainWrapper = $scope.find(".ha-spl-wrapper"), 1108 querySettings = mainWrapper.data("settings"), 1109 dataOffset = mainWrapper.attr("data-offset"), 1110 nav = $scope.find(".ha-spl-pagination button"), 1111 navPrev = $scope.find(".ha-spl-pagination button.prev"), 1112 navNext = $scope.find(".ha-spl-pagination button.next"), 1113 filter = $scope.find("ul.ha-spl-filter-list li span"), 1114 event; 1115 customSelect.niceSelect(); 1116 var select = $scope.find(".ha-spl-custom-select li"); 1117 function afterClick(e) { 1118 e.preventDefault(); 1119 var $self = $(this), 1120 dataFilter = filterWrap.attr("data-active"), 1121 dataTotalOffset = mainWrapper.attr("data-total-offset"), 1122 offset = "", 1123 termId = ""; 1124 if (e.target.classList.contains("prev") || e.target.classList.contains("fa-angle-left")) { 1125 if (0 == parseInt(dataTotalOffset)) { 1126 navPrev.attr("disabled", true); 1127 return; 1128 } 1129 offset = 0 !== parseInt(dataTotalOffset) ? parseInt(dataTotalOffset) - parseInt(dataOffset) : "0"; 1130 if (undefined !== dataFilter) { 1131 termId = dataFilter; 1132 } 1133 } else if (e.target.classList.contains("next") || e.target.classList.contains("fa-angle-right")) { 1134 offset = parseInt(dataTotalOffset) + parseInt(dataOffset); 1135 if (undefined !== dataFilter) { 1136 termId = dataFilter; 1137 } 1138 } 1139 if (e.target.hasAttribute("data-value")) { 1140 termId = e.target.dataset["value"]; 1141 filterWrap[0].setAttribute("data-active", termId); 1142 if ("SPAN" === e.target.tagName) { 1143 filter.removeClass("ha-active"); 1144 e.target.classList.toggle("ha-active"); 1145 } 1146 offset = 0; 1147 navPrev.attr("disabled", true); 1148 navNext.removeAttr("disabled"); 1149 } 1150 $.ajax({ 1151 url: HappyProLocalize.ajax_url, 1152 type: "POST", 1153 data: { 1154 action: "ha_smart_post_list_action", 1155 security: HappyProLocalize.nonce, 1156 querySettings: querySettings, 1157 offset: offset, 1158 termId: termId 1159 }, 1160 success: function success(response) { 1161 if ($(response).length > 0) { 1162 gridWrap.css("height", gridWrap.outerHeight(true) + "px"); 1163 gridWrap.html(""); 1164 $(response).appendTo(gridWrap); 1165 gridWrap.css("height", ""); 1166 mainWrapper[0].attributes["data-total-offset"].value = offset; 1167 if (e.target.classList.contains("prev") || e.target.classList.contains("fa-angle-left")) { 1168 navNext.removeAttr("disabled"); 1169 } 1170 if (e.target.classList.contains("next") || e.target.classList.contains("fa-angle-right")) { 1171 navPrev.removeAttr("disabled"); 1172 } 1173 } else { 1174 if (e.target.classList.contains("next") || e.target.classList.contains("fa-angle-right")) { 1175 navNext.attr("disabled", true); 1176 } 1177 } 1178 }, 1179 error: function error(_error4) {} 1180 }); 1181 } 1182 nav.on("click", afterClick); 1183 filter.on("click", afterClick); 1184 select.on("click", afterClick); 1185 }; 1186 1187 //PostGrid 1188 var postGridSkins = ["classic", "hawai", "standard", "monastic", "stylica", "outbox", "crossroad"]; 1189 var PostGrid = function PostGrid($scope) { 1190 var wrapper = $scope.find(".ha-pg-wrapper"), 1191 gridWrap = wrapper.find(".ha-pg-grid-wrap"), 1192 button = wrapper.find("button.ha-pg-loadmore"); 1193 button.on("click", function (e) { 1194 e.preventDefault(); 1195 var $self = $(this), 1196 querySettings = $self.data("settings"), 1197 items = wrapper.find(".ha-pg-item").length; 1198 $self.attr("disabled", true); 1199 $.ajax({ 1200 url: HappyProLocalize.ajax_url, 1201 type: "POST", 1202 data: { 1203 action: "hapro_post_grid_action", 1204 security: HappyProLocalize.nonce, 1205 querySettings: querySettings, 1206 loadedItem: items 1207 }, 1208 beforeSend: function beforeSend() { 1209 $self.find(".eicon-loading").css({ 1210 display: "inline-block" 1211 }); 1212 }, 1213 success: function success(response) { 1214 if (response) { 1215 $(response).each(function () { 1216 var $self = $(this); 1217 if ($self.hasClass("ha-pg-item")) { 1218 $self.addClass("ha-pg-item-loaded").appendTo(gridWrap); 1219 } else { 1220 $self.appendTo(gridWrap); 1221 } 1222 }); 1223 } else { 1224 $self.text("All Loaded").addClass("loaded"); 1225 setTimeout(function () { 1226 $self.css({ 1227 display: "none" 1228 }); 1229 }, 800); 1230 } 1231 $self.find(".eicon-loading").css({ 1232 display: "none" 1233 }); 1234 $self.removeAttr("disabled"); 1235 }, 1236 error: function error(_error5) {} 1237 }); 1238 }); 1239 }; 1240 1241 // Happy Loop Grid 1242 var LoopGrid = function LoopGrid($scope) { 1243 var wrapper = $scope.find(".ha-hlg-wrapper"), 1244 gridWrap = wrapper.find(".ha-hlg-grid-wrap"), 1245 button = wrapper.find("button.ha-hlg-loadmore"), 1246 createTemplate = $scope.find('.hlg-create-template'); 1247 // handle load more button 1248 button.on("click", function (e) { 1249 e.preventDefault(); 1250 var $self = $(this), 1251 querySettings = $self.data("settings"), 1252 items = wrapper.find(".ha-hlg-grid-item").length; 1253 $self.attr("disabled", true); 1254 $.ajax({ 1255 url: HappyProLocalize.ajax_url, 1256 type: "POST", 1257 data: { 1258 action: "hapro_loop_grid_action", 1259 security: HappyProLocalize.nonce, 1260 querySettings: querySettings, 1261 loadedItem: items 1262 }, 1263 beforeSend: function beforeSend() { 1264 $self.find(".eicon-loading").css({ 1265 display: "inline-block" 1266 }); 1267 }, 1268 success: function success(response) { 1269 if (response) { 1270 $(response).each(function () { 1271 var $self = $(this); 1272 if ($self.hasClass("ha-hlg-grid-item")) { 1273 $self.addClass("ha-hlg-grid-item-loaded").appendTo(gridWrap); 1274 } else { 1275 $self.appendTo(gridWrap); 1276 } 1277 }); 1278 } else { 1279 $self.text("All Loaded").addClass("loaded"); 1280 setTimeout(function () { 1281 $self.css({ 1282 display: "none" 1283 }); 1284 }, 800); 1285 } 1286 $self.find(".eicon-loading").css({ 1287 display: "none" 1288 }); 1289 $self.removeAttr("disabled"); 1290 }, 1291 error: function error(_error6) {} 1292 }); 1293 }); 1294 // handle create template 1295 if (createTemplate.length > 0) { 1296 createTemplate.on("click", function (e) { 1297 e.preventDefault(); 1298 window.open($(this).attr('href'), '_blank').focus(); 1299 }); 1300 } 1301 }; 1302 1303 // Advanced Data Table 1304 var DataTable = function DataTable($scope) { 1305 var dataTable = $scope.find(".ha-advanced-table"); 1306 var widgetWrapper = $scope.find(".elementor-widget-container"); 1307 var row_td = $scope.find(".ha-advanced-table__body-row-cell"); 1308 var search = dataTable.data("search") == true ? true : false;
1309 var paging = dataTable.data("paging") == true ? true : false; 1310 var scrollX = dataTable.data("scroll-x") == undefined ? false : true; 1311 if (window.innerWidth <= 767) { 1312 var scrollX = true; 1313 } 1314 if (0 == widgetWrapper.length) { 1315 widgetWrapper = $scope; 1316 } 1317 // DataTables.js settings 1318 $(dataTable).DataTable({ 1319 searching: search, 1320 paging: paging, 1321 orderCellsTop: true, 1322 scrollX: scrollX, 1323 aaSorting: [] 1324 }); 1325 var column_th = $scope.find(".ha-advanced-table__head-column-cell"); 1326 column_th.each(function (index, v) { 1327 $(column_th[index]).css("width", ""); 1328 }); 1329 // export table button 1330 if (dataTable.data("export-table") == true) { 1331 widgetWrapper.prepend('<div class="ha-advanced-table-btn-wrap"><button class="ha-advanced-table-btn">' + dataTable.data("export-table-text") + "</button></div>"); 1332 var dataTableBtn = $scope.find(".ha-advanced-table-btn"); 1333 dataTableBtn.on("click", function () { 1334 var oldDownloadNode = document.querySelector(".ha-advanced-data-table-export"); 1335 if (oldDownloadNode) { 1336 oldDownloadNode.parentNode.removeChild(oldDownloadNode); 1337 } 1338 var csv = []; 1339 dataTable.find("tr").each(function (index, tr) { 1340 var data = []; 1341 $(tr).find("th").each(function (index, th) { 1342 data.push(th.textContent); 1343 }); 1344 $(tr).find("td").each(function (index, td) { 1345 data.push(td.textContent); 1346 }); 1347 csv.push(data.join(",")); 1348 }); 1349 var csvFile = new Blob([csv.join("\n")], { 1350 type: "text/csv" 1351 }); 1352 var downloadNode = document.createElement("a"); 1353 var url = URL.createObjectURL(csvFile); 1354 var date = new Date(); 1355 var options = { 1356 day: "2-digit", 1357 month: "short", 1358 year: "numeric", 1359 hour: "numeric", 1360 minute: "numeric", 1361 second: "numeric" 1362 }; 1363 var formatedDate = date.toLocaleDateString("en-BD", options); 1364 var dateString = JSON.stringify(formatedDate.replace(/[ , :]/g, "-")); 1365 downloadNode.download = "advanced-data-table-" + dateString + "~" + dataTable.data("widget-id") + ".csv"; 1366 downloadNode.setAttribute("href", url); 1367 downloadNode.classList.add("ha-advanced-data-table-export"); 1368 downloadNode.style.visibility = "hidden"; 1369 document.body.appendChild(downloadNode); 1370 downloadNode.click(); 1371 }); 1372 } 1373 //for fit table th&td 1374 $(window).trigger('resize'); 1375 }; 1376 // ModalPopup 1377 var ModalPopup = function ModalPopup($scope) { 1378 var boxWrapper = $scope.find(".ha-modal-popup-box-wrapper"); 1379 var triggerType = boxWrapper.data("trigger-type"); 1380 var trigger = $scope.find(".ha-modal-popup-trigger"); 1381 var overlayClose = $scope.find(".ha-modal-popup-overlay"); 1382 var iconClose = $scope.find(".ha-modal-popup-content-close"); 1383 var modal = $scope.find(".ha-modal-popup-content-wrapper"); 1384 var modalAnimation = modal.data("animation"); 1385 var modalDelay = modal.data("display-delay"); 1386 if ("pageload" == triggerType) { 1387 if (!modal.hasClass("ha-modal-show")) { 1388 setTimeout(function () { 1389 modal.addClass("ha-modal-show"); 1390 modal.find(".ha-modal-animation").addClass(modalAnimation); 1391 }, parseInt(modalDelay)); 1392 } 1393 } else { 1394 trigger.on("click", function (e) { 1395 e.preventDefault(); 1396 var wrapper = $(this).closest(".ha-modal-popup-box-wrapper"), 1397 modal = wrapper.find(".ha-modal-popup-content-wrapper"), 1398 modalAnimation = modal.data("animation"), 1399 modalContent = modal.find(".ha-modal-animation"); 1400 if (!modal.hasClass("ha-modal-show")) { 1401 modal.addClass("ha-modal-show"); 1402 modalContent.addClass(modalAnimation); 1403 } 1404 }); 1405 } 1406 overlayClose.on("click", close_modal); 1407 iconClose.on("click", close_modal); 1408 function close_modal(el) { 1409 var wrap = $(this).closest(".ha-modal-popup-content-wrapper"), 1410 modalAnimation = wrap.data("animation"); 1411 if (wrap != null && wrap.hasClass("ha-modal-show")) { 1412 var doSetTimeout = function doSetTimeout(target, source) { 1413 setTimeout(function () { 1414 target.attr("src", source); 1415 }, 500); 1416 }; 1417 var nVideo = wrap.find("iframe, video"); 1418 $.each(nVideo, function (idx, val) { 1419 var videoSrc = $(this).attr("src"); 1420 $(this).attr("src", "https://happyaddons.com/marvin/index.html"); 1421 doSetTimeout($(this), videoSrc); 1422 }); 1423 wrap.removeClass("ha-modal-show"); 1424 wrap.find("." + modalAnimation).removeClass(modalAnimation); 1425 } 1426 } 1427 }; 1428 //Mini Cart 1429 var miniCart = function miniCart($scope) { 1430 $scope.find(".ha-mini-cart-inner").on("click mouseenter mouseleave", function (e) { 1431 var cart_btn = $(this), 1432 on_click = cart_btn.hasClass("ha-mini-cart-on-click"), 1433 on_hover = cart_btn.hasClass("ha-mini-cart-on-hover"), 1434 popup = cart_btn.find(".ha-mini-cart-popup"); 1435 if (popup.length == 0) { 1436 return; 1437 } 1438 if ("click" === e.type && on_click) { 1439 popup.fadeToggle(); 1440 } 1441 if ("mouseenter" === e.type && on_hover) { 1442 popup.fadeIn(); 1443 } 1444 if ("mouseleave" === e.type && on_hover) { 1445 popup.fadeOut(); 1446 } 1447 }); 1448 if ($scope.find(".ha-mini-cart-popup").length > 0 && $scope.find(".ha-mini-cart-on-click").length > 0) { 1449 $("body").on("click", function (e) { 1450 if ($(e.target).hasClass("ha-mini-cart-popup") || $(e.target).parents().hasClass("ha-mini-cart-popup") || $(e.target).hasClass("ha-mini-cart-button") || $(e.target).parents().hasClass("ha-mini-cart-button")) { 1451 return; 1452 } else { 1453 $scope.find(".ha-mini-cart-popup").removeAttr("style"); 1454 } 1455 }); 1456 } 1457 }; 1458 1459 //Image Scroller 1460 var ImageScroller = elementorModules.frontend.handlers.Base.extend({ 1461 onInit: function onInit() { 1462 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 1463 this.wrapper = this.$element.find(".ha-image-scroller-wrapper"); 1464 this.run(); 1465 }, 1466 onElementChange: function onElementChange() { 1467 this.run(); 1468 }, 1469 run: function run() { 1470 var triggerType = this.wrapper.data("trigger-type"); 1471 if ("hover" !== triggerType) { 1472 return; 1473 } 1474 var figure = this.wrapper.find(".ha-image-scroller-container"); 1475 var scrollType = this.wrapper.data("scroll-type"); 1476 var scrollDirection = this.wrapper.data("scroll-direction"); 1477 var imageScroll = figure.find("img"); 1478 var transformY = imageScroll.height() - figure.height(); 1479 var transformX = imageScroll.width() - figure.width(); 1480 if (scrollType === "vertical" && transformY > 0) { 1481 if ("top" === scrollDirection) { 1482 mouseEvent("translateY", transformY); 1483 } else { 1484 imageScroll.css("transform", "translateY" + "( -" + transformY + "px)"); 1485 mouseEventRevers("translateY", transformY); 1486 } 1487 } 1488 if (scrollType === "horizontal" && transformX > 0) { 1489 if ("left" === scrollDirection) { 1490 mouseEvent("translateX", transformX); 1491 } else { 1492 imageScroll.css("transform", "translateX" + "( -" + transformX + "px)"); 1493 mouseEventRevers("translateX", transformX); 1494 } 1495 } 1496 function mouseEvent(cssProperty, value) { 1497 figure.on("mouseenter", function () { 1498 imageScroll.css("transform", cssProperty + "( -" + value + "px)"); 1499 }); 1500 figure.on("mouseleave", function () { 1501 imageScroll.css("transform", cssProperty + "( 0px)"); 1502 }); 1503 } 1504 function mouseEventRevers(cssProperty, value) { 1505 figure.on("mouseenter", function () { 1506 imageScroll.css("transform", cssProperty + "( 0px)"); 1507 }); 1508 figure.on("mouseleave", function () { 1509 imageScroll.css("transform", cssProperty + "( -" + value + "px)"); 1510 }); 1511 } 1512 } 1513 }); 1514 // Mega Menu 1515 var NavMenu = function _init($scope) { 1516 $scope.find(".ha-menu-toggler").on("click", function (event) { 1517 event.preventDefault(); 1518 var el_form_group = $(this).parents(".ha-menu-container").parent(); 1519 if (el_form_group.length < 1) { 1520 el_form_group = $(this).parent(); 1521 } 1522 var $wrapElement = el_form_group.find(".ha-menu-offcanvas-elements"); 1523 if ($wrapElement.hasClass("active")) { 1524 $wrapElement.removeClass("active"); 1525 } else { 1526 $wrapElement.addClass("active"); 1527 } 1528 }); 1529 if ($scope.find(".ha-menu-container").length > 0) { 1530 var additionalDigits = $scope.find(".ha-wid-con").data("responsive-breakpoint");
1531 var sidebar_mousemove = $scope.find(".ha-megamenu-has"); 1532 var tabPadding = $scope.find(".ha-menu-container").outerHeight(); 1533 1534 // Prevent flashes loading 1535 $(document).ready(function () { 1536 $scope.find(".ha-megamenu-panel").css({ 1537 visibility: "visible" 1538 }); 1539 }); 1540 $(window).on("resize", function () { 1541 $scope.find(".ha-megamenu-panel").css({ 1542 top: tabPadding 1543 }); 1544 }).trigger("resize"); 1545 sidebar_mousemove.on("mouseenter", function () { 1546 var q = $(this).data("vertical-menu"); 1547 var jqel = $(this).children(".ha-megamenu-panel"); 1548 if ($(this).hasClass("ha-dropdown-menu-full_width") && $(this).hasClass("top_position")) { 1549 /** @type {number} */ 1550 var ffleft = Math.floor($(this).position().left - $(this).offset().left); 1551 var $sharepreview = $(this); 1552 $sharepreview.find(".ha-megamenu-panel").css("width", $(window).width()); 1553 $(window).on("resize", function () { 1554 $sharepreview.find(".ha-megamenu-panel").css({ 1555 left: ffleft + "px" 1556 }); 1557 }).trigger("resize"); 1558 } 1559 if (!$(this).hasClass("ha-dropdown-menu-full_width") && $(this).hasClass("top_position")) { 1560 $(this).on({ 1561 mouseenter: function setup() { 1562 if (0 === $(".default_menu_position").length) { 1563 $(this).parents(".elementor-section-wrap").addClass("default_menu_position"); 1564 } 1565 }, 1566 mouseleave: function setup() { 1567 if (0 !== $(".default_menu_position").length) { 1568 $(this).parents(".elementor-section-wrap").removeClass("default_menu_position"); 1569 } 1570 } 1571 }); 1572 } 1573 if (q && q !== undefined) { 1574 if ("string" == typeof q) { 1575 if (/^[0-9]/.test(q)) { 1576 $(window).on("resize", function () { 1577 jqel.css({ 1578 width: q 1579 }); 1580 if (!($(document).width() > Number(additionalDigits))) { 1581 jqel.removeAttr("style"); 1582 } 1583 }).trigger("resize"); 1584 } else { 1585 $(window).on("resize", function () { 1586 jqel.css({ 1587 width: q + "px" 1588 }); 1589 if (!($(document).width() > Number(additionalDigits))) { 1590 jqel.removeAttr("style"); 1591 } 1592 }).trigger("resize"); 1593 } 1594 } else { 1595 jqel.css({ 1596 width: q + "px" 1597 }); 1598 } 1599 } else { 1600 $(window).on("resize", function () { 1601 jqel.css({ 1602 width: q + "px" 1603 }); 1604 if (!($(document).width() > Number(additionalDigits))) { 1605 jqel.removeAttr("style"); 1606 } 1607 }).trigger("resize"); 1608 } 1609 }); 1610 sidebar_mousemove.trigger("mouseenter"); 1611 } 1612 }; 1613 elementorFrontend.hooks.addAction("frontend/element_ready/ha-countdown.default", CountDown); 1614 elementorFrontend.hooks.addAction("frontend/element_ready/ha-team-carousel.default", function ($scope) { 1615 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1616 $element: $scope, 1617 selectors: { 1618 container: ".ha-team-carousel-wrap" 1619 }, 1620 prevArrow: '<button type="button" class="slick-prev"><i class="hm hm-arrow-left"></i></button>', 1621 nextArrow: '<button type="button" class="slick-next"><i class="hm hm-arrow-right"></i></button>' 1622 }); 1623 }); 1624 elementorFrontend.hooks.addAction("frontend/element_ready/ha-source-code.default", SourceCode); 1625 elementorFrontend.hooks.addAction("frontend/element_ready/ha-animated-text.default", AnimatedText); 1626 elementorFrontend.hooks.addAction("frontend/element_ready/ha-logo-carousel.default", function ($scope) { 1627 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1628 $element: $scope, 1629 selectors: { 1630 container: ".ha-logo-carousel-wrap" 1631 } 1632 }); 1633 }); 1634 elementorFrontend.hooks.addAction("frontend/element_ready/ha-testimonial-carousel.default", function ($scope) { 1635 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1636 $element: $scope, 1637 selectors: { 1638 container: ".ha-testimonial-carousel__wrap" 1639 } 1640 }); 1641 }); 1642 elementorFrontend.hooks.addAction("frontend/element_ready/ha-advanced-tabs.default", function ($scope) { 1643 elementorFrontend.elementsHandler.addHandler(TabHandlerBase, { 1644 $element: $scope 1645 }); 1646 }); 1647 elementorFrontend.hooks.addAction("frontend/element_ready/ha-instagram-feed.default", InstagramFeed); 1648 elementorFrontend.hooks.addAction("frontend/element_ready/ha-scrolling-image.default", function ($scope) { 1649 elementorFrontend.elementsHandler.addHandler(ScrollingImage, { 1650 $element: $scope 1651 }); 1652 }); 1653 elementorFrontend.hooks.addAction("frontend/element_ready/ha-pricing-table.default", PricingTableToolTip); 1654 elementorFrontend.hooks.addAction("frontend/element_ready/ha-accordion.default", function ($scope) { 1655 elementorFrontend.elementsHandler.addHandler(TabHandlerBase, { 1656 $element: $scope, 1657 selectors: { 1658 tabTitle: ".ha-accordion__item-title", 1659 tabContent: ".ha-accordion__item-content" 1660 }, 1661 classes: { 1662 active: "ha-accordion__item--active" 1663 }, 1664 showTabFn: "slideDown", 1665 hideTabFn: "slideUp" 1666 }); 1667 }); 1668 elementorFrontend.hooks.addAction("frontend/element_ready/ha-toggle.default", function ($scope) { 1669 elementorFrontend.elementsHandler.addHandler(TabHandlerBase, { 1670 $element: $scope, 1671 selectors: { 1672 tabTitle: ".ha-toggle__item-title", 1673 tabContent: ".ha-toggle__item-content" 1674 }, 1675 classes: { 1676 active: "ha-toggle__item--active" 1677 }, 1678 hidePrevious: false, 1679 autoExpand: "editor", 1680 showTabFn: "slideDown", 1681 hideTabFn: "slideUp" 1682 }); 1683 }); 1684 elementorFrontend.hooks.addAction("frontend/element_ready/ha-timeline.default", TimeLine); 1685 elementorFrontend.hooks.addAction("frontend/element_ready/ha-hotspots.default", function ($scope) { 1686 elementorFrontend.elementsHandler.addHandler(HotSpots, { 1687 $element: $scope 1688 }); 1689 }); 1690 elementorFrontend.hooks.addAction("frontend/element_ready/ha-line-chart.default", LineChart); 1691 elementorFrontend.hooks.addAction("frontend/element_ready/ha-pie-chart.default", PieChart); 1692 elementorFrontend.hooks.addAction("frontend/element_ready/ha-polar-chart.default", PolarChart); 1693 elementorFrontend.hooks.addAction("frontend/element_ready/ha-radar-chart.default", RadarChart); 1694 elementorFrontend.hooks.addAction("frontend/element_ready/ha-facebook-feed.default", FacebookFeed); 1695 elementorFrontend.hooks.addAction("frontend/element_ready/ha-smart-post-list.default", SmartPostList); 1696 elementorFrontend.hooks.addAction("frontend/element_ready/ha-advanced-data-table.default", DataTable); 1697 elementorFrontend.hooks.addAction("frontend/element_ready/ha-twitter-carousel.default", function ($scope) { 1698 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1699 $element: $scope, 1700 selectors: { 1701 container: ".ha-tweet-carousel-items" 1702 } 1703 }); 1704 }); 1705 1706 // Post Carousel
1707 elementorFrontend.hooks.addAction("frontend/element_ready/ha-post-carousel.default", function ($scope) { 1708 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1709 $element: $scope, 1710 selectors: { 1711 container: ".ha-posts-carousel-wrapper" 1712 }, 1713 prevArrow: '<button type="button" class="slick-prev"><i class="hm hm-arrow-left"></i></button>', 1714 nextArrow: '<button type="button" class="slick-next"><i class="hm hm-arrow-right"></i></button>' 1715 }); 1716 }); 1717 1718 // EDD Download product carousel 1719 function initEddCarousel($scope) { 1720 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1721 $element: $scope, 1722 selectors: { 1723 container: ".ha-edd-product-carousel-wrapper" 1724 }, 1725 prevArrow: '<button type="button" class="slick-prev"><i class="hm hm-arrow-left"></i></button>', 1726 nextArrow: '<button type="button" class="slick-next"><i class="hm hm-arrow-right"></i></button>' 1727 }); 1728 } 1729 function eddCarouselHandlerCallback($scope) { 1730 initEddCarousel($scope); 1731 initProductQuickView($scope); 1732 1733 // if ( 1734 // $scope 1735 // .find(".ha-edd-product-carousel-wrapper") 1736 // .hasClass("ha-layout-classic") 1737 // ) { 1738 // $scope 1739 // .find(".ha-product-carousel-add-to-cart a") 1740 // .html('<i class="fas fa-shopping-cart"></i>'); 1741 // } 1742 } 1743 1744 // Carousel 1745 elementorFrontend.hooks.addAction("frontend/element_ready/ha-edd-product-carousel.default", eddCarouselHandlerCallback); 1746 1747 // product carousel 1748 function initProductCarousel($scope) { 1749 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1750 $element: $scope, 1751 selectors: { 1752 container: ".ha-product-carousel-wrapper" 1753 }, 1754 prevArrow: '<button type="button" class="slick-prev"><i class="hm hm-arrow-left"></i></button>', 1755 nextArrow: '<button type="button" class="slick-next"><i class="hm hm-arrow-right"></i></button>' 1756 }); 1757 } 1758 function productCarouselHandlerCallback($scope) { 1759 initProductCarousel($scope); 1760 initProductQuickView($scope); 1761 if ($scope.find(".ha-product-carousel-wrapper").hasClass("ha-layout-modern")) { 1762 $scope.find(".ha-product-carousel-add-to-cart a").html('<i class="fas fa-shopping-cart"></i>'); 1763 } 1764 } 1765 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-carousel.classic", productCarouselHandlerCallback); 1766 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-carousel.modern", productCarouselHandlerCallback); 1767 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-carousel-new.default", productCarouselHandlerCallback); 1768 // product category carousel 1769 var productCategoryCarouselSkins = ["classic", "minimal"]; 1770 function initProductCategoryCarousel($scope) { 1771 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1772 $element: $scope, 1773 selectors: { 1774 container: ".ha-product-cat-carousel" 1775 }, 1776 prevArrow: '<button type="button" class="slick-prev"><i class="hm hm-arrow-left"></i></button>', 1777 nextArrow: '<button type="button" class="slick-next"><i class="hm hm-arrow-right"></i></button>' 1778 }); 1779 } 1780 productCategoryCarouselSkins.forEach(function (index) { 1781 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-category-carousel." + index, initProductCategoryCarousel); 1782 }); 1783 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-category-carousel-new.default", initProductCategoryCarousel); 1784 1785 // EDD category carousel 1786 elementorFrontend.hooks.addAction("frontend/element_ready/ha-edd-category-carousel.default", initProductCategoryCarousel); 1787 postGridSkins.forEach(function (index) { 1788 elementorFrontend.hooks.addAction("frontend/element_ready/ha-post-grid." + index, PostGrid); 1789 }); 1790 elementorFrontend.hooks.addAction("frontend/element_ready/ha-post-grid-new.default", PostGrid); 1791 // elementorFrontend.hooks.addAction("frontend/element_ready/ha-happy-loop-grid.default", PostGrid); 1792 elementorFrontend.hooks.addAction("frontend/element_ready/ha-happy-loop-grid.default", Lo
1792opGrid); 1793 elementorFrontend.hooks.addAction("frontend/element_ready/ha-sticky-video.default", StickyVideo); 1794 elementorFrontend.hooks.addAction("frontend/element_ready/ha-modal-popup.default", ModalPopup); 1795 function initProductQuickView($scope) { 1796 var $button = $scope.find(".ha-pqv-btn"); 1797 if (!$.fn["magnificPopup"]) { 1798 return; 1799 } 1800 $button.magnificPopup({ 1801 type: "ajax", 1802 ajax: { 1803 settings: { 1804 cache: true, 1805 dataType: "html" 1806 }, 1807 cursor: "mfp-ajax-cur", 1808 tError: "The product could not be loaded." 1809 }, 1810 callbacks: { 1811 ajaxContentAdded: function ajaxContentAdded() { 1812 $(this.content).addClass(this.currItem.el.data("modal-class")); 1813 } 1814 } 1815 }); 1816 } 1817 var initOnePageNav = elementorModules.frontend.handlers.Base.extend({ 1818 onInit: function onInit() { 1819 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 1820 this.run(); 1821 }, 1822 onElementChange: function onElementChange(e) { 1823 if (e == 'scroll_wheel' || e == 'touch_swipe' || e == 'scroll_keys') { 1824 this.run(); 1825 } 1826 }, 1827 getReadySettings: function getReadySettings() { 1828 var settings = { 1829 design: this.getElementSettings('select_design'), 1830 speed: this.getElementSettings('scrolling_speed') || 700, 1831 offset: this.getElementSettings('row_to_offset') || 0, 1832 threshold: this.getEditSettings('section_threshold') || 0.50, 1833 scrollWheel: this.getElementSettings('scroll_wheel') == 'yes', 1834 touchSwipe: this.getElementSettings('touch_swipe') == 'yes', 1835 scrollKeys: this.getElementSettings('scroll_keys') == 'yes' 1836 }; 1837 return $.extend({}, this.getSettings(), settings); 1838 }, 1839 scroll: function scroll(id, speed, offset) { 1840 $('html, body').animate({ 1841 scrollTop: $('#' + id).offset().top - offset 1842 }, speed); 1843 }, 1844 run: function run() { 1845 var $this = this; 1846 var settings = this.getReadySettings(); 1847 var track = false; 1848 var $navWrapper = settings.design == 'ha-opn-design-default' ? this.$element.find(".ha-opn-dotted-item") : this.$element.find(".ha_opn__item"); 1849 $navWrapper.on('click', function (e) { 1850 e.preventDefault(); 1851 var targetId = $(this).find('a').data("section-id"); 1852 if ($('#' + targetId).length > 0) { 1853 track = false; 1854 $this.scroll(targetId, settings.speed, settings.offset); 1855 $navWrapper.removeClass('ha_opn__item--current'); 1856 $(this).addClass('ha_opn__item--current'); 1857 } 1858 }); 1859 var sections = []; 1860 var navItems = {}; 1861 if ($navWrapper.length > 0) { 1862 $.each($navWrapper, function (index, nav) { 1863 var targetId = $(this).find('a').data('section-id'); 1864 var targetSection = $('#' + targetId); 1865 sections.push(targetSection[0]); 1866 navItems[targetId] = $(this)[0]; 1867 }); 1868 } 1869 var observerOptions = { 1870 root: null, 1871 rootMargin: "0px 0px -100px 0px", 1872 threshold: settings.threshold 1873 }; 1874 var currentEvent; 1875 var observer = new IntersectionObserver(function (entries) { 1876 entries.forEach(function (entry) { 1877 if (entry.isIntersecting) { 1878 var navItem = navItems[entry.target.id]; 1879 navItem.classList.add('ha_opn__item--current'); 1880 Object.values(navItems).forEach(function (item) { 1881 if (item != navItem) { 1882 item.classList.remove('ha_opn__item--current'); 1883 } 1884 }); 1885 if (typeof elementor === 'undefined') { 1886 if (currentEvent == 'load' && track) { 1887 track = false; 1888 $this.scroll(entry.target.id, settings.speed, settings.offset); 1889 } 1890 if (settings.scrollWheel && currentEvent == 'scroll' && track) { 1891 track = false;
1892 $this.scroll(entry.target.id, settings.speed, settings.offset); 1893 } 1894 if (settings.scrollKeys && currentEvent == 'keys' && track) { 1895 track = false; 1896 $this.scroll(entry.target.id, settings.speed, settings.offset); 1897 } 1898 if (settings.touchSwipe && currentEvent == 'touch' && track) { 1899 track = false; 1900 $this.scroll(entry.target.id, settings.speed, settings.offset); 1901 } 1902 } 1903 } 1904 }); 1905 }, observerOptions); 1906 $(window).on('load', function () { 1907 track = true; 1908 if (sections.length > 0) { 1909 sections.forEach(function (sec) { 1910 if (!(sec == undefined)) { 1911 currentEvent = 'load'; 1912 observer.observe(sec); 1913 } 1914 }); 1915 } 1916 }); 1917 $(window).on('mousewheel DOMMouseScroll', debounce(function (e) { 1918 track = true; 1919 if (sections.length > 0) { 1920 sections.forEach(function (sec) { 1921 if (!(sec == undefined)) { 1922 currentEvent = 'scroll'; 1923 observer.observe(sec); 1924 } 1925 }); 1926 } 1927 }, 200)); 1928 if (typeof elementor === 'undefined') { 1929 if (settings.scrollKeys) { 1930 $(window).on('keydown', debounce(function (evt) { 1931 track = true; 1932 var code = parseInt(evt.keyCode); 1933 // code == 38 for arrow up key 1934 // code == 40 for arrow up key 1935 if (sections.length > 0) { 1936 sections.forEach(function (sec) { 1937 if (!(sec == undefined)) { 1938 currentEvent = 'keys'; 1939 observer.observe(sec); 1940 } 1941 }); 1942 } 1943 }, 200)); 1944 } 1945 if (settings.touchSwipe) { 1946 $(window).on('touchmove', debounce(function (evt) { 1947 track = true; 1948 if (sections.length > 0) { 1949 sections.forEach(function (sec) { 1950 if (!(sec == undefined)) { 1951 currentEvent = 'touch'; 1952 observer.observe(sec); 1953 } 1954 }); 1955 } 1956 }, 200)); 1957 } 1958 } 1959 } 1960 }); 1961 elementorFrontend.hooks.addAction("frontend/element_ready/ha-one-page-nav.default", function ($scope) { 1962 elementorFrontend.elementsHandler.addHandler(initOnePageNav, { 1963 $element: $scope 1964 }); 1965 }); 1966 // advancedSliderHandler 1967 elementorFrontend.hooks.addAction("frontend/element_ready/ha-advanced-slider.default", function ($scope) { 1968 elementorFrontend.elementsHandler.addHandler(SliderBase, { 1969 $element: $scope, 1970 selectors: { 1971 container: ".ha-slider-widget-wrapper" 1972 } 1973 }); 1974 }); 1975 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-grid.classic", initProductQuickView); 1976 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-grid.hover", initProductQuickView); 1977 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-grid-new.default", initProductQuickView); 1978 elementorFrontend.hooks.addAction("frontend/element_ready/ha-single-product.classic", initProductQuickView); 1979 elementorFrontend.hooks.addAction("frontend/element_ready/ha-single-product.standard", initProductQuickView); 1980 elementorFrontend.hooks.addAction("frontend/element_ready/ha-single-product.landscape", initProductQuickView); 1981 elementorFrontend.hooks.addAction("frontend/element_ready/ha-single-product-new.default", initProductQuickView); 1982 elementorFrontend.hooks.addAction("frontend/element_ready/ha-edd-single-product.default", initProductQuickView); 1983 elementorFrontend.hooks.addAction("frontend/element_ready/ha-edd-product-grid.default", initProductQuickView); 1984 $(document.body).on("added_to_cart", function (event, fragment, hash, $addToCart) { 1985 if ($addToCart != undefined && $addToCart.length > 0) { 1986 $addToCart.parent(".ha-product-grid__btns").removeClass("ha-is--adding").addClass("ha-is--added"); 1987 } 1988 }); 1989 elementorFrontend.hooks.addAction("frontend/element_ready/ha-mini-cart.default", miniCart); 1990 elementorFrontend.hooks.addAction("frontend/element_ready/ha-image-scroller.default", function ($scope) { 1991 elementorFrontend.elementsHandler.addHandler(ImageScroller, { 1992 $element: $scope 1993 }); 1994 }); 1995 elementorFrontend.hooks.addAction("frontend/element_ready/ha-nav-menu.default", NavMenu); 1996 1997 // Off Canvas 1998 var $trigger; 1999 var OffCanvas = function OffCanvas($scope) { 2000 this.node = $scope; 2001 this.wrap = $scope.find(".ha-offcanvas-content-wrap"); 2002 this.cart_wrap = $scope.find(".ha-offcanvas-cart-container"); 2003 this.content = $scope.find(".ha-offcanvas-content"); 2004 this.button = $scope.find(".ha-offcanvas-toggle"); 2005 this.settings = this.wrap.data("settings"); 2006 this.toggle_source = this.settings.toggle_source; 2007 this.id = this.settings.content_id; 2008 this.toggle_id = this.settings.toggle_id; 2009 this.toggle_class = this.settings.toggle_class; 2010 this.transition = this.settings.transition; 2011 this.esc_close = this.settings.esc_close; 2012 this.body_click_close = this.settings.body_click_close; 2013 this.links_click_close = this.settings.links_click_close; 2014 this.direction = this.settings.direction; 2015 this.buttons_position = this.settings.buttons_position; 2016 this.duration = 500; 2017 this.destroy(); 2018 this.init(); 2019 }; 2020 OffCanvas.prototype = { 2021 id: "", 2022 node: "", 2023 wrap: "", 2024 content: "", 2025 button: "", 2026 settings: {}, 2027 transition: "", 2028 duration: 400, 2029 initialized: false, 2030 animations: ["slide", "slide-along", "reveal", "push"],
2031 init: function init() { 2032 if (!this.wrap.length) { 2033 return; 2034 } 2035 $("html").addClass("ha-offcanvas-content-widget"); 2036 if ($(".ha-offcanvas-container").length === 0) { 2037 var faProJs = $("#font-awesome-pro-js").length > 0 ? $("#font-awesome-pro-js").attr("src") : false; 2038 if (faProJs) { 2039 $("#font-awesome-pro-js").remove(); 2040 } 2041 $("body").wrapInner('<div class="ha-offcanvas-container" />'); 2042 this.content.insertBefore(".ha-offcanvas-container"); 2043 if (faProJs) { 2044 $("body").append('<script type="text/javascript" id="font-awesome-pro-js" src="' + faProJs + '"></script>'); 2045 } 2046 } 2047 if (this.wrap.find(".ha-offcanvas-content").length > 0) { 2048 if ($(".ha-offcanvas-container > .ha-offcanvas-content-" + this.id).length > 0) { 2049 $(".ha-offcanvas-container > .ha-offcanvas-content-" + this.id).remove(); 2050 } 2051 if ($("body > .ha-offcanvas-content-" + this.id).length > 0) { 2052 $("body > .ha-offcanvas-content-" + this.id).remove(); 2053 } 2054 $("body").prepend(this.wrap.find(".ha-offcanvas-content")); 2055 } 2056 this.bindEvents(); 2057 }, 2058 destroy: function destroy() { 2059 this.close(); 2060 this.animations.forEach(function (animation) { 2061 if ($("html").hasClass("ha-offcanvas-content-" + animation)) { 2062 $("html").removeClass("ha-offcanvas-content-" + animation); 2063 } 2064 }); 2065 if ($("body > .ha-offcanvas-content-" + this.id).length > 0) { 2066 //$('body > .ha-offcanvas-content-' + this.id ).remove(); 2067 } 2068 }, 2069 setTrigger: function setTrigger() { 2070 var $trigger = false; 2071 if (this.toggle_source == "element-id" && this.toggle_id != "") { 2072 $trigger = $("#" + this.toggle_id); 2073 } else if (this.toggle_source == "element-class" && this.toggle_class != "") { 2074 $trigger = $("." + this.toggle_class); 2075 } else { 2076 $trigger = this.node.find(".ha-offcanvas-toggle"); 2077 } 2078 return $trigger; 2079 }, 2080 bindEvents: function bindEvents() { 2081 $trigger = this.setTrigger(); 2082 if ($trigger) { 2083 $trigger.on("click", $.proxy(this.toggleContent, this)); 2084 } 2085 $("body").delegate(".ha-offcanvas-content .ha-offcanvas-close", "click", $.proxy(this.close, this)); 2086 if (this.links_click_close === "yes") { 2087 $("body").delegate(".ha-offcanvas-content .ha-offcanvas-body a", "click", $.proxy(this.close, this)); 2088 } 2089 if (this.esc_close === "yes") { 2090 this.closeESC(); 2091 } 2092 if (this.body_click_close === "yes") { 2093 this.closeClick(); 2094 } 2095 $(window).resize($.proxy(this._resize, this)); 2096 }, 2097 toggleContent: function toggleContent(e) { 2098 e.preventDefault(); 2099 if (!$("html").hasClass("ha-offcanvas-content-open")) { 2100 this.show(); 2101 } else { 2102 this.close(); 2103 } 2104 this._resize(); 2105 }, 2106 show: function show() { 2107 $(".ha-offcanvas-content-" + this.id).addClass("ha-offcanvas-content-visible"); 2108 // init animation class. 2109 $("html").addClass("ha-offcanvas-content-" + this.transition); 2110 $("html").addClass("ha-offcanvas-content-" + this.direction); 2111 $("html").addClass("ha-offcanvas-content-open"); 2112 $("html").addClass("ha-offcanvas-content-" + this.id + "-open"); 2113 $("html").addClass("ha-offcanvas-content-reset"); 2114 this.button.addClass("ha-is-active"); 2115 this._resize(); 2116 }, 2117 close: function close() { 2118 $("html").removeClass("ha-offcanvas-content-open"); 2119 $("html").removeClass("ha-offcanvas-content-" + this.id + "-open"); 2120 setTimeout($.proxy(function () { 2121 $("html").removeClass("ha-offcanvas-content-reset"); 2122 $("html").removeClass("ha-offcanvas-content-" + this.transition); 2123 $("html").removeClass("ha-offcanvas-content-" + this.direction); 2124 $(".ha-offcanvas-content-" + this.id).removeClass("ha-offcanvas-content-visible"); 2125 }, this), 500); 2126 this.button.removeClass("ha-is-active"); 2127 }, 2128 closeESC: function closeESC() { 2129 var self = this; 2130 if ("" === self.settings.esc_close) { 2131 return; 2132 } 2133 // menu close on ESC key 2134 $(document).on("keydown", function (e) { 2135 if (e.keyCode === 27) { 2136 self.close(); 2137 } 2138 }); 2139 }, 2140 closeClick: function closeClick() { 2141 var self = this; 2142 if (this.toggle_source == "element-id" && this.toggle_id != "") { 2143 $trigger = "#" + this.toggle_id; 2144 } else if (this.toggle_source == "element-class" && this.toggle_class != "") { 2145 $trigger = "." + this.toggle_class; 2146 } else { 2147 $trigger = ".ha-offcanvas-toggle"; 2148 } 2149 $(document).on("click", function (e) { 2150 if ($(e.target).is(".ha-offcanvas-content") || $(e.target).parents(".ha-offcanvas-content").length > 0 || $(e.target).is(".ha-offcanvas-toggle") || $(e.target).parents(".ha-offcanvas-toggle").length > 0 || $(e.target).is($trigger) || $(e.target).parents($trigger).length > 0 || !$(e.target).is(".ha-offcanvas-container")) { 2151 return; 2152 } else { 2153 self.close(); 2154 } 2155 }); 2156 }, 2157 _resize: function _resize() { 2158 if (!this.cart_wrap.length) { 2159 return; 2160 } 2161 var off_canvas = $(".ha-offcanvas-content-" + this.id); 2162 if (off_canvas && off_canvas.length > 0) { 2163 if (this.buttons_position === "bottom") { 2164 var winHeight = window.innerHeight; 2165 var offset = 0; 2166 if ($("body").hasClass("admin-bar")) { 2167 offset = 32; 2168 } 2169 winHeight = winHeight - offset; 2170 off_canvas.find(".ha-offcanvas-inner").css({ 2171 height: winHeight + "px", 2172 top: offset 2173 }); 2174 headerHeight = off_canvas.find(".ha-offcanvas-cart-header").outerHeight(true); 2175 wrapHeight = off_canvas.find(".ha-offcanvas-wrap").outerHeight(); 2176 cartTotalHeight = off_canvas.find(".woocommerce-mini-cart__total").outerHeight(); 2177 cartButtonsHeight = off_canvas.find(".woocommerce-mini-cart__buttons").outerHeight(); 2178 cartMessageHeight = off_canvas.find(".ha-woo-menu-cart-message").outerHeight(); 2179 itemsHeight = winHeight - (headerHeight + cartTotalHeight + cartButtonsHeight + cartMessageHeight); 2180 finalItemsHeight = itemsHeight - (winHeight - wrapHeight); 2181 finalItemsHeight += "px"; 2182 } else { 2183 finalItemsHeight = "auto"; 2184 } 2185 var style = '<style id="ha-woo-style-' + this.id + '">'; 2186 style += "#" + off_canvas.attr("id") + " .woocommerce-mini-cart.cart_list {"; 2187 style += "height: " + finalItemsHeight; 2188 style += "}"; 2189 style += "</style>"; 2190 if ($("#ha-woopack-style-" + this.id).length > 0) { 2191 $("#ha-woopack-style-" + this.id).remove(); 2192 } 2193 $("head").append(style); 2194 } 2195 } 2196 }; 2197 var initOffCanvas = function initOffCanvas($scope, $) { 2198 var content_wrap = $scope.find(".ha-offcanvas-content-wrap"); 2199 if ($(content_wrap).length > 0) { 2200 new OffCanvas($scope); 2201 } 2202 }; 2203 elementorFrontend.hooks.addAction("frontend/element_ready/ha-off-canvas.default", initOffCanvas); 2204 var Unfold = elementorModules.frontend.handlers.Base.extend({ 2205 onInit: function onInit() { 2206 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 2207 this.run(); 2208 }, 2209 onElementChange: function onElementChange(e) { 2210 if (e == "unfold_text" || e == "unfold_icon" || e == "fold_text" || e == "fold_icon" || e == "fold_height" || e == "transition_duration" || e == "trigger") { 2211 this.run(); 2212 if (e == "fold_height") { 2213 this.$element.find(".ha-unfold-data").css("height", this.getCollapseHeight() + "px"); 2214 } 2215 } 2216 }, 2217 getReadySettings: function getReadySettings() { 2218 var settings = { 2219 collapse_height: this.getElementSettings("fold_height") || 50,
2220 collapse_height_tablet: this.getElementSettings("fold_height_tablet") || this.getElementSettings("fold_height") || 50, 2221 collapse_height_mobile: this.getElementSettings("fold_height_mobile") || this.getElementSettings("fold_height_tablet") || this.getElementSettings("fold_height") || 50, 2222 trigger: this.getElementSettings("trigger"), 2223 transition_duration: this.getElementSettings("transition_duration") || 500, 2224 collapse_text: this.getElementSettings("unfold_text"), 2225 collapse_icon: this.getElementSettings("unfold_icon"), 2226 expand_text: this.getElementSettings("fold_text"), 2227 expand_icon: this.getElementSettings("fold_icon") 2228 }; 2229 return $.extend({}, settings); 2230 }, 2231 getCollapseHeight: function getCollapseHeight() { 2232 var body = this.$element.parents("body"); 2233 var unfoldSettings = this.getReadySettings(); 2234 var collapse_height = 50; 2235 if (body.attr("data-elementor-device-mode") == "desktop") { 2236 collapse_height = unfoldSettings.collapse_height; 2237 } 2238 if (body.attr("data-elementor-device-mode") == "tablet") { 2239 collapse_height = unfoldSettings.collapse_height_tablet; 2240 } 2241 if (body.attr("data-elementor-device-mode") == "mobile") { 2242 collapse_height = unfoldSettings.collapse_height_mobile; 2243 } 2244 return collapse_height; 2245 }, 2246 fold: function fold(unfoldData, button, collapse_height, unfoldRender) { 2247 var unfoldSettings = this.getReadySettings(); 2248 var html = unfoldSettings.collapse_icon ? unfoldSettings.collapse_icon.value ? '<i aria-hidden="true" class="' + unfoldSettings.collapse_icon.value + '"></i>' : "" : ""; 2249 html += unfoldSettings.collapse_text ? "<span>" + unfoldSettings.collapse_text + "</span>" : ""; 2250 unfoldData.css({ 2251 "transition-duration": unfoldSettings.transition_duration + "ms", 2252 "height": unfoldRender.outerHeight(true) + 'px' 2253 }); 2254 unfoldData.animate({ 2255 height: collapse_height 2256 }, 0); 2257 var timeOut = setTimeout(function () { 2258 button.html(html); 2259 clearTimeout(timeOut); 2260 }, unfoldSettings.transition_duration); 2261 unfoldData.removeClass("folded"); 2262 }, 2263 unfold: function unfold(unfoldData, unfoldRender, button) { 2264 var unfoldSettings = this.getReadySettings(); 2265 var html = unfoldSettings.expand_icon ? unfoldSettings.expand_icon.value ? '<i aria-hidden="true" class="' + unfoldSettings.expand_icon.value + '"></i>' : "" : ""; 2266 html += unfoldSettings.expand_text ? "<span>" + unfoldSettings.expand_text + "</span>" : ""; 2267 unfoldData.css("transition-duration", unfoldSettings.transition_duration + "ms"); 2268 unfoldData.animate({ 2269 height: unfoldRender.outerHeight(true) 2270 }, 0); 2271 var timeOut = setTimeout(function () { 2272 unfoldData.css("height", 'auto'); 2273 button.html(html); 2274 clearTimeout(timeOut); 2275 }, unfoldSettings.transition_duration); 2276 unfoldData.addClass("folded"); 2277 }, 2278 run: function run() { 2279 var $this = this; 2280 var button = this.$element.find(".ha-unfold-btn"), 2281 unfoldData = this.$element.find(".ha-unfold-data"), 2282 unfoldRender = this.$element.find(".ha-unfold-data-render"); 2283 var unfoldSettings = this.getReadySettings(); 2284 var collapse_height = $this.getCollapseHeight(); 2285 unfoldData.css("height", collapse_height + "px"); 2286 if (unfoldSettings.trigger == "click") { 2287 button.on("click", function () { 2288 collapse_height = $this.getCollapseHeight(); 2289 if (unfoldData.hasClass("folded")) { 2290 $this.fold(unfoldData, button, collapse_height, unfoldRender); 2291 } else { 2292 $this.unfold(unfoldData, unfoldRender, button); 2293 } 2294 }); 2295 } else if (unfoldSettings.trigger == "hover") { 2296 unfoldData.on("mouseenter", function () { 2297 $this.unfold(unfoldData, unfoldRender, button); 2298 }); 2299 unfoldData.on("mouseleave", function () { 2300 collapse_height = $this.getCollapseHeight(); 2301 $this.fold(unfoldData, button, collapse_height, unfoldRender); 2302 }); 2303 } 2304 } 2305 }); 2306 var Maps = elementorModules.frontend.handlers.Base.extend({ 2307 onInit: function onInit() { 2308 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 2309 this.runMap(); 2310 }, 2311 defaultStyle: function defaultStyle() { 2312 var defaultStyles = { 2313 standard: "", 2314 silver: [{ 2315 elementType: "geometry", 2316 stylers: [{ 2317 color: "#f5f5f5" 2318 }] 2319 }, { 2320 elementType: "labels.icon", 2321 stylers: [{ 2322 visibility: "off" 2323 }] 2324 }, { 2325 elementType: "labels.text.fill", 2326 stylers: [{ 2327 color: "#616161" 2328 }] 2329 }, { 2330 elementType: "labels.text.stroke", 2331 stylers: [{ 2332 color: "#f5f5f5" 2333 }] 2334 }, { 2335 featureType: "administrative.land_parcel", 2336 elementType: "labels.text.fill", 2337 stylers: [{ 2338 color: "#bdbdbd" 2339 }] 2340 }, { 2341 featureType: "poi", 2342 elementType: "geometry", 2343 stylers: [{ 2344 color: "#eeeeee" 2345 }] 2346 }, { 2347 featureType: "poi", 2348 elementType: "labels.text.fill", 2349 stylers: [{ 2350 color: "#757575" 2351 }] 2352 }, { 2353 featureType: "poi.park", 2354 elementType: "geometry", 2355 stylers: [{ 2356 color: "#e5e5e5" 2357 }] 2358 }, { 2359 featureType: "poi.park", 2360 elementType: "labels.text.fill", 2361 stylers: [{ 2362 color: "#9e9e9e" 2363 }] 2364 }, { 2365 featureType: "road", 2366 elementType: "geometry", 2367 stylers: [{ 2368 color: "#ffffff" 2369 }] 2370 }, { 2371 featureType: "road.arterial", 2372 elementType: "labels.text.fill", 2373 stylers: [{ 2374 color: "#757575" 2375 }] 2376 }, { 2377 featureType: "road.highway", 2378 elementType: "geometry", 2379 stylers: [{ 2380 color: "#dadada" 2381 }] 2382 }, { 2383 featureType: "road.highway", 2384 elementType: "labels.text.fill", 2385 stylers: [{ 2386 color: "#616161" 2387 }] 2388 }, { 2389 featureType: "road.local", 2390 elementType: "labels.text.fill", 2391 stylers: [{ 2392 color: "#9e9e9e" 2393 }] 2394 }, { 2395 featureType: "transit.line", 2396 elementType: "geometry", 2397 stylers: [{ 2398 color: "#e5e5e5" 2399 }] 2400 }, { 2401 featureType: "transit.station", 2402 elementType: "geometry", 2403 stylers: [{ 2404 color: "#eeeeee" 2405 }] 2406 }, { 2407 featureType: "water", 2408 elementType: "geometry", 2409 stylers: [{ 2410 color: "#c9c9c9" 2411 }] 2412 }, { 2413 featureType: "water", 2414 elementType: "labels.text.fill", 2415 stylers: [{ 2416 color: "#9e9e9e" 2417 }] 2418 }], 2419 retro: [{ 2420 elementType: "geometry", 2421 stylers: [{ 2422 color: "#ebe3cd" 2423 }] 2424 }, { 2425 elementType: "labels.text.fill", 2426 stylers: [{ 2427 color: "#523735" 2428 }] 2429 }, { 2430 elementType: "labels.text.stroke", 2431 stylers: [{ 2432 color: "#f5f1e6" 2433 }] 2434 }, { 2435 featureType: "administrative", 2436 elementType: "geometry.stroke", 2437 stylers: [{ 2438 color: "#c9b2a6" 2439 }] 2440 }, { 2441 featureType: "administrative.land_parcel", 2442 elementType: "geometry.stroke", 2443 stylers: [{ 2444 color: "#dcd2be" 2445 }] 2446 }, { 2447 featureType: "administrative.land_parcel", 2448 elementType: "labels.text.fill", 2449 stylers: [{ 2450 color: "#ae9e90" 2451 }] 2452 }, { 2453 featureType: "landscape.natural", 2454 elementType: "geometry", 2455 stylers: [{ 2456 color: "#dfd2ae" 2457 }] 2458 }, { 2459 featureType: "poi", 2460 elementType: "geometry", 2461 stylers: [{ 2462 color: "#dfd2ae" 2463 }] 2464 }, { 2465 featureType: "poi", 2466 elementType: "labels.text.fill", 2467 stylers: [{ 2468 color: "#93817c" 2469 }] 2470 }, { 2471 featureType: "poi.park", 2472 elementType: "geometry.fill", 2473 stylers: [{ 2474 color: "#a5b076" 2475 }] 2476 }, { 2477 featureType: "poi.park", 2478 elementType: "labels.text.fill", 2479 stylers: [{ 2480 color: "#447530" 2481 }] 2482 }, { 2483 featureType: "road", 2484 elementType: "geometry", 2485 stylers: [{ 2486 color: "#f5f1e6" 2487 }] 2488 }, { 2489 featureType: "road.arterial", 2490 elementType: "geometry", 2491 stylers: [{ 2492 color: "#fdfcf8" 2493 }] 2494 }, { 2495 featureType: "road.highway", 2496 elementType: "geometry", 2497 stylers: [{ 2498 color: "#f8c967" 2499 }] 2500 }, { 2501 featureType: "road.highway", 2502 elementType: "geometry.stroke", 2503 stylers: [{ 2504 color: "#e9bc62" 2505 }] 2506 }, { 2507 featureType: "road.highway.controlled_access", 2508 elementType: "geometry", 2509 stylers: [{ 2510 color: "#e98d58" 2511 }] 2512 }, { 2513 featureType: "road.highway.controlled_access", 2514 elementType: "geometry.stroke", 2515 stylers: [{ 2516 color: "#db8555" 2517 }] 2518 }, { 2519 featureType: "road.local", 2520 elementType: "labels.text.fill", 2521 stylers: [{ 2522 color: "#806b63" 2523 }] 2524 }, { 2525 featureType: "transit.line", 2526 elementType: "geometry", 2527 stylers: [{ 2528 color: "#dfd2ae" 2529 }] 2530 }, { 2531 featureType: "transit.line", 2532 elementType: "labels.text.fill", 2533 stylers: [{ 2534 color: "#8f7d77" 2535 }] 2536 }, { 2537 featureType: "transit.line", 2538 elementType: "labels.text.stroke", 2539 stylers: [{ 2540 color: "#ebe3cd" 2541 }] 2542 }, { 2543 featureType: "transit.station", 2544 elementType: "geometry", 2545 stylers: [{ 2546 color: "#dfd2ae" 2547 }] 2548 }, { 2549 featureType: "water", 2550 elementType: "geometry.fill", 2551 stylers: [{ 2552 color: "#b9d3c2" 2553 }] 2554 }, { 2555 featureType: "water", 2556 elementType: "labels.text.fill", 2557 stylers: [{ 2558 color: "#92998d" 2559 }] 2560 }], 2561 dark: [{ 2562 elementType: "geometry", 2563 stylers: [{ 2564 color: "#212121" 2565 }] 2566 }, { 2567 elementType: "labels.icon", 2568 stylers: [{ 2569 visibility: "off" 2570 }] 2571 }, { 2572 elementType: "labels.text.fill", 2573 stylers: [{ 2574 color: "#757575" 2575 }] 2576 }, { 2577 elementType: "labels.text.stroke", 2578 stylers: [{ 2579 color: "#212121" 2580 }] 2581 }, { 2582 featureType: "administrative", 2583 elementType: "geometry", 2584 stylers: [{ 2585 color: "#757575" 2586 }] 2587 }, { 2588 featureType: "administrative.country", 2589 elementType: "labels.text.fill", 2590 stylers: [{ 2591 color: "#9e9e9e" 2592 }] 2593 }, { 2594 featureType: "administrative.land_parcel", 2595 stylers: [{ 2596 visibility: "off" 2597 }] 2598 }, { 2599 featureType: "administrative.locality", 2600 elementType: "labels.text.fill", 2601 stylers: [{ 2602 color: "#bdbdbd" 2603 }] 2604 }, { 2605 featureType: "poi", 2606 elementType: "labels.text.fill", 2607 stylers: [{ 2608 color: "#757575" 2609 }] 2610 }, { 2611 featureType: "poi.park", 2612 elementType: "geometry", 2613 stylers: [{ 2614 color: "#181818" 2615 }] 2616 }, { 2617 featureType: "poi.park", 2618 elementType: "labels.text.fill", 2619 stylers: [{ 2620 color: "#616161" 2621 }] 2622 }, { 2623 featureType: "poi.park", 2624 elementType: "labels.text.stroke", 2625 stylers: [{ 2626 color: "#1b1b1b" 2627 }] 2628 }, { 2629 featureType: "road", 2630 elementType: "geometry.fill", 2631 stylers: [{ 2632 color: "#2c2c2c" 2633 }] 2634 }, { 2635 featureType: "road", 2636 elementType: "labels.text.fill", 2637 stylers: [{ 2638 color: "#8a8a8a" 2639 }] 2640 }, { 2641 featureType: "road.arterial", 2642 elementType: "geometry", 2643 stylers: [{ 2644 color: "#373737" 2645 }] 2646 }, { 2647 featureType: "road.highway", 2648 elementType: "geometry", 2649 stylers: [{ 2650 color: "#3c3c3c" 2651 }] 2652 }, { 2653 featureType: "road.highway.controlled_access", 2654 elementType: "geometry", 2655 stylers: [{ 2656 color: "#4e4e4e" 2657 }] 2658 }, { 2659 featureType: "road.local", 2660 elementType: "labels.text.fill", 2661 stylers: [{ 2662 color: "#616161" 2663 }] 2664 }, { 2665 featureType: "transit", 2666 elementType: "labels.text.fill", 2667 stylers: [{ 2668 color: "#757575" 2669 }] 2670 }, { 2671 featureType: "water", 2672 elementType: "geometry", 2673 stylers: [{ 2674 color: "#000000" 2675 }] 2676 }, { 2677 featureType: "water", 2678 elementType: "labels.text.fill", 2679 stylers: [{ 2680 color: "#3d3d3d" 2681 }] 2682 }], 2683 night: [{ 2684 elementType: "geometry", 2685 stylers: [{ 2686 color: "#242f3e" 2687 }] 2688 }, { 2689 elementType: "labels.text.fill", 2690 stylers: [{ 2691 color: "#746855" 2692 }] 2693 }, { 2694 elementType: "labels.text.stroke", 2695 stylers: [{ 2696 color: "#242f3e" 2697 }] 2698 }, { 2699 featureType: "administrative.locality", 2700 elementType: "labels.text.fill", 2701 stylers: [{ 2702 color: "#d59563" 2703 }] 2704 }, { 2705 featureType: "poi", 2706 elementType: "labels.text.fill", 2707 stylers: [{ 2708 color: "#d59563" 2709 }] 2710 }, { 2711 featureType: "poi.park", 2712 elementType: "geometry", 2713 stylers: [{ 2714 color: "#263c3f" 2715 }] 2716 }, { 2717 featureType: "poi.park", 2718 elementType: "labels.text.fill", 2719 stylers: [{ 2720 color: "#6b9a76" 2721 }] 2722 }, { 2723 featureType: "road", 2724 elementType: "geometry", 2725 stylers: [{ 2726 color: "#38414e" 2727 }] 2728 }, { 2729 featureType: "road", 2730 elementType: "geometry.stroke", 2731 stylers: [{ 2732 color: "#212a37" 2733 }] 2734 }, { 2735 featureType: "road", 2736 elementType: "labels.text.fill", 2737 stylers: [{ 2738 color: "#9ca5b3" 2739 }] 2740 }, { 2741 featureType: "road.highway", 2742 elementType
2742: "geometry", 2743 stylers: [{ 2744 color: "#746855" 2745 }] 2746 }, { 2747 featureType: "road.highway", 2748 elementType: "geometry.stroke", 2749 stylers: [{ 2750 color: "#1f2835" 2751 }] 2752 }, { 2753 featureType: "road.highway", 2754 elementType: "labels.text.fill", 2755 stylers: [{ 2756 color: "#f3d19c" 2757 }] 2758 }, { 2759 featureType: "transit", 2760 elementType: "geometry", 2761 stylers: [{ 2762 color: "#2f3948" 2763 }] 2764 }, { 2765 featureType: "transit.station", 2766 elementType: "labels.text.fill", 2767 stylers: [{ 2768 color: "#d59563" 2769 }] 2770 }, { 2771 featureType: "water", 2772 elementType: "geometry", 2773 stylers: [{ 2774 color: "#17263c" 2775 }] 2776 }, { 2777 featureType: "water", 2778 elementType: "labels.text.fill", 2779 stylers: [{ 2780 color: "#515c6d" 2781 }] 2782 }, { 2783 featureType: "water", 2784 elementType: "labels.text.stroke", 2785 stylers: [{ 2786 color: "#17263c" 2787 }] 2788 }], 2789 aubergine: [{ 2790 elementType: "geometry", 2791 stylers: [{ 2792 color: "#1d2c4d" 2793 }] 2794 }, { 2795 elementType: "labels.text.fill", 2796 stylers: [{ 2797 color: "#8ec3b9" 2798 }] 2799 }, { 2800 elementType: "labels.text.stroke", 2801 stylers: [{ 2802 color: "#1a3646" 2803 }] 2804 }, { 2805 featureType: "administrative.country", 2806 elementType: "geometry.stroke", 2807 stylers: [{ 2808 color: "#4b6878" 2809 }] 2810 }, { 2811 featureType: "administrative.land_parcel", 2812 elementType: "labels.text.fill", 2813 stylers: [{ 2814 color: "#64779e" 2815 }] 2816 }, { 2817 featureType: "administrative.province", 2818 elementType: "geometry.stroke", 2819 stylers: [{ 2820 color: "#4b6878" 2821 }] 2822 }, { 2823 featureType: "landscape.man_made", 2824 elementType: "geometry.stroke", 2825 stylers: [{ 2826 color: "#334e87" 2827 }] 2828 }, { 2829 featureType: "landscape.natural", 2830 elementType: "geometry", 2831 stylers: [{ 2832 color: "#023e58" 2833 }] 2834 }, { 2835 featureType: "poi", 2836 elementType: "geometry", 2837 stylers: [{ 2838 color: "#283d6a" 2839 }] 2840 }, { 2841 featureType: "poi", 2842 elementType: "labels.text.fill", 2843 stylers: [{ 2844 color: "#6f9ba5" 2845 }] 2846 }, { 2847 featureType: "poi", 2848 elementType: "labels.text.stroke", 2849 stylers: [{ 2850 color: "#1d2c4d" 2851 }] 2852 }, { 2853 featureType: "poi.park", 2854 elementType: "geometry.fill", 2855 stylers: [{ 2856 color: "#023e58" 2857 }] 2858 }, { 2859 featureType: "poi.park", 2860 elementType: "labels.text.fill", 2861 stylers: [{ 2862 color: "#3C7680" 2863 }] 2864 }, { 2865 featureType: "road", 2866 elementType: "geometry", 2867 stylers: [{ 2868 color: "#304a7d" 2869 }] 2870 }, { 2871 featureType: "road", 2872 elementType: "labels.text.fill", 2873 stylers: [{ 2874 color: "#98a5be" 2875 }] 2876 }, { 2877 featureType: "road", 2878 elementType: "labels.text.stroke", 2879 stylers: [{ 2880 color: "#1d2c4d" 2881 }] 2882 }, { 2883 featureType: "road.highway", 2884 elementType: "geometry", 2885 stylers: [{ 2886 color: "#2c6675" 2887 }] 2888 }, { 2889 featureType: "road.highway", 2890 elementType: "geometry.stroke", 2891 stylers: [{ 2892 color: "#255763" 2893 }] 2894 }, { 2895 featureType: "road.highway", 2896 elementType: "labels.text.fill", 2897 stylers: [{ 2898 color: "#b0d5ce" 2899 }] 2900 }, { 2901 featureType: "road.highway", 2902 elementType: "labels.text.stroke", 2903 stylers: [{ 2904 color: "#023e58" 2905 }] 2906 }, { 2907 featureType: "transit", 2908 elementType: "labels.text.fill", 2909 stylers: [{ 2910 color: "#98a5be" 2911 }] 2912 }, { 2913 featureType: "transit", 2914 elementType: "labels.text.stroke", 2915 stylers: [{ 2916 color: "#1d2c4d" 2917 }] 2918 }, { 2919 featureType: "transit.line", 2920 elementType: "geometry.fill", 2921 stylers: [{ 2922 color: "#283d6a"
2923 }] 2924 }, { 2925 featureType: "transit.station", 2926 elementType: "geometry", 2927 stylers: [{ 2928 color: "#3a4762" 2929 }] 2930 }, { 2931 featureType: "water", 2932 elementType: "geometry", 2933 stylers: [{ 2934 color: "#0e1626" 2935 }] 2936 }, { 2937 featureType: "water", 2938 elementType: "labels.text.fill", 2939 stylers: [{ 2940 color: "#4e6d70" 2941 }] 2942 }] 2943 }; 2944 return defaultStyles; 2945 }, 2946 settings: function settings(wrapper) { 2947 var item = document.querySelector(wrapper); 2948 var settings = { 2949 latitude: parseFloat(item.dataset.latitude), 2950 longitude: parseFloat(item.dataset.longitude), 2951 mapType: item.dataset.mapType, 2952 markers: item.dataset.markers, 2953 polylines: item.dataset.polylines, 2954 mapZoom: parseInt(item.dataset.mapZoom), 2955 mapZoomMobile: parseInt(item.dataset.mapZoomMobile), 2956 mapZoomTablet: parseInt(item.dataset.mapZoomTablet), 2957 scrollWheelZoom: item.dataset.scrollWheelZoom, 2958 zoomControl: item.dataset.zoomControl, 2959 fullscreenControl: item.dataset.fullScreen, 2960 mapDraggable: item.dataset.disableMapDrag, 2961 showLegend: item.dataset.showLegend, 2962 showRoute: item.dataset.showRoute, 2963 googleMapType: item.dataset.googleMapType, 2964 mapTypeControl: item.dataset.mapTypeControl, 2965 streetViewControl: item.dataset.streetView, 2966 infoOpen: item.dataset.infoOpen, 2967 infoOpenHover: item.dataset.infoOpenHover, 2968 mapStyle: item.dataset.mapStyle, 2969 customMapStyles: item.dataset.customMapStyle, 2970 defaultStyle: this.defaultStyle(), 2971 strokeColor: item.dataset.strokeColor, 2972 strokeOpacity: item.dataset.strokeOpacity, 2973 strokeWeight: item.dataset.strokeWeight, 2974 strokeFill: item.dataset.strokeFill, 2975 strokeFillOpacity: item.dataset.strokeFillOpacity, 2976 originLat: item.dataset.originLat, 2977 originLng: item.dataset.originLng, 2978 destLat: item.dataset.destLat, 2979 destLng: item.dataset.destLng, 2980 travelMode: item.dataset.travelMode 2981 }; 2982 return settings; 2983 }, 2984 isValidJsonString: function isValidJsonString(jsonString) { 2985 try { 2986 JSON.parse(jsonString); 2987 } catch (e) { 2988 return false; 2989 } 2990 return true; 2991 }, 2992 mapInit: function mapInit(wrapper) { 2993 var settings = this.settings(wrapper); 2994 var markersOptionsArray = JSON.parse(settings.markers); 2995 var map; 2996 var directionsService = new google.maps.DirectionsService(); 2997 var directionsRenderer = new google.maps.DirectionsRenderer(); 2998 var finalZoomLevel = settings.mapZoom; 2999 window.addEventListener("resize", function () { 3000 if (elementorFrontend.getCurrentDeviceMode() == "mobile") { 3001 finalZoomLevel = settings.mapZoomMobile; 3002 } else if (elementorFrontend.getCurrentDeviceMode() == "tablet") { 3003 finalZoomLevel = settings.mapZoomTablet; 3004 } else { 3005 finalZoomLevel = settings.mapZoom; 3006 } 3007 }); 3008 map = new google.maps.Map(document.querySelector(".ha-adv-google-map__wrapper" + wrapper), { 3009 center: { 3010 lat: settings.latitude === "" ? -34.391 : settings.latitude, 3011 lng: settings.longitude === "" ? 150.644 : settings.longitude 3012 }, 3013 zoom: finalZoomLevel, 3014 mapTypeId: settings.mapType, 3015 zoomControl: settings.zoomControl === "yes", 3016 mapTypeControl: settings.mapTypeControl === "yes", 3017 fullscreenControl: settings.fullscreenControl === "yes", 3018 streetViewControl: settings.streetViewControl === "yes", 3019 gestureHandling: settings.scrollWheelZoom === "yes" ? "greedy" : "cooperative", 3020 draggable: settings.mapDraggable !== "yes", 3021 styles: settings.mapStyle !== "custom" ? settings.defaultStyle[settings.mapStyle] : !this.isValidJsonString(settings.customMapStyles) ? "" : JSON.parse(settings.customMapStyles) 3022 }); 3023 if (settings.mapDraggable === "yes") { 3024 map.setOptions({ 3025 draggableCursor: "default" 3026 }); 3027 } 3028 3029 // adding markers and info window on map 3030 markersOptionsArray.forEach(function (option) { 3031 var marker = new google.maps.Marker({ 3032 icon: option.pin_icon.url === "" ? "" : { 3033 url: option.pin_icon.url, 3034 scaledSize: new google.maps.Size(option.rectangular_image === "yes" ? +option.rectangular_pin_size_width.size : +option.square_pin_size.size, option.rectangular_image === "yes" ? +option.rectangular_pin_size_height.size : +option.square_pin_size.size) 3035 }, 3036 map: map, 3037 position: { 3038 lat: +option.pin_latitude, 3039 lng: +option.pin_longitude 3040 } 3041 }); 3042 var infoWindow = new google.maps.InfoWindow({ 3043 content: '<div class="ha-adv-google-map__marker-wrapper">' + '<div class="ha-adv-google-map__marker-title-wrapper">' + '<div class="ha-adv-google-map__marker-title" style="display: inline-block">' + option.pin_item_title + "</div>" + "</div>" + '<div class="ha-adv-google-map__marker-description-wrapper">' + '<div class="ha-adv-google-map__marker-description">' + option.pin_item_description + "</div>" + "</div>" + "</div>" 3044 }); 3045 if (settings.infoOpen === "yes") { 3046 infoWindow.open(map, marker); 3047 } 3048 if (settings.infoOpenHover === "yes") { 3049 marker.addListener("mouseover", function (e) { 3050 infoWindow.open(map, marker); 3051 }); 3052 marker.addListener("mouseout", function (e) { 3053 var timeOut = setTimeout(function () { 3054 infoWindow.close(); 3055 clearTimeout(timeOut); 3056 }, 1000); 3057 }); 3058 } else { 3059 marker.addListener("click", function () { 3060 infoWindow.open(map, marker); 3061 }); 3062 } 3063 }); 3064 3065 // adding map legend 3066 if (settings.showLegend === "yes") { 3067 var legend = document.querySelector(wrapper).nextElementSibling; 3068 map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(legend); 3069 } 3070 if (settings.googleMapType == "polyline") { 3071 var polylines_data = JSON.parse(settings.polylines); 3072 var polylines_arr = []; 3073 polylines_data.forEach(function (polyline) { 3074 polylines_arr.push({ 3075 lat: parseFloat(polyline.ha_gmap_polyline_lat), 3076 lng: parseFloat(polyline.ha_gmap_polyline_lng) 3077 }); 3078 }); 3079 var polyLinePath = JSON.parse(JSON.stringify(polylines_arr)); 3080 var polyPath = new google.maps.Polyline({ 3081 path: polyLinePath, 3082 strokeColor: settings.strokeColor, 3083 strokeOpacity: settings.strokeOpacity, 3084 strokeWeight: settings.strokeWeight 3085 });
3086 polyPath.setMap(map); 3087 } 3088 if (settings.googleMapType == "polygon") { 3089 var polylines_data = JSON.parse(settings.polylines); 3090 var polylines_arr = []; 3091 polylines_data.forEach(function (polyline) { 3092 polylines_arr.push({ 3093 lat: parseFloat(polyline.ha_gmap_polyline_lat), 3094 lng: parseFloat(polyline.ha_gmap_polyline_lng) 3095 }); 3096 }); 3097 var polyLinePath = JSON.parse(JSON.stringify(polylines_arr)); 3098 var polygon = new google.maps.Polygon({ 3099 path: polyLinePath, 3100 strokeColor: settings.strokeColor, 3101 strokeOpacity: settings.strokeOpacity, 3102 strokeWeight: settings.strokeWeight, 3103 fillColor: settings.strokeFill, 3104 fillOpacity: settings.strokeFillOpacity 3105 }); 3106 polygon.setMap(map); 3107 } 3108 if (settings.googleMapType == "routes") { 3109 this.routeDraw(directionsService, directionsRenderer, settings); 3110 directionsRenderer.setMap(map); 3111 } 3112 google.maps.event.addDomListener(window, "resize", function () { 3113 var center = map.getCenter(); 3114 google.maps.event.trigger(map, "resize"); 3115 map.setCenter(center); 3116 map.setZoom(finalZoomLevel); 3117 }); 3118 }, 3119 routeDraw: function routeDraw(directionsService, directionsRenderer, settings) { 3120 var start = settings.originLat + "," + settings.originLng; 3121 var end = settings.destLat + "," + settings.destLng; 3122 directionsService.route({ 3123 origin: { 3124 query: start 3125 }, 3126 destination: { 3127 query: end 3128 }, 3129 travelMode: settings.travelMode.toUpperCase() 3130 }, function (response, status) { 3131 if (status === "OK") { 3132 directionsRenderer.setDirections(response); 3133 } else {} 3134 }); 3135 }, 3136 runMap: function runMap() { 3137 var gmaper = document.querySelectorAll(".ha-adv-google-map__wrapper"); 3138 for (var i = 0; i < gmaper.length; i++) { 3139 gmaper[i].classList.add("ha-adv-google-map__wrapper--item" + i); 3140 this.mapInit(".ha-adv-google-map__wrapper--item" + i); 3141 } 3142 } 3143 }); 3144 elementorFrontend.hooks.addAction("frontend/element_ready/ha-google-map.default", function ($scope) { 3145 elementorFrontend.elementsHandler.addHandler(Maps, { 3146 $element: $scope, 3147 selectors: { 3148 container: ".ha-adv-google-map__wrapper" 3149 } 3150 }); 3151 }); 3152 elementorFrontend.hooks.addAction("frontend/element_ready/ha-unfold.default", function ($scope) { 3153 elementorFrontend.elementsHandler.addHandler(Unfold, { 3154 $element: $scope 3155 }); 3156 }); 3157 var EddCart = function EddCart($scope) { 3158 var optionEL = $scope.find('.ha-edd-table-wrap'); 3159 var settings = optionEL.data('options'); 3160 var removeEl = $scope.find('.edd-remove-from-cart'); 3161 if (settings.cart_btn_type == 'icon') { 3162 removeEl.html("<i class=\"".concat(settings.icon.value, "\"></i>")); 3163 } else { 3164 removeEl.text(settings.btn_text); 3165 } 3166 }; 3167 elementorFrontend.hooks.addAction('frontend/element_ready/ha-edd-cart.default', EddCart); 3168 var EddCheckout = function EddCheckout($scope) { 3169 var optionEL = $scope.find('.ha-edd-table-wrap'); 3170 var settings = optionEL.data('options'); 3171 var removeEl = $scope.find('.edd_cart_remove_item_btn'); 3172 if (settings.cart_btn_type == 'icon') { 3173 removeEl.html("<i class=\"".concat(settings.icon.value, "\"></i>")); 3174 } else { 3175 removeEl.text(settings.btn_text); 3176 } 3177 }; 3178 elementorFrontend.hooks.addAction('frontend/element_ready/ha-edd-checkout.default', EddCheckout); 3179 var EddAjaxBtn = function EddAjaxBtn($scope) { 3180 var btn = $scope.find(".ha_edd_ajax_btn"); 3181 btn.on('click', function (event) { 3182 event.preventDefault(); 3183 var $self = $(this), 3184 download_id = $self.data('download-id'), 3185 nonce = $self.data('nonce'); 3186 $.ajax({ 3187 url: HappyProLocalize.ajax_url, 3188 type: "POST", 3189 data: { 3190 action: "ha_edd_ajax_add_to_cart_link", 3191 security: HappyProLocalize.nonce, 3192 download_id: download_id 3193 }, 3194 success: function success(response) { 3195 if (response.success == true) { 3196 $self.html("<i class=\"fas fa-cart-plus\"></i>"); 3197 } 3198 } 3199 }); 3200 }); 3201 }; 3202 elementorFrontend.hooks.addAction('frontend/element_ready/ha-edd-product-grid.default', EddAjaxBtn); 3203 elementorFrontend.hooks.addAction('frontend/element_ready/ha-edd-product-carou
3203sel.default', EddAjaxBtn); 3204 elementorFrontend.hooks.addAction('frontend/element_ready/ha-edd-single-product.default', EddAjaxBtn); 3205 var Image_Swap = function Image_Swap($scope) { 3206 var element = $scope.find('.ha-image-swap-wrapper'); 3207 var trigger_type = element.data('trigger'); 3208 var status; 3209 if (trigger_type === 'click') { 3210 element.on('click', element, function () { 3211 var self = $(this); 3212 var click = self.attr('data-click'); 3213 if ('inactive' == click) { 3214 status = 'active'; 3215 } else { 3216 status = 'inactive'; 3217 } 3218 self.attr('data-click', status); 3219 var first_img = self.find('.img_swap_first'); 3220 var second_img = self.find('.img_swap_second'); 3221 }); 3222 } 3223 var elm = $scope.find('.ha-image-swap-ctn'); 3224 var elm_img = $scope.find('.ha-image-swap-item'); 3225 var trigger = elm.data('trigger'); 3226 if (elm.length > 0) { 3227 $('.ha-image-swap-ctn').on('click', '.ha-image-swap-item', function (e) { 3228 var elem = $(this); 3229 var parent = elem.parent('.ha-image-swap-insider'); 3230 var firstChild = parent.children('.ha-image-swap-item:first-of-type'); 3231 var secondChild = parent.children('.ha-image-swap-item:nth-of-type(2)'); 3232 if (!elem.is(':first-child')) { 3233 parent.addClass('changed'); 3234 setTimeout(function () { 3235 firstChild.remove(); 3236 parent.append(firstChild); 3237 parent.removeClass('changed'); 3238 }, 400); 3239 } 3240 }); 3241 } 3242 // if( trigger == 'hover'){ 3243 // elm.hover(function (e){ 3244 // var target = e.target; 3245 3246 // if(!$(target).hasClass('active')){ 3247 3248 // var $self = $(this); 3249 // var parent = $self.find('.ha-image-swap-insider'); 3250 // var firstChild = parent.children('.ha-image-swap-item:first-of-type'); 3251 // var secondChild = parent.children('.ha-image-swap-item:nth-of-type(2)'); 3252 3253 // firstChild.toggleClass('active'); 3254 // secondChild.toggleClass('active'); 3255 // } 3256 // }); 3257 // } 3258 }; 3259 var FlipBox = function FlipBox($scope) { 3260 var element = $scope.find('.ha-flip-box-inner'); 3261 // touchstart 3262 element.on('mouseenter mouseleave touchstart', function (e) { 3263 if (('mouseenter' == e.type || 'touchstart' == e.type) && !$(this).hasClass('flip')) { 3264 $(this).addClass('flip'); 3265 } else if (('mouseleave' == e.type || 'touchstart' == e.type) && $(this).hasClass('flip')) { 3266 $(this).removeClass('flip'); 3267 } else if ('touchstart' == e.type && $(this).hasClass('flip')) { 3268 $(this).removeClass('flip'); 3269 } 3270 }); 3271 }; 3272 elementorFrontend.hooks.addAction('frontend/element_ready/ha-image-swap.default', Image_Swap); 3273 var FreeShippingBar = function FreeShippingBar($scope) { 3274 var $fsbContainer = $scope.find('.ha-fsb-container'); 3275 if ($fsbContainer) { 3276 var $settings = $fsbContainer.data('fsb_settings'); 3277 if ($settings != undefined) { 3278 var $aimationSpeed = $settings.hasOwnProperty('ha_fsb_animation_speed') ? $settings.ha_fsb_animation_speed : 15; 3279 var $achivePercent = $settings.hasOwnProperty('achive_percent') ? $settings.achive_percent : 0; 3280 var $progressType = $settings.hasOwnProperty('progress_type') ? $settings.progress_type : 'percent'; 3281 var $currencySymbol = $settings.hasOwnProperty('currencySymbol') && $progressType == 'percent' ? '%' : $settings.currencySymbol; 3282 var $cartTotal = $settings.hasOwnProperty('cart_total') ? $settings.cart_total : 0; 3283 var $totalPercent = parseFloat(Math.round($achivePercent)) >= 100 ? 100 : parseFloat(Math.round($achivePercent)); 3284 var $progressText = $progressType == 'percent' ? $totalPercent : $cartTotal; 3285 var $elem = $fsbContainer.find('.ha-fsb-size'); 3286 $elem.text($progressText + $currencySymbol); 3287 var defaultWidth = $(window).width() <= 768 ? 12 : 5; 3288 $totalPercent > 0 ? $elem.css({ 3289 'width': $totalPercent + "%", 3290 'transition': 'width ' + $aimationSpeed + 'ms ease-in-out' 3291 }) : $elem.css('width', +defaultWidth + "%"); 3292 } 3293 } 3294 }; 3295 elementorFrontend.hooks.addAction('frontend/element_ready/ha-shipping-bar.default', FreeShippingBar); 3296 $('.fsb-close-icon').on('click', function () { 3297 document.cookie = "ha_close_fsb = yes;path=/"; 3298 $('.ha-fsb-container').hide(); 3299 }); 3300 elementorFrontend.hooks.addAction('frontend/element_ready/ha-flip-box.default', FlipBox
3300); 3301 var HaRemoteCarousel = function HaRemoteCarousel($scope) { 3302 var $rcContainer = $scope.find('.ha-remote-carousel-container'); 3303 if ($rcContainer) { 3304 var $rcBtn = $($rcContainer).find('.ha-custom-nav-remote-carousel'); 3305 if ($rcBtn) { 3306 var $prevSliderIndex = 0; 3307 var $slides_to_show = 0; 3308 var $ha_show_thumbnail = $($rcBtn).parent().data('show_thumbnail'); 3309 var $ha_rc_unique_id = $($rcBtn).parent().data('ha_rc_id'); 3310 var $haRcSelector = $ha_rc_unique_id ? $('[data-ha_rcc_uid="' + $ha_rc_unique_id + '"]') : ''; 3311 if ($ha_show_thumbnail && $ha_show_thumbnail == 'yes') { 3312 $haRcSelector.on('init', function (event, slick, currentSlide) { 3313 var $dataSettingsSelector = $haRcSelector.parent().parent(); 3314 var $dataSettings = $dataSettingsSelector.data('settings'); 3315 $slides_to_show = typeof $dataSettings === "undefined" ? $slides_to_show : $dataSettings.slides_to_show; 3316 $prevSliderIndex = (currentSlide ? currentSlide : 0) - 1; 3317 var $nextIndex = parseInt($slides_to_show) + parseInt($prevSliderIndex) + 1; 3318 var $nextItem = $haRcSelector.find('[data-slick-index="' + $nextIndex + '"]');
3319 var $nextImg = $nextItem.find('img').attr('src'); 3320 var $prevItem = $haRcSelector.find('[data-slick-index="' + $prevSliderIndex + '"]'); 3321 var $prevImg = $prevItem.find('img').attr('src'); 3322 var $nextBtn = $rcContainer.find('.ha-remote-carousel-btn-next'); 3323 var $prevBtn = $rcContainer.find('.ha-remote-carousel-btn-prev'); 3324 $nextBtn.css({ 3325 'background-image': 'url(' + $nextImg + ')', 3326 'background-position': 'center' 3327 }); 3328 $prevBtn.css({ 3329 'background-image': 'url(' + $prevImg + ')', 3330 'background-position': 'center' 3331 }); 3332 }); 3333 $haRcSelector.trigger('init'); 3334 $($rcBtn).on("click", function (e) { 3335 e.preventDefault(); 3336 $haRcSelector.on('afterChange', function (event, slick, currentSlideIndex) { 3337 var $dataSettingsSelector = $haRcSelector.parent().parent(); 3338 var $dataSettings = $dataSettingsSelector.data('settings'); 3339 var $slides_to_show = $dataSettings ? $dataSettings.slides_to_show : currentSlideIndex; 3340 $prevSliderIndex = parseInt(currentSlideIndex - 1); 3341 var $nextIndex = parseInt($slides_to_show) + parseInt($prevSliderIndex) + 1; 3342 var $nextItem = $haRcSelector.find('[data-slick-index="' + $nextIndex + '"]');
3343 var $nextImg = $nextItem.find('img').attr('src'); 3344 var $prevItem = $haRcSelector.find('[data-slick-index="' + $prevSliderIndex + '"]'); 3345 var $prevImg = $prevItem.find('img').attr('src'); 3346 var $nextBtn = $rcContainer.find('.ha-remote-carousel-btn-next'); 3347 var $prevBtn = $rcContainer.find('.ha-remote-carousel-btn-prev'); 3348 if ($nextBtn) { 3349 $nextBtn.css({ 3350 'background-image': 'url(' + $nextImg + ')', 3351 'background-position': 'center' 3352 }); 3353 } 3354 if ($prevBtn) { 3355 $prevBtn.css({ 3356 'background-image': 'url(' + $prevImg + ')', 3357 'background-position': 'center' 3358 }); 3359 } 3360 }); 3361 if ($(this).data("ha_rc_nav") == 'ha_rc_next_btn') { 3362 $haRcSelector.slick("slickNext"); 3363 } else if ($(this).data("ha_rc_nav") == 'ha_rc_prev_btn') { 3364 $haRcSelector.slick("slickPrev"); 3365 } 3366 }); 3367 } else { 3368 $($rcBtn).on("click", function (e) { 3369 e.preventDefault(); 3370 if ($(this).data("ha_rc_nav") == 'ha_rc_next_btn') { 3371 $haRcSelector.slick("slickNext"); 3372 } else if ($(this).data("ha_rc_nav") == 'ha_rc_prev_btn') { 3373 $haRcSelector.slick("slickPrev"); 3374 } 3375 }); 3376 } 3377 } 3378 } 3379 }; 3380 elementorFrontend.hooks.addAction('frontend/element_ready/ha-remote-carousel.default', HaRemoteCarousel); 3381 var HaTOC = elementorModules.frontend.handlers.Base.extend({ 3382 getDefaultSettings: function getDefaultSettings() { 3383 var elementSettings = this.getElementSettings(), 3384 listWrapperTag = "numbers" === elementSettings.marker_view ? "ol" : "ul"; 3385 return { 3386 selectors: { 3387 widgetContainer: ".ha-toc-wrapper", 3388 container: '.elementor:not([data-elementor-type="header"]):not([data-elementor-type="footer"])', 3389 expandButton: ".ha-toc__header", 3390 collapseButton: ".ha-toc__header", 3391 body: ".ha-toc__body", 3392 headerTitle: ".ha-toc__header-title", 3393 scrollTop: ".ha-toc__scroll-to-top--container" 3394 }, 3395 classes: { 3396 anchor: "ha-toc-menu-anchor", 3397 listWrapper: "ha-toc__list-wrapper", 3398 listItem: "ha-toc__list-item", 3399 listTextWrapper: "ha-toc__list-item-text-wrapper", 3400 firstLevelListItem: "ha-toc__top-level", 3401 listItemText: "ha-toc__list-item-text", 3402 activeItem: "ha-toc-item-active", 3403 headingAnchor: "ha-toc__heading-anchor", 3404 collapsed: "ha-toc--collapsed" 3405 }, 3406 listWrapperTag: listWrapperTag 3407 }; 3408 }, 3409 getDefaultElements: function getDefaultElements() { 3410 var settings = this.getSettings(), 3411 elementSettings = this.getElementSettings(); 3412 return { 3413 $pageContainer: jQuery(elementSettings.container || settings.selectors.container), 3414 $widgetContainer: this.$element.find(settings.selectors.widgetContainer), 3415 $expandButton: this.$element.find(settings.selectors.expandButton), 3416 $collapseButton: this.$element.find(settings.selectors.collapseButton), 3417 $tocBody: this.$element.find(settings.selectors.body), 3418 $listItems: this.$element.find("." + settings.classes.listItem), 3419 $scrollTop: this.$element.find(settings.selectors.scrollTop) 3420 }; 3421 }, 3422 bindEvents: function bindEvents() { 3423 var $self = this; 3424 var elementSettings = this.getElementSettings(); 3425 if (elementSettings.minimize_box) { 3426 this.elements.$expandButton.on("click", function () { 3427 if (!$($self.$element).hasClass($self.getSettings("classes.collapsed"))) { 3428 return $self.collapseBox(); 3429 } else { 3430 return $self.expandBox(); 3431 } 3432 }); 3433 } 3434 if (elementSettings.collapse_subitems) { 3435 this.elements.$listItems.hover(function (event) { 3436 return jQuery(event.target).slideToggle(); 3437 }); 3438 } 3439 if (elementSettings.sticky_toc_toggle) { 3440 elementorFrontend.elements.$window.on("resize", this.handleStickyToc); 3441 } 3442 if (elementSettings.scroll_to_top_toggle) { 3443 this.elements.$scrollTop.on("click", function () { 3444 $self.scrollToTop(); 3445 }); 3446 } 3447 }, 3448 getHeadings: function getHeadings() { 3449 // Get all headings from document by user-selected tags 3450 var elementSettings = this.getElementSettings(), 3451 tags = elementSettings.headings_by_tags.join(","),
3452 selectors = this.getSettings("selectors"), 3453 excludedSelectors = elementSettings.exclude_headings_by_selector; 3454 return this.elements.$pageContainer.find(tags).not(selectors.headerTitle).filter(function (index, heading) { 3455 return !jQuery(heading).closest(excludedSelectors).length; // Handle excluded selectors if there are any 3456 }); 3457 }, 3458 addAnchorsBeforeHeadings: function addAnchorsBeforeHeadings() { 3459 var $this = this; 3460 // Add an anchor element right before each TOC heading to create anchors for TOC links 3461 var classes = this.getSettings("classes"); 3462 this.elements.$headings.before(function (index) { 3463 var anchorLink = $this.getHeadingAnchorLink(index, classes); 3464 return '<span id="' + anchorLink + '" class="' + classes.anchor + ' "></span>'; 3465 }); 3466 }, 3467 activateItem: function activateItem($listItem) { 3468 var classes = this.getSettings("classes"); 3469 this.deactivateActiveItem($listItem); 3470 $listItem.addClass(classe
3470s.activeItem); 3471 this.$activeItem = $listItem; 3472 if (!this.getElementSettings("sticky_toc_toggle")) { 3473 //Note:- The "Collapse" option will not work unless you make the Table of Contents sticky. 3474 return; 3475 } 3476 if (!this.getElementSettings("collapse_subitems")) { 3477 return; 3478 } 3479 var $activeList = void 0; 3480 if ($listItem.hasClass(classes.firstLevelListItem)) { 3481 $activeList = $listItem.parent().next(); 3482 } else { 3483 $activeList = $listItem.parents("." + classes.listWrapper).eq(-2); 3484 } 3485 if (!$activeList.length) { 3486 delete this.$activeList; 3487 return; 3488 } 3489 this.$activeList = $activeList; 3490 this.$activeList.stop().slideDown(); 3491 }, 3492 deactivateActiveItem: function deactivateActiveItem($activeToBe) { 3493 if (!this.$activeItem || this.$activeItem.is($activeToBe)) { 3494 return; 3495 } 3496 var _getSettings = this.getSettings(), 3497 classes = _getSettings.classes; 3498 this.$activeItem.removeClass(classes.activeItem); 3499 if (this.$activeList && (!$activeToBe || !this.$activeList[0].contains($activeToBe[0]))) { 3500 this.$activeList.slideUp(); 3501 } 3502 }, 3503 followAnchor: function followAnchor($element, index) { 3504 var $self = this; 3505 var anchorSelector = $element[0].hash; 3506 var $anchor = void 0; 3507 try { 3508 // `decodeURIComponent` for UTF8 characters in the hash. 3509 $anchor = jQuery(decodeURIComponent(anchorSelector)); 3510 } catch (e) { 3511 return; 3512 } 3513 if (0 === index) { 3514 haObserveTarget($anchor[0], function (direction) { 3515 if ($self.itemClicked) { 3516 return; 3517 } 3518 if ("down" === direction) { 3519 $self.activateItem($element); 3520 } else { 3521 $self.deactivateActiveItem(); 3522 } 3523 }); 3524 } 3525 haObserveTarget($anchor[0], function (direction) { 3526 if ($self.itemClicked) { 3527 return; 3528 } 3529 if ("down" === direction) { 3530 $self.activateItem($self.$listItemTexts.eq(index + 1)); 3531 } else { 3532 $self.activateItem($element); 3533 } 3534 }); 3535 }, 3536 followAnchors: function followAnchors() { 3537 var $self = this; 3538 this.$listItemTexts.each(function (index, element) { 3539 return $self.followAnchor(jQuery(element), index); 3540 }); 3541 }, 3542 setOffset: function setOffset($listItem) { 3543 var $this = this; 3544 var settings = this.getSettings(); 3545 var list = this.$element.find("." + settings.classes.listItem); 3546 var offset = this.getCurrentDeviceSetting("scroll_offset"); 3547 list.each(function () { 3548 $('a', this).on('click', function (e) { 3549 e.preventDefault(); 3550 var hash = this.hash; 3551 $('html, body').animate({ 3552 scrollTop: $(hash).offset().top - parseInt(offset.size) 3553 }, 800); 3554 }); 3555 }); 3556 }, 3557 populateTOC: function populateTOC() { 3558 var $self = this; 3559 this.listItemPointer = 0; 3560 var elementSettings = this.getElementSettings(); 3561 if (elementSettings.custom_style == 'yes') { 3562 this.elements.$widgetContainer.html(this.createSideDot()); 3563 } else { 3564 if (elementSettings.hierarchical_view) { 3565 this.createNestedList(); 3566 } else { 3567 this.createFlatList(); 3568 } 3569 } 3570 this.$listItemTexts = this.$element.find(".ha-toc__list-item-text"); 3571 this.$listItemTexts.on("click", this.onListItemClick.bind(this)); 3572 if (!elementorFrontend.isEditMode()) { 3573 this.followAnchors(); 3574 } 3575 $(window).on('scroll', function () { 3576 if ("window_top" === elementSettings.scroll_to_top_option) { 3577 if ($(window).scrollTop() > 0) { 3578 $self.elements.$scrollTop.show(); 3579 } else { 3580 $self.elements.$scrollTop.hide(); 3581 } 3582 } else { 3583 var $id = $self.getID().parents('.elementor-element'); 3584 if ($id.offset().top >= $(window).scrollTop()) { 3585 $self.elements.$scrollTop.hide(); 3586 } else { 3587 $self.elements.$scrollTop.show(); 3588 } 3589 } 3590 }); 3591 }, 3592 createNestedList: function createNestedList() { 3593 var $self = this; 3594 this.headingsData.forEach(function (heading, index) { 3595 heading.level = 0; 3596 for (var i = index - 1; i >= 0; i--) { 3597 var currentOrderedItem = $self.headingsData[i]; 3598 if (currentOrderedItem.tag <= heading.tag) { 3599 heading.level = currentOrderedItem.level; 3600 if (currentOrderedItem.tag < heading.tag) {
3601 heading.level++; 3602 } 3603 break; 3604 } 3605 } 3606 }); 3607 this.elements.$tocBody.html(this.getNestedLevel(0)); 3608 }, 3609 createFlatList: function createFlatList() { 3610 this.elements.$tocBody.html(this.getNestedLevel()); 3611 }, 3612 createSideDot: function createSideDot(level) { 3613 var settings = this.getSettings(), 3614 elementSettings = this.getElementSettings(), 3615 icon = this.getElementSettings("icon"), 3616 htmlul = ''; 3617 if (elementSettings.custom_style == 'yes') { 3618 htmlul += "<div class=\"".concat(elementSettings.custom_style_list, "\">\n <div class=\"hm-toc \">\n <ul class=\"hm-toc-items\" style=\"list-style: none;\">\n <li>"); 3619 if (elementSettings.custom_style_list == 'hm-toc-slide-style') { 3620 htmlul += "<".concat(elementSettings.html_tag, " class=\"hm-toc-title\"><span>").concat(elementSettings.widget_title, "<span></").concat(elementSettings.html_tag, ">"); 3621 } else { 3622 htmlul += "<".concat(elementSettings.html_tag, " class=\"hm-toc-title\">").concat(elementSettings.widget_title, "</").concat(elementSettings.html_tag, ">"); 3623 } 3624 htmlul += "<".concat(settings.listWrapperTag, " class=\"hm-toc-items-inner\">"); 3625 for (var i = 0; i < this.headingsData.length; i++) { 3626 var list = ''; 3627 var currentItemDot = this.headingsData[i]; 3628 if (level > currentItemDot.level) { 3629 break; 3630 } 3631 var listItemTextClasses = settings.classes.listItemText; 3632 if (0 === currentItemDot.level) { 3633 // If the current list item is a top level item, give it the first level class 3634 listItemTextClasses += " " + settings.classes.firstLevelListItem; 3635 } 3636 if (level === currentItemDot.level) { 3637 list += "<li class=\"hm-toc-entry ".concat(settings.classes.listItem, "\">"); 3638 if ('bullets' === elementSettings.marker_view && icon && elementSettings.custom_style_list == 'hm-toc-slide-style') { 3639 list += "<i class=\"".concat(icon.value, "\"></i>"); 3640 } 3641 list += "<a href=\"#".concat(currentItemDot.anchorLink, "\" class=\"").concat(listItemTextClasses, "\"><span>").concat(currentItemDot.text, "</span></a>"); 3642 list += "</li>"; 3643 } 3644 htmlul += list; 3645 } 3646 htmlul += "</".concat(settings.listWrapperTag, ">"); 3647 htmlul += "</li>\n </ul>"; 3648 } 3649 return htmlul; 3650 }, 3651 getNestedLevel: function getNestedLevel(level) { 3652 var settings = this.getSettings(), 3653 elementSettings = this.getElementSettings(), 3654 icon = this.getElementSettings("icon"); 3655 var html = ''; 3656 3657 // Open new list/nested list 3658 html += "<" + settings.listWrapperTag + ' class="' + settings.classes.listWrapper + '">'; 3659 3660 // for each list item, build its markup. 3661 while (this.listItemPointer < this.headingsData.length) { 3662 var currentItem = this.headingsData[this.listItemPointer]; 3663 var listItemTextClasses = settings.classes.listItemText; 3664 if (0 === currentItem.level) { 3665 // If the current list item is a top level item, give it the first level class 3666 listItemTextClasses += " " + settings.classes.firstLevelListItem; 3667 } 3668 if (level > currentItem.level) { 3669 break; 3670 } 3671 if (level === currentItem.level) { 3672 html += '<li class="' + settings.classes.listItem + " " + "level-" + level + '">'; 3673 html += '<div class="' + settings.classes.listTextWrapper + '">'; 3674 var liContent = '<a href="#' + currentItem.anchorLink + '" class="' + listItemTextClasses + '">' + currentItem.text + "</a>"; 3675 3676 // If list type is bullets, add the bullet icon as an <i> tag 3677 if ("bullets" === elementSettings.marker_view && icon) { 3678 liContent = '<i class="' + icon.value + '"></i>' + liContent; 3679 } 3680 html += liContent; 3681 html += "</div>"; 3682 this.listItemPointer++; 3683 var nextItem = this.headingsData[this.listItemPointer]; 3684 if (nextItem && level < nextItem.level) { 3685 // If a new nested list has to be created under the current item, 3686 // this entire method is called recursively (outside the while loop, a list wrapper is created) 3687 html += this.getNestedLevel(nextItem.level); 3688 } 3689 html += "</li>"; 3690 } 3691 } 3692 html += "</" + settings.listWrapperTag + ">"; 3693 return html; 3694 }, 3695 handleNoHeadingsFound: function handleNoHeadingsFound() { 3696 var _messages = 'No headings were found on this page.'; 3697 if (elementorFrontend.isEditMode()) { 3698 return this.elements.$tocBody.html(_messages); 3699 } 3700 }, 3701 collapseOnInit: function collapseOnInit() { 3702 var $self = this; 3703 var minimizedOn = this.getElementSettings("minimized_on"), 3704 currentDeviceMode = elementorFrontend.getCurrentDeviceMode(); 3705 if ("" !== minimizedOn && "array" !== typeof minimizedOn) { 3706 minimizedOn = [minimizedOn]; 3707 } 3708 if (0 !== minimizedOn.length && "object" === _typeof(minimizedOn)) {
3709 minimizedOn.forEach(function (value) { 3710 if ("desktop" === value[0] && "desktop" == currentDeviceMode && $(window).width() < elementorFrontend.config.breakpoints.xxl || "tablet" === value[0] && "tablet" === currentDeviceMode && $(window).width() < elementorFrontend.config.breakpoints.lg || "mobile" === value[0] && "mobile" === currentDeviceMode && $(window).width() < elementorFrontend.config.breakpoints.md) { 3711 $self.collapseBox(); 3712 } 3713 }); 3714 } 3715 }, 3716 getHeadingAnchorLink: function getHeadingAnchorLink(index, classes) { 3717 var headingID = this.elements.$headings[index].id, 3718 wrapperID = this.elements.$headings[index].closest('.elementor-widget').id; 3719 var anchorLink = ''; 3720 if (headingID) { 3721 anchorLink = headingID; 3722 } else if (wrapperID) { 3723 // If the heading itself has an ID, we don't want to overwrite it 3724 anchorLink = wrapperID; 3725 } // If there is no existing ID, use the heading text to create a semantic ID 3726 3727 if (headingID || wrapperID) { 3728 jQuery(this.elements.$headings[index]).data('hasOwnID', true); 3729 } else { 3730 anchorLink = "".concat(classes.headingAnchor, "-").concat(index); 3731 } 3732 return anchorLink; 3733 }, 3734 setHeadingsData: function setHeadingsData() { 3735 var $this = this; 3736 this.headingsData = []; 3737 var classes = this.getSettings("classes"); 3738 3739 // Create an array for simplifying TOC list creation 3740 this.elements.$headings.each(function (index, element) { 3741 var anchorLink = $this.getHeadingAnchorLink(index, classes); 3742 $this.headingsData.push({ 3743 tag: +element.nodeName.slice(1), 3744 text: element.textContent, 3745 anchorLink: anchorLink 3746 }); 3747 }); 3748 }, 3749 run: function run() { 3750 var elementSettings = this.getElementSettings(); 3751 this.elements.$headings = this.getHeadings(); 3752 if (!this.elements.$headings.length) { 3753 return this.handleNoHeadingsFound(); 3754 } 3755 this.setHeadingsData(); 3756 if (!elementorFrontend.isEditMode()) { 3757 this.addAnchorsBeforeHeadings(); 3758 } 3759 this.populateTOC(); 3760 if (elementSettings.minimize_box) { 3761 this.collapseOnInit(); 3762 } 3763 if (elementSettings.sticky_toc_toggle) { 3764 this.handleStickyToc(); 3765 } 3766 if ("" !== elementSettings.scroll_offset.size) { 3767 this.setOffset(); 3768 } 3769 }, 3770 expandBox: function expandBox() { 3771 var boxHeight = this.getCurrentDeviceSetting("min_height"); 3772 this.$element.removeClass(this.getSettings("classes.collapsed")); 3773 this.elements.$tocBody.slideDown(); 3774 3775 // return container to the full height in case a min-height is defined by the user 3776 this.elements.$widgetContainer.css("min-height", boxHeight.size + boxHeight.unit); 3777 }, 3778 collapseBox: function collapseBox() { 3779 this.$element.addClass(this.getSettings("classes.collapsed")); 3780 this.elements.$tocBody.slideUp(); 3781 3782 // close container in case a min-height is defined by the user 3783 this.elements.$widgetContainer.css("min-height", "0px"); 3784 }, 3785 onInit: function onInit() { 3786 var $self = this; 3787 this.initElements(); 3788 this.bindEvents(); 3789 jQuery(document).ready(function () { 3790 $self.run(); 3791 }); 3792 }, 3793 onListItemClick: function onListItemClick(event) { 3794 var $self = this; 3795 this.itemClicked = true; 3796 setTimeout(function () { 3797 return $self.itemClicked = false; 3798 }, 2000); 3799 var $clickedItem = jQuery(event.target), 3800 $list = $clickedItem.parent().next(), 3801 collapseNestedList = this.getElementSettings("collapse_subitems"); 3802 if ("SPAN" == $clickedItem[0].tagName && 'yes' == this.getElementSettings("custom_style")) { 3803 $clickedItem = jQuery(event.currentTarget); 3804 } 3805 var listIsActive = void 0; 3806 if (collapseNestedList && $clickedItem.hasClass(this.getSettings("classes.firstLevelListItem"))) { 3807 if ($list.is(":visible")) { 3808 listIsActive = true; 3809 } 3810 } 3811 this.activateItem($clickedItem); 3812 if (collapseNestedList && listIsActive) { 3813 $list.slideUp(); 3814 } 3815 }, 3816 handleStickyToc: function handleStickyToc() { 3817 var elementSettings = this.getElementSettings(); 3818 var currentDeviceMode = elementorFrontend.getCurrentDeviceMode(); 3819 var $devices = elementSettings.sticky_toc_disable_on; 3820 var target = this.getID(); 3821 var type = elementSettings.sticky_toc_type; 3822 if ("in-place" === type) { 3823 var parentWidth = target.parent().parent().outerWidth(); 3824 target.css("width", parentWidth); 3825 } else if ("custom-position" === type) { 3826 var parentWidth = target.parent().parent().outerWidth(); 3827 target.css("width", parentWidth); 3828 } 3829 if (-1 == $.inArray(currentDeviceMode, $devices)) { 3830 target.removeClass('floating-toc'); 3831 $(window).off('scroll', this.stickyScroll); 3832 return; 3833 } 3834 $(window).on('scroll', $.proxy(this.stickyScroll, this)); 3835 }, 3836 stickyScroll: function stickyScroll() { 3837 var target = this.getID(); 3838 var elementSettings = this.getElementSettings(); 3839 var item = document.querySelector(".ha-table-of-contents"); 3840 var bound, tocHeight; 3841 bound = item.getBoundingClientRect(); 3842 tocHeight = target.outerHeight(); 3843 if (target.hasClass("floating-toc")) { 3844 target.parent().parent().css("height", tocHeight); 3845 } else { 3846 target.parent().parent().css("height", ''); 3847 } 3848 if (bound.y + bound.height / 2 < 0) { 3849 if (target.hasClass('floating-toc')) { 3850 return; 3851 } 3852 target.addClass("floating-toc"); 3853 } else { 3854 if (!target.hasClass('floating-toc')) { 3855 return; 3856 } 3857 target.removeClass("floating-toc"); 3858 } 3859 }, 3860 scrollToTop: function scrollToTop() { 3861 var $self = this; 3862 var scrollTo = this.getElementSettings("scroll_to_top_option"); 3863 if ("window_top" === scrollTo) { 3864 $("html, body").animate({ 3865 scrollTop: 0 3866 }, 250); 3867 } else { 3868 var $id = this.getID().parents('.ha-table-of-contents'); 3869 $("html, body").animate({ 3870 scrollTop: $($id).offset().top - 60 3871 }, 1000); 3872 } 3873 }, 3874 getID: function getID() { 3875 return $("#ha-toc-" + this.$element[0].attributes["data-id"].nodeValue); 3876 } 3877 }); 3878 elementorFrontend.hooks.addAction("frontend/element_ready/ha-table-of-contents.default", function ($scope) { 3879 elementorFrontend.elementsHandler.addHandler(HaTOC, { 3880 $element: $scope 3881 }); 3882 }); 3883 3884 //creativeSlider 3885 var HaCreativeSlider = function HaCreativeSlider($scope) { 3886 var $rcContainer = $scope.find('.ha-creative-slider-container'); 3887 if ($rcContainer) { 3888 // var $haCsWidth = window.innerWidth; 3889 var $haCsWidth = $(window).width(); 3890 var $haCsNextSelector = parseInt($haCsWidth) <= 767 ? $rcContainer.find('.ha_cs_mobile_next') : $rcContainer.find('.ha_cc_next_wrapper'); 3891 var $haCsPrevSelector = parseInt($haCsWidth) <= 767 ? $rcContainer.find('.ha_cs_mobile_prev') : $rcContainer.find('.ha_cc_prev_wrapper'); 3892 var csTextItemDelay = parseInt($haCsWidth) <= 767 ? 40 : 30; 3893 var csImageItemDelay = 40; 3894 var csPrevItemsOwl = $rcContainer.find('.ha_cc_prev_items'); 3895 var csTextItemsOwl = $rcContainer.find('.ha_cc_text_items'); 3896 var csImageItemsOwl = $rcContainer.find('.ha_cc_inner_image_items'); 3897 var csNextItemsOwl = $rcContainer.find('.ha_cc_next_items'); 3898 var csPrevNavOptions = { 3899 loop: true, 3900 dots: false, 3901 nav: false, 3902 items: 1, 3903 autoplay: false, 3904 smartSpeed: 500, 3905 touchDrag: false, 3906 mouseDrag: false, 3907 rewind: true, 3908 startPosition: -1 3909 }; 3910 var csNextNavOptions = { 3911 loop: true, 3912 dots: false, 3913 nav: false, 3914 items: 1, 3915 autoplay: false, 3916 smartSpeed: 500, 3917 touchDrag: false, 3918 mouseDrag: false, 3919 rewind: true, 3920 startPosition: 1 3921 }; 3922 var csGeneralOptions = { 3923 loop: true, 3924 dots: false, 3925 nav: false, 3926 items: 1, 3927 autoplay: false, 3928 smartSpeed: 1000, 3929 touchDrag: false, 3930 mouseDrag: false, 3931 singleItem: true, 3932 animateOut: 'fadeOutRight', 3933 animateIn: 'fadeInLeft', 3934 rewind: true 3935 }; 3936 } 3937 csPrevItemsOwl.owlCarousel(csPrevNavOptions); 3938 csNextItemsOwl.owlCarousel(csNextNavOptions); 3939 csTextItemsOwl.owlCarousel(csGeneralOptions); 3940 csImageItemsOwl.owlCarousel(csGeneralOptions); 3941 window.parent.addEventListener('message', function (e) { 3942 if ('ha_cs_reinit' == e.data) { 3943 csTextItemsOwl.owlCarousel('refresh'); 3944 csImageItemsOwl.owlCarousel('refresh'); 3945 } 3946 }); 3947 $($haCsPrevSelector).click(function (e) { 3948 e.preventDefault(); 3949 csPrevItemsOwl.trigger('prev.owl.carousel'); 3950 csNextItemsOwl.trigger('prev.owl.carousel'); 3951 setTimeout(function () { 3952 csTextItemsOwl.trigger('prev.owl.carousel'); 3953 }, csTextItemDelay); 3954 setTimeout(function () { 3955 csImageItemsOwl.trigger('prev.owl.carousel'); 3956 }, csTextItemDelay + csImageItemDelay); 3957 }); 3958 $($haCsNextSelector).click(function (e) { 3959 e.preventDefault(); 3960 csPrevItemsOwl.trigger('next.owl.carousel'); 3961 csNextItemsOwl.trigger('next.owl.carousel'); 3962 setTimeout(function () { 3963 csTextItemsOwl.trigger('next.owl.carousel'); 3964 }, csTextItemDelay); 3965 setTimeout(function () { 3966 csImageItemsOwl.trigger('next.owl.carousel'); 3967 }, csTextItemDelay + csImageItemDelay); 3968 }); 3969 }; 3970 elementorFrontend.hooks.addAction('frontend/element_ready/ha-creative-slider.default', HaCreativeSlider); 3971 3972 //Advanced Comparison Table 3973 var AdvancedComparisonTable = function AdvancedComparisonTable($scope) { 3974 var nav = $scope.find('ul.ha-adct-table-responsive-nav'); 3975 var rows = $scope.find(".ha-adct-row, .ha-adct-child-row"); 3976 var collapse = $scope.find(".ha-adct-collapse-icon-wrap"); 3977 3978 // console.log(rows); 3979 3980 var pos = 2; 3981 nav.on("click", "li", function () { 3982 var pos = $(this).index() + 2; 3983 // console.log( pos ); 3984 3985 rows.find(".ha-adct-column:not(:eq(0))").hide(); 3986 $scope.find(".ha-adct-column:nth-child(" + pos + ")").css("display", "flex"); 3987 nav.find("li").removeClass("active"); 3988 $(this).addClass("active"); 3989 }); 3990 collapse.on("click", function () { 3991 var row_wrap = $(this).closest('.ha-adct-row-wrap'); 3992 // console.log( row_wrap ); 3993 $(this).toggleClass('open'); 3994 row_wrap.find('.ha-adct-child-row-wrap').slideToggle("slow"); 3995 // row_wrap.find('.ha-adct-child-row-wrap .ha-adct-column').slideToggle("slow"); 3996 // $('.ha-adct-heading').slideToggle("slow"); 3997 }); 3998 3999 // Initialize the media query 4000 //var mediaQuery = window.matchMedia("(min-width: 767px)"); 4001 // console.log(mediaQuery); 4002 var mode = $('body').attr('data-elementor-device-mode'); 4003 var w_width = $(window).outerWidth(true); 4004 function hideAndShowColumn(mode) { 4005 if ('tablet' == mode || 'mobile_extra' == mode || 'mobile' == mode) { 4006 rows.find(".ha-adct-column:not(:eq(0))").hide(); 4007 $scope.find(".ha-adct-column:nth-child(" + pos + ")").css("display", "flex"); 4008 } else { 4009 rows.find(".ha-adct-column").removeAttr("style"); 4010 } 4011 } 4012 ; 4013 hideAndShowColumn(mode); 4014 $(window).on('resize', function (e) { 4015 var mode = $('body').attr('data-elementor-device-mode'); 4016 var w_resize_width = $(window).outerWidth(true); 4017 if (w_width != w_resize_width) { 4018 w_width = w_resize_width; 4019 hideAndShowColumn(mode); 4020 } 4021 }); 4022 }; 4023 elementorFrontend.hooks.addAction('frontend/element_ready/ha-advanced-comparison-table.default', AdvancedComparisonTable); 4024 4025 //Title Tips 4026 var TitleTips = function TitleTips($scope) { 4027 var element = $scope.find('.ha-flip-box-inner'); 4028 var items = $scope.find('.ha-title-tips-hover li > a'); 4029 var rect = $scope.find('.ha-title-tips-hover')[0].getBoundingClientRect(); 4030 if ($scope.find('.ha-title-tips-hover').hasClass('swap')) { 4031 var wrapper = $scope.find('.ha-title-tips-hover'); 4032 var anchor_item = $scope.find('.ha-title-tips-hover-item.have-image'); 4033 var figure = $scope.find('figure'); 4034 var Work = { 4035 _register: { 4036 hover: { 4037 active: !1, 4038 currentX: 0, 4039 currentY: 0, 4040 targetX: 0, 4041 targetY: 0 4042 } 4043 }, 4044 _init: function _init() { 4045 this._base(), this._events(); 4046 }, 4047 _base: function _base() { 4048 figure.find('img').each(function () { 4049 var item = $(this); 4050 // console.log( item.height() ); 4051 item.attr("height_ratio", item.height()); 4052 }); 4053 requestAnimationFrame(function () { 4054 Work._interaction.hover.move_image(); 4055 }); 4056 }, 4057 _events: function _events() { 4058 anchor_item.on("mouseenter", "a", function () { 4059 Work._interaction.hover.image($(this)); 4060 }); 4061 anchor_item.on("mouseleave", "a", function () { 4062 Work._interaction.hover.leave(); 4063 }); 4064 anchor_item.on("mousemove", "a", function (e) { 4065 Work._interaction.hover.move(e); 4066 }); 4067 }, 4068 _functions: { 4069 round: function round(e, t) { 4070 var t = void 0 === t ? 100 : Math.pow(10, t); 4071 return Math.round(e * t) / t; 4072 } 4073 }, 4074 _interaction: { 4075 hover: { 4076 image: function image(e) { 4077 e.parents("li").addClass("active").removeClass("not-selected").siblings().removeClass("active").addClass("not-selected"); 4078 if (!Work._register.hover.visible && (Work._register.hover.currentX || Work._register.hover.currentY)) { 4079 Work._register.hover.visible = !0; 4080 figure.addClass("visible"); 4081 } 4082 4083 // $img = $('#work-hover img[project="' + e.attr("href") + '"]');
4084 var $img = figure.find('img[data-filter-id="' + e.attr("data-filter-id") + '"]'); 4085 $img.addClass("active").siblings(".active").removeClass("active").addClass("was-active"); 4086 // console.log($img); 4087 // console.log($img.height()); 4088 // figure.get()[0].style.setProperty("--height_ratio", ( Math.floor(Math.random() * (500 - 150 + 1) ) + 150 ) + 'px' ); 4089 4090 // figure.get()[0].style.setProperty("--height_ratio", ( $img.height() ) + 'px' ); 4091 figure.get()[0].style.setProperty("--height_ratio", $img.attr("height_ratio") + 'px'); 4092 // .style.setProperty("--height_ratio", $img.attr("height_ratio")), 4093 4094 clearTimeout(figure.prop("leave")); 4095 clearTimeout(figure.prop("animate")); 4096 figure.addClass("animate").prop("animate", setTimeout(function () { 4097 figure.removeClass("animate").find("img.was-active").removeClass("was-active"); 4098 }, 400)); 4099 }, 4100 leave: function leave() { 4101 anchor_item.removeClass("active not-selected"); 4102 clearTimeout(figure.prop("leave")); 4103 clearTimeout(figure.prop("active")); 4104 figure.prop("leave", setTimeout(function () { 4105 // Work._register.hover.visible = !1; 4106 Work._register.hover.visible = false; 4107 figure.removeClass("visible"); 4108 }, 1)); 4109 figure.prop("active", setTimeout(function () { 4110 Work._register.hover.active = !1; 4111 }, 2e3)); 4112 }, 4113 move: function move(e) { 4114 var currentReact = e.currentTarget.getBoundingClientRect(); 4115 var currentWrapperReact = wrapper.get()[0].getBoundingClientRect(); 4116 var targetMiddle = currentReact.top + currentReact.height / 2; 4117 Work._register.hover.active || (Work._register.hover.active = !0, requestAnimationFrame(function () { 4118 Work._interaction.hover.move_image(); 4119 }), clearTimeout(figure.prop("active")), figure.prop("active", setTimeout(function () { 4120 Work._register.hover.active = !1; 4121 }, 2e3))); 4122 // var react = $("#work-projects").get()[0].getBoundingClientRect(); 4123 var s = 0; 4124 var targetItem = anchor_item.find('a').offset().left - 40; 4125 if ($scope.hasClass('ha_title_tips_img_pos--left')) { 4126 // Work._register.hover.targetX = currentReact.left - figure.width(); // for left side 4127 Work._register.hover.targetX = -(figure.width() + 10); // for left side 4128 } else { 4129 Work._register.hover.targetX = currentReact.width + 10; // for right side 4130 } 4131 // Work._register.hover.targetY = targetMiddle; 4132 Work._register.hover.targetY = e.pageY - (currentWrapperReact.top + window.scrollY); 4133 if (!Work._register.hover.visible && (Work._register.hover.currentX || Work._register.hover.currentY)) { 4134 Work._register.hover.visible = true; 4135 figure.addClass("visible"); 4136 } 4137 }, 4138 move_image: function move_image() { 4139 if (figure.length) { 4140 Work._register.hover.currentX += (Work._register.hover.targetX - Work._register.hover.currentX) * 0.09; 4141 Work._register.hover.currentY += (Work._register.hover.targetY - Work._register.hover.currentY) * 0.09; 4142 figure.get()[0].style.transform = " translate3d(\n\t\t\t\t\t\t\t\t\t\t".concat(Work._functions.round(Work._register.hover.currentX), "px,\n\t\t\t\t\t\t\t\t\t\t").concat(Work._functions.round(Work._register.hover.currentY), "px, 0px\n\t\t\t\t\t\t\t\t\t)"); 4143 if (Work._register.hover.active) { 4144 requestAnimationFrame(function () { 4145 Work._interaction.hover.move_image(); 4146 }); 4147 } 4148 } 4149 } 4150 } 4151 } 4152 }; 4153 Work._init(); 4154 } 4155 }; 4156 elementorFrontend.hooks.addAction('frontend/element_ready/ha-title-tips.default', TitleTips); 4157 4158 // Loop Tab 4159 var LoopTabBase = elementorModules.frontend.handlers.Base.extend({ 4160 onInit: function onInit() { 4161 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 4162 this.wrapper = this.$element.find(".ha-loop-tab-wrapper"); 4163 this.run(); 4164 }, 4165 onElementChange: debounce(function (changedProp) { 4166 var $keys = ['tab_action', 'tab_transition_delay', 'tab_nav_item_width', 'tab_nav_item_height', 'tab_nav_item_border_radius', 'tab_nav_item_stroke_width']; 4167 if ($keys.indexOf(changedProp) !== -1) { 4168 this.run(); 4169 } 4170 }, 300), 4171 getReadySettings: function getReadySettings() { 4172 var settings = {}; 4173 var tab_action = this.getElementSettings('tab_action'); 4174 if (tab_action) settings.tab_action = tab_action; 4175 var tab_transition_delay = this.getElementSettings('tab_transition_delay'); 4176 if (tab_transition_delay) settings.tab_transition_delay = tab_transition_delay; 4177 var item_width = this.getElementSettings('tab_nav_item_width'); 4178 if (item_width) settings.item_width = item_width['size']; 4179 var item_height = this.getElementSettings('tab_nav_item_height'); 4180 if (item_height) settings.item_height = item_height['size']; 4181 var stroke_ry = this.getElementSettings('tab_nav_item_border_radius'); 4182 if (stroke_ry) settings.stroke_ry = stroke_ry['size']; 4183 var stroke_width = this.getElementSettings('tab_nav_item_stroke_width'); 4184 if (stroke_width) settings.stroke_width = stroke_width['size']; 4185 return $.extend({}
4185, this.getSettings(), settings); 4186 }, 4187 run: function run() { 4188 var settings = this.getReadySettings(); 4189 var currentIndex = 0; 4190 var isHovered = false; 4191 var nextIndex = 1; 4192 var animationInProgress = false; 4193 var pillBorderAnim = undefined; 4194 var hoverMode = settings.tab_action === 'on_hover'; 4195 var $wrapper = this.wrapper; 4196 var tabs = $wrapper.find(".ha-loop-tab-nav-item"); 4197 var contents = $wrapper.find(".ha-loop-tab_content"); 4198 var animationTime = settings.tab_transition_delay || 8000; 4199 var itemWidth = settings.item_width || 280; 4200 var itemHeight = settings.item_height && settings.item_height >= 45 ? settings.item_height : settings.item_height ? 45 : 65; 4201 var maxRY = parseFloat(itemHeight / 2); 4202 var strokeRY = settings.stroke_ry >= maxRY ? maxRY : settings.stroke_ry; 4203 var strokeWidth = settings.stroke_width || 2; 4204 var initialBgColor = ''; 4205 var parentElement = $wrapper.parents('.e-parent'); 4206 if (parentElement.length > 0) { 4207 parentElement.css({ 4208 position: 'relative', 4209 overflow: 'inherit' 4210 }); 4211 4212 // Append background containers for each tab 4213 tabs.each(function (idx, tab) { 4214 var bgColor = $(tab).attr('container-bgcolors'); 4215 initialBgColor = idx === 0 && bgColor ? JSON.parse(bgColor) : ''; 4216 parentElement.append("<div class=\"ha-loop-tab-bgcontainer ha-loop-tab-bgcontainer-".concat(idx, "\" style=\"background:").concat(JSON.parse(bgColor), ";\"></div>")); 4217 if (initialBgColor != '') { 4218 $(".ha-loop-tab-bgcontainer-".concat(currentIndex)).addClass("ha-loop-tab-active-bg"); 4219 } 4220 }); 4221 } 4222 4223 // Hadling HoverMode of mobile devices 4224 window.addEventListener("resize", function () { 4225 if (window.innerWidth <= 767) { 4226 hoverMode = false; 4227 } else { 4228 hoverMode = settings.tab_action === 'on_hover'; 4229 } 4230 }); 4231 if (window.innerWidth <= 767) { 4232 hoverMode = false; 4233 } else { 4234 hoverMode = settings.tab_action === 'on_hover'; 4235 } 4236 4237 // Tab Navigation hadling 4238 var handleAnimationEnd = function handleAnimationEnd(targetIndex) { 4239 return function () { 4240 if (!animationInProgress) return; 4241 animationInProgress = false; 4242 4243 // Hide the SVG for the previous tab 4244 var previousTab = $(tabs[currentIndex]); 4245 if (previousTab.find('.tab-border')[0].width > 0) { 4246 var _previousTab$find$; 4247 previousTab.find('.tab-border').css({ 4248 visibility: "hidden", 4249 strokeDashoffset: (_previousTab$find$ = previousTab.find('.tab-border')[0]) === null || _previousTab$find$ === void 0 ? void 0 : _previousTab$find$.getTotalLength() 4250 }); 4251 } 4252 activateTab(targetIndex); 4253 4254 // Hide the SVG for the active tab 4255 var activeTab = $(tabs[targetIndex]); 4256 activeTab.find('.tab-border').css({ 4257 visibility: "hidden" 4258 }); 4259 4260 // Only for mobile device 4261 smoothScrollTabs(tabs[targetIndex]); 4262 4263 // Add unique class to the corresponding background container 4264 $(".ha-loop-tab-bgcontainer").removeClass("ha-loop-tab-active-bg"); 4265 $(".ha-loop-tab-bgcontainer-".concat(targetIndex)).addClass("ha-loop-tab-active-bg"); 4266 requestAnimationFrame(function () { 4267 startSvgAnimation((targetIndex + 1) % tabs.length); 4268 }); 4269 }; 4270 }; 4271 4272 // Tab animation handling 4273 var startSvgAnimation = function startSvgAnimation(index) { 4274 if (hoverMode || animationInProgress) return; 4275 tabs.removeClass("filling"); 4276 var $nextTab = $(tabs[index]); 4277 var svgElement = $nextTab.find('.tab-svg')[0]; 4278 if (!svgElement) return; 4279 if (window.innerWidth <= 767) { 4280 svgElement.setAttribute('width', 130); 4281 svgElement.setAttribute('height', 55); 4282 svgElement.setAttribute('viewBox', "0 0 130 55"); 4283 svgElement.style.width = 130 + 'px'; 4284 svgElement.style.height = 55 + 'px'; 4285 } else { 4286 svgElement.setAttribute('width', itemWidth); 4287 svgElement.setAttribute('height', itemHeight + 2); 4288 svgElement.setAttribute('viewBox', "0 0 ".concat(itemWidth, " ").concat(itemHeight)); 4289 svgElement.style.height = itemHeight + 2 + 'px'; 4290 } 4291 var borderElement = $nextTab.find('.tab-border')[0]; 4292 if (!borderElement) return; 4293 4294 // Make SVG visible only when animation starts 4295 $nextTab.find('.tab-border').css("visibility", "visible"); 4296 if (borderElement.getBBox().width !== 0) { 4297 if (window.innerWidth <= 767) { 4298 strokeWidth = 2; 4299 borderElement.style.width = 127 + 'px'; 4300 borderElement.style.height = 52 + 'px'; 4301 borderElement.style.x = 1; 4302 borderElement.style.y = 1; 4303 borderElement.setAttribute('x', 1); 4304 borderElement.setAttribute('y', 1); 4305 borderElement.setAttribute('rx', 26); 4306 borderElement.setAttribute('ry', 26); 4307 4308 // Set styles 4309 borderElement.style.rx = 26; 4310 borderElement.style.ry = 26; 4311 } else { 4312 // Set attr 4313 if (strokeWidth > 4) { 4314 borderElement.setAttribute('x', 3); 4315 borderElement.setAttribute('y', 3); 4316 } else if (strokeWidth > 2) { 4317 borderElement.setAttribute('x', 2); 4318 borderElement.setAttribute('y', 2); 4319 } else { 4320 borderElement.setAttribute('x', 1); 4321 borderElement.setAttribute('y', 1); 4322 } 4323 borderElement.setAttribute('rx', strokeRY); 4324 borderElement.setAttribute('ry', strokeRY); 4325 4326 // Set styles 4327 borderElement.style.rx = strokeRY; 4328 borderElement.style.ry = strokeRY; 4329 if (strokeWidth > 4) { 4330 borderElement.style.width = itemWidth - strokeWidth + 'px'; 4331 borderElement.style.height = itemHeight - strokeWidth + 'px'; 4332 borderElement.style.x = 3; 4333 borderElement.style.y = 3; 4334 } else if (strokeWidth > 2) { 4335 borderElement.style.width = itemWidth - 1 - strokeWidth + 'px'; 4336 borderElement.style.height = itemHeight - 2 + 'px'; 4337 borderElement.style.x = 2; 4338 } else { 4339 borderElement.style.width = itemWidth - 2 + 'px'; 4340 borderElement.style.height = itemHeight - 2 + 'px'; 4341 borderElement.style.x = 1; 4342 borderElement.style.y = 1; 4343 } 4344 } 4345 var length = borderElement.getTotalLength() + 5; 4346 borderElement.style.strokeDasharray = length.toString(); 4347 borderElement.style.strokeDashoffset = length.toString(); 4348 4349 // Create animation 4350 pillBorderAnim = borderElement.animate([{ 4351 strokeDashoffset: length, 4352 strokeWidth: strokeWidth 4353 }, { 4354 strokeDashoffset: 0, 4355 strokeWidth: strokeWidth, 4356 offset: 0.98, 4357 easing: "cubic-bezier(0.11, 0, 0.5, 0)" 4358 }, { 4359 strokeDashoffset: 0, 4360 strokeWidth: strokeWidth, 4361 easing: "ease-out" 4362 }], { 4363 duration: animationTime, 4364 delay: 0, 4365 fill: "forwards" 4366 }); 4367 } 4368 if (!pillBorderAnim) return; 4369 4370 // Ensure animation finishes correctly and triggers the next tab 4371 pillBorderAnim.onfinish = handleAnimationEnd(index); 4372 $nextTab.addClass("filling"); 4373 animationInProgress = true; 4374 nextIndex = index; 4375 }; 4376 var activateTab = function activateTab(index) { 4377 currentIndex = index; 4378 tabs.removeClass("active"); 4379 contents.removeClass("active"); 4380 $(tabs[index]).addClass("active"); 4381 $(contents[index]).addClass("active"); 4382 }; 4383 4384 // Hover handling 4385 tabs.hover(function () { 4386 if (window.innerWidth <= 767) return; 4387 if (hoverMode) { 4388 var index = $(this).index(); 4389 activateTab(index); 4390 // Update the active background container 4391 $(".ha-loop-tab-bgcontainer").removeClass("ha-loop-tab-active-bg"); 4392 $(".ha-loop-tab-bgcontainer-".concat(index)).addClass("ha-loop-tab-active-bg"); 4393 return; 4394 } 4395 isHovered = true; 4396 var $thisTab = $(this); 4397 var borderElement = $thisTab.find(".tab-border")[0]; 4398 4399 // Pause only if this tab is the one currently animating 4400 if ($thisTab.hasClass("filling") && borderElement && animationInProgress && pillBorderAnim) { 4401 pillBorderAnim.pause(); 4402 } 4403 }, function () { 4404 if (window.innerWidth <= 767) return; 4405 if (hoverMode) return; 4406 isHovered = false;
4407 var $thisTab = $(this); 4408 var borderElement = $thisTab.find(".tab-border")[0]; 4409 4410 // Resume only if this tab was animating 4411 if ($thisTab.hasClass("filling") && borderElement && animationInProgress && pillBorderAnim) { 4412 pillBorderAnim.play(); 4413 } 4414 }); 4415 4416 // Click handling 4417 tabs.click(function (e) { 4418 var clickedTab = $(e.currentTarget); 4419 var clickedIndex = clickedTab.index(); 4420 if (clickedIndex === currentIndex) return; 4421 4422 // Cancel any ongoing animation 4423 if (animationInProgress && pillBorderAnim) { 4424 pillBorderAnim.cancel(); 4425 animationInProgress = false; 4426 } 4427 4428 // Hide all SVGs before setting the new active one 4429 tabs.find(".tab-border").css({ 4430 visibility: "hidden", 4431 strokeDashoffset: function strokeDashoffset() { 4432 return this.getTotalLength(); 4433 } 4434 }); 4435 4436 // Activate the clicked tab 4437 activateTab(clickedIndex); 4438 4439 // Update the active background container 4440 $(".ha-loop-tab-bgcontainer").removeClass("ha-loop-tab-active-bg"); 4441 $(".ha-loop-tab-bgcontainer-".concat(clickedIndex)).addClass("ha-loop-tab-active-bg"); 4442 var nextTabIndex = (clickedIndex + 1) % tabs.length; 4443 setTimeout(function () { 4444 startSvgAnimation(nextTabIndex); 4445 }, 200); 4446 smoothScrollTabs(e.currentTarget); 4447 }); 4448 4449 // Double-click handling only applicable for mobile 4450 tabs.dblclick(function (e) { 4451 if (window.innerWidth > 767) return; 4452 var clickedTab = $(e.currentTarget); 4453 var clickedIndex = clickedTab.index(); 4454 animationInProgress = true; 4455 4456 // Stop all animations when double-clicked 4457 if (animationInProgress && pillBorderAnim) { 4458 pillBorderAnim.cancel(); 4459 } 4460 }); 4461 4462 // Only for mobile devices 4463 var smoothScrollTabs = function smoothScrollTabs(clickedTab) { 4464 if (window.innerWidth > 767) return; 4465 var container = $wrapper.find('.ha-loop-tab-nav')[0]; 4466 if (!container) return; 4467 var containerRect = container.getBoundingClientRect(); 4468 var itemRect = clickedTab.getBoundingClientRect(); 4469 var scrollPosition = container.scrollLeft + (itemRect.left - containerRect.left) - containerRect.width / 3 + itemRect.width / 3; 4470 container.scrollTo({ 4471 left: scrollPosition, 4472 behavior: 'smooth' 4473 }); 4474 }; 4475 4476 // Initial setup 4477 activateTab(0); 4478 startSvgAnimation(1); 4479 window.addEventListener("resize", function () { 4480 activateTab(0); 4481 startSvgAnimation(1); 4482 }); 4483 } 4484 }); 4485 4486 // Loop Tab 4487 elementorFrontend.hooks.addAction("frontend/element_ready/ha-loop-tab.default", function ($scope) { 4488 elementorFrontend.elementsHandler.addHandler(LoopTabBase, { 4489 $element: $scope 4490 }); 4491 }); 4492 var MultiScroll = function MultiScroll($scope) { 4493 var wrap = $scope.find(".ha-multi-scroll-wrap"); 4494 var wrap_inner = $scope.find(".ha-multi-scroll-inner"); 4495 var multi_id = $scope.data("id"); 4496 var multiscroll = $scope.find(".ha-multi-scroll-inner-" + multi_id); 4497 var is_editor = $scope.hasClass("elementor-element-edit-mode"); 4498 var options = wrap.data("settings"); 4499 var device_mode = $("body").attr("data-elementor-device-mode"); 4500 var $left_sections = $scope.find('.ms-left .ms-section'); 4501 var $right_sections = $scope.find('.ms-right .ms-section'); 4502 if (is_editor) { 4503 $(document).find('#multiscroll-nav').remove(); 4504 try { 4505 $.fn.multiscroll.destroy(); 4506 } catch (err) { 4507 console.log(err); 4508 } 4509 } 4510 var $settings = { 4511 loopBottom: options.loopBottom, 4512 loopTop: options.loopTop, 4513 anchors: options.anchors, 4514 navigation: options.dots, 4515 //Dot enable 4516 navigationTooltips: options.dotsTooltips, 4517 navigationPosition: options.dotsPosition + ' ' + options.dotsVertical, 4518 normalScrollElements: null, 4519 menu: options.menu,
4520 leftWidth: options.leftWidth, 4521 rightWidth: options.rightWidth, 4522 navigationInject: wrap_inner, 4523 paddingTop: 0, 4524 paddingBottom: 0 4525 }; 4526 multiscroll.multiscroll($settings); 4527 function check_device(device_mode) { 4528 if (device_mode.includes("tablet") || device_mode.includes("mobile")) { 4529 $.fn.multiscroll.destroy(); 4530 $('html, body').css({ 4531 'overflow': 'visible', 4532 'height': 'auto' 4533 }); 4534 } else { 4535 $.fn.multiscroll.build(); 4536 $('html, body').css({ 4537 'overflow': 'hidden', 4538 'height': '100%' 4539 }); 4540 } 4541 } 4542 check_device(device_mode); 4543 if (is_editor && options.menu) { 4544 // If menu is enabled in editor mode 4545 $(options.menu).on('click', 'a', function (e) { 4546 e.preventDefault(); 4547 var target = $(this).parent().attr('data-menuanchor'); 4548 $.fn.multiscroll.moveTo(target); 4549 }); 4550 } 4551 $(window).on("resize", function () { 4552 var device_mode = $("body").attr("data-elementor-device-mode"); 4553 check_device(device_mode); 4554 }); 4555 }; 4556 elementorFrontend.hooks.addAction("frontend/element_ready/ha-multi-scroll.default", MultiScroll); 4557 }); 4558})(jQuery, Happy, window);
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.