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 // For Flip Box Back editor mode 3261 var ha_flip_box_back = sessionStorage.getItem('haFlipBoxBack'); 3262 if (elementorFrontend.isEditMode() && ha_flip_box_back && 'yes' == ha_flip_box_back) { 3263 $scope.find('.ha-flip-box-inner').addClass('flip-styling flip'); 3264 } // For Flip Box Back editor mode end 3265 3266 var element = $scope.find('.ha-flip-box-inner'); 3267 // touchstart 3268 element.on('mouseenter mouseleave touchstart', function (e) { 3269 if (elementorFrontend.isEditMode() && $(this).hasClass('flip-styling')) { 3270 return; 3271 } 3272 if (('mouseenter' == e.type || 'touchstart' == e.type) && !$(this).hasClass('flip')) { 3273 $(this).addClass('flip'); 3274 } else if (('mouseleave' == e.type || 'touchstart' == e.type) && $(this).hasClass('flip')) { 3275 $(this).removeClass('flip'); 3276 } else if ('touchstart' == e.type && $(this).hasClass('flip')) { 3277 $(this).removeClass('flip'); 3278 } 3279 }); 3280 }; 3281 elementorFrontend.hooks.addAction('frontend/element_ready/ha-image-swap.default', Image_Swap); 3282 var FreeShippingBar = function FreeShippingBar($scope) { 3283 var $fsbContainer = $scope.find('.ha-fsb-container'); 3284 if ($fsbContainer) { 3285 var $settings = $fsbContainer.data('fsb_settings'); 3286 if ($settings != undefined) { 3287 var $aimationSpeed = $settings.hasOwnProperty('ha_fsb_animation_speed') ? $settings.ha_fsb_animation_speed : 15; 3288 var $achivePercent = $settings.hasOwnProperty('achive_percent') ? $settings.achive_percent : 0; 3289 var $progressType = $settings.hasOwnProperty('progress_type') ? $settings.progress_type : 'percent'; 3290 var $currencySymbol = $settings.hasOwnProperty('currencySymbol') && $progressType == 'percent' ? '%' : $settings.currencySymbol; 3291 var $cartTotal = $settings.hasOwnProperty('cart_total') ? $settings.cart_total : 0; 3292 var $totalPercent = parseFloat(Math.round($achivePercent)) >= 100 ? 100 : parseFloat(Math.round($achivePercent)); 3293 var $progressText = $progressType == 'percent' ? $totalPercent : $cartTotal; 3294 var $elem = $fsbContainer.find('.ha-fsb-size'); 3295 $elem.text($progressText + $currencySymbol); 3296 var defaultWidth = $(window).width() <= 768 ? 12 : 5; 3297 $totalPercent > 0 ? $elem.css({ 3298 'width': $totalPercent + "%", 3299 'transition': 'width ' + $aimationSpeed + 'ms ease-in-out' 3300 }) : $elem.css('width', +defaultWidth + "%"); 3301 } 3302 } 3303 }; 3304 elementorFrontend.hooks.addAction('frontend/element_ready/ha-shipping-bar.default', FreeShippingBar); 3305 $('.fsb-close-icon').on('click', function () { 3306 document.cookie = "ha_close_fsb = yes;path=/"; 3307 $('.ha-fsb-container').hide(); 3308 }); 3309 elementorFrontend.hooks.addAction('frontend/element_ready/ha-flip-box.default', FlipBox
3309); 3310 var HaRemoteCarousel = function HaRemoteCarousel($scope) { 3311 var $rcContainer = $scope.find('.ha-remote-carousel-container'); 3312 if ($rcContainer) { 3313 var $rcBtn = $($rcContainer).find('.ha-custom-nav-remote-carousel'); 3314 if ($rcBtn) { 3315 var $prevSliderIndex = 0; 3316 var $slides_to_show = 0; 3317 var $ha_show_thumbnail = $($rcBtn).parent().data('show_thumbnail'); 3318 var $ha_rc_unique_id = $($rcBtn).parent().data('ha_rc_id'); 3319 var $haRcSelector = $ha_rc_unique_id ? $('[data-ha_rcc_uid="' + $ha_rc_unique_id + '"]') : ''; 3320 if ($ha_show_thumbnail && $ha_show_thumbnail == 'yes') { 3321 $haRcSelector.on('init', function (event, slick, currentSlide) { 3322 var $dataSettingsSelector = $haRcSelector.parent().parent(); 3323 var $dataSettings = $dataSettingsSelector.data('settings'); 3324 $slides_to_show = typeof $dataSettings === "undefined" ? $slides_to_show : $dataSettings.slides_to_show; 3325 $prevSliderIndex = (currentSlide ? currentSlide : 0) - 1; 3326 var $nextIndex = parseInt($slides_to_show) + parseInt($prevSliderIndex) + 1; 3327 var $nextItem = $haRcSelector.find('[data-slick-index="' + $nextIndex + '"]');
3328 var $nextImg = $nextItem.find('img').attr('src'); 3329 var $prevItem = $haRcSelector.find('[data-slick-index="' + $prevSliderIndex + '"]'); 3330 var $prevImg = $prevItem.find('img').attr('src'); 3331 var $nextBtn = $rcContainer.find('.ha-remote-carousel-btn-next'); 3332 var $prevBtn = $rcContainer.find('.ha-remote-carousel-btn-prev'); 3333 $nextBtn.css({ 3334 'background-image': 'url(' + $nextImg + ')', 3335 'background-position': 'center' 3336 }); 3337 $prevBtn.css({ 3338 'background-image': 'url(' + $prevImg + ')', 3339 'background-position': 'center' 3340 }); 3341 }); 3342 $haRcSelector.trigger('init'); 3343 $($rcBtn).on("click", function (e) { 3344 e.preventDefault(); 3345 $haRcSelector.on('afterChange', function (event, slick, currentSlideIndex) { 3346 var $dataSettingsSelector = $haRcSelector.parent().parent(); 3347 var $dataSettings = $dataSettingsSelector.data('settings'); 3348 var $slides_to_show = $dataSettings ? $dataSettings.slides_to_show : currentSlideIndex; 3349 $prevSliderIndex = parseInt(currentSlideIndex - 1); 3350 var $nextIndex = parseInt($slides_to_show) + parseInt($prevSliderIndex) + 1; 3351 var $nextItem = $haRcSelector.find('[data-slick-index="' + $nextIndex + '"]');
3352 var $nextImg = $nextItem.find('img').attr('src'); 3353 var $prevItem = $haRcSelector.find('[data-slick-index="' + $prevSliderIndex + '"]'); 3354 var $prevImg = $prevItem.find('img').attr('src'); 3355 var $nextBtn = $rcContainer.find('.ha-remote-carousel-btn-next'); 3356 var $prevBtn = $rcContainer.find('.ha-remote-carousel-btn-prev'); 3357 if ($nextBtn) { 3358 $nextBtn.css({ 3359 'background-image': 'url(' + $nextImg + ')', 3360 'background-position': 'center' 3361 }); 3362 } 3363 if ($prevBtn) { 3364 $prevBtn.css({ 3365 'background-image': 'url(' + $prevImg + ')', 3366 'background-position': 'center' 3367 }); 3368 } 3369 }); 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 } else { 3377 $($rcBtn).on("click", function (e) { 3378 e.preventDefault(); 3379 if ($(this).data("ha_rc_nav") == 'ha_rc_next_btn') { 3380 $haRcSelector.slick("slickNext"); 3381 } else if ($(this).data("ha_rc_nav") == 'ha_rc_prev_btn') { 3382 $haRcSelector.slick("slickPrev"); 3383 } 3384 }); 3385 } 3386 } 3387 } 3388 }; 3389 elementorFrontend.hooks.addAction('frontend/element_ready/ha-remote-carousel.default', HaRemoteCarousel); 3390 var HaTOC = elementorModules.frontend.handlers.Base.extend({ 3391 getDefaultSettings: function getDefaultSettings() { 3392 var elementSettings = this.getElementSettings(), 3393 listWrapperTag = "numbers" === elementSettings.marker_view ? "ol" : "ul"; 3394 return { 3395 selectors: { 3396 widgetContainer: ".ha-toc-wrapper", 3397 container: '.elementor:not([data-elementor-type="header"]):not([data-elementor-type="footer"])', 3398 expandButton: ".ha-toc__header", 3399 collapseButton: ".ha-toc__header", 3400 body: ".ha-toc__body", 3401 headerTitle: ".ha-toc__header-title", 3402 scrollTop: ".ha-toc__scroll-to-top--container" 3403 }, 3404 classes: { 3405 anchor: "ha-toc-menu-anchor", 3406 listWrapper: "ha-toc__list-wrapper", 3407 listItem: "ha-toc__list-item", 3408 listTextWrapper: "ha-toc__list-item-text-wrapper", 3409 firstLevelListItem: "ha-toc__top-level", 3410 listItemText: "ha-toc__list-item-text", 3411 activeItem: "ha-toc-item-active", 3412 headingAnchor: "ha-toc__heading-anchor", 3413 collapsed: "ha-toc--collapsed" 3414 }, 3415 listWrapperTag: listWrapperTag 3416 }; 3417 }, 3418 getDefaultElements: function getDefaultElements() { 3419 var settings = this.getSettings(), 3420 elementSettings = this.getElementSettings(); 3421 return { 3422 $pageContainer: jQuery(elementSettings.container || settings.selectors.container), 3423 $widgetContainer: this.$element.find(settings.selectors.widgetContainer), 3424 $expandButton: this.$element.find(settings.selectors.expandButton), 3425 $collapseButton: this.$element.find(settings.selectors.collapseButton), 3426 $tocBody: this.$element.find(settings.selectors.body), 3427 $listItems: this.$element.find("." + settings.classes.listItem), 3428 $scrollTop: this.$element.find(settings.selectors.scrollTop) 3429 }; 3430 }, 3431 bindEvents: function bindEvents() { 3432 var $self = this; 3433 var elementSettings = this.getElementSettings(); 3434 if (elementSettings.minimize_box) { 3435 this.elements.$expandButton.on("click", function () { 3436 if (!$($self.$element).hasClass($self.getSettings("classes.collapsed"))) { 3437 return $self.collapseBox(); 3438 } else { 3439 return $self.expandBox(); 3440 } 3441 }); 3442 } 3443 if (elementSettings.collapse_subitems) { 3444 this.elements.$listItems.hover(function (event) { 3445 return jQuery(event.target).slideToggle(); 3446 }); 3447 } 3448 if (elementSettings.sticky_toc_toggle) { 3449 elementorFrontend.elements.$window.on("resize", this.handleStickyToc); 3450 } 3451 if (elementSettings.scroll_to_top_toggle) { 3452 this.elements.$scrollTop.on("click", function () { 3453 $self.scrollToTop(); 3454 }); 3455 } 3456 }, 3457 getHeadings: function getHeadings() { 3458 // Get all headings from document by user-selected tags 3459 var elementSettings = this.getElementSettings(), 3460 tags = elementSettings.headings_by_tags.join(","),
3461 selectors = this.getSettings("selectors"), 3462 excludedSelectors = elementSettings.exclude_headings_by_selector; 3463 return this.elements.$pageContainer.find(tags).not(selectors.headerTitle).filter(function (index, heading) { 3464 return !jQuery(heading).closest(excludedSelectors).length; // Handle excluded selectors if there are any 3465 }); 3466 }, 3467 addAnchorsBeforeHeadings: function addAnchorsBeforeHeadings() { 3468 var $this = this; 3469 // Add an anchor element right before each TOC heading to create anchors for TOC links 3470 var classes = this.getSettings("classes"); 3471 this.elements.$headings.before(function (index) { 3472 var anchorLink = $this.getHeadingAnchorLink(index, classes); 3473 return '<span id="' + anchorLink + '" class="' + classes.anchor + ' "></span>'; 3474 }); 3475 }, 3476 activateItem: function activateItem($listItem) { 3477 var classes = this.getSettings("classes"); 3478 this.deactivateActiveItem($listItem); 3479 $listItem.addClass(classe
3479s.activeItem); 3480 this.$activeItem = $listItem; 3481 if (!this.getElementSettings("sticky_toc_toggle")) { 3482 //Note:- The "Collapse" option will not work unless you make the Table of Contents sticky. 3483 return; 3484 } 3485 if (!this.getElementSettings("collapse_subitems")) { 3486 return; 3487 } 3488 var $activeList = void 0; 3489 if ($listItem.hasClass(classes.firstLevelListItem)) { 3490 $activeList = $listItem.parent().next(); 3491 } else { 3492 $activeList = $listItem.parents("." + classes.listWrapper).eq(-2); 3493 } 3494 if (!$activeList.length) { 3495 delete this.$activeList; 3496 return; 3497 } 3498 this.$activeList = $activeList; 3499 this.$activeList.stop().slideDown(); 3500 }, 3501 deactivateActiveItem: function deactivateActiveItem($activeToBe) { 3502 if (!this.$activeItem || this.$activeItem.is($activeToBe)) { 3503 return; 3504 } 3505 var _getSettings = this.getSettings(), 3506 classes = _getSettings.classes; 3507 this.$activeItem.removeClass(classes.activeItem); 3508 if (this.$activeList && (!$activeToBe || !this.$activeList[0].contains($activeToBe[0]))) { 3509 this.$activeList.slideUp(); 3510 } 3511 }, 3512 followAnchor: function followAnchor($element, index) { 3513 var $self = this; 3514 var anchorSelector = $element[0].hash; 3515 var $anchor = void 0; 3516 try { 3517 // `decodeURIComponent` for UTF8 characters in the hash. 3518 $anchor = jQuery(decodeURIComponent(anchorSelector)); 3519 } catch (e) { 3520 return; 3521 } 3522 if (0 === index) { 3523 haObserveTarget($anchor[0], function (direction) { 3524 if ($self.itemClicked) { 3525 return; 3526 } 3527 if ("down" === direction) { 3528 $self.activateItem($element); 3529 } else { 3530 $self.deactivateActiveItem(); 3531 } 3532 }); 3533 } 3534 haObserveTarget($anchor[0], function (direction) { 3535 if ($self.itemClicked) { 3536 return; 3537 } 3538 if ("down" === direction) { 3539 $self.activateItem($self.$listItemTexts.eq(index + 1)); 3540 } else { 3541 $self.activateItem($element); 3542 } 3543 }); 3544 }, 3545 followAnchors: function followAnchors() { 3546 var $self = this; 3547 this.$listItemTexts.each(function (index, element) { 3548 return $self.followAnchor(jQuery(element), index); 3549 }); 3550 }, 3551 setOffset: function setOffset($listItem) { 3552 var $this = this; 3553 var settings = this.getSettings(); 3554 var list = this.$element.find("." + settings.classes.listItem); 3555 var offset = this.getCurrentDeviceSetting("scroll_offset"); 3556 list.each(function () { 3557 $('a', this).on('click', function (e) { 3558 e.preventDefault(); 3559 var hash = this.hash; 3560 $('html, body').animate({ 3561 scrollTop: $(hash).offset().top - parseInt(offset.size) 3562 }, 800); 3563 }); 3564 }); 3565 }, 3566 populateTOC: function populateTOC() { 3567 var $self = this; 3568 this.listItemPointer = 0; 3569 var elementSettings = this.getElementSettings(); 3570 if (elementSettings.custom_style == 'yes') { 3571 this.elements.$widgetContainer.html(this.createSideDot()); 3572 } else { 3573 if (elementSettings.hierarchical_view) { 3574 this.createNestedList(); 3575 } else { 3576 this.createFlatList(); 3577 } 3578 } 3579 this.$listItemTexts = this.$element.find(".ha-toc__list-item-text"); 3580 this.$listItemTexts.on("click", this.onListItemClick.bind(this)); 3581 if (!elementorFrontend.isEditMode()) { 3582 this.followAnchors(); 3583 } 3584 $(window).on('scroll', function () { 3585 if ("window_top" === elementSettings.scroll_to_top_option) { 3586 if ($(window).scrollTop() > 0) { 3587 $self.elements.$scrollTop.show(); 3588 } else { 3589 $self.elements.$scrollTop.hide(); 3590 } 3591 } else { 3592 var $id = $self.getID().parents('.elementor-element'); 3593 if ($id.offset().top >= $(window).scrollTop()) { 3594 $self.elements.$scrollTop.hide(); 3595 } else { 3596 $self.elements.$scrollTop.show(); 3597 } 3598 } 3599 }); 3600 }, 3601 createNestedList: function createNestedList() { 3602 var $self = this; 3603 this.headingsData.forEach(function (heading, index) { 3604 heading.level = 0; 3605 for (var i = index - 1; i >= 0; i--) { 3606 var currentOrderedItem = $self.headingsData[i]; 3607 if (currentOrderedItem.tag <= heading.tag) { 3608 heading.level = currentOrderedItem.level; 3609 if (currentOrderedItem.tag < heading.tag) {
3610 heading.level++; 3611 } 3612 break; 3613 } 3614 } 3615 }); 3616 this.elements.$tocBody.html(this.getNestedLevel(0)); 3617 }, 3618 createFlatList: function createFlatList() { 3619 this.elements.$tocBody.html(this.getNestedLevel()); 3620 }, 3621 createSideDot: function createSideDot(level) { 3622 var settings = this.getSettings(), 3623 elementSettings = this.getElementSettings(), 3624 icon = this.getElementSettings("icon"), 3625 htmlul = ''; 3626 if (elementSettings.custom_style == 'yes') { 3627 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>"); 3628 if (elementSettings.custom_style_list == 'hm-toc-slide-style') { 3629 htmlul += "<".concat(elementSettings.html_tag, " class=\"hm-toc-title\"><span>").concat(elementSettings.widget_title, "<span></").concat(elementSettings.html_tag, ">"); 3630 } else { 3631 htmlul += "<".concat(elementSettings.html_tag, " class=\"hm-toc-title\">").concat(elementSettings.widget_title, "</").concat(elementSettings.html_tag, ">"); 3632 } 3633 htmlul += "<".concat(settings.listWrapperTag, " class=\"hm-toc-items-inner\">"); 3634 for (var i = 0; i < this.headingsData.length; i++) { 3635 var list = ''; 3636 var currentItemDot = this.headingsData[i]; 3637 if (level > currentItemDot.level) { 3638 break; 3639 } 3640 var listItemTextClasses = settings.classes.listItemText; 3641 if (0 === currentItemDot.level) { 3642 // If the current list item is a top level item, give it the first level class 3643 listItemTextClasses += " " + settings.classes.firstLevelListItem; 3644 } 3645 if (level === currentItemDot.level) { 3646 list += "<li class=\"hm-toc-entry ".concat(settings.classes.listItem, "\">"); 3647 if ('bullets' === elementSettings.marker_view && icon && elementSettings.custom_style_list == 'hm-toc-slide-style') { 3648 list += "<i class=\"".concat(icon.value, "\"></i>"); 3649 } 3650 list += "<a href=\"#".concat(currentItemDot.anchorLink, "\" class=\"").concat(listItemTextClasses, "\"><span>").concat(currentItemDot.text, "</span></a>"); 3651 list += "</li>"; 3652 } 3653 htmlul += list; 3654 } 3655 htmlul += "</".concat(settings.listWrapperTag, ">"); 3656 htmlul += "</li>\n </ul>"; 3657 } 3658 return htmlul; 3659 }, 3660 getNestedLevel: function getNestedLevel(level) { 3661 var settings = this.getSettings(), 3662 elementSettings = this.getElementSettings(), 3663 icon = this.getElementSettings("icon"); 3664 var html = ''; 3665 3666 // Open new list/nested list 3667 html += "<" + settings.listWrapperTag + ' class="' + settings.classes.listWrapper + '">'; 3668 3669 // for each list item, build its markup. 3670 while (this.listItemPointer < this.headingsData.length) { 3671 var currentItem = this.headingsData[this.listItemPointer]; 3672 var listItemTextClasses = settings.classes.listItemText; 3673 if (0 === currentItem.level) { 3674 // If the current list item is a top level item, give it the first level class 3675 listItemTextClasses += " " + settings.classes.firstLevelListItem; 3676 } 3677 if (level > currentItem.level) { 3678 break; 3679 } 3680 if (level === currentItem.level) { 3681 html += '<li class="' + settings.classes.listItem + " " + "level-" + level + '">'; 3682 html += '<div class="' + settings.classes.listTextWrapper + '">'; 3683 var liContent = '<a href="#' + currentItem.anchorLink + '" class="' + listItemTextClasses + '">' + currentItem.text + "</a>"; 3684 3685 // If list type is bullets, add the bullet icon as an <i> tag 3686 if ("bullets" === elementSettings.marker_view && icon) { 3687 liContent = '<i class="' + icon.value + '"></i>' + liContent; 3688 } 3689 html += liContent; 3690 html += "</div>"; 3691 this.listItemPointer++; 3692 var nextItem = this.headingsData[this.listItemPointer]; 3693 if (nextItem && level < nextItem.level) { 3694 // If a new nested list has to be created under the current item, 3695 // this entire method is called recursively (outside the while loop, a list wrapper is created) 3696 html += this.getNestedLevel(nextItem.level); 3697 } 3698 html += "</li>"; 3699 } 3700 } 3701 html += "</" + settings.listWrapperTag + ">"; 3702 return html; 3703 }, 3704 handleNoHeadingsFound: function handleNoHeadingsFound() { 3705 var _messages = 'No headings were found on this page.'; 3706 if (elementorFrontend.isEditMode()) { 3707 return this.elements.$tocBody.html(_messages); 3708 } 3709 }, 3710 collapseOnInit: function collapseOnInit() { 3711 var $self = this; 3712 var minimizedOn = this.getElementSettings("minimized_on"), 3713 currentDeviceMode = elementorFrontend.getCurrentDeviceMode(); 3714 if ("" !== minimizedOn && "array" !== typeof minimizedOn) { 3715 minimizedOn = [minimizedOn]; 3716 } 3717 if (0 !== minimizedOn.length && "object" === _typeof(minimizedOn)) {
3718 minimizedOn.forEach(function (value) { 3719 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) { 3720 $self.collapseBox(); 3721 } 3722 }); 3723 } 3724 }, 3725 getHeadingAnchorLink: function getHeadingAnchorLink(index, classes) { 3726 var headingID = this.elements.$headings[index].id, 3727 wrapperID = this.elements.$headings[index].closest('.elementor-widget').id; 3728 var anchorLink = ''; 3729 if (headingID) { 3730 anchorLink = headingID; 3731 } else if (wrapperID) { 3732 // If the heading itself has an ID, we don't want to overwrite it 3733 anchorLink = wrapperID; 3734 } // If there is no existing ID, use the heading text to create a semantic ID 3735 3736 if (headingID || wrapperID) { 3737 jQuery(this.elements.$headings[index]).data('hasOwnID', true); 3738 } else { 3739 anchorLink = "".concat(classes.headingAnchor, "-").concat(index); 3740 } 3741 return anchorLink; 3742 }, 3743 setHeadingsData: function setHeadingsData() { 3744 var $this = this; 3745 this.headingsData = []; 3746 var classes = this.getSettings("classes"); 3747 3748 // Create an array for simplifying TOC list creation 3749 this.elements.$headings.each(function (index, element) { 3750 var anchorLink = $this.getHeadingAnchorLink(index, classes); 3751 $this.headingsData.push({ 3752 tag: +element.nodeName.slice(1), 3753 text: element.textContent, 3754 anchorLink: anchorLink 3755 }); 3756 }); 3757 }, 3758 run: function run() { 3759 var elementSettings = this.getElementSettings(); 3760 this.elements.$headings = this.getHeadings(); 3761 if (!this.elements.$headings.length) { 3762 return this.handleNoHeadingsFound(); 3763 } 3764 this.setHeadingsData(); 3765 if (!elementorFrontend.isEditMode()) { 3766 this.addAnchorsBeforeHeadings(); 3767 } 3768 this.populateTOC(); 3769 if (elementSettings.minimize_box) { 3770 this.collapseOnInit(); 3771 } 3772 if (elementSettings.sticky_toc_toggle) { 3773 this.handleStickyToc(); 3774 } 3775 if ("" !== elementSettings.scroll_offset.size) { 3776 this.setOffset(); 3777 } 3778 }, 3779 expandBox: function expandBox() { 3780 var boxHeight = this.getCurrentDeviceSetting("min_height"); 3781 this.$element.removeClass(this.getSettings("classes.collapsed")); 3782 this.elements.$tocBody.slideDown(); 3783 3784 // return container to the full height in case a min-height is defined by the user 3785 this.elements.$widgetContainer.css("min-height", boxHeight.size + boxHeight.unit); 3786 }, 3787 collapseBox: function collapseBox() { 3788 this.$element.addClass(this.getSettings("classes.collapsed")); 3789 this.elements.$tocBody.slideUp(); 3790 3791 // close container in case a min-height is defined by the user 3792 this.elements.$widgetContainer.css("min-height", "0px"); 3793 }, 3794 onInit: function onInit() { 3795 var $self = this; 3796 this.initElements(); 3797 this.bindEvents(); 3798 jQuery(document).ready(function () { 3799 $self.run(); 3800 }); 3801 }, 3802 onListItemClick: function onListItemClick(event) { 3803 var $self = this; 3804 this.itemClicked = true; 3805 setTimeout(function () { 3806 return $self.itemClicked = false; 3807 }, 2000); 3808 var $clickedItem = jQuery(event.target), 3809 $list = $clickedItem.parent().next(), 3810 collapseNestedList = this.getElementSettings("collapse_subitems"); 3811 if ("SPAN" == $clickedItem[0].tagName && 'yes' == this.getElementSettings("custom_style")) { 3812 $clickedItem = jQuery(event.currentTarget); 3813 } 3814 var listIsActive = void 0; 3815 if (collapseNestedList && $clickedItem.hasClass(this.getSettings("classes.firstLevelListItem"))) { 3816 if ($list.is(":visible")) { 3817 listIsActive = true; 3818 } 3819 } 3820 this.activateItem($clickedItem); 3821 if (collapseNestedList && listIsActive) { 3822 $list.slideUp(); 3823 } 3824 }, 3825 handleStickyToc: function handleStickyToc() { 3826 var elementSettings = this.getElementSettings(); 3827 var currentDeviceMode = elementorFrontend.getCurrentDeviceMode(); 3828 var $devices = elementSettings.sticky_toc_disable_on; 3829 var target = this.getID(); 3830 var type = elementSettings.sticky_toc_type; 3831 if ("in-place" === type) { 3832 var parentWidth = target.parent().parent().outerWidth(); 3833 target.css("width", parentWidth); 3834 } else if ("custom-position" === type) { 3835 var parentWidth = target.parent().parent().outerWidth(); 3836 target.css("width", parentWidth); 3837 } 3838 if (-1 == $.inArray(currentDeviceMode, $devices)) { 3839 target.removeClass('floating-toc'); 3840 $(window).off('scroll', this.stickyScroll); 3841 return; 3842 } 3843 $(window).on('scroll', $.proxy(this.stickyScroll, this)); 3844 }, 3845 stickyScroll: function stickyScroll() { 3846 var target = this.getID(); 3847 var elementSettings = this.getElementSettings(); 3848 var item = document.querySelector(".ha-table-of-contents"); 3849 var bound, tocHeight; 3850 bound = item.getBoundingClientRect(); 3851 tocHeight = target.outerHeight(); 3852 if (target.hasClass("floating-toc")) { 3853 target.parent().parent().css("height", tocHeight); 3854 } else { 3855 target.parent().parent().css("height", ''); 3856 } 3857 if (bound.y + bound.height / 2 < 0) { 3858 if (target.hasClass('floating-toc')) { 3859 return; 3860 } 3861 target.addClass("floating-toc"); 3862 } else { 3863 if (!target.hasClass('floating-toc')) { 3864 return; 3865 } 3866 target.removeClass("floating-toc"); 3867 } 3868 }, 3869 scrollToTop: function scrollToTop() { 3870 var $self = this; 3871 var scrollTo = this.getElementSettings("scroll_to_top_option"); 3872 if ("window_top" === scrollTo) { 3873 $("html, body").animate({ 3874 scrollTop: 0 3875 }, 250); 3876 } else { 3877 var $id = this.getID().parents('.ha-table-of-contents'); 3878 $("html, body").animate({ 3879 scrollTop: $($id).offset().top - 60 3880 }, 1000); 3881 } 3882 }, 3883 getID: function getID() { 3884 return $("#ha-toc-" + this.$element[0].attributes["data-id"].nodeValue); 3885 } 3886 }); 3887 elementorFrontend.hooks.addAction("frontend/element_ready/ha-table-of-contents.default", function ($scope) { 3888 elementorFrontend.elementsHandler.addHandler(HaTOC, { 3889 $element: $scope 3890 }); 3891 }); 3892 3893 //creativeSlider 3894 var HaCreativeSlider = function HaCreativeSlider($scope) { 3895 var $rcContainer = $scope.find('.ha-creative-slider-container'); 3896 if ($rcContainer) { 3897 // var $haCsWidth = window.innerWidth; 3898 var $haCsWidth = $(window).width(); 3899 var $haCsNextSelector = parseInt($haCsWidth) <= 767 ? $rcContainer.find('.ha_cs_mobile_next') : $rcContainer.find('.ha_cc_next_wrapper'); 3900 var $haCsPrevSelector = parseInt($haCsWidth) <= 767 ? $rcContainer.find('.ha_cs_mobile_prev') : $rcContainer.find('.ha_cc_prev_wrapper'); 3901 var csTextItemDelay = parseInt($haCsWidth) <= 767 ? 40 : 30; 3902 var csImageItemDelay = 40; 3903 var csPrevItemsOwl = $rcContainer.find('.ha_cc_prev_items'); 3904 var csTextItemsOwl = $rcContainer.find('.ha_cc_text_items'); 3905 var csImageItemsOwl = $rcContainer.find('.ha_cc_inner_image_items'); 3906 var csNextItemsOwl = $rcContainer.find('.ha_cc_next_items'); 3907 var csPrevNavOptions = { 3908 loop: true, 3909 dots: false, 3910 nav: false, 3911 items: 1, 3912 autoplay: false, 3913 smartSpeed: 500, 3914 touchDrag: false, 3915 mouseDrag: false, 3916 rewind: true, 3917 startPosition: -1 3918 }; 3919 var csNextNavOptions = { 3920 loop: true, 3921 dots: false, 3922 nav: false, 3923 items: 1, 3924 autoplay: false, 3925 smartSpeed: 500, 3926 touchDrag: false, 3927 mouseDrag: false, 3928 rewind: true, 3929 startPosition: 1 3930 }; 3931 var csGeneralOptions = { 3932 loop: true, 3933 dots: false, 3934 nav: false, 3935 items: 1, 3936 autoplay: false, 3937 smartSpeed: 1000, 3938 touchDrag: false, 3939 mouseDrag: false, 3940 singleItem: true, 3941 animateOut: 'fadeOutRight', 3942 animateIn: 'fadeInLeft', 3943 rewind: true 3944 }; 3945 } 3946 csPrevItemsOwl.owlCarousel(csPrevNavOptions); 3947 csNextItemsOwl.owlCarousel(csNextNavOptions); 3948 csTextItemsOwl.owlCarousel(csGeneralOptions); 3949 csImageItemsOwl.owlCarousel(csGeneralOptions); 3950 window.parent.addEventListener('message', function (e) { 3951 if ('ha_cs_reinit' == e.data) { 3952 csTextItemsOwl.owlCarousel('refresh'); 3953 csImageItemsOwl.owlCarousel('refresh'); 3954 } 3955 }); 3956 $($haCsPrevSelector).click(function (e) { 3957 e.preventDefault(); 3958 csPrevItemsOwl.trigger('prev.owl.carousel'); 3959 csNextItemsOwl.trigger('prev.owl.carousel'); 3960 setTimeout(function () { 3961 csTextItemsOwl.trigger('prev.owl.carousel'); 3962 }, csTextItemDelay); 3963 setTimeout(function () { 3964 csImageItemsOwl.trigger('prev.owl.carousel'); 3965 }, csTextItemDelay + csImageItemDelay); 3966 }); 3967 $($haCsNextSelector).click(function (e) { 3968 e.preventDefault(); 3969 csPrevItemsOwl.trigger('next.owl.carousel'); 3970 csNextItemsOwl.trigger('next.owl.carousel'); 3971 setTimeout(function () { 3972 csTextItemsOwl.trigger('next.owl.carousel'); 3973 }, csTextItemDelay); 3974 setTimeout(function () { 3975 csImageItemsOwl.trigger('next.owl.carousel'); 3976 }, csTextItemDelay + csImageItemDelay); 3977 }); 3978 }; 3979 elementorFrontend.hooks.addAction('frontend/element_ready/ha-creative-slider.default', HaCreativeSlider); 3980 3981 //Advanced Comparison Table 3982 var AdvancedComparisonTable = function AdvancedComparisonTable($scope) { 3983 var nav = $scope.find('ul.ha-adct-table-responsive-nav'); 3984 var rows = $scope.find(".ha-adct-row, .ha-adct-child-row"); 3985 var collapse = $scope.find(".ha-adct-collapse-icon-wrap"); 3986 3987 // console.log(rows); 3988 3989 var pos = 2; 3990 nav.on("click", "li", function () { 3991 var pos = $(this).index() + 2; 3992 // console.log( pos ); 3993 3994 rows.find(".ha-adct-column:not(:eq(0))").hide(); 3995 $scope.find(".ha-adct-column:nth-child(" + pos + ")").css("display", "flex"); 3996 nav.find("li").removeClass("active"); 3997 $(this).addClass("active"); 3998 }); 3999 collapse.on("click", function () { 4000 var row_wrap = $(this).closest('.ha-adct-row-wrap'); 4001 // console.log( row_wrap ); 4002 $(this).toggleClass('open'); 4003 row_wrap.find('.ha-adct-child-row-wrap').slideToggle("slow"); 4004 // row_wrap.find('.ha-adct-child-row-wrap .ha-adct-column').slideToggle("slow"); 4005 // $('.ha-adct-heading').slideToggle("slow"); 4006 }); 4007 4008 // Initialize the media query 4009 //var mediaQuery = window.matchMedia("(min-width: 767px)"); 4010 // console.log(mediaQuery); 4011 var mode = $('body').attr('data-elementor-device-mode'); 4012 var w_width = $(window).outerWidth(true); 4013 function hideAndShowColumn(mode) { 4014 if ('tablet' == mode || 'mobile_extra' == mode || 'mobile' == mode) { 4015 rows.find(".ha-adct-column:not(:eq(0))").hide(); 4016 $scope.find(".ha-adct-column:nth-child(" + pos + ")").css("display", "flex"); 4017 } else { 4018 rows.find(".ha-adct-column").removeAttr("style"); 4019 } 4020 } 4021 ; 4022 hideAndShowColumn(mode); 4023 $(window).on('resize', function (e) { 4024 var mode = $('body').attr('data-elementor-device-mode'); 4025 var w_resize_width = $(window).outerWidth(true); 4026 if (w_width != w_resize_width) { 4027 w_width = w_resize_width; 4028 hideAndShowColumn(mode); 4029 } 4030 }); 4031 }; 4032 elementorFrontend.hooks.addAction('frontend/element_ready/ha-advanced-comparison-table.default', AdvancedComparisonTable); 4033 4034 //Title Tips 4035 var TitleTips = function TitleTips($scope) { 4036 var element = $scope.find('.ha-flip-box-inner'); 4037 var items = $scope.find('.ha-title-tips-hover li > a'); 4038 var rect = $scope.find('.ha-title-tips-hover')[0].getBoundingClientRect(); 4039 if ($scope.find('.ha-title-tips-hover').hasClass('swap')) { 4040 var wrapper = $scope.find('.ha-title-tips-hover'); 4041 var anchor_item = $scope.find('.ha-title-tips-hover-item.have-image'); 4042 var figure = $scope.find('figure'); 4043 var Work = { 4044 _register: { 4045 hover: { 4046 active: !1, 4047 currentX: 0, 4048 currentY: 0, 4049 targetX: 0, 4050 targetY: 0 4051 } 4052 }, 4053 _init: function _init() { 4054 this._base(), this._events(); 4055 }, 4056 _base: function _base() { 4057 figure.find('img').each(function () { 4058 var item = $(this); 4059 // console.log( item.height() ); 4060 item.attr("height_ratio", item.height()); 4061 }); 4062 requestAnimationFrame(function () { 4063 Work._interaction.hover.move_image(); 4064 }); 4065 }, 4066 _events: function _events() { 4067 anchor_item.on("mouseenter", "a", function () { 4068 Work._interaction.hover.image($(this)); 4069 }); 4070 anchor_item.on("mouseleave", "a", function () { 4071 Work._interaction.hover.leave(); 4072 }); 4073 anchor_item.on("mousemove", "a", function (e) { 4074 Work._interaction.hover.move(e); 4075 }); 4076 }, 4077 _functions: { 4078 round: function round(e, t) { 4079 var t = void 0 === t ? 100 : Math.pow(10, t); 4080 return Math.round(e * t) / t; 4081 } 4082 }, 4083 _interaction: { 4084 hover: { 4085 image: function image(e) { 4086 e.parents("li").addClass("active").removeClass("not-selected").siblings().removeClass("active").addClass("not-selected"); 4087 if (!Work._register.hover.visible && (Work._register.hover.currentX || Work._register.hover.currentY)) { 4088 Work._register.hover.visible = !0; 4089 figure.addClass("visible"); 4090 } 4091 4092 // $img = $('#work-hover img[project="' + e.attr("href") + '"]');
4093 var $img = figure.find('img[data-filter-id="' + e.attr("data-filter-id") + '"]'); 4094 $img.addClass("active").siblings(".active").removeClass("active").addClass("was-active"); 4095 // console.log($img); 4096 // console.log($img.height()); 4097 // figure.get()[0].style.setProperty("--height_ratio", ( Math.floor(Math.random() * (500 - 150 + 1) ) + 150 ) + 'px' ); 4098 4099 // figure.get()[0].style.setProperty("--height_ratio", ( $img.height() ) + 'px' ); 4100 figure.get()[0].style.setProperty("--height_ratio", $img.attr("height_ratio") + 'px'); 4101 // .style.setProperty("--height_ratio", $img.attr("height_ratio")), 4102 4103 clearTimeout(figure.prop("leave")); 4104 clearTimeout(figure.prop("animate")); 4105 figure.addClass("animate").prop("animate", setTimeout(function () { 4106 figure.removeClass("animate").find("img.was-active").removeClass("was-active"); 4107 }, 400)); 4108 }, 4109 leave: function leave() { 4110 anchor_item.removeClass("active not-selected"); 4111 clearTimeout(figure.prop("leave")); 4112 clearTimeout(figure.prop("active")); 4113 figure.prop("leave", setTimeout(function () { 4114 // Work._register.hover.visible = !1; 4115 Work._register.hover.visible = false; 4116 figure.removeClass("visible"); 4117 }, 1)); 4118 figure.prop("active", setTimeout(function () { 4119 Work._register.hover.active = !1; 4120 }, 2e3)); 4121 }, 4122 move: function move(e) { 4123 var currentReact = e.currentTarget.getBoundingClientRect(); 4124 var currentWrapperReact = wrapper.get()[0].getBoundingClientRect(); 4125 var targetMiddle = currentReact.top + currentReact.height / 2; 4126 Work._register.hover.active || (Work._register.hover.active = !0, requestAnimationFrame(function () { 4127 Work._interaction.hover.move_image(); 4128 }), clearTimeout(figure.prop("active")), figure.prop("active", setTimeout(function () { 4129 Work._register.hover.active = !1; 4130 }, 2e3))); 4131 // var react = $("#work-projects").get()[0].getBoundingClientRect(); 4132 var s = 0; 4133 var targetItem = anchor_item.find('a').offset().left - 40; 4134 if ($scope.hasClass('ha_title_tips_img_pos--left')) { 4135 // Work._register.hover.targetX = currentReact.left - figure.width(); // for left side 4136 Work._register.hover.targetX = -(figure.width() + 10); // for left side 4137 } else { 4138 Work._register.hover.targetX = currentReact.width + 10; // for right side 4139 } 4140 // Work._register.hover.targetY = targetMiddle; 4141 Work._register.hover.targetY = e.pageY - (currentWrapperReact.top + window.scrollY); 4142 if (!Work._register.hover.visible && (Work._register.hover.currentX || Work._register.hover.currentY)) { 4143 Work._register.hover.visible = true; 4144 figure.addClass("visible"); 4145 } 4146 }, 4147 move_image: function move_image() { 4148 if (figure.length) { 4149 Work._register.hover.currentX += (Work._register.hover.targetX - Work._register.hover.currentX) * 0.09; 4150 Work._register.hover.currentY += (Work._register.hover.targetY - Work._register.hover.currentY) * 0.09; 4151 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)"); 4152 if (Work._register.hover.active) { 4153 requestAnimationFrame(function () { 4154 Work._interaction.hover.move_image(); 4155 }); 4156 } 4157 } 4158 } 4159 } 4160 } 4161 }; 4162 Work._init(); 4163 } 4164 }; 4165 elementorFrontend.hooks.addAction('frontend/element_ready/ha-title-tips.default', TitleTips); 4166 4167 // Loop Tab 4168 var LoopTabBase = elementorModules.frontend.handlers.Base.extend({ 4169 onInit: function onInit() { 4170 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 4171 this.wrapper = this.$element.find(".ha-loop-tab-wrapper"); 4172 this.run(); 4173 }, 4174 onElementChange: debounce(function (changedProp) { 4175 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']; 4176 if ($keys.indexOf(changedProp) !== -1) { 4177 this.run(); 4178 } 4179 }, 300), 4180 getReadySettings: function getReadySettings() { 4181 var settings = {}; 4182 var tab_action = this.getElementSettings('tab_action'); 4183 if (tab_action) settings.tab_action = tab_action; 4184 var tab_transition_delay = this.getElementSettings('tab_transition_delay'); 4185 if (tab_transition_delay) settings.tab_transition_delay = tab_transition_delay; 4186 var item_width = this.getElementSettings('tab_nav_item_width'); 4187 if (item_width) settings.item_width = item_width['size']; 4188 var item_height = this.getElementSettings('tab_nav_item_height'); 4189 if (item_height) settings.item_height = item_height['size']; 4190 var stroke_ry = this.getElementSettings('tab_nav_item_border_radius'); 4191 if (stroke_ry) settings.stroke_ry = stroke_ry['size']; 4192 var stroke_width = this.getElementSettings('tab_nav_item_stroke_width'); 4193 if (stroke_width) settings.stroke_width = stroke_width['size']; 4194 return $.extend({}
4194, this.getSettings(), settings); 4195 }, 4196 run: function run() { 4197 var settings = this.getReadySettings(); 4198 var currentIndex = 0; 4199 var isHovered = false; 4200 var nextIndex = 1; 4201 var animationInProgress = false; 4202 var pillBorderAnim = undefined; 4203 var hoverMode = settings.tab_action === 'on_hover'; 4204 var $wrapper = this.wrapper; 4205 var tabs = $wrapper.find(".ha-loop-tab-nav-item"); 4206 var contents = $wrapper.find(".ha-loop-tab_content"); 4207 var animationTime = settings.tab_transition_delay || 8000; 4208 var itemWidth = settings.item_width || 280; 4209 var itemHeight = settings.item_height && settings.item_height >= 45 ? settings.item_height : settings.item_height ? 45 : 65; 4210 var maxRY = parseFloat(itemHeight / 2); 4211 var strokeRY = settings.stroke_ry >= maxRY ? maxRY : settings.stroke_ry; 4212 var strokeWidth = settings.stroke_width || 2; 4213 var initialBgColor = ''; 4214 var parentElement = $wrapper.parents('.e-parent'); 4215 if (parentElement.length > 0) { 4216 parentElement.css({ 4217 position: 'relative', 4218 overflow: 'inherit' 4219 }); 4220 4221 // Append background containers for each tab 4222 tabs.each(function (idx, tab) { 4223 var bgColor = $(tab).attr('container-bgcolors'); 4224 initialBgColor = idx === 0 && bgColor ? JSON.parse(bgColor) : ''; 4225 parentElement.append("<div class=\"ha-loop-tab-bgcontainer ha-loop-tab-bgcontainer-".concat(idx, "\" style=\"background:").concat(JSON.parse(bgColor), ";\"></div>")); 4226 if (initialBgColor != '') { 4227 $(".ha-loop-tab-bgcontainer-".concat(currentIndex)).addClass("ha-loop-tab-active-bg"); 4228 } 4229 }); 4230 } 4231 4232 // Hadling HoverMode of mobile devices 4233 window.addEventListener("resize", function () { 4234 if (window.innerWidth <= 767) { 4235 hoverMode = false; 4236 } else { 4237 hoverMode = settings.tab_action === 'on_hover'; 4238 } 4239 }); 4240 if (window.innerWidth <= 767) { 4241 hoverMode = false; 4242 } else { 4243 hoverMode = settings.tab_action === 'on_hover'; 4244 } 4245 4246 // Tab Navigation hadling 4247 var handleAnimationEnd = function handleAnimationEnd(targetIndex) { 4248 return function () { 4249 if (!animationInProgress) return; 4250 animationInProgress = false; 4251 4252 // Hide the SVG for the previous tab 4253 var previousTab = $(tabs[currentIndex]); 4254 if (previousTab.find('.tab-border')[0].width > 0) { 4255 var _previousTab$find$; 4256 previousTab.find('.tab-border').css({ 4257 visibility: "hidden", 4258 strokeDashoffset: (_previousTab$find$ = previousTab.find('.tab-border')[0]) === null || _previousTab$find$ === void 0 ? void 0 : _previousTab$find$.getTotalLength() 4259 }); 4260 } 4261 activateTab(targetIndex); 4262 4263 // Hide the SVG for the active tab 4264 var activeTab = $(tabs[targetIndex]); 4265 activeTab.find('.tab-border').css({ 4266 visibility: "hidden" 4267 }); 4268 4269 // Only for mobile device 4270 smoothScrollTabs(tabs[targetIndex]); 4271 4272 // Add unique class to the corresponding background container 4273 $(".ha-loop-tab-bgcontainer").removeClass("ha-loop-tab-active-bg"); 4274 $(".ha-loop-tab-bgcontainer-".concat(targetIndex)).addClass("ha-loop-tab-active-bg"); 4275 requestAnimationFrame(function () { 4276 startSvgAnimation((targetIndex + 1) % tabs.length); 4277 }); 4278 }; 4279 }; 4280 4281 // Tab animation handling 4282 var startSvgAnimation = function startSvgAnimation(index) { 4283 if (hoverMode || animationInProgress) return; 4284 tabs.removeClass("filling"); 4285 var $nextTab = $(tabs[index]); 4286 var svgElement = $nextTab.find('.tab-svg')[0]; 4287 if (!svgElement) return; 4288 if (window.innerWidth <= 767) { 4289 svgElement.setAttribute('width', 130); 4290 svgElement.setAttribute('height', 55); 4291 svgElement.setAttribute('viewBox', "0 0 130 55"); 4292 svgElement.style.width = 130 + 'px'; 4293 svgElement.style.height = 55 + 'px'; 4294 } else { 4295 svgElement.setAttribute('width', itemWidth); 4296 svgElement.setAttribute('height', itemHeight + 2); 4297 svgElement.setAttribute('viewBox', "0 0 ".concat(itemWidth, " ").concat(itemHeight)); 4298 svgElement.style.height = itemHeight + 2 + 'px'; 4299 } 4300 var borderElement = $nextTab.find('.tab-border')[0]; 4301 if (!borderElement) return; 4302 4303 // Make SVG visible only when animation starts 4304 $nextTab.find('.tab-border').css("visibility", "visible"); 4305 if (borderElement.getBBox().width !== 0) { 4306 if (window.innerWidth <= 767) { 4307 strokeWidth = 2; 4308 borderElement.style.width = 127 + 'px'; 4309 borderElement.style.height = 52 + 'px'; 4310 borderElement.style.x = 1; 4311 borderElement.style.y = 1; 4312 borderElement.setAttribute('x', 1); 4313 borderElement.setAttribute('y', 1); 4314 borderElement.setAttribute('rx', 26); 4315 borderElement.setAttribute('ry', 26); 4316 4317 // Set styles 4318 borderElement.style.rx = 26; 4319 borderElement.style.ry = 26; 4320 } else { 4321 // Set attr 4322 if (strokeWidth > 4) { 4323 borderElement.setAttribute('x', 3); 4324 borderElement.setAttribute('y', 3); 4325 } else if (strokeWidth > 2) { 4326 borderElement.setAttribute('x', 2); 4327 borderElement.setAttribute('y', 2); 4328 } else { 4329 borderElement.setAttribute('x', 1); 4330 borderElement.setAttribute('y', 1); 4331 } 4332 borderElement.setAttribute('rx', strokeRY); 4333 borderElement.setAttribute('ry', strokeRY); 4334 4335 // Set styles 4336 borderElement.style.rx = strokeRY; 4337 borderElement.style.ry = strokeRY; 4338 if (strokeWidth > 4) { 4339 borderElement.style.width = itemWidth - strokeWidth + 'px'; 4340 borderElement.style.height = itemHeight - strokeWidth + 'px'; 4341 borderElement.style.x = 3; 4342 borderElement.style.y = 3; 4343 } else if (strokeWidth > 2) { 4344 borderElement.style.width = itemWidth - 1 - strokeWidth + 'px'; 4345 borderElement.style.height = itemHeight - 2 + 'px'; 4346 borderElement.style.x = 2; 4347 } else { 4348 borderElement.style.width = itemWidth - 2 + 'px'; 4349 borderElement.style.height = itemHeight - 2 + 'px'; 4350 borderElement.style.x = 1; 4351 borderElement.style.y = 1; 4352 } 4353 } 4354 var length = borderElement.getTotalLength() + 5; 4355 borderElement.style.strokeDasharray = length.toString(); 4356 borderElement.style.strokeDashoffset = length.toString(); 4357 4358 // Create animation 4359 pillBorderAnim = borderElement.animate([{ 4360 strokeDashoffset: length, 4361 strokeWidth: strokeWidth 4362 }, { 4363 strokeDashoffset: 0, 4364 strokeWidth: strokeWidth, 4365 offset: 0.98, 4366 easing: "cubic-bezier(0.11, 0, 0.5, 0)" 4367 }, { 4368 strokeDashoffset: 0, 4369 strokeWidth: strokeWidth, 4370 easing: "ease-out" 4371 }], { 4372 duration: animationTime, 4373 delay: 0, 4374 fill: "forwards" 4375 }); 4376 } 4377 if (!pillBorderAnim) return; 4378 4379 // Ensure animation finishes correctly and triggers the next tab 4380 pillBorderAnim.onfinish = handleAnimationEnd(index); 4381 $nextTab.addClass("filling"); 4382 animationInProgress = true; 4383 nextIndex = index; 4384 }; 4385 var activateTab = function activateTab(index) { 4386 currentIndex = index; 4387 tabs.removeClass("active"); 4388 contents.removeClass("active"); 4389 $(tabs[index]).addClass("active"); 4390 $(contents[index]).addClass("active"); 4391 }; 4392 4393 // Hover handling 4394 tabs.hover(function () { 4395 if (window.innerWidth <= 767) return; 4396 if (hoverMode) { 4397 var index = $(this).index(); 4398 activateTab(index); 4399 // Update the active background container 4400 $(".ha-loop-tab-bgcontainer").removeClass("ha-loop-tab-active-bg"); 4401 $(".ha-loop-tab-bgcontainer-".concat(index)).addClass("ha-loop-tab-active-bg"); 4402 return; 4403 } 4404 isHovered = true; 4405 var $thisTab = $(this); 4406 var borderElement = $thisTab.find(".tab-border")[0]; 4407 4408 // Pause only if this tab is the one currently animating 4409 if ($thisTab.hasClass("filling") && borderElement && animationInProgress && pillBorderAnim) { 4410 pillBorderAnim.pause(); 4411 } 4412 }, function () { 4413 if (window.innerWidth <= 767) return; 4414 if (hoverMode) return; 4415 isHovered = false;
4416 var $thisTab = $(this); 4417 var borderElement = $thisTab.find(".tab-border")[0]; 4418 4419 // Resume only if this tab was animating 4420 if ($thisTab.hasClass("filling") && borderElement && animationInProgress && pillBorderAnim) { 4421 pillBorderAnim.play(); 4422 } 4423 }); 4424 4425 // Click handling 4426 tabs.click(function (e) { 4427 var clickedTab = $(e.currentTarget); 4428 var clickedIndex = clickedTab.index(); 4429 if (clickedIndex === currentIndex) return; 4430 4431 // Cancel any ongoing animation 4432 if (animationInProgress && pillBorderAnim) { 4433 pillBorderAnim.cancel(); 4434 animationInProgress = false; 4435 } 4436 4437 // Hide all SVGs before setting the new active one 4438 tabs.find(".tab-border").css({ 4439 visibility: "hidden", 4440 strokeDashoffset: function strokeDashoffset() { 4441 return this.getTotalLength(); 4442 } 4443 }); 4444 4445 // Activate the clicked tab 4446 activateTab(clickedIndex); 4447 4448 // Update the active background container 4449 $(".ha-loop-tab-bgcontainer").removeClass("ha-loop-tab-active-bg"); 4450 $(".ha-loop-tab-bgcontainer-".concat(clickedIndex)).addClass("ha-loop-tab-active-bg"); 4451 var nextTabIndex = (clickedIndex + 1) % tabs.length; 4452 setTimeout(function () { 4453 startSvgAnimation(nextTabIndex); 4454 }, 200); 4455 smoothScrollTabs(e.currentTarget); 4456 }); 4457 4458 // Double-click handling only applicable for mobile 4459 tabs.dblclick(function (e) { 4460 if (window.innerWidth > 767) return; 4461 var clickedTab = $(e.currentTarget); 4462 var clickedIndex = clickedTab.index(); 4463 animationInProgress = true; 4464 4465 // Stop all animations when double-clicked 4466 if (animationInProgress && pillBorderAnim) { 4467 pillBorderAnim.cancel(); 4468 } 4469 }); 4470 4471 // Only for mobile devices 4472 var smoothScrollTabs = function smoothScrollTabs(clickedTab) { 4473 if (window.innerWidth > 767) return; 4474 var container = $wrapper.find('.ha-loop-tab-nav')[0]; 4475 if (!container) return; 4476 var containerRect = container.getBoundingClientRect(); 4477 var itemRect = clickedTab.getBoundingClientRect(); 4478 var scrollPosition = container.scrollLeft + (itemRect.left - containerRect.left) - containerRect.width / 3 + itemRect.width / 3; 4479 container.scrollTo({ 4480 left: scrollPosition, 4481 behavior: 'smooth' 4482 }); 4483 }; 4484 4485 // Initial setup 4486 activateTab(0); 4487 startSvgAnimation(1); 4488 window.addEventListener("resize", function () { 4489 activateTab(0); 4490 startSvgAnimation(1); 4491 }); 4492 } 4493 }); 4494 4495 // Loop Tab 4496 elementorFrontend.hooks.addAction("frontend/element_ready/ha-loop-tab.default", function ($scope) { 4497 elementorFrontend.elementsHandler.addHandler(LoopTabBase, { 4498 $element: $scope 4499 }); 4500 }); 4501 var MultiScroll = function MultiScroll($scope) { 4502 var wrap = $scope.find(".ha-multi-scroll-wrap"); 4503 var wrap_inner = $scope.find(".ha-multi-scroll-inner"); 4504 var multi_id = $scope.data("id"); 4505 var multiscroll = $scope.find(".ha-multi-scroll-inner-" + multi_id); 4506 var is_editor = $scope.hasClass("elementor-element-edit-mode"); 4507 var options = wrap.data("settings"); 4508 var device_mode = $("body").attr("data-elementor-device-mode"); 4509 var $left_sections = $scope.find('.ms-left .ms-section'); 4510 var $right_sections = $scope.find('.ms-right .ms-section'); 4511 if (is_editor) { 4512 $(document).find('#multiscroll-nav').remove(); 4513 try { 4514 $.fn.multiscroll.destroy(); 4515 } catch (err) { 4516 console.log(err); 4517 } 4518 } 4519 var $settings = { 4520 loopBottom: options.loopBottom, 4521 loopTop: options.loopTop, 4522 anchors: options.anchors, 4523 navigation: options.dots, 4524 //Dot enable 4525 navigationTooltips: options.dotsTooltips, 4526 navigationPosition: options.dotsPosition + ' ' + options.dotsVertical, 4527 normalScrollElements: null, 4528 menu: options.menu,
4529 leftWidth: options.leftWidth, 4530 rightWidth: options.rightWidth, 4531 navigationInject: wrap_inner, 4532 paddingTop: 0, 4533 paddingBottom: 0 4534 }; 4535 multiscroll.multiscroll($settings); 4536 function check_device(device_mode) { 4537 if (device_mode.includes("tablet") || device_mode.includes("mobile")) { 4538 $.fn.multiscroll.destroy(); 4539 $('html, body').css({ 4540 'overflow': 'visible', 4541 'height': 'auto' 4542 }); 4543 } else { 4544 $.fn.multiscroll.build(); 4545 $('html, body').css({ 4546 'overflow': 'hidden', 4547 'height': '100%' 4548 }); 4549 } 4550 } 4551 check_device(device_mode); 4552 if (is_editor && options.menu) { 4553 // If menu is enabled in editor mode 4554 $(options.menu).on('click', 'a', function (e) { 4555 e.preventDefault(); 4556 var target = $(this).parent().attr('data-menuanchor'); 4557 $.fn.multiscroll.moveTo(target); 4558 }); 4559 } 4560 $(window).on("resize", function () { 4561 var device_mode = $("body").attr("data-elementor-device-mode"); 4562 check_device(device_mode); 4563 }); 4564 }; 4565 elementorFrontend.hooks.addAction("frontend/element_ready/ha-multi-scroll.default", MultiScroll); 4566 var ScrollSequence = function ScrollSequence($scope) { 4567 // For Scroll Sequence editor mode 4568 var get_ID = sessionStorage.getItem('haScrollSequenceChangeApply'); 4569 if (get_ID && get_ID == $scope.data('id')) { 4570 $scope.trigger("click"); 4571 $("body,html,document").scrollTop($scope.offset().top); // for scroll to the widget top 4572 sessionStorage.removeItem('haScrollSequenceChangeApply'); 4573 } // For Scroll Sequence editor mode end 4574 4575 var element = $scope.find('.ha-scroll-sequence-wrap'); 4576 if (!element.length) return; 4577 var settings = element.data('settings'), 4578 canvas_wrap = element.find('.ha-scroll-sequence-canvas-wrap'), 4579 is_editor = $scope.hasClass("elementor-element-edit-mode"), 4580 apply_to = settings.apply_to, 4581 target_wrap = '.ha-scroll-sequence-canvas--' + settings.widget_id + ' .ha-scroll-sequence-canvas-wrap-inner', 4582 image_links = [], 4583 folder_path = '', 4584 name_prefix = '', 4585 number_format = 1, 4586 image_type = 'jpg', 4587 total_image = 0, 4588 parent_wrapper, 4589 contid, 4590 containerSS; 4591 if ("gallery" == settings.image_source) { 4592 image_links = settings.images; 4593 } else if ("server" == settings.image_source) { 4594 folder_path = settings.images, name_prefix = settings.name_prefix, number_format = settings.number_format, image_type = settings.image_type, total_image = settings.total_image, image_links = createImageLink(folder_path, name_prefix, number_format, image_type, total_image); 4595 } 4596 canvas_wrap.remove(); 4597 if ('body' == apply_to) { 4598 parent_wrapper = $(document).find('body'); 4599 containerSS = "body"; 4600 } else if ('container' == apply_to) { 4601 parent_wrapper = $scope.closest('.e-con'); 4602 contid = parent_wrapper.data('id'); 4603 containerSS = ".elementor-element-" + contid; 4604 } else if ('section' == apply_to) { 4605 parent_wrapper = $scope.closest('.elementor-section'); 4606 contid = parent_wrapper.data('id'); 4607 containerSS = ".elementor-element-" + contid; 4608 } else if ('column' == apply_to) { 4609 parent_wrapper = $scope.closest('.elementor-column'); 4610 if (parent_wrapper) { 4611 contid = parent_wrapper.data('id'); 4612 containerSS = ".elementor-element-" + contid; 4613 } 4614 } 4615 if (is_editor) { 4616 try { 4617 parent_wrapper.find('.ha-scroll-sequence-canvas-wrap').remove(); 4618 } catch (err) { 4619 console.log(err); 4620 } 4621 } 4622 parent_wrapper.prepend(canvas_wrap); 4623 $(target_wrap).HappySequencer({ 4624 links: image_links, 4625 // Folder where the images are stored 4626 count: total_image // Number of frames (0 to 50 = 51 frames total) 4627 }, function () { 4628 //console.log('All frames loaded.'); 4629 }); 4630 function createImageLink(folder_path, name_prefix, number_format, image_type, total_image) { 4631 var imgGallery = []; 4632 if (!isNaN(number_format) && folder_path !== '' && total_image && ['jpg', 'png', 'webp'].includes(image_type)) { 4633 for (var i = 1; i <= total_image; i++) { 4634 var paddedNumber = i.toString().padStart(number_format, '0'); 4635 var imgUrl = "".concat(folder_path, "/").concat(name_prefix).concat(pad
4635dedNumber, ".").concat(image_type); 4636 imgGallery.push(imgUrl); 4637 } 4638 } 4639 return imgGallery; 4640 } 4641 }; 4642 elementorFrontend.hooks.addAction('frontend/element_ready/ha-scroll-sequence.default', ScrollSequence); 4643 var ScrollTabs = function ScrollTabs($scope) { 4644 content_1(); 4645 function content_1() { 4646 var contentwrap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.ha-scroll-tab-content-wrapper'; 4647 var navItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.ha-scroll-tab-nav-item'; 4648 var $contentWrapper = $scope.find('.ha-scroll-tab-content-wrapper'); 4649 var totalInnerSection = $contentWrapper.find('.ha-scroll-tab-content-section').length; 4650 var $navItems = $scope.find('.ha-scroll-tab-nav-item'); 4651 // const sectionHeight = 668; 4652 var sectionHeight = $contentWrapper.height(); 4653 var isScrolling = false; 4654 var isAnimating = false; 4655 // let scrollTimer = null; 4656 var animDuration = 10; 4657 var debounceTime = 200; 4658 4659 // Handle navigation item clicks 4660 $navItems.on('click', debounce(function () { 4661 var sectionIndex = parseInt($(this).data('section')); 4662 scrollToSection(sectionIndex); 4663 }, debounceTime)); 4664 4665 // Scroll to specific section 4666 function scrollToSection(sectionIndex) { 4667 isScrolling = true; 4668 isAnimating = true; 4669 var targetScroll = sectionIndex * sectionHeight; 4670 $contentWrapper.animate({ 4671 scrollTop: targetScroll 4672 }, animDuration, function () { 4673 isScrolling = false; 4674 isAnimating = false; 4675 // Ensure final state is correct after animation 4676 updateActiveStates(sectionIndex); 4677 }); 4678 } 4679 function getCurrentSection(deltaY, target) { 4680 var sectionIndex = null; 4681 if (deltaY < 0) { 4682 if (target.hasClass('ha-scroll-tab-content-section')) { 4683 sectionIndex = parseInt(target.data('section')); 4684 } else if (target.closest('.ha-scroll-tab-content-section').length > 0) { 4685 sectionIndex = parseInt(target.closest('.ha-scroll-tab-content-section').data('section')); 4686 } 4687 } else if (deltaY > 0) { 4688 if (target.hasClass('ha-scroll-tab-content-section')) { 4689 sectionIndex = parseInt(target.data('section')); 4690 } else if (target.closest('.ha-scroll-tab-content-section').length > 0) { 4691 sectionIndex = parseInt(target.closest('.ha-scroll-tab-content-section').data('section')); 4692 } 4693 } 4694 return sectionIndex; 4695 } 4696 4697 // Update active states for navigation 4698 function updateActiveStates(activeIndex) { 4699 // Only update if not currently animating to prevent blinking and intermediate activations 4700 if (!isAnimating) { 4701 $navItems.removeClass('active'); 4702 $navItems.filter("[data-section=\"".concat(activeIndex, "\"]")).addClass('active'); 4703 } 4704 } 4705 4706 // Handle scroll event on content wrapper 4707 $contentWrapper.on('scroll', debounce(function () { 4708 if (isScrolling || isAnimating) return; 4709 var scrollTop = $(this).scrollTop(); 4710 var currentSection = Math.round(scrollTop / sectionHeight); 4711 if (false == isAnimating) { 4712 isAnimating = true; 4713 var targetScroll = currentSection * sectionHeight; 4714 $contentWrapper.animate({ 4715 scrollTop: targetScroll 4716 }, animDuration, function () { 4717 isAnimating = false; 4718 updateActiveStates(currentSection); 4719 }); 4720 } 4721 4722 // Only update active states if not animating 4723 if (false == isAnimating) { 4724 updateActiveStates(currentSection); 4725 } 4726 }, debounceTime)); 4727 4728 // Handle wheel scrolling for smoother section transitions 4729 $contentWrapper.on('wheel', debounce(function (e) { 4730 var scrollTop = $(this).scrollTop(); 4731 var currentSection = Math.round(scrollTop / sectionHeight); 4732 var delta = e.originalEvent.deltaY; 4733 var maxScroll = $contentWrapper[0].scrollHeight - $contentWrapper.height(); 4734 var present = getCurrentSection(delta, $(e.target)); 4735 4736 // Allow normal page scroll when at top and scrolling up 4737 if (scrollTop <= 0 && delta < 0) { 4738 return; // Don't prevent default, allow page scroll 4739 } 4740 4741 // Allow normal page scroll when at bottom and scrolling down 4742 if (scrollTop >= maxScroll && delta > 0) { 4743 return; // Don't prevent default, allow page scroll 4744 } 4745 4746 // Custom section scrolling for middle content 4747 e.preventDefault(); 4748 var targetSection = currentSection; 4749 if (e.originalEvent.deltaY < 0) { 4750 // Scrolling up 4751 targetSection = 0 == present ? 0 : present - 1; 4752 } else if (e.originalEvent.deltaY > 0) { 4753 // Scrolling down 4754 targetSection = totalInnerSection - 0 == present ? present : present + 1; 4755 }
4756 if (targetSection !== currentSection && false == isAnimating) { 4757 scrollToSection(targetSection); 4758 // $contentWrapper.trigger( "scroll" ); 4759 } 4760 }, debounceTime)); 4761 4762 // Handle general page wheel scrolling to detect when over content wrapper 4763 $(document).on('wheel', debounce(function (e) { 4764 var $target = $(e.target); 4765 4766 // If scrolling over content wrapper or its children, let the content wrapper handle it 4767 if ($target.closest('.ha-scroll-tab-content-wrapper').length > 0) { 4768 return; 4769 } 4770 4771 // For other areas, allow normal page scrolling 4772 }, debounceTime)); 4773 } 4774 }; 4775 elementorFrontend.hooks.addAction('frontend/element_ready/ha-scroll-tabs.default', ScrollTabs); 4776 }); 4777})(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.