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 //console.log(items); 645 //console.log( this.$element.hasClass( "ha-scrolling-image-hover-pause--yes" ) ); 646 647 if (this.$element.hasClass("ha-scrolling-image-hover-pause--yes")) { 648 items.find(".ha-scrolling-image-item").on('mouseover mouseleave', function (e) { 649 var $this = $(this); 650 // console.log(e.type); 651 if (e.type === 'mouseover') { 652 items.pauseKeyframe(); 653 } else if (e.type === 'mouseleave') { 654 items.resumeKeyframe(); 655 } 656 }); 657 } 658 } 659 }); 660 //Pricing Table ToolTip 661 var PricingTableToolTip = function PricingTableToolTip($scope) { 662 var tooltip_area = $scope.find(".ha-pricing-table-feature-tooltip"); 663 tooltip_area.on({ 664 mouseenter: function mouseenter(e) { 665 var $this = $(this), 666 direction = $this[0].getBoundingClientRect(), 667 tooltip = $this.find(".ha-pricing-table-feature-tooltip-text"), 668 tooltipW = tooltip.outerWidth(true), 669 tooltipH = tooltip.outerHeight(true), 670 W_width = $(window).width(), 671 W_height = $(window).height(); 672 tooltip.css({ 673 left: "0", 674 right: "auto", 675 top: "calc(100% + 1px)", 676 bottom: "auto" 677 }); 678 if (W_width - direction.left < tooltipW && direction.right < tooltipW) { 679 tooltip.css({ 680 left: "calc(50% - (" + tooltipW + "px/2))" 681 }); 682 } else if (W_width - direction.left < tooltipW) { 683 tooltip.css({ 684 left: "auto", 685 right: "0" 686 }); 687 } 688 if (W_height - direction.bottom < tooltipH) { 689 tooltip.css({ 690 top: "auto", 691 bottom: "calc(100% + 1px)" 692 }); 693 } 694 } 695 }); 696 }; 697 var TabHandlerBase = elementorModules.frontend.handlers.Base.extend({ 698 $activeContent: null, 699 getDefaultSettings: function getDefaultSettings() { 700 return { 701 selectors: { 702 tabTitle: ".ha-tab__title", 703 tabContent: ".ha-tab__content" 704 }, 705 classes: { 706 active: "ha-tab--active" 707 }, 708 showTabFn: "show", 709 hideTabFn: "hide", 710 toggleSelf: false, 711 hidePrevious: true, 712 autoExpand: true 713 }; 714 }, 715 getDefaultElements: function getDefaultElements() {
716 var selectors = this.getSettings("selectors"); 717 return { 718 $tabTitles: this.findElement(selectors.tabTitle), 719 $tabContents: this.findElement(selectors.tabContent) 720 }; 721 }, 722 activateDefaultTab: function activateDefaultTab() { 723 var settings = this.getSettings(); 724 if (!settings.autoExpand || "editor" === settings.autoExpand && !this.isEdit) { 725 return; 726 } 727 var defaultActiveTab = this.getEditSettings("activeItemIndex") || 1, 728 originalToggleMethods = { 729 showTabFn: settings.showTabFn, 730 hideTabFn: settings.hideTabFn 731 }; 732 // Toggle tabs without animation to avoid jumping 733 this.setSettings({ 734 showTabFn: "show", 735 hideTabFn: "hide" 736 }); 737 this.changeActiveTab(defaultActiveTab); 738 // Return back original toggle effects 739 this.setSettings(originalToggleMethods); 740 }, 741 deactivateActiveTab: function deactivateActiveTab(tabIndex) { 742 var settings = this.getSettings(), 743 activeClass = settings.classes.active, 744 activeFilter = tabIndex ? '[data-tab="' + tabIndex + '"]' : "." + activeClass, 745 $activeTitle = this.elements.$tabTitles.filter(activeFilter), 746 $activeContent = this.elements.$tabContents.filter(activeFilter); 747 $activeTitle.add($activeContent).removeClass(activeClass); 748 $activeContent[settings.hideTabFn](); 749 }, 750 activateTab: function activateTab(tabIndex) { 751 var settings = this.getSettings(), 752 activeClass = settings.classes.active, 753 $requestedTitle = this.elements.$tabTitles.filter('[data-tab="' + tabIndex + '"]'), 754 $requestedContent = this.elements.$tabContents.filter('[data-tab="' + tabIndex + '"]'); 755 $requestedTitle.add($requestedContent).addClass(activeClass); 756 $requestedContent[settings.showTabFn](); 757 }, 758 isActiveTab: function isActiveTab(tabIndex) { 759 return this.elements.$tabTitles.filter('[data-tab="' + tabIndex + '"]').hasClass(this.getSettings("classes.active")); 760 }, 761 bindEvents: function bindEvents() { 762 var _this = this; 763 this.elements.$tabTitles.on({ 764 keydown: function keydown(event) { 765 if ("Enter" === event.key) { 766 if ('A' == event.currentTarget.tagName && event.currentTarget.classList.contains('ha-tab__title')) { 767 //this conditional scope in only for advance tab widget 768 return; 769 } 770 event.preventDefault(); 771 _this.changeActiveTab(event.currentTarget.getAttribute("data-tab")); 772 } 773 }, 774 click: function click(event) { 775 if ('A' == event.currentTarget.tagName && event.currentTarget.classList.contains('ha-tab__title')) { 776 //this conditional scope in only for advance tab widget 777 return; 778 } 779 event.preventDefault(); 780 _this.changeActiveTab(event.currentTarget.getAttribute("data-tab")); 781 // iphone specific scroll to top 782 if (/iPhone/i.test(navigator.userAgent)) { 783 $("body,html,document").scrollTop($(this).offset().top); 784 } 785 } 786 }); 787 this.smoothScrollTabs(); 788 }, 789 onInit: function onInit() { 790 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 791 this.activateDefaultTab(); 792 this.smoothScrollTabs(); 793 }, 794 onEditSettingsChange: function onEditSettingsChange(propertyName) { 795 if ("activeItemIndex" === propertyName) { 796 this.activateDefaultTab(); 797 } 798 }, 799 changeActiveTab: function changeActiveTab(tabIndex) { 800 var isActiveTab = this.isActiveTab(tabIndex), 801 settings = this.getSettings(); 802 if ((settings.toggleSelf || !isActiveTab) && settings.hidePrevious) { 803 this.deactivateActiveTab(); 804 } 805 if (!settings.hidePrevious && isActiveTab) { 806 this.deactivateActiveTab(tabIndex); 807 } 808 if (!isActiveTab) { 809 this.activateTab(tabIndex); 810 } 811 $(window).trigger("resize"); 812 }, 813 smoothScrollTabs: function smoothScrollTabs() { 814 var that = this; 815 var tabTitles = this.$element.find('.ha-tabs__nav .ha-tab__title'); 816 $(window).on("resize", function () { 817 // Check if the screen width is less than or equal to 768px 818 if (window.innerWidth <= 768) { 819 tabTitles.each(function () { 820 $(this).on('click', function () { 821 var container = that.$element.find('.ha-tabs__nav')[0]; 822 if (container) { 823 var containerRect = container.getBoundingClientRect(); 824 var itemRect = this.getBoundingClientRect(); 825 // Calculate the scroll position to center the clicked item 826 var scrollPosition = container.scrollLeft + (itemRect.left - containerRect.left) - containerRect.width / 2 + itemRect.width / 2; 827 828 // Smoothly scroll to the calculated position 829 container.scrollTo({ 830 left: scrollPosition, 831 behavior: 'smooth' 832 }); 833 } 834 }); 835 }); 836 } 837 }).trigger("resize"); 838 } 839 }); 840 var TimeLine = function TimeLine($scope) { 841 var T_ID = $scope.data("id"); 842 var timeline = $scope.find(".ha-timeline-wrap"); 843 var dataScroll = timeline.data("scroll"); 844 var timeline_block = timeline.find(".ha-timeline-block"); 845 var event = "scroll.timelineScroll" + T_ID + " resize.timelineScroll" + T_ID; 846 function scroll_tree() { 847 timeline_block.each(function () { 848 var block_height = $(this).outerHeight(true); 849 var $offsetTop = $(this).offset().top;
850 var window_middle_p = $window.scrollTop() + $window.height() / 2; 851 if ($offsetTop < window_middle_p) { 852 $(this).addClass("ha-timeline-scroll-tree"); 853 } else { 854 $(this).removeClass("ha-timeline-scroll-tree"); 855 } 856 var scroll_tree_wrap = $(this).find(".ha-timeline-tree-inner"); 857 var scroll_height = $window.scrollTop() - scroll_tree_wrap.offset().top + $window.outerHeight() / 2; 858 if ($offsetTop < window_middle_p && timeline_block.hasClass("ha-timeline-scroll-tree")) { 859 if (block_height > scroll_height) { 860 scroll_tree_wrap.css({ 861 height: scroll_height * 1.5 + "px" 862 }); 863 } else { 864 scroll_tree_wrap.css({ 865 height: block_height * 1.2 + "px" 866 }); 867 } 868 } else { 869 scroll_tree_wrap.css("height", "0px"); 870 } 871 }); 872 } 873 if ("yes" === dataScroll) { 874 scroll_tree(); 875 $window.on(event, scroll_tree); 876 } else { 877 $window.off(event); 878 } 879 }; 880 var HotSpots = elementorModules.frontend.handlers.Base.extend({ 881 onInit: function onInit() { 882 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 883 this.init(); 884 }, 885 bindEvents: function bindEvents() { 886 if (!this.isEdit) { 887 this.elements.$items.on("click.spotClick", function (e) { 888 e.preventDefault(); 889 }); 890 } 891 }, 892 getDefaultSettings: function getDefaultSettings() { 893 return { 894 selectors: { 895 item: ".ha-hotspots__item" 896 } 897 }; 898 }, 899 getDefaultElements: function getDefaultElements() { 900 return { 901 $items: this.findElement(this.getSettings("selectors.item")) 902 }; 903 }, 904 onElementChange: function onElementChange(changedProp) { 905 if (!this.hasTipso()) { 906 return; 907 } 908 if (changedProp.indexOf("tooltip_") === 0) { 909 this.elements.$items.tipso("destroy"); 910 this.init(); 911 } 912 }, 913 hasTipso: function hasTipso() { 914 return $.fn["tipso"]; 915 }, 916 init: function init() { 917 var position = this.getElementSettings("tooltip_position"), 918 width = this.getElementSettings("tooltip_width"), 919 background = this.getElementSettings("tooltip_bg_color"), 920 color = this.getElementSettings("tooltip_color"), 921 speed = this.getElementSettings("tooltip_speed"), 922 delay = this.getElementSettings("tooltip_delay"), 923 hideDelay = this.getElementSettings("tooltip_hide_delay"), 924 hideArrow = this.getElementSettings("tooltip_hide_arrow"), 925 hover = this.getElementSettings("tooltip_hover"), 926 elementId = this.getID(); 927 if (!this.hasTipso()) { 928 return; 929 } 930 this.elements.$items.each(function (index, item) { 931 var $item = $(item), 932 target = $item.data("target"), 933 settings = $item.data("settings"), 934 classes = ["ha-hotspots--" + elementId, "elementor-repeater-item-" + target]; 935 $item.tipso({ 936 color: color, 937 width: width.size || 200, 938 position: settings.position || position, 939 speed: speed, 940 delay: delay, 941 showArrow: !hideArrow, 942 tooltipHover: !!hover, 943 hideDelay: hideDelay, 944 background: background, 945 useTitle: false, 946 content: $("#ha-" + target).html(), 947 onBeforeShow: function onBeforeShow($e, e, tooltip) { 948 $(document).find('.elementor-repeater-item-' + target).remove();
949 tooltip.tipso_bubble.addClass(classes.join(" ")); 950 } 951 }); 952 }); 953 } 954 }); 955 var LineChart = function LineChart($scope) { 956 haObserveTarget($scope[0], function () { 957 var $container = $scope.find(".ha-line-chart-container"), 958 $chart_canvas = $scope.find("#ha-line-chart"), 959 settings = $container.data("settings"); 960 if ($container.length) { 961 var chart = new Chart($chart_canvas, settings); 962 } 963 }); 964 }; 965 var RadarChart = function RadarChart($scope) { 966 haObserveTarget($scope[0], function () { 967 var $container = $scope.find(".ha-radar-chart-container"), 968 $chart_canvas = $scope.find("#ha-radar-chart"), 969 settings = $container.data("settings"); 970 if ($container.length) { 971 var chart = new Chart($chart_canvas, settings); 972 } 973 }); 974 }; 975 var PolarChart = function PolarChart($scope) { 976 haObserveTarget($scope[0], function () { 977 var $container = $scope.find(".ha-polar-chart-container"), 978 $chart_canvas = $scope.find("#ha-polar-chart"), 979 settings = $container.data("settings"); 980 if ($container.length) { 981 var chart = new Chart($chart_canvas, settings); 982 } 983 }); 984 }; 985 var PieChart = function PieChart($scope) { 986 haObserveTarget($scope[0], function () { 987 var $container = $scope.find(".ha-pie-chart-container"), 988 $chart_canvas = $scope.find("#ha-pie-chart"), 989 settings = $container.data("settings"); 990 if ($container.length) { 991 var chart = new Chart($chart_canvas, settings); 992 } 993 }); 994 }; 995 var StickyVideoArray = []; 996 var StickyVideo = function StickyVideo($scope) { 997 var $id = "#ha-sticky-video-player-" + $scope.data("id"), 998 $wrap = $scope.find(".ha-sticky-video-wrap"), 999 $settting = $wrap.data("ha-player"), 1000 $box = $wrap.find(".ha-sticky-video-box"), 1001 $overlay_box = $wrap.find(".ha-sticky-video-overlay"), 1002 $overlay_play = $overlay_box.find(".ha-sticky-video-overlay-icon"), 1003 $sticky_close = $wrap.find(".ha-sticky-video-close i"), 1004 $all_box = $(".ha-sticky-video-box"), 1005 event = "scroll.haStickyVideo" + $scope.data("id"), 1006 set; 1007 var playerAbc = new Plyr($id); 1008 var StickyVideoObject = { 1009 player: playerAbc, 1010 event: event, 1011 player_box: $box 1012 }; 1013 StickyVideoArray.push(StickyVideoObject); 1014 1015 //on ready 1016 playerAbc.on("ready", function (e) { 1017 var $box_plyr = $box.find('.plyr.plyr--video'); 1018 if (true == $settting.autoplay) { 1019 $box_plyr.trigger("click"); 1020 } 1021 }); 1022 1023 //on overlay click 1024 if (0 !== $overlay_box.length) { 1025 var $el = 0 !== $overlay_play.length ? $overlay_play : $overlay_box; 1026 $el.on("click", function () { 1027 playerAbc.play(); 1028 }); 1029 } 1030 //on close sticky 1031 $sticky_close.on("click", function () { 1032 $box.removeClass("sticky"); 1033 $box.addClass("sticky-close"); 1034 playerAbc.pause(); 1035 }); 1036 //on Play 1037 playerAbc.on("play", function (e) { 1038 $overlay_box.css("display", "none"); 1039 if ($box.hasClass("sticky-close")) { 1040 $box.removeClass("sticky-close"); 1041 } 1042 StickyVideoArray.forEach(function (item, index) { 1043 if (item.player !== playerAbc) { 1044 item.player.pause(); 1045 } 1046 if (item.event !== event) { 1047 $window.off(item.event); 1048 } 1049 if (item.player_box !== $box) { 1050 item.player_box.removeClass("sticky"); 1051 } 1052 }); 1053 if (true === $settting.sticky) { 1054 $window.on(event, function () { 1055 var height = $box.outerHeight(true); 1056 var $offsetTop = $wrap.offset().top; 1057 var videoBoxTopPoint = $window.scrollTop(); 1058 var videoBoxMiddlePoint = $offsetTop + height / 2; 1059 if (!$box.hasClass("sticky-close")) { 1060 if (videoBoxMiddlePoint < videoBoxTopPoint) { 1061 $box.addClass("sticky"); 1062 } else { 1063 $box.removeClass("sticky"); 1064 } 1065 } 1066 }); 1067 } else { 1068 $window.off(event); 1069 } 1070 }); 1071 // on pause 1072 playerAbc.on("pause", function (e) { 1073 $window.off(event); 1074 }); 1075 $window.on("load resize", debounce(function () { 1076 var height = $box.find(".plyr").height(); 1077 $wrap.css("min-height", height + "px"); 1078 }, 100)); 1079 }; 1080 1081 //facebook feed 1082 var FacebookFeed = function FacebookFeed($scope) { 1083 var button = $scope.find(".ha-facebook-load-more"); 1084 var facebook_wrap = $scope.find(".ha-facebook-items"); 1085 button.on("click", function (e) { 1086 e.preventDefault(); 1087 var $self = $(this), 1088 query_settings = $self.data("settings"), 1089 total = $self.data("total"), 1090 items = $scope.find(".ha-facebook-item").length; 1091 $.ajax({ 1092 url: HappyProLocalize.ajax_url, 1093 type: "POST", 1094 data: { 1095 action: "ha_facebook_feed_action", 1096 security: HappyProLocalize.nonce, 1097 query_settings: query_settings, 1098 loaded_item: items 1099 }, 1100 success: function success(response) { 1101 if (total > items) { 1102 $(response).appendTo(facebook_wrap); 1103 } else { 1104 $self.text("All Loaded").addClass("loaded"); 1105 setTimeout(function () { 1106 $self.css({ 1107 display: "none" 1108 }); 1109 }, 800); 1110 } 1111 }, 1112 error: function error(_error3) {} 1113 }); 1114 }); 1115 }; 1116 //SmartPostList 1117 var SmartPostList = function SmartPostList($scope) { 1118 var filterWrap = $scope.find(".ha-spl-filter"), 1119 customSelect = $scope.find(".ha-spl-custom-select"),
1120 gridWrap = $scope.find(".ha-spl-grid-area"), 1121 mainWrapper = $scope.find(".ha-spl-wrapper"), 1122 querySettings = mainWrapper.data("settings"), 1123 dataOffset = mainWrapper.attr("data-offset"), 1124 nav = $scope.find(".ha-spl-pagination button"), 1125 navPrev = $scope.find(".ha-spl-pagination button.prev"), 1126 navNext = $scope.find(".ha-spl-pagination button.next"), 1127 filter = $scope.find("ul.ha-spl-filter-list li span"), 1128 event; 1129 customSelect.niceSelect(); 1130 var select = $scope.find(".ha-spl-custom-select li"); 1131 function afterClick(e) { 1132 e.preventDefault(); 1133 var $self = $(this), 1134 dataFilter = filterWrap.attr("data-active"), 1135 dataTotalOffset = mainWrapper.attr("data-total-offset"), 1136 offset = "", 1137 termId = ""; 1138 if (e.target.classList.contains("prev") || e.target.classList.contains("fa-angle-left")) { 1139 if (0 == parseInt(dataTotalOffset)) { 1140 navPrev.attr("disabled", true); 1141 return; 1142 } 1143 offset = 0 !== parseInt(dataTotalOffset) ? parseInt(dataTotalOffset) - parseInt(dataOffset) : "0"; 1144 if (undefined !== dataFilter) { 1145 termId = dataFilter; 1146 } 1147 } else if (e.target.classList.contains("next") || e.target.classList.contains("fa-angle-right")) { 1148 offset = parseInt(dataTotalOffset) + parseInt(dataOffset); 1149 if (undefined !== dataFilter) { 1150 termId = dataFilter; 1151 } 1152 } 1153 if (e.target.hasAttribute("data-value")) { 1154 termId = e.target.dataset["value"]; 1155 filterWrap[0].setAttribute("data-active", termId); 1156 if ("SPAN" === e.target.tagName) { 1157 filter.removeClass("ha-active"); 1158 e.target.classList.toggle("ha-active"); 1159 } 1160 offset = 0; 1161 navPrev.attr("disabled", true); 1162 navNext.removeAttr("disabled"); 1163 } 1164 $.ajax({ 1165 url: HappyProLocalize.ajax_url, 1166 type: "POST", 1167 data: { 1168 action: "ha_smart_post_list_action", 1169 security: HappyProLocalize.nonce, 1170 querySettings: querySettings, 1171 offset: offset, 1172 termId: termId 1173 }, 1174 success: function success(response) { 1175 if ($(response).length > 0) { 1176 gridWrap.css("height", gridWrap.outerHeight(true) + "px"); 1177 gridWrap.html(""); 1178 $(response).appendTo(gridWrap); 1179 gridWrap.css("height", ""); 1180 mainWrapper[0].attributes["data-total-offset"].value = offset; 1181 if (e.target.classList.contains("prev") || e.target.classList.contains("fa-angle-left")) { 1182 navNext.removeAttr("disabled"); 1183 } 1184 if (e.target.classList.contains("next") || e.target.classList.contains("fa-angle-right")) { 1185 navPrev.removeAttr("disabled"); 1186 } 1187 } else { 1188 if (e.target.classList.contains("next") || e.target.classList.contains("fa-angle-right")) { 1189 navNext.attr("disabled", true); 1190 } 1191 } 1192 }, 1193 error: function error(_error4) {} 1194 }); 1195 } 1196 nav.on("click", afterClick); 1197 filter.on("click", afterClick); 1198 select.on("click", afterClick); 1199 }; 1200 1201 //PostGrid 1202 var postGridSkins = ["classic", "hawai", "standard", "monastic", "stylica", "outbox", "crossroad"]; 1203 var PostGrid = function PostGrid($scope) { 1204 var wrapper = $scope.find(".ha-pg-wrapper"), 1205 gridWrap = wrapper.find(".ha-pg-grid-wrap"), 1206 button = wrapper.find("button.ha-pg-loadmore"); 1207 button.on("click", function (e) { 1208 e.preventDefault(); 1209 var $self = $(this), 1210 querySettings = $self.data("settings"), 1211 items = wrapper.find(".ha-pg-item").length; 1212 $self.attr("disabled", true); 1213 $.ajax({ 1214 url: HappyProLocalize.ajax_url, 1215 type: "POST", 1216 data: { 1217 action: "hapro_post_grid_action", 1218 security: HappyProLocalize.nonce, 1219 querySettings: querySettings, 1220 loadedItem: items 1221 }, 1222 beforeSend: function beforeSend() { 1223 $self.find(".eicon-loading").css({ 1224 display: "inline-block" 1225 }); 1226 }, 1227 success: function success(response) { 1228 if (response) { 1229 $(response).each(function () { 1230 var $self = $(this); 1231 if ($self.hasClass("ha-pg-item")) { 1232 $self.addClass("ha-pg-item-loaded").appendTo(gridWrap); 1233 } else { 1234 $self.appendTo(gridWrap); 1235 } 1236 }); 1237 } else { 1238 $self.text("All Loaded").addClass("loaded"); 1239 setTimeout(function () { 1240 $self.css({ 1241 display: "none" 1242 }); 1243 }, 800); 1244 } 1245 $self.find(".eicon-loading").css({ 1246 display: "none" 1247 }); 1248 $self.removeAttr("disabled"); 1249 }, 1250 error: function error(_error5) {} 1251 }); 1252 }); 1253 }; 1254 1255 // Happy Loop Grid 1256 var LoopGrid = function LoopGrid($scope) { 1257 var wrapper = $scope.find(".ha-hlg-wrapper"), 1258 gridWrap = wrapper.find(".ha-hlg-grid-wrap"), 1259 button = wrapper.find("button.ha-hlg-loadmore"), 1260 createTemplate = $scope.find('.hlg-create-template'); 1261 // handle load more button 1262 button.on("click", function (e) { 1263 e.preventDefault(); 1264 var $self = $(this), 1265 querySettings = $self.data("settings"), 1266 items = wrapper.find(".ha-hlg-grid-item").length; 1267 $self.attr("disabled", true); 1268 $.ajax({ 1269 url: HappyProLocalize.ajax_url, 1270 type: "POST", 1271 data: { 1272 action: "hapro_loop_grid_action", 1273 security: HappyProLocalize.nonce, 1274 querySettings: querySettings, 1275 loadedItem: items 1276 }, 1277 beforeSend: function beforeSend() { 1278 $self.find(".eicon-loading").css({ 1279 display: "inline-block" 1280 }); 1281 }, 1282 success: function success(response) { 1283 if (response) { 1284 $(response).each(function () { 1285 var $self = $(this); 1286 if ($self.hasClass("ha-hlg-grid-item")) { 1287 $self.addClass("ha-hlg-grid-item-loaded").appendTo(gridWrap); 1288 } else { 1289 $self.appendTo(gridWrap); 1290 } 1291 }); 1292 } else { 1293 $self.text("All Loaded").addClass("loaded"); 1294 setTimeout(function () { 1295 $self.css({ 1296 display: "none" 1297 }); 1298 }, 800); 1299 } 1300 $self.find(".eicon-loading").css({ 1301 display: "none" 1302 }); 1303 $self.removeAttr("disabled"); 1304 }, 1305 error: function error(_error6) {} 1306 }); 1307 }); 1308 // handle create template 1309 if (createTemplate.length > 0) { 1310 createTemplate.on("click", function (e) { 1311 e.preventDefault(); 1312 window.open($(this).attr('href'), '_blank').focus(); 1313 }); 1314 } 1315 }; 1316 1317 // Advanced Data Table 1318 var DataTable = function DataTable($scope) { 1319 var dataTable = $scope.find(".ha-advanced-table"); 1320 var widgetWrapper = $scope.find(".elementor-widget-container"); 1321 var row_td = $scope.find(".ha-advanced-table__body-row-cell"); 1322 var search = dataTable.data("search") == true ? true : false;
1323 var paging = dataTable.data("paging") == true ? true : false; 1324 var scrollX = dataTable.data("scroll-x") == undefined ? false : true; 1325 if (window.innerWidth <= 767) { 1326 var scrollX = true; 1327 } 1328 if (0 == widgetWrapper.length) { 1329 widgetWrapper = $scope; 1330 } 1331 // DataTables.js settings 1332 $(dataTable).DataTable({ 1333 searching: search, 1334 paging: paging, 1335 orderCellsTop: true, 1336 scrollX: scrollX, 1337 aaSorting: [] 1338 }); 1339 var column_th = $scope.find(".ha-advanced-table__head-column-cell"); 1340 column_th.each(function (index, v) { 1341 $(column_th[index]).css("width", ""); 1342 }); 1343 // export table button 1344 if (dataTable.data("export-table") == true) { 1345 widgetWrapper.prepend('<div class="ha-advanced-table-btn-wrap"><button class="ha-advanced-table-btn">' + dataTable.data("export-table-text") + "</button></div>"); 1346 var dataTableBtn = $scope.find(".ha-advanced-table-btn"); 1347 dataTableBtn.on("click", function () { 1348 var oldDownloadNode = document.querySelector(".ha-advanced-data-table-export"); 1349 if (oldDownloadNode) { 1350 oldDownloadNode.parentNode.removeChild(oldDownloadNode); 1351 } 1352 var csv = []; 1353 dataTable.find("tr").each(function (index, tr) { 1354 var data = []; 1355 $(tr).find("th").each(function (index, th) { 1356 data.push(th.textContent); 1357 }); 1358 $(tr).find("td").each(function (index, td) { 1359 data.push(td.textContent); 1360 }); 1361 csv.push(data.join(",")); 1362 }); 1363 var csvFile = new Blob([csv.join("\n")], { 1364 type: "text/csv" 1365 }); 1366 var downloadNode = document.createElement("a"); 1367 var url = URL.createObjectURL(csvFile); 1368 var date = new Date(); 1369 var options = { 1370 day: "2-digit", 1371 month: "short", 1372 year: "numeric", 1373 hour: "numeric", 1374 minute: "numeric", 1375 second: "numeric" 1376 }; 1377 var formatedDate = date.toLocaleDateString("en-BD", options); 1378 var dateString = JSON.stringify(formatedDate.replace(/[ , :]/g, "-")); 1379 downloadNode.download = "advanced-data-table-" + dateString + "~" + dataTable.data("widget-id") + ".csv"; 1380 downloadNode.setAttribute("href", url); 1381 downloadNode.classList.add("ha-advanced-data-table-export"); 1382 downloadNode.style.visibility = "hidden"; 1383 document.body.appendChild(downloadNode); 1384 downloadNode.click(); 1385 }); 1386 } 1387 //for fit table th&td 1388 $(window).trigger('resize'); 1389 }; 1390 // ModalPopup 1391 var ModalPopup = function ModalPopup($scope) { 1392 var boxWrapper = $scope.find(".ha-modal-popup-box-wrapper"); 1393 var triggerType = boxWrapper.data("trigger-type"); 1394 var trigger = $scope.find(".ha-modal-popup-trigger"); 1395 var overlayClose = $scope.find(".ha-modal-popup-overlay"); 1396 var iconClose = $scope.find(".ha-modal-popup-content-close"); 1397 var modal = $scope.find(".ha-modal-popup-content-wrapper"); 1398 var modalAnimation = modal.data("animation"); 1399 var modalDelay = modal.data("display-delay"); 1400 if ("pageload" == triggerType) { 1401 if (!modal.hasClass("ha-modal-show")) { 1402 setTimeout(function () { 1403 modal.addClass("ha-modal-show"); 1404 modal.find(".ha-modal-animation").addClass(modalAnimation); 1405 }, parseInt(modalDelay)); 1406 } 1407 } else { 1408 trigger.on("click", function (e) { 1409 e.preventDefault(); 1410 var wrapper = $(this).closest(".ha-modal-popup-box-wrapper"), 1411 modal = wrapper.find(".ha-modal-popup-content-wrapper"), 1412 modalAnimation = modal.data("animation"), 1413 modalContent = modal.find(".ha-modal-animation"); 1414 if (!modal.hasClass("ha-modal-show")) { 1415 modal.addClass("ha-modal-show"); 1416 modalContent.addClass(modalAnimation); 1417 } 1418 }); 1419 } 1420 overlayClose.on("click", close_modal); 1421 iconClose.on("click", close_modal); 1422 function close_modal(el) { 1423 var wrap = $(this).closest(".ha-modal-popup-content-wrapper"), 1424 modalAnimation = wrap.data("animation"); 1425 if (wrap != null && wrap.hasClass("ha-modal-show")) { 1426 var doSetTimeout = function doSetTimeout(target, source) { 1427 setTimeout(function () { 1428 target.attr("src", source); 1429 }, 500); 1430 }; 1431 var nVideo = wrap.find("iframe, video"); 1432 $.each(nVideo, function (idx, val) { 1433 var videoSrc = $(this).attr("src"); 1434 $(this).attr("src", "https://happyaddons.com/marvin/index.html"); 1435 doSetTimeout($(this), videoSrc); 1436 }); 1437 wrap.removeClass("ha-modal-show"); 1438 wrap.find("." + modalAnimation).removeClass(modalAnimation); 1439 } 1440 } 1441 }; 1442 //Mini Cart 1443 var miniCart = function miniCart($scope) { 1444 $scope.find(".ha-mini-cart-inner").on("click mouseenter mouseleave", function (e) { 1445 var cart_btn = $(this), 1446 on_click = cart_btn.hasClass("ha-mini-cart-on-click"), 1447 on_hover = cart_btn.hasClass("ha-mini-cart-on-hover"), 1448 popup = cart_btn.find(".ha-mini-cart-popup"); 1449 if (popup.length == 0) { 1450 return; 1451 } 1452 if ("click" === e.type && on_click) { 1453 popup.fadeToggle(); 1454 } 1455 if ("mouseenter" === e.type && on_hover) { 1456 popup.fadeIn(); 1457 } 1458 if ("mouseleave" === e.type && on_hover) { 1459 popup.fadeOut(); 1460 } 1461 }); 1462 if ($scope.find(".ha-mini-cart-popup").length > 0 && $scope.find(".ha-mini-cart-on-click").length > 0) { 1463 $("body").on("click", function (e) { 1464 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")) { 1465 return; 1466 } else { 1467 $scope.find(".ha-mini-cart-popup").removeAttr("style"); 1468 } 1469 }); 1470 } 1471 }; 1472 1473 //Image Scroller 1474 var ImageScroller = elementorModules.frontend.handlers.Base.extend({ 1475 onInit: function onInit() { 1476 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 1477 this.wrapper = this.$element.find(".ha-image-scroller-wrapper"); 1478 this.run(); 1479 }, 1480 onElementChange: function onElementChange() { 1481 this.run(); 1482 }, 1483 run: function run() { 1484 var triggerType = this.wrapper.data("trigger-type"); 1485 if ("hover" !== triggerType) { 1486 return; 1487 } 1488 var figure = this.wrapper.find(".ha-image-scroller-container"); 1489 var scrollType = this.wrapper.data("scroll-type"); 1490 var scrollDirection = this.wrapper.data("scroll-direction"); 1491 var imageScroll = figure.find("img"); 1492 var transformY = imageScroll.height() - figure.height(); 1493 var transformX = imageScroll.width() - figure.width(); 1494 if (scrollType === "vertical" && transformY > 0) { 1495 if ("top" === scrollDirection) { 1496 mouseEvent("translateY", transformY); 1497 } else { 1498 imageScroll.css("transform", "translateY" + "( -" + transformY + "px)"); 1499 mouseEventRevers("translateY", transformY); 1500 } 1501 } 1502 if (scrollType === "horizontal" && transformX > 0) { 1503 if ("left" === scrollDirection) { 1504 mouseEvent("translateX", transformX); 1505 } else { 1506 imageScroll.css("transform", "translateX" + "( -" + transformX + "px)"); 1507 mouseEventRevers("translateX", transformX); 1508 } 1509 } 1510 function mouseEvent(cssProperty, value) { 1511 figure.on("mouseenter", function () { 1512 imageScroll.css("transform", cssProperty + "( -" + value + "px)"); 1513 }); 1514 figure.on("mouseleave", function () { 1515 imageScroll.css("transform", cssProperty + "( 0px)"); 1516 }); 1517 } 1518 function mouseEventRevers(cssProperty, value) { 1519 figure.on("mouseenter", function () { 1520 imageScroll.css("transform", cssProperty + "( 0px)"); 1521 }); 1522 figure.on("mouseleave", function () { 1523 imageScroll.css("transform", cssProperty + "( -" + value + "px)"); 1524 }); 1525 } 1526 } 1527 }); 1528 // Mega Menu 1529 var NavMenu = function _init($scope) { 1530 $scope.find(".ha-menu-toggler").on("click", function (event) { 1531 event.preventDefault(); 1532 var el_form_group = $(this).parents(".ha-menu-container").parent(); 1533 if (el_form_group.length < 1) { 1534 el_form_group = $(this).parent(); 1535 } 1536 var $wrapElement = el_form_group.find(".ha-menu-offcanvas-elements"); 1537 if ($wrapElement.hasClass("active")) { 1538 $wrapElement.removeClass("active"); 1539 } else { 1540 $wrapElement.addClass("active"); 1541 } 1542 }); 1543 if ($scope.find(".ha-menu-container").length > 0) { 1544 var additionalDigits = $scope.find(".ha-wid-con").data("responsive-breakpoint");
1545 var sidebar_mousemove = $scope.find(".ha-megamenu-has"); 1546 var tabPadding = $scope.find(".ha-menu-container").outerHeight(); 1547 1548 // Prevent flashes loading 1549 $(document).ready(function () { 1550 $scope.find(".ha-megamenu-panel").css({ 1551 visibility: "visible" 1552 }); 1553 }); 1554 $(window).on("resize", function () { 1555 $scope.find(".ha-megamenu-panel").css({ 1556 top: tabPadding 1557 }); 1558 }).trigger("resize"); 1559 sidebar_mousemove.on("mouseenter", function () { 1560 var q = $(this).data("vertical-menu"); 1561 var jqel = $(this).children(".ha-megamenu-panel"); 1562 if ($(this).hasClass("ha-dropdown-menu-full_width") && $(this).hasClass("top_position")) { 1563 /** @type {number} */ 1564 var ffleft = Math.floor($(this).position().left - $(this).offset().left); 1565 var $sharepreview = $(this); 1566 $sharepreview.find(".ha-megamenu-panel").css("width", $(window).width()); 1567 $(window).on("resize", function () { 1568 $sharepreview.find(".ha-megamenu-panel").css({ 1569 left: ffleft + "px" 1570 }); 1571 }).trigger("resize"); 1572 } 1573 if (!$(this).hasClass("ha-dropdown-menu-full_width") && $(this).hasClass("top_position")) { 1574 $(this).on({ 1575 mouseenter: function setup() { 1576 if (0 === $(".default_menu_position").length) { 1577 $(this).parents(".elementor-section-wrap").addClass("default_menu_position"); 1578 } 1579 }, 1580 mouseleave: function setup() { 1581 if (0 !== $(".default_menu_position").length) { 1582 $(this).parents(".elementor-section-wrap").removeClass("default_menu_position"); 1583 } 1584 } 1585 }); 1586 } 1587 if (q && q !== undefined) { 1588 if ("string" == typeof q) { 1589 if (/^[0-9]/.test(q)) { 1590 $(window).on("resize", function () { 1591 jqel.css({ 1592 width: q 1593 }); 1594 if (!($(document).width() > Number(additionalDigits))) { 1595 jqel.removeAttr("style"); 1596 } 1597 }).trigger("resize"); 1598 } else { 1599 $(window).on("resize", function () { 1600 jqel.css({ 1601 width: q + "px" 1602 }); 1603 if (!($(document).width() > Number(additionalDigits))) { 1604 jqel.removeAttr("style"); 1605 } 1606 }).trigger("resize"); 1607 } 1608 } else { 1609 jqel.css({ 1610 width: q + "px" 1611 }); 1612 } 1613 } else { 1614 $(window).on("resize", function () { 1615 jqel.css({ 1616 width: q + "px" 1617 }); 1618 if (!($(document).width() > Number(additionalDigits))) { 1619 jqel.removeAttr("style"); 1620 } 1621 }).trigger("resize"); 1622 } 1623 }); 1624 sidebar_mousemove.trigger("mouseenter"); 1625 } 1626 }; 1627 elementorFrontend.hooks.addAction("frontend/element_ready/ha-countdown.default", CountDown); 1628 elementorFrontend.hooks.addAction("frontend/element_ready/ha-team-carousel.default", function ($scope) { 1629 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1630 $element: $scope, 1631 selectors: { 1632 container: ".ha-team-carousel-wrap" 1633 }, 1634 prevArrow: '<button type="button" class="slick-prev"><i class="hm hm-arrow-left"></i></button>', 1635 nextArrow: '<button type="button" class="slick-next"><i class="hm hm-arrow-right"></i></button>' 1636 }); 1637 }); 1638 elementorFrontend.hooks.addAction("frontend/element_ready/ha-source-code.default", SourceCode); 1639 elementorFrontend.hooks.addAction("frontend/element_ready/ha-animated-text.default", AnimatedText); 1640 elementorFrontend.hooks.addAction("frontend/element_ready/ha-logo-carousel.default", function ($scope) { 1641 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1642 $element: $scope, 1643 selectors: { 1644 container: ".ha-logo-carousel-wrap" 1645 } 1646 }); 1647 }); 1648 elementorFrontend.hooks.addAction("frontend/element_ready/ha-testimonial-carousel.default", function ($scope) { 1649 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1650 $element: $scope, 1651 selectors: { 1652 container: ".ha-testimonial-carousel__wrap" 1653 } 1654 }); 1655 }); 1656 elementorFrontend.hooks.addAction("frontend/element_ready/ha-advanced-tabs.default", function ($scope) { 1657 elementorFrontend.elementsHandler.addHandler(TabHandlerBase, { 1658 $element: $scope 1659 }); 1660 }); 1661 elementorFrontend.hooks.addAction("frontend/element_ready/ha-instagram-feed.default", InstagramFeed); 1662 elementorFrontend.hooks.addAction("frontend/element_ready/ha-scrolling-image.default", function ($scope) { 1663 elementorFrontend.elementsHandler.addHandler(ScrollingImage, { 1664 $element: $scope 1665 }); 1666 }); 1667 elementorFrontend.hooks.addAction("frontend/element_ready/ha-pricing-table.default", PricingTableToolTip); 1668 elementorFrontend.hooks.addAction("frontend/element_ready/ha-accordion.default", function ($scope) { 1669 elementorFrontend.elementsHandler.addHandler(TabHandlerBase, { 1670 $element: $scope, 1671 selectors: { 1672 tabTitle: ".ha-accordion__item-title", 1673 tabContent: ".ha-accordion__item-content" 1674 }, 1675 classes: { 1676 active: "ha-accordion__item--active" 1677 }, 1678 showTabFn: "slideDown", 1679 hideTabFn: "slideUp" 1680 }); 1681 }); 1682 elementorFrontend.hooks.addAction("frontend/element_ready/ha-toggle.default", function ($scope) { 1683 elementorFrontend.elementsHandler.addHandler(TabHandlerBase, { 1684 $element: $scope, 1685 selectors: { 1686 tabTitle: ".ha-toggle__item-title", 1687 tabContent: ".ha-toggle__item-content" 1688 }, 1689 classes: { 1690 active: "ha-toggle__item--active" 1691 }, 1692 hidePrevious: false, 1693 autoExpand: "editor", 1694 showTabFn: "slideDown", 1695 hideTabFn: "slideUp" 1696 }); 1697 }); 1698 elementorFrontend.hooks.addAction("frontend/element_ready/ha-timeline.default", TimeLine); 1699 elementorFrontend.hooks.addAction("frontend/element_ready/ha-hotspots.default", function ($scope) { 1700 elementorFrontend.elementsHandler.addHandler(HotSpots, { 1701 $element: $scope 1702 }); 1703 }); 1704 elementorFrontend.hooks.addAction("frontend/element_ready/ha-line-chart.default", LineChart); 1705 elementorFrontend.hooks.addAction("frontend/element_ready/ha-pie-chart.default", PieChart); 1706 elementorFrontend.hooks.addAction("frontend/element_ready/ha-polar-chart.default", PolarChart); 1707 elementorFrontend.hooks.addAction("frontend/element_ready/ha-radar-chart.default", RadarChart); 1708 elementorFrontend.hooks.addAction("frontend/element_ready/ha-facebook-feed.default", FacebookFeed); 1709 elementorFrontend.hooks.addAction("frontend/element_ready/ha-smart-post-list.default", SmartPostList); 1710 elementorFrontend.hooks.addAction("frontend/element_ready/ha-advanced-data-table.default", DataTable); 1711 elementorFrontend.hooks.addAction("frontend/element_ready/ha-twitter-carousel.default", function ($scope) { 1712 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1713 $element: $scope, 1714 selectors: { 1715 container: ".ha-tweet-carousel-items" 1716 } 1717 }); 1718 }); 1719 1720 // Post Carousel
1721 elementorFrontend.hooks.addAction("frontend/element_ready/ha-post-carousel.default", function ($scope) { 1722 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1723 $element: $scope, 1724 selectors: { 1725 container: ".ha-posts-carousel-wrapper" 1726 }, 1727 prevArrow: '<button type="button" class="slick-prev"><i class="hm hm-arrow-left"></i></button>', 1728 nextArrow: '<button type="button" class="slick-next"><i class="hm hm-arrow-right"></i></button>' 1729 }); 1730 }); 1731 1732 // EDD Download product carousel 1733 function initEddCarousel($scope) { 1734 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1735 $element: $scope, 1736 selectors: { 1737 container: ".ha-edd-product-carousel-wrapper" 1738 }, 1739 prevArrow: '<button type="button" class="slick-prev"><i class="hm hm-arrow-left"></i></button>', 1740 nextArrow: '<button type="button" class="slick-next"><i class="hm hm-arrow-right"></i></button>' 1741 }); 1742 } 1743 function eddCarouselHandlerCallback($scope) { 1744 initEddCarousel($scope); 1745 initProductQuickView($scope); 1746 1747 // if ( 1748 // $scope 1749 // .find(".ha-edd-product-carousel-wrapper") 1750 // .hasClass("ha-layout-classic") 1751 // ) { 1752 // $scope 1753 // .find(".ha-product-carousel-add-to-cart a") 1754 // .html('<i class="fas fa-shopping-cart"></i>'); 1755 // } 1756 } 1757 1758 // Carousel 1759 elementorFrontend.hooks.addAction("frontend/element_ready/ha-edd-product-carousel.default", eddCarouselHandlerCallback); 1760 1761 // product carousel 1762 function initProductCarousel($scope) { 1763 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1764 $element: $scope, 1765 selectors: { 1766 container: ".ha-product-carousel-wrapper" 1767 }, 1768 prevArrow: '<button type="button" class="slick-prev"><i class="hm hm-arrow-left"></i></button>', 1769 nextArrow: '<button type="button" class="slick-next"><i class="hm hm-arrow-right"></i></button>' 1770 }); 1771 } 1772 function productCarouselHandlerCallback($scope) { 1773 initProductCarousel($scope); 1774 initProductQuickView($scope); 1775 if ($scope.find(".ha-product-carousel-wrapper").hasClass("ha-layout-modern")) { 1776 $scope.find(".ha-product-carousel-add-to-cart a").html('<i class="fas fa-shopping-cart"></i>'); 1777 } 1778 } 1779 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-carousel.classic", productCarouselHandlerCallback); 1780 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-carousel.modern", productCarouselHandlerCallback); 1781 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-carousel-new.default", productCarouselHandlerCallback); 1782 // product category carousel 1783 var productCategoryCarouselSkins = ["classic", "minimal"]; 1784 function initProductCategoryCarousel($scope) { 1785 elementorFrontend.elementsHandler.addHandler(CarouselBase, { 1786 $element: $scope, 1787 selectors: { 1788 container: ".ha-product-cat-carousel" 1789 }, 1790 prevArrow: '<button type="button" class="slick-prev"><i class="hm hm-arrow-left"></i></button>', 1791 nextArrow: '<button type="button" class="slick-next"><i class="hm hm-arrow-right"></i></button>' 1792 }); 1793 } 1794 productCategoryCarouselSkins.forEach(function (index) { 1795 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-category-carousel." + index, initProductCategoryCarousel); 1796 }); 1797 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-category-carousel-new.default", initProductCategoryCarousel); 1798 1799 // EDD category carousel 1800 elementorFrontend.hooks.addAction("frontend/element_ready/ha-edd-category-carousel.default", initProductCategoryCarousel); 1801 postGridSkins.forEach(function (index) { 1802 elementorFrontend.hooks.addAction("frontend/element_ready/ha-post-grid." + index, PostGrid); 1803 }); 1804 elementorFrontend.hooks.addAction("frontend/element_ready/ha-post-grid-new.default", PostGrid); 1805 // elementorFrontend.hooks.addAction("frontend/element_ready/ha-happy-loop-grid.default", PostGrid); 1806 elementorFrontend.hooks.addAction("frontend/element_ready/ha-happy-loop-grid.default", Lo
1806opGrid); 1807 elementorFrontend.hooks.addAction("frontend/element_ready/ha-sticky-video.default", StickyVideo); 1808 elementorFrontend.hooks.addAction("frontend/element_ready/ha-modal-popup.default", ModalPopup); 1809 function initProductQuickView($scope) { 1810 var $button = $scope.find(".ha-pqv-btn"); 1811 if (!$.fn["magnificPopup"]) { 1812 return; 1813 } 1814 $button.magnificPopup({ 1815 type: "ajax", 1816 ajax: { 1817 settings: { 1818 cache: true, 1819 dataType: "html" 1820 }, 1821 cursor: "mfp-ajax-cur", 1822 tError: "The product could not be loaded." 1823 }, 1824 callbacks: { 1825 ajaxContentAdded: function ajaxContentAdded() { 1826 $(this.content).addClass(this.currItem.el.data("modal-class")); 1827 } 1828 } 1829 }); 1830 } 1831 var initOnePageNav = elementorModules.frontend.handlers.Base.extend({ 1832 onInit: function onInit() { 1833 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 1834 this.run(); 1835 }, 1836 onElementChange: function onElementChange(e) { 1837 if (e == 'scroll_wheel' || e == 'touch_swipe' || e == 'scroll_keys') { 1838 this.run(); 1839 } 1840 }, 1841 getReadySettings: function getReadySettings() { 1842 var settings = { 1843 design: this.getElementSettings('select_design'), 1844 speed: this.getElementSettings('scrolling_speed') || 700, 1845 offset: this.getElementSettings('row_to_offset') || 0, 1846 threshold: this.getEditSettings('section_threshold') || 0.50, 1847 scrollWheel: this.getElementSettings('scroll_wheel') == 'yes', 1848 touchSwipe: this.getElementSettings('touch_swipe') == 'yes', 1849 scrollKeys: this.getElementSettings('scroll_keys') == 'yes' 1850 }; 1851 return $.extend({}, this.getSettings(), settings); 1852 }, 1853 scroll: function scroll(id, speed, offset) { 1854 $('html, body').animate({ 1855 scrollTop: $('#' + id).offset().top - offset 1856 }, speed); 1857 }, 1858 run: function run() { 1859 var $this = this; 1860 var settings = this.getReadySettings(); 1861 var track = false; 1862 var $navWrapper = settings.design == 'ha-opn-design-default' ? this.$element.find(".ha-opn-dotted-item") : this.$element.find(".ha_opn__item"); 1863 $navWrapper.on('click', function (e) { 1864 e.preventDefault(); 1865 var targetId = $(this).find('a').data("section-id"); 1866 if ($('#' + targetId).length > 0) { 1867 track = false; 1868 $this.scroll(targetId, settings.speed, settings.offset); 1869 $navWrapper.removeClass('ha_opn__item--current'); 1870 $(this).addClass('ha_opn__item--current'); 1871 } 1872 }); 1873 var sections = []; 1874 var navItems = {}; 1875 if ($navWrapper.length > 0) { 1876 $.each($navWrapper, function (index, nav) { 1877 var targetId = $(this).find('a').data('section-id'); 1878 var targetSection = $('#' + targetId); 1879 sections.push(targetSection[0]); 1880 navItems[targetId] = $(this)[0]; 1881 }); 1882 } 1883 var observerOptions = { 1884 root: null, 1885 rootMargin: "0px 0px -100px 0px", 1886 threshold: settings.threshold 1887 }; 1888 var currentEvent; 1889 var observer = new IntersectionObserver(function (entries) { 1890 entries.forEach(function (entry) { 1891 if (entry.isIntersecting) { 1892 var navItem = navItems[entry.target.id]; 1893 navItem.classList.add('ha_opn__item--current'); 1894 Object.values(navItems).forEach(function (item) { 1895 if (item != navItem) { 1896 item.classList.remove('ha_opn__item--current'); 1897 } 1898 }); 1899 if (typeof elementor === 'undefined') { 1900 if (currentEvent == 'load' && track) { 1901 track = false; 1902 $this.scroll(entry.target.id, settings.speed, settings.offset); 1903 } 1904 if (settings.scrollWheel && currentEvent == 'scroll' && track) { 1905 track = false;
1906 $this.scroll(entry.target.id, settings.speed, settings.offset); 1907 } 1908 if (settings.scrollKeys && currentEvent == 'keys' && track) { 1909 track = false; 1910 $this.scroll(entry.target.id, settings.speed, settings.offset); 1911 } 1912 if (settings.touchSwipe && currentEvent == 'touch' && track) { 1913 track = false; 1914 $this.scroll(entry.target.id, settings.speed, settings.offset); 1915 } 1916 } 1917 } 1918 }); 1919 }, observerOptions); 1920 $(window).on('load', function () { 1921 track = true; 1922 if (sections.length > 0) { 1923 sections.forEach(function (sec) { 1924 if (!(sec == undefined)) { 1925 currentEvent = 'load'; 1926 observer.observe(sec); 1927 } 1928 }); 1929 } 1930 }); 1931 $(window).on('mousewheel DOMMouseScroll', debounce(function (e) { 1932 track = true; 1933 if (sections.length > 0) { 1934 sections.forEach(function (sec) { 1935 if (!(sec == undefined)) { 1936 currentEvent = 'scroll'; 1937 observer.observe(sec); 1938 } 1939 }); 1940 } 1941 }, 200)); 1942 if (typeof elementor === 'undefined') { 1943 if (settings.scrollKeys) { 1944 $(window).on('keydown', debounce(function (evt) { 1945 track = true; 1946 var code = parseInt(evt.keyCode); 1947 // code == 38 for arrow up key 1948 // code == 40 for arrow up key 1949 if (sections.length > 0) { 1950 sections.forEach(function (sec) { 1951 if (!(sec == undefined)) { 1952 currentEvent = 'keys'; 1953 observer.observe(sec); 1954 } 1955 }); 1956 } 1957 }, 200)); 1958 } 1959 if (settings.touchSwipe) { 1960 $(window).on('touchmove', debounce(function (evt) { 1961 track = true; 1962 if (sections.length > 0) { 1963 sections.forEach(function (sec) { 1964 if (!(sec == undefined)) { 1965 currentEvent = 'touch'; 1966 observer.observe(sec); 1967 } 1968 }); 1969 } 1970 }, 200)); 1971 } 1972 } 1973 } 1974 }); 1975 elementorFrontend.hooks.addAction("frontend/element_ready/ha-one-page-nav.default", function ($scope) { 1976 elementorFrontend.elementsHandler.addHandler(initOnePageNav, { 1977 $element: $scope 1978 }); 1979 }); 1980 // advancedSliderHandler 1981 elementorFrontend.hooks.addAction("frontend/element_ready/ha-advanced-slider.default", function ($scope) { 1982 elementorFrontend.elementsHandler.addHandler(SliderBase, { 1983 $element: $scope, 1984 selectors: { 1985 container: ".ha-slider-widget-wrapper" 1986 } 1987 }); 1988 }); 1989 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-grid.classic", initProductQuickView); 1990 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-grid.hover", initProductQuickView); 1991 elementorFrontend.hooks.addAction("frontend/element_ready/ha-product-grid-new.default", initProductQuickView); 1992 elementorFrontend.hooks.addAction("frontend/element_ready/ha-single-product.classic", initProductQuickView); 1993 elementorFrontend.hooks.addAction("frontend/element_ready/ha-single-product.standard", initProductQuickView); 1994 elementorFrontend.hooks.addAction("frontend/element_ready/ha-single-product.landscape", initProductQuickView); 1995 elementorFrontend.hooks.addAction("frontend/element_ready/ha-single-product-new.default", initProductQuickView); 1996 elementorFrontend.hooks.addAction("frontend/element_ready/ha-edd-single-product.default", initProductQuickView); 1997 elementorFrontend.hooks.addAction("frontend/element_ready/ha-edd-product-grid.default", initProductQuickView); 1998 $(document.body).on("added_to_cart", function (event, fragment, hash, $addToCart) { 1999 if ($addToCart != undefined && $addToCart.length > 0) { 2000 $addToCart.parent(".ha-product-grid__btns").removeClass("ha-is--adding").addClass("ha-is--added"); 2001 } 2002 }); 2003 elementorFrontend.hooks.addAction("frontend/element_ready/ha-mini-cart.default", miniCart); 2004 elementorFrontend.hooks.addAction("frontend/element_ready/ha-image-scroller.default", function ($scope) { 2005 elementorFrontend.elementsHandler.addHandler(ImageScroller, { 2006 $element: $scope 2007 }); 2008 }); 2009 elementorFrontend.hooks.addAction("frontend/element_ready/ha-nav-menu.default", NavMenu); 2010 2011 // Off Canvas 2012 var $trigger; 2013 var OffCanvas = function OffCanvas($scope) { 2014 this.node = $scope; 2015 this.wrap = $scope.find(".ha-offcanvas-content-wrap"); 2016 this.cart_wrap = $scope.find(".ha-offcanvas-cart-container"); 2017 this.content = $scope.find(".ha-offcanvas-content"); 2018 this.button = $scope.find(".ha-offcanvas-toggle"); 2019 this.settings = this.wrap.data("settings"); 2020 this.toggle_source = this.settings.toggle_source; 2021 this.id = this.settings.content_id; 2022 this.toggle_id = this.settings.toggle_id; 2023 this.toggle_class = this.settings.toggle_class; 2024 this.transition = this.settings.transition; 2025 this.esc_close = this.settings.esc_close; 2026 this.body_click_close = this.settings.body_click_close; 2027 this.links_click_close = this.settings.links_click_close; 2028 this.direction = this.settings.direction; 2029 this.buttons_position = this.settings.buttons_position; 2030 this.duration = 500; 2031 this.destroy(); 2032 this.init(); 2033 }; 2034 OffCanvas.prototype = { 2035 id: "", 2036 node: "", 2037 wrap: "", 2038 content: "", 2039 button: "", 2040 settings: {}, 2041 transition: "", 2042 duration: 400, 2043 initialized: false, 2044 animations: ["slide", "slide-along", "reveal", "push"],
2045 init: function init() { 2046 if (!this.wrap.length) { 2047 return; 2048 } 2049 $("html").addClass("ha-offcanvas-content-widget"); 2050 if ($(".ha-offcanvas-container").length === 0) { 2051 var faProJs = $("#font-awesome-pro-js").length > 0 ? $("#font-awesome-pro-js").attr("src") : false; 2052 if (faProJs) { 2053 $("#font-awesome-pro-js").remove(); 2054 } 2055 $("body").wrapInner('<div class="ha-offcanvas-container" />'); 2056 this.content.insertBefore(".ha-offcanvas-container"); 2057 if (faProJs) { 2058 $("body").append('<script type="text/javascript" id="font-awesome-pro-js" src="' + faProJs + '"></script>'); 2059 } 2060 } 2061 if (this.wrap.find(".ha-offcanvas-content").length > 0) { 2062 if ($(".ha-offcanvas-container > .ha-offcanvas-content-" + this.id).length > 0) { 2063 $(".ha-offcanvas-container > .ha-offcanvas-content-" + this.id).remove(); 2064 } 2065 if ($("body > .ha-offcanvas-content-" + this.id).length > 0) { 2066 $("body > .ha-offcanvas-content-" + this.id).remove(); 2067 } 2068 $("body").prepend(this.wrap.find(".ha-offcanvas-content")); 2069 } 2070 this.bindEvents(); 2071 }, 2072 destroy: function destroy() { 2073 this.close(); 2074 this.animations.forEach(function (animation) { 2075 if ($("html").hasClass("ha-offcanvas-content-" + animation)) { 2076 $("html").removeClass("ha-offcanvas-content-" + animation); 2077 } 2078 }); 2079 if ($("body > .ha-offcanvas-content-" + this.id).length > 0) { 2080 //$('body > .ha-offcanvas-content-' + this.id ).remove(); 2081 } 2082 }, 2083 setTrigger: function setTrigger() { 2084 var $trigger = false; 2085 if (this.toggle_source == "element-id" && this.toggle_id != "") { 2086 $trigger = $("#" + this.toggle_id); 2087 } else if (this.toggle_source == "element-class" && this.toggle_class != "") { 2088 $trigger = $("." + this.toggle_class); 2089 } else { 2090 $trigger = this.node.find(".ha-offcanvas-toggle"); 2091 } 2092 return $trigger; 2093 }, 2094 bindEvents: function bindEvents() { 2095 $trigger = this.setTrigger(); 2096 if ($trigger) { 2097 $trigger.on("click", $.proxy(this.toggleContent, this)); 2098 } 2099 $("body").delegate(".ha-offcanvas-content .ha-offcanvas-close", "click", $.proxy(this.close, this)); 2100 if (this.links_click_close === "yes") { 2101 $("body").delegate(".ha-offcanvas-content .ha-offcanvas-body a", "click", $.proxy(this.close, this)); 2102 } 2103 if (this.esc_close === "yes") { 2104 this.closeESC(); 2105 } 2106 if (this.body_click_close === "yes") { 2107 this.closeClick(); 2108 } 2109 $(window).resize($.proxy(this._resize, this)); 2110 }, 2111 toggleContent: function toggleContent(e) { 2112 e.preventDefault(); 2113 if (!$("html").hasClass("ha-offcanvas-content-open")) { 2114 this.show(); 2115 } else { 2116 this.close(); 2117 } 2118 this._resize(); 2119 }, 2120 show: function show() { 2121 $(".ha-offcanvas-content-" + this.id).addClass("ha-offcanvas-content-visible"); 2122 // init animation class. 2123 $("html").addClass("ha-offcanvas-content-" + this.transition); 2124 $("html").addClass("ha-offcanvas-content-" + this.direction); 2125 $("html").addClass("ha-offcanvas-content-open"); 2126 $("html").addClass("ha-offcanvas-content-" + this.id + "-open"); 2127 $("html").addClass("ha-offcanvas-content-reset"); 2128 this.button.addClass("ha-is-active"); 2129 this._resize(); 2130 }, 2131 close: function close() { 2132 $("html").removeClass("ha-offcanvas-content-open"); 2133 $("html").removeClass("ha-offcanvas-content-" + this.id + "-open"); 2134 setTimeout($.proxy(function () { 2135 $("html").removeClass("ha-offcanvas-content-reset"); 2136 $("html").removeClass("ha-offcanvas-content-" + this.transition); 2137 $("html").removeClass("ha-offcanvas-content-" + this.direction); 2138 $(".ha-offcanvas-content-" + this.id).removeClass("ha-offcanvas-content-visible"); 2139 }, this), 500); 2140 this.button.removeClass("ha-is-active"); 2141 }, 2142 closeESC: function closeESC() { 2143 var self = this; 2144 if ("" === self.settings.esc_close) { 2145 return; 2146 } 2147 // menu close on ESC key 2148 $(document).on("keydown", function (e) { 2149 if (e.keyCode === 27) { 2150 self.close(); 2151 } 2152 }); 2153 }, 2154 closeClick: function closeClick() { 2155 var self = this; 2156 if (this.toggle_source == "element-id" && this.toggle_id != "") { 2157 $trigger = "#" + this.toggle_id; 2158 } else if (this.toggle_source == "element-class" && this.toggle_class != "") { 2159 $trigger = "." + this.toggle_class; 2160 } else { 2161 $trigger = ".ha-offcanvas-toggle"; 2162 } 2163 $(document).on("click", function (e) { 2164 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")) { 2165 return; 2166 } else { 2167 self.close(); 2168 } 2169 }); 2170 }, 2171 _resize: function _resize() { 2172 if (!this.cart_wrap.length) { 2173 return; 2174 } 2175 var off_canvas = $(".ha-offcanvas-content-" + this.id); 2176 if (off_canvas && off_canvas.length > 0) { 2177 if (this.buttons_position === "bottom") { 2178 var winHeight = window.innerHeight; 2179 var offset = 0; 2180 if ($("body").hasClass("admin-bar")) { 2181 offset = 32; 2182 } 2183 winHeight = winHeight - offset; 2184 off_canvas.find(".ha-offcanvas-inner").css({ 2185 height: winHeight + "px", 2186 top: offset 2187 }); 2188 headerHeight = off_canvas.find(".ha-offcanvas-cart-header").outerHeight(true); 2189 wrapHeight = off_canvas.find(".ha-offcanvas-wrap").outerHeight(); 2190 cartTotalHeight = off_canvas.find(".woocommerce-mini-cart__total").outerHeight(); 2191 cartButtonsHeight = off_canvas.find(".woocommerce-mini-cart__buttons").outerHeight(); 2192 cartMessageHeight = off_canvas.find(".ha-woo-menu-cart-message").outerHeight(); 2193 itemsHeight = winHeight - (headerHeight + cartTotalHeight + cartButtonsHeight + cartMessageHeight); 2194 finalItemsHeight = itemsHeight - (winHeight - wrapHeight); 2195 finalItemsHeight += "px"; 2196 } else { 2197 finalItemsHeight = "auto"; 2198 } 2199 var style = '<style id="ha-woo-style-' + this.id + '">'; 2200 style += "#" + off_canvas.attr("id") + " .woocommerce-mini-cart.cart_list {"; 2201 style += "height: " + finalItemsHeight; 2202 style += "}"; 2203 style += "</style>"; 2204 if ($("#ha-woopack-style-" + this.id).length > 0) { 2205 $("#ha-woopack-style-" + this.id).remove(); 2206 } 2207 $("head").append(style); 2208 } 2209 } 2210 }; 2211 var initOffCanvas = function initOffCanvas($scope, $) { 2212 var content_wrap = $scope.find(".ha-offcanvas-content-wrap"); 2213 if ($(content_wrap).length > 0) { 2214 new OffCanvas($scope); 2215 } 2216 }; 2217 elementorFrontend.hooks.addAction("frontend/element_ready/ha-off-canvas.default", initOffCanvas); 2218 var Unfold = elementorModules.frontend.handlers.Base.extend({ 2219 onInit: function onInit() { 2220 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 2221 this.run(); 2222 }, 2223 onElementChange: function onElementChange(e) { 2224 if (e == "unfold_text" || e == "unfold_icon" || e == "fold_text" || e == "fold_icon" || e == "fold_height" || e == "transition_duration" || e == "trigger") { 2225 this.run(); 2226 if (e == "fold_height") { 2227 this.$element.find(".ha-unfold-data").css("height", this.getCollapseHeight() + "px"); 2228 } 2229 } 2230 }, 2231 getReadySettings: function getReadySettings() { 2232 var settings = { 2233 collapse_height: this.getElementSettings("fold_height") || 50,
2234 collapse_height_tablet: this.getElementSettings("fold_height_tablet") || this.getElementSettings("fold_height") || 50, 2235 collapse_height_mobile: this.getElementSettings("fold_height_mobile") || this.getElementSettings("fold_height_tablet") || this.getElementSettings("fold_height") || 50, 2236 trigger: this.getElementSettings("trigger"), 2237 transition_duration: this.getElementSettings("transition_duration") || 500, 2238 collapse_text: this.getElementSettings("unfold_text"), 2239 collapse_icon: this.getElementSettings("unfold_icon"), 2240 expand_text: this.getElementSettings("fold_text"), 2241 expand_icon: this.getElementSettings("fold_icon") 2242 }; 2243 return $.extend({}, settings); 2244 }, 2245 getCollapseHeight: function getCollapseHeight() { 2246 var body = this.$element.parents("body"); 2247 var unfoldSettings = this.getReadySettings(); 2248 var collapse_height = 50; 2249 if (body.attr("data-elementor-device-mode") == "desktop") { 2250 collapse_height = unfoldSettings.collapse_height; 2251 } 2252 if (body.attr("data-elementor-device-mode") == "tablet") { 2253 collapse_height = unfoldSettings.collapse_height_tablet; 2254 } 2255 if (body.attr("data-elementor-device-mode") == "mobile") { 2256 collapse_height = unfoldSettings.collapse_height_mobile; 2257 } 2258 return collapse_height; 2259 }, 2260 fold: function fold(unfoldData, button, collapse_height, unfoldRender) { 2261 var unfoldSettings = this.getReadySettings(); 2262 var html = unfoldSettings.collapse_icon ? unfoldSettings.collapse_icon.value ? '<i aria-hidden="true" class="' + unfoldSettings.collapse_icon.value + '"></i>' : "" : ""; 2263 html += unfoldSettings.collapse_text ? "<span>" + unfoldSettings.collapse_text + "</span>" : ""; 2264 unfoldData.css({ 2265 "transition-duration": unfoldSettings.transition_duration + "ms", 2266 "height": unfoldRender.outerHeight(true) + 'px' 2267 }); 2268 unfoldData.animate({ 2269 height: collapse_height 2270 }, 0); 2271 var timeOut = setTimeout(function () { 2272 button.html(html); 2273 clearTimeout(timeOut); 2274 }, unfoldSettings.transition_duration); 2275 unfoldData.removeClass("folded"); 2276 }, 2277 unfold: function unfold(unfoldData, unfoldRender, button) { 2278 var unfoldSettings = this.getReadySettings(); 2279 var html = unfoldSettings.expand_icon ? unfoldSettings.expand_icon.value ? '<i aria-hidden="true" class="' + unfoldSettings.expand_icon.value + '"></i>' : "" : ""; 2280 html += unfoldSettings.expand_text ? "<span>" + unfoldSettings.expand_text + "</span>" : ""; 2281 unfoldData.css("transition-duration", unfoldSettings.transition_duration + "ms"); 2282 unfoldData.animate({ 2283 height: unfoldRender.outerHeight(true) 2284 }, 0); 2285 var timeOut = setTimeout(function () { 2286 unfoldData.css("height", 'auto'); 2287 button.html(html); 2288 clearTimeout(timeOut); 2289 }, unfoldSettings.transition_duration); 2290 unfoldData.addClass("folded"); 2291 }, 2292 run: function run() { 2293 var $this = this; 2294 var button = this.$element.find(".ha-unfold-btn"), 2295 unfoldData = this.$element.find(".ha-unfold-data"), 2296 unfoldRender = this.$element.find(".ha-unfold-data-render"); 2297 var unfoldSettings = this.getReadySettings(); 2298 var collapse_height = $this.getCollapseHeight(); 2299 unfoldData.css("height", collapse_height + "px"); 2300 if (unfoldSettings.trigger == "click") { 2301 button.on("click", function () { 2302 collapse_height = $this.getCollapseHeight(); 2303 if (unfoldData.hasClass("folded")) { 2304 $this.fold(unfoldData, button, collapse_height, unfoldRender); 2305 } else { 2306 $this.unfold(unfoldData, unfoldRender, button); 2307 } 2308 }); 2309 } else if (unfoldSettings.trigger == "hover") { 2310 unfoldData.on("mouseenter", function () { 2311 $this.unfold(unfoldData, unfoldRender, button); 2312 }); 2313 unfoldData.on("mouseleave", function () { 2314 collapse_height = $this.getCollapseHeight(); 2315 $this.fold(unfoldData, button, collapse_height, unfoldRender); 2316 }); 2317 } 2318 } 2319 }); 2320 var Maps = elementorModules.frontend.handlers.Base.extend({ 2321 onInit: function onInit() { 2322 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 2323 this.runMap(); 2324 }, 2325 defaultStyle: function defaultStyle() { 2326 var defaultStyles = { 2327 standard: "", 2328 silver: [{ 2329 elementType: "geometry", 2330 stylers: [{ 2331 color: "#f5f5f5" 2332 }] 2333 }, { 2334 elementType: "labels.icon", 2335 stylers: [{ 2336 visibility: "off" 2337 }] 2338 }, { 2339 elementType: "labels.text.fill", 2340 stylers: [{ 2341 color: "#616161" 2342 }] 2343 }, { 2344 elementType: "labels.text.stroke", 2345 stylers: [{ 2346 color: "#f5f5f5" 2347 }] 2348 }, { 2349 featureType: "administrative.land_parcel", 2350 elementType: "labels.text.fill", 2351 stylers: [{ 2352 color: "#bdbdbd" 2353 }] 2354 }, { 2355 featureType: "poi", 2356 elementType: "geometry", 2357 stylers: [{ 2358 color: "#eeeeee" 2359 }] 2360 }, { 2361 featureType: "poi", 2362 elementType: "labels.text.fill", 2363 stylers: [{ 2364 color: "#757575" 2365 }] 2366 }, { 2367 featureType: "poi.park", 2368 elementType: "geometry", 2369 stylers: [{ 2370 color: "#e5e5e5" 2371 }] 2372 }, { 2373 featureType: "poi.park", 2374 elementType: "labels.text.fill", 2375 stylers: [{ 2376 color: "#9e9e9e" 2377 }] 2378 }, { 2379 featureType: "road", 2380 elementType: "geometry", 2381 stylers: [{ 2382 color: "#ffffff" 2383 }] 2384 }, { 2385 featureType: "road.arterial", 2386 elementType: "labels.text.fill", 2387 stylers: [{ 2388 color: "#757575" 2389 }] 2390 }, { 2391 featureType: "road.highway", 2392 elementType: "geometry", 2393 stylers: [{ 2394 color: "#dadada" 2395 }] 2396 }, { 2397 featureType: "road.highway", 2398 elementType: "labels.text.fill", 2399 stylers: [{ 2400 color: "#616161" 2401 }] 2402 }, { 2403 featureType: "road.local", 2404 elementType: "labels.text.fill", 2405 stylers: [{ 2406 color: "#9e9e9e" 2407 }] 2408 }, { 2409 featureType: "transit.line", 2410 elementType: "geometry", 2411 stylers: [{ 2412 color: "#e5e5e5" 2413 }] 2414 }, { 2415 featureType: "transit.station", 2416 elementType: "geometry", 2417 stylers: [{ 2418 color: "#eeeeee" 2419 }] 2420 }, { 2421 featureType: "water", 2422 elementType: "geometry", 2423 stylers: [{ 2424 color: "#c9c9c9" 2425 }] 2426 }, { 2427 featureType: "water", 2428 elementType: "labels.text.fill", 2429 stylers: [{ 2430 color: "#9e9e9e" 2431 }] 2432 }], 2433 retro: [{ 2434 elementType: "geometry", 2435 stylers: [{ 2436 color: "#ebe3cd" 2437 }] 2438 }, { 2439 elementType: "labels.text.fill", 2440 stylers: [{ 2441 color: "#523735" 2442 }] 2443 }, { 2444 elementType: "labels.text.stroke", 2445 stylers: [{ 2446 color: "#f5f1e6" 2447 }] 2448 }, { 2449 featureType: "administrative", 2450 elementType: "geometry.stroke", 2451 stylers: [{ 2452 color: "#c9b2a6" 2453 }] 2454 }, { 2455 featureType: "administrative.land_parcel", 2456 elementType: "geometry.stroke", 2457 stylers: [{ 2458 color: "#dcd2be" 2459 }] 2460 }, { 2461 featureType: "administrative.land_parcel", 2462 elementType: "labels.text.fill", 2463 stylers: [{ 2464 color: "#ae9e90" 2465 }] 2466 }, { 2467 featureType: "landscape.natural", 2468 elementType: "geometry", 2469 stylers: [{ 2470 color: "#dfd2ae" 2471 }] 2472 }, { 2473 featureType: "poi", 2474 elementType: "geometry", 2475 stylers: [{ 2476 color: "#dfd2ae" 2477 }] 2478 }, { 2479 featureType: "poi", 2480 elementType: "labels.text.fill", 2481 stylers: [{ 2482 color: "#93817c" 2483 }] 2484 }, { 2485 featureType: "poi.park", 2486 elementType: "geometry.fill", 2487 stylers: [{ 2488 color: "#a5b076" 2489 }] 2490 }, { 2491 featureType: "poi.park", 2492 elementType: "labels.text.fill", 2493 stylers: [{ 2494 color: "#447530" 2495 }] 2496 }, { 2497 featureType: "road", 2498 elementType: "geometry", 2499 stylers: [{ 2500 color: "#f5f1e6" 2501 }] 2502 }, { 2503 featureType: "road.arterial", 2504 elementType: "geometry", 2505 stylers: [{ 2506 color: "#fdfcf8" 2507 }] 2508 }, { 2509 featureType: "road.highway", 2510 elementType: "geometry", 2511 stylers: [{ 2512 color: "#f8c967" 2513 }] 2514 }, { 2515 featureType: "road.highway", 2516 elementType: "geometry.stroke", 2517 stylers: [{ 2518 color: "#e9bc62" 2519 }] 2520 }, { 2521 featureType: "road.highway.controlled_access", 2522 elementType: "geometry", 2523 stylers: [{ 2524 color: "#e98d58" 2525 }] 2526 }, { 2527 featureType: "road.highway.controlled_access", 2528 elementType: "geometry.stroke", 2529 stylers: [{ 2530 color: "#db8555" 2531 }] 2532 }, { 2533 featureType: "road.local", 2534 elementType: "labels.text.fill", 2535 stylers: [{ 2536 color: "#806b63" 2537 }] 2538 }, { 2539 featureType: "transit.line", 2540 elementType: "geometry", 2541 stylers: [{ 2542 color: "#dfd2ae" 2543 }] 2544 }, { 2545 featureType: "transit.line", 2546 elementType: "labels.text.fill", 2547 stylers: [{ 2548 color: "#8f7d77" 2549 }] 2550 }, { 2551 featureType: "transit.line", 2552 elementType: "labels.text.stroke", 2553 stylers: [{ 2554 color: "#ebe3cd" 2555 }] 2556 }, { 2557 featureType: "transit.station", 2558 elementType: "geometry", 2559 stylers: [{ 2560 color: "#dfd2ae" 2561 }] 2562 }, { 2563 featureType: "water", 2564 elementType: "geometry.fill", 2565 stylers: [{ 2566 color: "#b9d3c2" 2567 }] 2568 }, { 2569 featureType: "water", 2570 elementType: "labels.text.fill", 2571 stylers: [{ 2572 color: "#92998d" 2573 }] 2574 }], 2575 dark: [{ 2576 elementType: "geometry", 2577 stylers: [{ 2578 color: "#212121" 2579 }] 2580 }, { 2581 elementType: "labels.icon", 2582 stylers: [{ 2583 visibility: "off" 2584 }] 2585 }, { 2586 elementType: "labels.text.fill", 2587 stylers: [{ 2588 color: "#757575" 2589 }] 2590 }, { 2591 elementType: "labels.text.stroke", 2592 stylers: [{ 2593 color: "#212121" 2594 }] 2595 }, { 2596 featureType: "administrative", 2597 elementType: "geometry", 2598 stylers: [{ 2599 color: "#757575" 2600 }] 2601 }, { 2602 featureType: "administrative.country", 2603 elementType: "labels.text.fill", 2604 stylers: [{ 2605 color: "#9e9e9e" 2606 }] 2607 }, { 2608 featureType: "administrative.land_parcel", 2609 stylers: [{ 2610 visibility: "off" 2611 }] 2612 }, { 2613 featureType: "administrative.locality", 2614 elementType: "labels.text.fill", 2615 stylers: [{ 2616 color: "#bdbdbd" 2617 }] 2618 }, { 2619 featureType: "poi", 2620 elementType: "labels.text.fill", 2621 stylers: [{ 2622 color: "#757575" 2623 }] 2624 }, { 2625 featureType: "poi.park", 2626 elementType: "geometry", 2627 stylers: [{ 2628 color: "#181818" 2629 }] 2630 }, { 2631 featureType: "poi.park", 2632 elementType: "labels.text.fill", 2633 stylers: [{ 2634 color: "#616161" 2635 }] 2636 }, { 2637 featureType: "poi.park", 2638 elementType: "labels.text.stroke", 2639 stylers: [{ 2640 color: "#1b1b1b" 2641 }] 2642 }, { 2643 featureType: "road", 2644 elementType: "geometry.fill", 2645 stylers: [{ 2646 color: "#2c2c2c" 2647 }] 2648 }, { 2649 featureType: "road", 2650 elementType: "labels.text.fill", 2651 stylers: [{ 2652 color: "#8a8a8a" 2653 }] 2654 }, { 2655 featureType: "road.arterial", 2656 elementType: "geometry", 2657 stylers: [{ 2658 color: "#373737" 2659 }] 2660 }, { 2661 featureType: "road.highway", 2662 elementType: "geometry", 2663 stylers: [{ 2664 color: "#3c3c3c" 2665 }] 2666 }, { 2667 featureType: "road.highway.controlled_access", 2668 elementType: "geometry", 2669 stylers: [{ 2670 color: "#4e4e4e" 2671 }] 2672 }, { 2673 featureType: "road.local", 2674 elementType: "labels.text.fill", 2675 stylers: [{ 2676 color: "#616161" 2677 }] 2678 }, { 2679 featureType: "transit", 2680 elementType: "labels.text.fill", 2681 stylers: [{ 2682 color: "#757575" 2683 }] 2684 }, { 2685 featureType: "water", 2686 elementType: "geometry", 2687 stylers: [{ 2688 color: "#000000" 2689 }] 2690 }, { 2691 featureType: "water", 2692 elementType: "labels.text.fill", 2693 stylers: [{ 2694 color: "#3d3d3d" 2695 }] 2696 }], 2697 night: [{ 2698 elementType: "geometry", 2699 stylers: [{ 2700 color: "#242f3e" 2701 }] 2702 }, { 2703 elementType: "labels.text.fill", 2704 stylers: [{ 2705 color: "#746855" 2706 }] 2707 }, { 2708 elementType: "labels.text.stroke", 2709 stylers: [{ 2710 color: "#242f3e" 2711 }] 2712 }, { 2713 featureType: "administrative.locality", 2714 elementType: "labels.text.fill", 2715 stylers: [{ 2716 color: "#d59563" 2717 }] 2718 }, { 2719 featureType: "poi", 2720 elementType: "labels.text.fill", 2721 stylers: [{ 2722 color: "#d59563" 2723 }] 2724 }, { 2725 featureType: "poi.park", 2726 elementType: "geometry", 2727 stylers: [{ 2728 color: "#263c3f" 2729 }] 2730 }, { 2731 featureType: "poi.park", 2732 elementType: "labels.text.fill", 2733 stylers: [{ 2734 color: "#6b9a76" 2735 }] 2736 }, { 2737 featureType: "road", 2738 elementType: "geometry", 2739 stylers: [{ 2740 color: "#38414e" 2741 }] 2742 }, { 2743 featureType: "road", 2744 elementType: "geometry.stroke", 2745 stylers: [{ 2746 color: "#212a37" 2747 }] 2748 }, { 2749 featureType: "road", 2750 elementType: "labels.text.fill", 2751 stylers: [{ 2752 color: "#9ca5b3" 2753 }] 2754 }, { 2755 featureType: "road.highway", 2756 elementType
2756: "geometry", 2757 stylers: [{ 2758 color: "#746855" 2759 }] 2760 }, { 2761 featureType: "road.highway", 2762 elementType: "geometry.stroke", 2763 stylers: [{ 2764 color: "#1f2835" 2765 }] 2766 }, { 2767 featureType: "road.highway", 2768 elementType: "labels.text.fill", 2769 stylers: [{ 2770 color: "#f3d19c" 2771 }] 2772 }, { 2773 featureType: "transit", 2774 elementType: "geometry", 2775 stylers: [{ 2776 color: "#2f3948" 2777 }] 2778 }, { 2779 featureType: "transit.station", 2780 elementType: "labels.text.fill", 2781 stylers: [{ 2782 color: "#d59563" 2783 }] 2784 }, { 2785 featureType: "water", 2786 elementType: "geometry", 2787 stylers: [{ 2788 color: "#17263c" 2789 }] 2790 }, { 2791 featureType: "water", 2792 elementType: "labels.text.fill", 2793 stylers: [{ 2794 color: "#515c6d" 2795 }] 2796 }, { 2797 featureType: "water", 2798 elementType: "labels.text.stroke", 2799 stylers: [{ 2800 color: "#17263c" 2801 }] 2802 }], 2803 aubergine: [{ 2804 elementType: "geometry", 2805 stylers: [{ 2806 color: "#1d2c4d" 2807 }] 2808 }, { 2809 elementType: "labels.text.fill", 2810 stylers: [{ 2811 color: "#8ec3b9" 2812 }] 2813 }, { 2814 elementType: "labels.text.stroke", 2815 stylers: [{ 2816 color: "#1a3646" 2817 }] 2818 }, { 2819 featureType: "administrative.country", 2820 elementType: "geometry.stroke", 2821 stylers: [{ 2822 color: "#4b6878" 2823 }] 2824 }, { 2825 featureType: "administrative.land_parcel", 2826 elementType: "labels.text.fill", 2827 stylers: [{ 2828 color: "#64779e" 2829 }] 2830 }, { 2831 featureType: "administrative.province", 2832 elementType: "geometry.stroke", 2833 stylers: [{ 2834 color: "#4b6878" 2835 }] 2836 }, { 2837 featureType: "landscape.man_made", 2838 elementType: "geometry.stroke", 2839 stylers: [{ 2840 color: "#334e87" 2841 }] 2842 }, { 2843 featureType: "landscape.natural", 2844 elementType: "geometry", 2845 stylers: [{ 2846 color: "#023e58" 2847 }] 2848 }, { 2849 featureType: "poi", 2850 elementType: "geometry", 2851 stylers: [{ 2852 color: "#283d6a" 2853 }] 2854 }, { 2855 featureType: "poi", 2856 elementType: "labels.text.fill", 2857 stylers: [{ 2858 color: "#6f9ba5" 2859 }] 2860 }, { 2861 featureType: "poi", 2862 elementType: "labels.text.stroke", 2863 stylers: [{ 2864 color: "#1d2c4d" 2865 }] 2866 }, { 2867 featureType: "poi.park", 2868 elementType: "geometry.fill", 2869 stylers: [{ 2870 color: "#023e58" 2871 }] 2872 }, { 2873 featureType: "poi.park", 2874 elementType: "labels.text.fill", 2875 stylers: [{ 2876 color: "#3C7680" 2877 }] 2878 }, { 2879 featureType: "road", 2880 elementType: "geometry", 2881 stylers: [{ 2882 color: "#304a7d" 2883 }] 2884 }, { 2885 featureType: "road", 2886 elementType: "labels.text.fill", 2887 stylers: [{ 2888 color: "#98a5be" 2889 }] 2890 }, { 2891 featureType: "road", 2892 elementType: "labels.text.stroke", 2893 stylers: [{ 2894 color: "#1d2c4d" 2895 }] 2896 }, { 2897 featureType: "road.highway", 2898 elementType: "geometry", 2899 stylers: [{ 2900 color: "#2c6675" 2901 }] 2902 }, { 2903 featureType: "road.highway", 2904 elementType: "geometry.stroke", 2905 stylers: [{ 2906 color: "#255763" 2907 }] 2908 }, { 2909 featureType: "road.highway", 2910 elementType: "labels.text.fill", 2911 stylers: [{ 2912 color: "#b0d5ce" 2913 }] 2914 }, { 2915 featureType: "road.highway", 2916 elementType: "labels.text.stroke", 2917 stylers: [{ 2918 color: "#023e58" 2919 }] 2920 }, { 2921 featureType: "transit", 2922 elementType: "labels.text.fill", 2923 stylers: [{ 2924 color: "#98a5be" 2925 }] 2926 }, { 2927 featureType: "transit", 2928 elementType: "labels.text.stroke", 2929 stylers: [{ 2930 color: "#1d2c4d" 2931 }] 2932 }, { 2933 featureType: "transit.line", 2934 elementType: "geometry.fill", 2935 stylers: [{ 2936 color: "#283d6a"
2937 }] 2938 }, { 2939 featureType: "transit.station", 2940 elementType: "geometry", 2941 stylers: [{ 2942 color: "#3a4762" 2943 }] 2944 }, { 2945 featureType: "water", 2946 elementType: "geometry", 2947 stylers: [{ 2948 color: "#0e1626" 2949 }] 2950 }, { 2951 featureType: "water", 2952 elementType: "labels.text.fill", 2953 stylers: [{ 2954 color: "#4e6d70" 2955 }] 2956 }] 2957 }; 2958 return defaultStyles; 2959 }, 2960 settings: function settings(wrapper) { 2961 var item = document.querySelector(wrapper); 2962 var settings = { 2963 latitude: parseFloat(item.dataset.latitude), 2964 longitude: parseFloat(item.dataset.longitude), 2965 mapType: item.dataset.mapType, 2966 markers: item.dataset.markers, 2967 polylines: item.dataset.polylines, 2968 mapZoom: parseInt(item.dataset.mapZoom), 2969 mapZoomMobile: parseInt(item.dataset.mapZoomMobile), 2970 mapZoomTablet: parseInt(item.dataset.mapZoomTablet), 2971 scrollWheelZoom: item.dataset.scrollWheelZoom, 2972 zoomControl: item.dataset.zoomControl, 2973 fullscreenControl: item.dataset.fullScreen, 2974 mapDraggable: item.dataset.disableMapDrag, 2975 showLegend: item.dataset.showLegend, 2976 showRoute: item.dataset.showRoute, 2977 googleMapType: item.dataset.googleMapType, 2978 mapTypeControl: item.dataset.mapTypeControl, 2979 streetViewControl: item.dataset.streetView, 2980 infoOpen: item.dataset.infoOpen, 2981 infoOpenHover: item.dataset.infoOpenHover, 2982 mapStyle: item.dataset.mapStyle, 2983 customMapStyles: item.dataset.customMapStyle, 2984 defaultStyle: this.defaultStyle(), 2985 strokeColor: item.dataset.strokeColor, 2986 strokeOpacity: item.dataset.strokeOpacity, 2987 strokeWeight: item.dataset.strokeWeight, 2988 strokeFill: item.dataset.strokeFill, 2989 strokeFillOpacity: item.dataset.strokeFillOpacity, 2990 originLat: item.dataset.originLat, 2991 originLng: item.dataset.originLng, 2992 destLat: item.dataset.destLat, 2993 destLng: item.dataset.destLng, 2994 travelMode: item.dataset.travelMode 2995 }; 2996 return settings; 2997 }, 2998 isValidJsonString: function isValidJsonString(jsonString) { 2999 try { 3000 JSON.parse(jsonString); 3001 } catch (e) { 3002 return false; 3003 } 3004 return true; 3005 }, 3006 mapInit: function mapInit(wrapper) { 3007 var settings = this.settings(wrapper); 3008 var markersOptionsArray = JSON.parse(settings.markers); 3009 var map; 3010 var directionsService = new google.maps.DirectionsService(); 3011 var directionsRenderer = new google.maps.DirectionsRenderer(); 3012 var finalZoomLevel = settings.mapZoom; 3013 window.addEventListener("resize", function () { 3014 if (elementorFrontend.getCurrentDeviceMode() == "mobile") { 3015 finalZoomLevel = settings.mapZoomMobile; 3016 } else if (elementorFrontend.getCurrentDeviceMode() == "tablet") { 3017 finalZoomLevel = settings.mapZoomTablet; 3018 } else { 3019 finalZoomLevel = settings.mapZoom; 3020 } 3021 }); 3022 map = new google.maps.Map(document.querySelector(".ha-adv-google-map__wrapper" + wrapper), { 3023 center: { 3024 lat: settings.latitude === "" ? -34.391 : settings.latitude, 3025 lng: settings.longitude === "" ? 150.644 : settings.longitude 3026 }, 3027 zoom: finalZoomLevel, 3028 mapTypeId: settings.mapType, 3029 zoomControl: settings.zoomControl === "yes", 3030 mapTypeControl: settings.mapTypeControl === "yes", 3031 fullscreenControl: settings.fullscreenControl === "yes", 3032 streetViewControl: settings.streetViewControl === "yes", 3033 gestureHandling: settings.scrollWheelZoom === "yes" ? "greedy" : "cooperative", 3034 draggable: settings.mapDraggable !== "yes", 3035 styles: settings.mapStyle !== "custom" ? settings.defaultStyle[settings.mapStyle] : !this.isValidJsonString(settings.customMapStyles) ? "" : JSON.parse(settings.customMapStyles) 3036 }); 3037 if (settings.mapDraggable === "yes") { 3038 map.setOptions({ 3039 draggableCursor: "default" 3040 }); 3041 } 3042 3043 // adding markers and info window on map 3044 markersOptionsArray.forEach(function (option) { 3045 var marker = new google.maps.Marker({ 3046 icon: option.pin_icon.url === "" ? "" : { 3047 url: option.pin_icon.url, 3048 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) 3049 }, 3050 map: map, 3051 position: { 3052 lat: +option.pin_latitude, 3053 lng: +option.pin_longitude 3054 } 3055 }); 3056 var infoWindow = new google.maps.InfoWindow({ 3057 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>" 3058 }); 3059 if (settings.infoOpen === "yes") { 3060 infoWindow.open(map, marker); 3061 } 3062 if (settings.infoOpenHover === "yes") { 3063 marker.addListener("mouseover", function (e) { 3064 infoWindow.open(map, marker); 3065 }); 3066 marker.addListener("mouseout", function (e) { 3067 var timeOut = setTimeout(function () { 3068 infoWindow.close(); 3069 clearTimeout(timeOut); 3070 }, 1000); 3071 }); 3072 } else { 3073 marker.addListener("click", function () { 3074 infoWindow.open(map, marker); 3075 }); 3076 } 3077 }); 3078 3079 // adding map legend 3080 if (settings.showLegend === "yes") { 3081 var legend = document.querySelector(wrapper).nextElementSibling; 3082 map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(legend); 3083 } 3084 if (settings.googleMapType == "polyline") { 3085 var polylines_data = JSON.parse(settings.polylines); 3086 var polylines_arr = []; 3087 polylines_data.forEach(function (polyline) { 3088 polylines_arr.push({ 3089 lat: parseFloat(polyline.ha_gmap_polyline_lat), 3090 lng: parseFloat(polyline.ha_gmap_polyline_lng) 3091 }); 3092 }); 3093 var polyLinePath = JSON.parse(JSON.stringify(polylines_arr)); 3094 var polyPath = new google.maps.Polyline({ 3095 path: polyLinePath, 3096 strokeColor: settings.strokeColor, 3097 strokeOpacity: settings.strokeOpacity, 3098 strokeWeight: settings.strokeWeight 3099 });
3100 polyPath.setMap(map); 3101 } 3102 if (settings.googleMapType == "polygon") { 3103 var polylines_data = JSON.parse(settings.polylines); 3104 var polylines_arr = []; 3105 polylines_data.forEach(function (polyline) { 3106 polylines_arr.push({ 3107 lat: parseFloat(polyline.ha_gmap_polyline_lat), 3108 lng: parseFloat(polyline.ha_gmap_polyline_lng) 3109 }); 3110 }); 3111 var polyLinePath = JSON.parse(JSON.stringify(polylines_arr)); 3112 var polygon = new google.maps.Polygon({ 3113 path: polyLinePath, 3114 strokeColor: settings.strokeColor, 3115 strokeOpacity: settings.strokeOpacity, 3116 strokeWeight: settings.strokeWeight, 3117 fillColor: settings.strokeFill, 3118 fillOpacity: settings.strokeFillOpacity 3119 }); 3120 polygon.setMap(map); 3121 } 3122 if (settings.googleMapType == "routes") { 3123 this.routeDraw(directionsService, directionsRenderer, settings); 3124 directionsRenderer.setMap(map); 3125 } 3126 google.maps.event.addDomListener(window, "resize", function () { 3127 var center = map.getCenter(); 3128 google.maps.event.trigger(map, "resize"); 3129 map.setCenter(center); 3130 map.setZoom(finalZoomLevel); 3131 }); 3132 }, 3133 routeDraw: function routeDraw(directionsService, directionsRenderer, settings) { 3134 var start = settings.originLat + "," + settings.originLng; 3135 var end = settings.destLat + "," + settings.destLng; 3136 directionsService.route({ 3137 origin: { 3138 query: start 3139 }, 3140 destination: { 3141 query: end 3142 }, 3143 travelMode: settings.travelMode.toUpperCase() 3144 }, function (response, status) { 3145 if (status === "OK") { 3146 directionsRenderer.setDirections(response); 3147 } else {} 3148 }); 3149 }, 3150 runMap: function runMap() { 3151 var gmaper = document.querySelectorAll(".ha-adv-google-map__wrapper"); 3152 for (var i = 0; i < gmaper.length; i++) { 3153 gmaper[i].classList.add("ha-adv-google-map__wrapper--item" + i); 3154 this.mapInit(".ha-adv-google-map__wrapper--item" + i); 3155 } 3156 } 3157 }); 3158 elementorFrontend.hooks.addAction("frontend/element_ready/ha-google-map.default", function ($scope) { 3159 elementorFrontend.elementsHandler.addHandler(Maps, { 3160 $element: $scope, 3161 selectors: { 3162 container: ".ha-adv-google-map__wrapper" 3163 } 3164 }); 3165 }); 3166 elementorFrontend.hooks.addAction("frontend/element_ready/ha-unfold.default", function ($scope) { 3167 elementorFrontend.elementsHandler.addHandler(Unfold, { 3168 $element: $scope 3169 }); 3170 }); 3171 var EddCart = function EddCart($scope) { 3172 var optionEL = $scope.find('.ha-edd-table-wrap'); 3173 var settings = optionEL.data('options'); 3174 var removeEl = $scope.find('.edd-remove-from-cart'); 3175 if (settings.cart_btn_type == 'icon') { 3176 removeEl.html("<i class=\"".concat(settings.icon.value, "\"></i>")); 3177 } else { 3178 removeEl.text(settings.btn_text); 3179 } 3180 }; 3181 elementorFrontend.hooks.addAction('frontend/element_ready/ha-edd-cart.default', EddCart); 3182 var EddCheckout = function EddCheckout($scope) { 3183 var optionEL = $scope.find('.ha-edd-table-wrap'); 3184 var settings = optionEL.data('options'); 3185 var removeEl = $scope.find('.edd_cart_remove_item_btn'); 3186 if (settings.cart_btn_type == 'icon') { 3187 removeEl.html("<i class=\"".concat(settings.icon.value, "\"></i>")); 3188 } else { 3189 removeEl.text(settings.btn_text); 3190 } 3191 }; 3192 elementorFrontend.hooks.addAction('frontend/element_ready/ha-edd-checkout.default', EddCheckout); 3193 var EddAjaxBtn = function EddAjaxBtn($scope) { 3194 var btn = $scope.find(".ha_edd_ajax_btn"); 3195 btn.on('click', function (event) { 3196 event.preventDefault(); 3197 var $self = $(this), 3198 download_id = $self.data('download-id'), 3199 nonce = $self.data('nonce'); 3200 $.ajax({ 3201 url: HappyProLocalize.ajax_url, 3202 type: "POST", 3203 data: { 3204 action: "ha_edd_ajax_add_to_cart_link", 3205 security: HappyProLocalize.nonce, 3206 download_id: download_id 3207 }, 3208 success: function success(response) { 3209 if (response.success == true) { 3210 $self.html("<i class=\"fas fa-cart-plus\"></i>"); 3211 } 3212 } 3213 }); 3214 }); 3215 }; 3216 elementorFrontend.hooks.addAction('frontend/element_ready/ha-edd-product-grid.default', EddAjaxBtn); 3217 elementorFrontend.hooks.addAction('frontend/element_ready/ha-edd-product-carou
3217sel.default', EddAjaxBtn); 3218 elementorFrontend.hooks.addAction('frontend/element_ready/ha-edd-single-product.default', EddAjaxBtn); 3219 var Image_Swap = function Image_Swap($scope) { 3220 var element = $scope.find('.ha-image-swap-wrapper'); 3221 var trigger_type = element.data('trigger'); 3222 var status; 3223 if (trigger_type === 'click') { 3224 element.on('click', element, function () { 3225 var self = $(this); 3226 var click = self.attr('data-click'); 3227 if ('inactive' == click) { 3228 status = 'active'; 3229 } else { 3230 status = 'inactive'; 3231 } 3232 self.attr('data-click', status); 3233 var first_img = self.find('.img_swap_first'); 3234 var second_img = self.find('.img_swap_second'); 3235 }); 3236 } 3237 var elm = $scope.find('.ha-image-swap-ctn'); 3238 var elm_img = $scope.find('.ha-image-swap-item'); 3239 var trigger = elm.data('trigger'); 3240 if (elm.length > 0) { 3241 $('.ha-image-swap-ctn').on('click', '.ha-image-swap-item', function (e) { 3242 var elem = $(this); 3243 var parent = elem.parent('.ha-image-swap-insider'); 3244 var firstChild = parent.children('.ha-image-swap-item:first-of-type'); 3245 var secondChild = parent.children('.ha-image-swap-item:nth-of-type(2)'); 3246 if (!elem.is(':first-child')) { 3247 parent.addClass('changed'); 3248 setTimeout(function () { 3249 firstChild.remove(); 3250 parent.append(firstChild); 3251 parent.removeClass('changed'); 3252 }, 400); 3253 } 3254 }); 3255 } 3256 // if( trigger == 'hover'){ 3257 // elm.hover(function (e){ 3258 // var target = e.target; 3259 3260 // if(!$(target).hasClass('active')){ 3261 3262 // var $self = $(this); 3263 // var parent = $self.find('.ha-image-swap-insider'); 3264 // var firstChild = parent.children('.ha-image-swap-item:first-of-type'); 3265 // var secondChild = parent.children('.ha-image-swap-item:nth-of-type(2)'); 3266 3267 // firstChild.toggleClass('active'); 3268 // secondChild.toggleClass('active'); 3269 // } 3270 // }); 3271 // } 3272 }; 3273 var FlipBox = function FlipBox($scope) { 3274 // For Flip Box Back editor mode 3275 var ha_flip_box_back = sessionStorage.getItem('haFlipBoxBack'); 3276 if (elementorFrontend.isEditMode() && ha_flip_box_back && 'yes' == ha_flip_box_back) { 3277 $scope.find('.ha-flip-box-inner').addClass('flip-styling flip'); 3278 } // For Flip Box Back editor mode end 3279 3280 var element = $scope.find('.ha-flip-box-inner'); 3281 // touchstart 3282 element.on('mouseenter mouseleave touchstart', function (e) { 3283 if (elementorFrontend.isEditMode() && $(this).hasClass('flip-styling')) { 3284 return; 3285 } 3286 if (('mouseenter' == e.type || 'touchstart' == e.type) && !$(this).hasClass('flip')) { 3287 $(this).addClass('flip'); 3288 } else if (('mouseleave' == e.type || 'touchstart' == e.type) && $(this).hasClass('flip')) { 3289 $(this).removeClass('flip'); 3290 } else if ('touchstart' == e.type && $(this).hasClass('flip')) { 3291 $(this).removeClass('flip'); 3292 } 3293 }); 3294 }; 3295 elementorFrontend.hooks.addAction('frontend/element_ready/ha-image-swap.default', Image_Swap); 3296 var FreeShippingBar = function FreeShippingBar($scope) { 3297 var $fsbContainer = $scope.find('.ha-fsb-container'); 3298 if ($fsbContainer) { 3299 var $settings = $fsbContainer.data('fsb_settings'); 3300 if ($settings != undefined) { 3301 var $aimationSpeed = $settings.hasOwnProperty('ha_fsb_animation_speed') ? $settings.ha_fsb_animation_speed : 15; 3302 var $achivePercent = $settings.hasOwnProperty('achive_percent') ? $settings.achive_percent : 0; 3303 var $progressType = $settings.hasOwnProperty('progress_type') ? $settings.progress_type : 'percent'; 3304 var $currencySymbol = $settings.hasOwnProperty('currencySymbol') && $progressType == 'percent' ? '%' : $settings.currencySymbol; 3305 var $cartTotal = $settings.hasOwnProperty('cart_total') ? $settings.cart_total : 0; 3306 var $totalPercent = parseFloat(Math.round($achivePercent)) >= 100 ? 100 : parseFloat(Math.round($achivePercent)); 3307 var $progressText = $progressType == 'percent' ? $totalPercent : $cartTotal; 3308 var $elem = $fsbContainer.find('.ha-fsb-size'); 3309 $elem.text($progressText + $currencySymbol); 3310 var defaultWidth = $(window).width() <= 768 ? 12 : 5; 3311 $totalPercent > 0 ? $elem.css({ 3312 'width': $totalPercent + "%", 3313 'transition': 'width ' + $aimationSpeed + 'ms ease-in-out' 3314 }) : $elem.css('width', +defaultWidth + "%"); 3315 } 3316 } 3317 }; 3318 elementorFrontend.hooks.addAction('frontend/element_ready/ha-shipping-bar.default', FreeShippingBar); 3319 $('.fsb-close-icon').on('click', function () { 3320 document.cookie = "ha_close_fsb = yes;path=/"; 3321 $('.ha-fsb-container').hide(); 3322 }); 3323 elementorFrontend.hooks.addAction('frontend/element_ready/ha-flip-box.default', FlipBox
3323); 3324 var HaRemoteCarousel = function HaRemoteCarousel($scope) { 3325 var $rcContainer = $scope.find('.ha-remote-carousel-container'); 3326 if ($rcContainer) { 3327 var $rcBtn = $($rcContainer).find('.ha-custom-nav-remote-carousel'); 3328 if ($rcBtn) { 3329 var $prevSliderIndex = 0; 3330 var $slides_to_show = 0; 3331 var $ha_show_thumbnail = $($rcBtn).parent().data('show_thumbnail'); 3332 var $ha_rc_unique_id = $($rcBtn).parent().data('ha_rc_id'); 3333 var $haRcSelector = $ha_rc_unique_id ? $('[data-ha_rcc_uid="' + $ha_rc_unique_id + '"]') : ''; 3334 if ($ha_show_thumbnail && $ha_show_thumbnail == 'yes') { 3335 $haRcSelector.on('init', function (event, slick, currentSlide) { 3336 var $dataSettingsSelector = $haRcSelector.parent().parent(); 3337 var $dataSettings = $dataSettingsSelector.data('settings'); 3338 $slides_to_show = typeof $dataSettings === "undefined" ? $slides_to_show : $dataSettings.slides_to_show; 3339 $prevSliderIndex = (currentSlide ? currentSlide : 0) - 1; 3340 var $nextIndex = parseInt($slides_to_show) + parseInt($prevSliderIndex) + 1; 3341 var $nextItem = $haRcSelector.find('[data-slick-index="' + $nextIndex + '"]');
3342 var $nextImg = $nextItem.find('img').attr('src'); 3343 var $prevItem = $haRcSelector.find('[data-slick-index="' + $prevSliderIndex + '"]'); 3344 var $prevImg = $prevItem.find('img').attr('src'); 3345 var $nextBtn = $rcContainer.find('.ha-remote-carousel-btn-next'); 3346 var $prevBtn = $rcContainer.find('.ha-remote-carousel-btn-prev'); 3347 $nextBtn.css({ 3348 'background-image': 'url(' + $nextImg + ')', 3349 'background-position': 'center' 3350 }); 3351 $prevBtn.css({ 3352 'background-image': 'url(' + $prevImg + ')', 3353 'background-position': 'center' 3354 }); 3355 }); 3356 $haRcSelector.trigger('init'); 3357 $($rcBtn).on("click", function (e) { 3358 e.preventDefault(); 3359 $haRcSelector.on('afterChange', function (event, slick, currentSlideIndex) { 3360 var $dataSettingsSelector = $haRcSelector.parent().parent(); 3361 var $dataSettings = $dataSettingsSelector.data('settings'); 3362 var $slides_to_show = $dataSettings ? $dataSettings.slides_to_show : currentSlideIndex; 3363 $prevSliderIndex = parseInt(currentSlideIndex - 1); 3364 var $nextIndex = parseInt($slides_to_show) + parseInt($prevSliderIndex) + 1; 3365 var $nextItem = $haRcSelector.find('[data-slick-index="' + $nextIndex + '"]');
3366 var $nextImg = $nextItem.find('img').attr('src'); 3367 var $prevItem = $haRcSelector.find('[data-slick-index="' + $prevSliderIndex + '"]'); 3368 var $prevImg = $prevItem.find('img').attr('src'); 3369 var $nextBtn = $rcContainer.find('.ha-remote-carousel-btn-next'); 3370 var $prevBtn = $rcContainer.find('.ha-remote-carousel-btn-prev'); 3371 if ($nextBtn) { 3372 $nextBtn.css({ 3373 'background-image': 'url(' + $nextImg + ')', 3374 'background-position': 'center' 3375 }); 3376 } 3377 if ($prevBtn) { 3378 $prevBtn.css({ 3379 'background-image': 'url(' + $prevImg + ')', 3380 'background-position': 'center' 3381 }); 3382 } 3383 }); 3384 if ($(this).data("ha_rc_nav") == 'ha_rc_next_btn') { 3385 $haRcSelector.slick("slickNext"); 3386 } else if ($(this).data("ha_rc_nav") == 'ha_rc_prev_btn') { 3387 $haRcSelector.slick("slickPrev"); 3388 } 3389 }); 3390 } else { 3391 $($rcBtn).on("click", function (e) { 3392 e.preventDefault(); 3393 if ($(this).data("ha_rc_nav") == 'ha_rc_next_btn') { 3394 $haRcSelector.slick("slickNext"); 3395 } else if ($(this).data("ha_rc_nav") == 'ha_rc_prev_btn') { 3396 $haRcSelector.slick("slickPrev"); 3397 } 3398 }); 3399 } 3400 } 3401 } 3402 }; 3403 elementorFrontend.hooks.addAction('frontend/element_ready/ha-remote-carousel.default', HaRemoteCarousel); 3404 var HaTOC = elementorModules.frontend.handlers.Base.extend({ 3405 getDefaultSettings: function getDefaultSettings() { 3406 var elementSettings = this.getElementSettings(), 3407 listWrapperTag = "numbers" === elementSettings.marker_view ? "ol" : "ul"; 3408 return { 3409 selectors: { 3410 widgetContainer: ".ha-toc-wrapper", 3411 container: '.elementor:not([data-elementor-type="header"]):not([data-elementor-type="footer"])', 3412 expandButton: ".ha-toc__header", 3413 collapseButton: ".ha-toc__header", 3414 body: ".ha-toc__body", 3415 headerTitle: ".ha-toc__header-title", 3416 scrollTop: ".ha-toc__scroll-to-top--container" 3417 }, 3418 classes: { 3419 anchor: "ha-toc-menu-anchor", 3420 listWrapper: "ha-toc__list-wrapper", 3421 listItem: "ha-toc__list-item", 3422 listTextWrapper: "ha-toc__list-item-text-wrapper", 3423 firstLevelListItem: "ha-toc__top-level", 3424 listItemText: "ha-toc__list-item-text", 3425 activeItem: "ha-toc-item-active", 3426 headingAnchor: "ha-toc__heading-anchor", 3427 collapsed: "ha-toc--collapsed" 3428 }, 3429 listWrapperTag: listWrapperTag 3430 }; 3431 }, 3432 getDefaultElements: function getDefaultElements() { 3433 var settings = this.getSettings(), 3434 elementSettings = this.getElementSettings(); 3435 return { 3436 $pageContainer: jQuery(elementSettings.container || settings.selectors.container), 3437 $widgetContainer: this.$element.find(settings.selectors.widgetContainer), 3438 $expandButton: this.$element.find(settings.selectors.expandButton), 3439 $collapseButton: this.$element.find(settings.selectors.collapseButton), 3440 $tocBody: this.$element.find(settings.selectors.body), 3441 $listItems: this.$element.find("." + settings.classes.listItem), 3442 $scrollTop: this.$element.find(settings.selectors.scrollTop) 3443 }; 3444 }, 3445 bindEvents: function bindEvents() { 3446 var $self = this; 3447 var elementSettings = this.getElementSettings(); 3448 if (elementSettings.minimize_box) { 3449 this.elements.$expandButton.on("click", function () { 3450 if (!$($self.$element).hasClass($self.getSettings("classes.collapsed"))) { 3451 return $self.collapseBox(); 3452 } else { 3453 return $self.expandBox(); 3454 } 3455 }); 3456 } 3457 if (elementSettings.collapse_subitems) { 3458 this.elements.$listItems.hover(function (event) { 3459 return jQuery(event.target).slideToggle(); 3460 }); 3461 } 3462 if (elementSettings.sticky_toc_toggle) { 3463 elementorFrontend.elements.$window.on("resize", this.handleStickyToc); 3464 } 3465 if (elementSettings.scroll_to_top_toggle) { 3466 this.elements.$scrollTop.on("click", function () { 3467 $self.scrollToTop(); 3468 }); 3469 } 3470 }, 3471 getHeadings: function getHeadings() { 3472 // Get all headings from document by user-selected tags 3473 var elementSettings = this.getElementSettings(), 3474 tags = elementSettings.headings_by_tags.join(","),
3475 selectors = this.getSettings("selectors"), 3476 excludedSelectors = elementSettings.exclude_headings_by_selector; 3477 return this.elements.$pageContainer.find(tags).not(selectors.headerTitle).filter(function (index, heading) { 3478 return !jQuery(heading).closest(excludedSelectors).length; // Handle excluded selectors if there are any 3479 }); 3480 }, 3481 addAnchorsBeforeHeadings: function addAnchorsBeforeHeadings() { 3482 var $this = this; 3483 // Add an anchor element right before each TOC heading to create anchors for TOC links 3484 var classes = this.getSettings("classes"); 3485 this.elements.$headings.before(function (index) { 3486 var anchorLink = $this.getHeadingAnchorLink(index, classes); 3487 return '<span id="' + anchorLink + '" class="' + classes.anchor + ' "></span>'; 3488 }); 3489 }, 3490 activateItem: function activateItem($listItem) { 3491 var classes = this.getSettings("classes"); 3492 this.deactivateActiveItem($listItem); 3493 $listItem.addClass(classe
3493s.activeItem); 3494 this.$activeItem = $listItem; 3495 if (!this.getElementSettings("sticky_toc_toggle")) { 3496 //Note:- The "Collapse" option will not work unless you make the Table of Contents sticky. 3497 return; 3498 } 3499 if (!this.getElementSettings("collapse_subitems")) { 3500 return; 3501 } 3502 var $activeList = void 0; 3503 if ($listItem.hasClass(classes.firstLevelListItem)) { 3504 $activeList = $listItem.parent().next(); 3505 } else { 3506 $activeList = $listItem.parents("." + classes.listWrapper).eq(-2); 3507 } 3508 if (!$activeList.length) { 3509 delete this.$activeList; 3510 return; 3511 } 3512 this.$activeList = $activeList; 3513 this.$activeList.stop().slideDown(); 3514 }, 3515 deactivateActiveItem: function deactivateActiveItem($activeToBe) { 3516 if (!this.$activeItem || this.$activeItem.is($activeToBe)) { 3517 return; 3518 } 3519 var _getSettings = this.getSettings(), 3520 classes = _getSettings.classes; 3521 this.$activeItem.removeClass(classes.activeItem); 3522 if (this.$activeList && (!$activeToBe || !this.$activeList[0].contains($activeToBe[0]))) { 3523 this.$activeList.slideUp(); 3524 } 3525 }, 3526 followAnchor: function followAnchor($element, index) { 3527 var $self = this; 3528 var anchorSelector = $element[0].hash; 3529 var $anchor = void 0; 3530 try { 3531 // `decodeURIComponent` for UTF8 characters in the hash. 3532 $anchor = jQuery(decodeURIComponent(anchorSelector)); 3533 } catch (e) { 3534 return; 3535 } 3536 if (0 === index) { 3537 haObserveTarget($anchor[0], function (direction) { 3538 if ($self.itemClicked) { 3539 return; 3540 } 3541 if ("down" === direction) { 3542 $self.activateItem($element); 3543 } else { 3544 $self.deactivateActiveItem(); 3545 } 3546 }); 3547 } 3548 haObserveTarget($anchor[0], function (direction) { 3549 if ($self.itemClicked) { 3550 return; 3551 } 3552 if ("down" === direction) { 3553 $self.activateItem($self.$listItemTexts.eq(index + 1)); 3554 } else { 3555 $self.activateItem($element); 3556 } 3557 }); 3558 }, 3559 followAnchors: function followAnchors() { 3560 var $self = this; 3561 this.$listItemTexts.each(function (index, element) { 3562 return $self.followAnchor(jQuery(element), index); 3563 }); 3564 }, 3565 setOffset: function setOffset($listItem) { 3566 var $this = this; 3567 var settings = this.getSettings(); 3568 var list = this.$element.find("." + settings.classes.listItem); 3569 var offset = this.getCurrentDeviceSetting("scroll_offset"); 3570 list.each(function () { 3571 $('a', this).on('click', function (e) { 3572 e.preventDefault(); 3573 var hash = this.hash; 3574 $('html, body').animate({ 3575 scrollTop: $(hash).offset().top - parseInt(offset.size) 3576 }, 800); 3577 }); 3578 }); 3579 }, 3580 populateTOC: function populateTOC() { 3581 var $self = this; 3582 this.listItemPointer = 0; 3583 var elementSettings = this.getElementSettings(); 3584 if (elementSettings.custom_style == 'yes') { 3585 this.elements.$widgetContainer.html(this.createSideDot()); 3586 } else { 3587 if (elementSettings.hierarchical_view) { 3588 this.createNestedList(); 3589 } else { 3590 this.createFlatList(); 3591 } 3592 } 3593 this.$listItemTexts = this.$element.find(".ha-toc__list-item-text"); 3594 this.$listItemTexts.on("click", this.onListItemClick.bind(this)); 3595 if (!elementorFrontend.isEditMode()) { 3596 this.followAnchors(); 3597 } 3598 $(window).on('scroll', function () { 3599 if ("window_top" === elementSettings.scroll_to_top_option) { 3600 if ($(window).scrollTop() > 0) { 3601 $self.elements.$scrollTop.show(); 3602 } else { 3603 $self.elements.$scrollTop.hide(); 3604 } 3605 } else { 3606 var $id = $self.getID().parents('.elementor-element'); 3607 if ($id.offset().top >= $(window).scrollTop()) { 3608 $self.elements.$scrollTop.hide(); 3609 } else { 3610 $self.elements.$scrollTop.show(); 3611 } 3612 } 3613 }); 3614 }, 3615 createNestedList: function createNestedList() { 3616 var $self = this; 3617 this.headingsData.forEach(function (heading, index) { 3618 heading.level = 0; 3619 for (var i = index - 1; i >= 0; i--) { 3620 var currentOrderedItem = $self.headingsData[i]; 3621 if (currentOrderedItem.tag <= heading.tag) { 3622 heading.level = currentOrderedItem.level; 3623 if (currentOrderedItem.tag < heading.tag) {
3624 heading.level++; 3625 } 3626 break; 3627 } 3628 } 3629 }); 3630 this.elements.$tocBody.html(this.getNestedLevel(0)); 3631 }, 3632 createFlatList: function createFlatList() { 3633 this.elements.$tocBody.html(this.getNestedLevel()); 3634 }, 3635 createSideDot: function createSideDot(level) { 3636 var settings = this.getSettings(), 3637 elementSettings = this.getElementSettings(), 3638 icon = this.getElementSettings("icon"), 3639 htmlul = ''; 3640 if (elementSettings.custom_style == 'yes') { 3641 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>"); 3642 if (elementSettings.custom_style_list == 'hm-toc-slide-style') { 3643 htmlul += "<".concat(elementSettings.html_tag, " class=\"hm-toc-title\"><span>").concat(elementSettings.widget_title, "<span></").concat(elementSettings.html_tag, ">"); 3644 } else { 3645 htmlul += "<".concat(elementSettings.html_tag, " class=\"hm-toc-title\">").concat(elementSettings.widget_title, "</").concat(elementSettings.html_tag, ">"); 3646 } 3647 htmlul += "<".concat(settings.listWrapperTag, " class=\"hm-toc-items-inner\">"); 3648 for (var i = 0; i < this.headingsData.length; i++) { 3649 var list = ''; 3650 var currentItemDot = this.headingsData[i]; 3651 if (level > currentItemDot.level) { 3652 break; 3653 } 3654 var listItemTextClasses = settings.classes.listItemText; 3655 if (0 === currentItemDot.level) { 3656 // If the current list item is a top level item, give it the first level class 3657 listItemTextClasses += " " + settings.classes.firstLevelListItem; 3658 } 3659 if (level === currentItemDot.level) { 3660 list += "<li class=\"hm-toc-entry ".concat(settings.classes.listItem, "\">"); 3661 if ('bullets' === elementSettings.marker_view && icon && elementSettings.custom_style_list == 'hm-toc-slide-style') { 3662 list += "<i class=\"".concat(icon.value, "\"></i>"); 3663 } 3664 list += "<a href=\"#".concat(currentItemDot.anchorLink, "\" class=\"").concat(listItemTextClasses, "\"><span>").concat(currentItemDot.text, "</span></a>"); 3665 list += "</li>"; 3666 } 3667 htmlul += list; 3668 } 3669 htmlul += "</".concat(settings.listWrapperTag, ">"); 3670 htmlul += "</li>\n </ul>"; 3671 } 3672 return htmlul; 3673 }, 3674 getNestedLevel: function getNestedLevel(level) { 3675 var settings = this.getSettings(), 3676 elementSettings = this.getElementSettings(), 3677 icon = this.getElementSettings("icon"); 3678 var html = ''; 3679 3680 // Open new list/nested list 3681 html += "<" + settings.listWrapperTag + ' class="' + settings.classes.listWrapper + '">'; 3682 3683 // for each list item, build its markup. 3684 while (this.listItemPointer < this.headingsData.length) { 3685 var currentItem = this.headingsData[this.listItemPointer]; 3686 var listItemTextClasses = settings.classes.listItemText; 3687 if (0 === currentItem.level) { 3688 // If the current list item is a top level item, give it the first level class 3689 listItemTextClasses += " " + settings.classes.firstLevelListItem; 3690 } 3691 if (level > currentItem.level) { 3692 break; 3693 } 3694 if (level === currentItem.level) { 3695 html += '<li class="' + settings.classes.listItem + " " + "level-" + level + '">'; 3696 html += '<div class="' + settings.classes.listTextWrapper + '">'; 3697 var liContent = '<a href="#' + currentItem.anchorLink + '" class="' + listItemTextClasses + '">' + currentItem.text + "</a>"; 3698 3699 // If list type is bullets, add the bullet icon as an <i> tag 3700 if ("bullets" === elementSettings.marker_view && icon) { 3701 liContent = '<i class="' + icon.value + '"></i>' + liContent; 3702 } 3703 html += liContent; 3704 html += "</div>"; 3705 this.listItemPointer++; 3706 var nextItem = this.headingsData[this.listItemPointer]; 3707 if (nextItem && level < nextItem.level) { 3708 // If a new nested list has to be created under the current item, 3709 // this entire method is called recursively (outside the while loop, a list wrapper is created) 3710 html += this.getNestedLevel(nextItem.level); 3711 } 3712 html += "</li>"; 3713 } 3714 } 3715 html += "</" + settings.listWrapperTag + ">"; 3716 return html; 3717 }, 3718 handleNoHeadingsFound: function handleNoHeadingsFound() { 3719 var _messages = 'No headings were found on this page.'; 3720 if (elementorFrontend.isEditMode()) { 3721 return this.elements.$tocBody.html(_messages); 3722 } 3723 }, 3724 collapseOnInit: function collapseOnInit() { 3725 var $self = this; 3726 var minimizedOn = this.getElementSettings("minimized_on"), 3727 currentDeviceMode = elementorFrontend.getCurrentDeviceMode(); 3728 if ("" !== minimizedOn && "array" !== typeof minimizedOn) { 3729 minimizedOn = [minimizedOn]; 3730 } 3731 if (0 !== minimizedOn.length && "object" === _typeof(minimizedOn)) {
3732 minimizedOn.forEach(function (value) { 3733 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) { 3734 $self.collapseBox(); 3735 } 3736 }); 3737 } 3738 }, 3739 getHeadingAnchorLink: function getHeadingAnchorLink(index, classes) { 3740 var headingID = this.elements.$headings[index].id, 3741 wrapperID = this.elements.$headings[index].closest('.elementor-widget').id; 3742 var anchorLink = ''; 3743 if (headingID) { 3744 anchorLink = headingID; 3745 } else if (wrapperID) { 3746 // If the heading itself has an ID, we don't want to overwrite it 3747 anchorLink = wrapperID; 3748 } // If there is no existing ID, use the heading text to create a semantic ID 3749 3750 if (headingID || wrapperID) { 3751 jQuery(this.elements.$headings[index]).data('hasOwnID', true); 3752 } else { 3753 anchorLink = "".concat(classes.headingAnchor, "-").concat(index); 3754 } 3755 return anchorLink; 3756 }, 3757 setHeadingsData: function setHeadingsData() { 3758 var $this = this; 3759 this.headingsData = []; 3760 var classes = this.getSettings("classes"); 3761 3762 // Create an array for simplifying TOC list creation 3763 this.elements.$headings.each(function (index, element) { 3764 var anchorLink = $this.getHeadingAnchorLink(index, classes); 3765 $this.headingsData.push({ 3766 tag: +element.nodeName.slice(1), 3767 text: element.textContent, 3768 anchorLink: anchorLink 3769 }); 3770 }); 3771 }, 3772 run: function run() { 3773 var elementSettings = this.getElementSettings(); 3774 this.elements.$headings = this.getHeadings(); 3775 if (!this.elements.$headings.length) { 3776 return this.handleNoHeadingsFound(); 3777 } 3778 this.setHeadingsData(); 3779 if (!elementorFrontend.isEditMode()) { 3780 this.addAnchorsBeforeHeadings(); 3781 } 3782 this.populateTOC(); 3783 if (elementSettings.minimize_box) { 3784 this.collapseOnInit(); 3785 } 3786 if (elementSettings.sticky_toc_toggle) { 3787 this.handleStickyToc(); 3788 } 3789 if ("" !== elementSettings.scroll_offset.size) { 3790 this.setOffset(); 3791 } 3792 }, 3793 expandBox: function expandBox() { 3794 var boxHeight = this.getCurrentDeviceSetting("min_height"); 3795 this.$element.removeClass(this.getSettings("classes.collapsed")); 3796 this.elements.$tocBody.slideDown(); 3797 3798 // return container to the full height in case a min-height is defined by the user 3799 this.elements.$widgetContainer.css("min-height", boxHeight.size + boxHeight.unit); 3800 }, 3801 collapseBox: function collapseBox() { 3802 this.$element.addClass(this.getSettings("classes.collapsed")); 3803 this.elements.$tocBody.slideUp(); 3804 3805 // close container in case a min-height is defined by the user 3806 this.elements.$widgetContainer.css("min-height", "0px"); 3807 }, 3808 onInit: function onInit() { 3809 var $self = this; 3810 this.initElements(); 3811 this.bindEvents(); 3812 jQuery(document).ready(function () { 3813 $self.run(); 3814 }); 3815 }, 3816 onListItemClick: function onListItemClick(event) { 3817 var $self = this; 3818 this.itemClicked = true; 3819 setTimeout(function () { 3820 return $self.itemClicked = false; 3821 }, 2000); 3822 var $clickedItem = jQuery(event.target), 3823 $list = $clickedItem.parent().next(), 3824 collapseNestedList = this.getElementSettings("collapse_subitems"); 3825 if ("SPAN" == $clickedItem[0].tagName && 'yes' == this.getElementSettings("custom_style")) { 3826 $clickedItem = jQuery(event.currentTarget); 3827 } 3828 var listIsActive = void 0; 3829 if (collapseNestedList && $clickedItem.hasClass(this.getSettings("classes.firstLevelListItem"))) { 3830 if ($list.is(":visible")) { 3831 listIsActive = true; 3832 } 3833 } 3834 this.activateItem($clickedItem); 3835 if (collapseNestedList && listIsActive) { 3836 $list.slideUp(); 3837 } 3838 }, 3839 handleStickyToc: function handleStickyToc() { 3840 var elementSettings = this.getElementSettings(); 3841 var currentDeviceMode = elementorFrontend.getCurrentDeviceMode(); 3842 var $devices = elementSettings.sticky_toc_disable_on; 3843 var target = this.getID(); 3844 var type = elementSettings.sticky_toc_type; 3845 if ("in-place" === type) { 3846 var parentWidth = target.parent().parent().outerWidth(); 3847 target.css("width", parentWidth); 3848 } else if ("custom-position" === type) { 3849 var parentWidth = target.parent().parent().outerWidth(); 3850 target.css("width", parentWidth); 3851 } 3852 if (-1 == $.inArray(currentDeviceMode, $devices)) { 3853 target.removeClass('floating-toc'); 3854 $(window).off('scroll', this.stickyScroll); 3855 return; 3856 } 3857 $(window).on('scroll', $.proxy(this.stickyScroll, this)); 3858 }, 3859 stickyScroll: function stickyScroll() { 3860 var target = this.getID(); 3861 var elementSettings = this.getElementSettings(); 3862 var item = document.querySelector(".ha-table-of-contents"); 3863 var bound, tocHeight; 3864 bound = item.getBoundingClientRect(); 3865 tocHeight = target.outerHeight(); 3866 if (target.hasClass("floating-toc")) { 3867 target.parent().parent().css("height", tocHeight); 3868 } else { 3869 target.parent().parent().css("height", ''); 3870 } 3871 if (bound.y + bound.height / 2 < 0) { 3872 if (target.hasClass('floating-toc')) { 3873 return; 3874 } 3875 target.addClass("floating-toc"); 3876 } else { 3877 if (!target.hasClass('floating-toc')) { 3878 return; 3879 } 3880 target.removeClass("floating-toc"); 3881 } 3882 }, 3883 scrollToTop: function scrollToTop() { 3884 var $self = this; 3885 var scrollTo = this.getElementSettings("scroll_to_top_option"); 3886 if ("window_top" === scrollTo) { 3887 $("html, body").animate({ 3888 scrollTop: 0 3889 }, 250); 3890 } else { 3891 var $id = this.getID().parents('.ha-table-of-contents'); 3892 $("html, body").animate({ 3893 scrollTop: $($id).offset().top - 60 3894 }, 1000); 3895 } 3896 }, 3897 getID: function getID() { 3898 return $("#ha-toc-" + this.$element[0].attributes["data-id"].nodeValue); 3899 } 3900 }); 3901 elementorFrontend.hooks.addAction("frontend/element_ready/ha-table-of-contents.default", function ($scope) { 3902 elementorFrontend.elementsHandler.addHandler(HaTOC, { 3903 $element: $scope 3904 }); 3905 }); 3906 3907 //creativeSlider 3908 var HaCreativeSlider = function HaCreativeSlider($scope) { 3909 var $rcContainer = $scope.find('.ha-creative-slider-container'); 3910 if ($rcContainer) { 3911 // var $haCsWidth = window.innerWidth; 3912 var $haCsWidth = $(window).width(); 3913 var $haCsNextSelector = parseInt($haCsWidth) <= 767 ? $rcContainer.find('.ha_cs_mobile_next') : $rcContainer.find('.ha_cc_next_wrapper'); 3914 var $haCsPrevSelector = parseInt($haCsWidth) <= 767 ? $rcContainer.find('.ha_cs_mobile_prev') : $rcContainer.find('.ha_cc_prev_wrapper'); 3915 var csTextItemDelay = parseInt($haCsWidth) <= 767 ? 40 : 30; 3916 var csImageItemDelay = 40; 3917 var csPrevItemsOwl = $rcContainer.find('.ha_cc_prev_items'); 3918 var csTextItemsOwl = $rcContainer.find('.ha_cc_text_items'); 3919 var csImageItemsOwl = $rcContainer.find('.ha_cc_inner_image_items'); 3920 var csNextItemsOwl = $rcContainer.find('.ha_cc_next_items'); 3921 var csPrevNavOptions = { 3922 loop: true, 3923 dots: false, 3924 nav: false, 3925 items: 1, 3926 autoplay: false, 3927 smartSpeed: 500, 3928 touchDrag: false, 3929 mouseDrag: false, 3930 rewind: true, 3931 startPosition: -1 3932 }; 3933 var csNextNavOptions = { 3934 loop: true, 3935 dots: false, 3936 nav: false, 3937 items: 1, 3938 autoplay: false, 3939 smartSpeed: 500, 3940 touchDrag: false, 3941 mouseDrag: false, 3942 rewind: true, 3943 startPosition: 1 3944 }; 3945 var csGeneralOptions = { 3946 loop: true, 3947 dots: false, 3948 nav: false, 3949 items: 1, 3950 autoplay: false, 3951 smartSpeed: 1000, 3952 touchDrag: false, 3953 mouseDrag: false, 3954 singleItem: true, 3955 animateOut: 'fadeOutRight', 3956 animateIn: 'fadeInLeft', 3957 rewind: true 3958 }; 3959 } 3960 csPrevItemsOwl.owlCarousel(csPrevNavOptions); 3961 csNextItemsOwl.owlCarousel(csNextNavOptions); 3962 csTextItemsOwl.owlCarousel(csGeneralOptions); 3963 csImageItemsOwl.owlCarousel(csGeneralOptions); 3964 window.parent.addEventListener('message', function (e) { 3965 if ('ha_cs_reinit' == e.data) { 3966 csTextItemsOwl.owlCarousel('refresh'); 3967 csImageItemsOwl.owlCarousel('refresh'); 3968 } 3969 }); 3970 $($haCsPrevSelector).click(function (e) { 3971 e.preventDefault(); 3972 csPrevItemsOwl.trigger('prev.owl.carousel'); 3973 csNextItemsOwl.trigger('prev.owl.carousel'); 3974 setTimeout(function () { 3975 csTextItemsOwl.trigger('prev.owl.carousel'); 3976 }, csTextItemDelay); 3977 setTimeout(function () { 3978 csImageItemsOwl.trigger('prev.owl.carousel'); 3979 }, csTextItemDelay + csImageItemDelay); 3980 }); 3981 $($haCsNextSelector).click(function (e) { 3982 e.preventDefault(); 3983 csPrevItemsOwl.trigger('next.owl.carousel'); 3984 csNextItemsOwl.trigger('next.owl.carousel'); 3985 setTimeout(function () { 3986 csTextItemsOwl.trigger('next.owl.carousel'); 3987 }, csTextItemDelay); 3988 setTimeout(function () { 3989 csImageItemsOwl.trigger('next.owl.carousel'); 3990 }, csTextItemDelay + csImageItemDelay); 3991 }); 3992 }; 3993 elementorFrontend.hooks.addAction('frontend/element_ready/ha-creative-slider.default', HaCreativeSlider); 3994 3995 //Advanced Comparison Table 3996 var AdvancedComparisonTable = function AdvancedComparisonTable($scope) { 3997 var nav = $scope.find('ul.ha-adct-table-responsive-nav'); 3998 var rows = $scope.find(".ha-adct-row, .ha-adct-child-row"); 3999 var collapse = $scope.find(".ha-adct-collapse-icon-wrap"); 4000 4001 // console.log(rows); 4002 4003 var pos = 2; 4004 nav.on("click", "li", function () { 4005 var pos = $(this).index() + 2; 4006 // console.log( pos ); 4007 4008 rows.find(".ha-adct-column:not(:eq(0))").hide(); 4009 $scope.find(".ha-adct-column:nth-child(" + pos + ")").css("display", "flex"); 4010 nav.find("li").removeClass("active"); 4011 $(this).addClass("active"); 4012 }); 4013 collapse.on("click", function () { 4014 var row_wrap = $(this).closest('.ha-adct-row-wrap'); 4015 // console.log( row_wrap ); 4016 $(this).toggleClass('open'); 4017 row_wrap.find('.ha-adct-child-row-wrap').slideToggle("slow"); 4018 // row_wrap.find('.ha-adct-child-row-wrap .ha-adct-column').slideToggle("slow"); 4019 // $('.ha-adct-heading').slideToggle("slow"); 4020 }); 4021 4022 // Initialize the media query 4023 //var mediaQuery = window.matchMedia("(min-width: 767px)"); 4024 // console.log(mediaQuery); 4025 var mode = $('body').attr('data-elementor-device-mode'); 4026 var w_width = $(window).outerWidth(true); 4027 function hideAndShowColumn(mode) { 4028 if ('tablet' == mode || 'mobile_extra' == mode || 'mobile' == mode) { 4029 rows.find(".ha-adct-column:not(:eq(0))").hide(); 4030 $scope.find(".ha-adct-column:nth-child(" + pos + ")").css("display", "flex"); 4031 } else { 4032 rows.find(".ha-adct-column").removeAttr("style"); 4033 } 4034 } 4035 ; 4036 hideAndShowColumn(mode); 4037 $(window).on('resize', function (e) { 4038 var mode = $('body').attr('data-elementor-device-mode'); 4039 var w_resize_width = $(window).outerWidth(true); 4040 if (w_width != w_resize_width) { 4041 w_width = w_resize_width; 4042 hideAndShowColumn(mode); 4043 } 4044 }); 4045 }; 4046 elementorFrontend.hooks.addAction('frontend/element_ready/ha-advanced-comparison-table.default', AdvancedComparisonTable); 4047 4048 //Title Tips 4049 var TitleTips = function TitleTips($scope) { 4050 var element = $scope.find('.ha-flip-box-inner'); 4051 var items = $scope.find('.ha-title-tips-hover li > a'); 4052 var rect = $scope.find('.ha-title-tips-hover')[0].getBoundingClientRect(); 4053 if ($scope.find('.ha-title-tips-hover').hasClass('swap')) { 4054 var wrapper = $scope.find('.ha-title-tips-hover'); 4055 var anchor_item = $scope.find('.ha-title-tips-hover-item.have-image'); 4056 var figure = $scope.find('figure'); 4057 var Work = { 4058 _register: { 4059 hover: { 4060 active: !1, 4061 currentX: 0, 4062 currentY: 0, 4063 targetX: 0, 4064 targetY: 0 4065 } 4066 }, 4067 _init: function _init() { 4068 this._base(), this._events(); 4069 }, 4070 _base: function _base() { 4071 figure.find('img').each(function () { 4072 var item = $(this); 4073 // console.log( item.height() ); 4074 item.attr("height_ratio", item.height()); 4075 }); 4076 requestAnimationFrame(function () { 4077 Work._interaction.hover.move_image(); 4078 }); 4079 }, 4080 _events: function _events() { 4081 anchor_item.on("mouseenter", "a", function () { 4082 Work._interaction.hover.image($(this)); 4083 }); 4084 anchor_item.on("mouseleave", "a", function () { 4085 Work._interaction.hover.leave(); 4086 }); 4087 anchor_item.on("mousemove", "a", function (e) { 4088 Work._interaction.hover.move(e); 4089 }); 4090 }, 4091 _functions: { 4092 round: function round(e, t) { 4093 var t = void 0 === t ? 100 : Math.pow(10, t); 4094 return Math.round(e * t) / t; 4095 } 4096 }, 4097 _interaction: { 4098 hover: { 4099 image: function image(e) { 4100 e.parents("li").addClass("active").removeClass("not-selected").siblings().removeClass("active").addClass("not-selected"); 4101 if (!Work._register.hover.visible && (Work._register.hover.currentX || Work._register.hover.currentY)) { 4102 Work._register.hover.visible = !0; 4103 figure.addClass("visible"); 4104 } 4105 4106 // $img = $('#work-hover img[project="' + e.attr("href") + '"]');
4107 var $img = figure.find('img[data-filter-id="' + e.attr("data-filter-id") + '"]'); 4108 $img.addClass("active").siblings(".active").removeClass("active").addClass("was-active"); 4109 // console.log($img); 4110 // console.log($img.height()); 4111 // figure.get()[0].style.setProperty("--height_ratio", ( Math.floor(Math.random() * (500 - 150 + 1) ) + 150 ) + 'px' ); 4112 4113 // figure.get()[0].style.setProperty("--height_ratio", ( $img.height() ) + 'px' ); 4114 figure.get()[0].style.setProperty("--height_ratio", $img.attr("height_ratio") + 'px'); 4115 // .style.setProperty("--height_ratio", $img.attr("height_ratio")), 4116 4117 clearTimeout(figure.prop("leave")); 4118 clearTimeout(figure.prop("animate")); 4119 figure.addClass("animate").prop("animate", setTimeout(function () { 4120 figure.removeClass("animate").find("img.was-active").removeClass("was-active"); 4121 }, 400)); 4122 }, 4123 leave: function leave() { 4124 anchor_item.removeClass("active not-selected"); 4125 clearTimeout(figure.prop("leave")); 4126 clearTimeout(figure.prop("active")); 4127 figure.prop("leave", setTimeout(function () { 4128 // Work._register.hover.visible = !1; 4129 Work._register.hover.visible = false; 4130 figure.removeClass("visible"); 4131 }, 1)); 4132 figure.prop("active", setTimeout(function () { 4133 Work._register.hover.active = !1; 4134 }, 2e3)); 4135 }, 4136 move: function move(e) { 4137 var currentReact = e.currentTarget.getBoundingClientRect(); 4138 var currentWrapperReact = wrapper.get()[0].getBoundingClientRect(); 4139 var targetMiddle = currentReact.top + currentReact.height / 2; 4140 Work._register.hover.active || (Work._register.hover.active = !0, requestAnimationFrame(function () { 4141 Work._interaction.hover.move_image(); 4142 }), clearTimeout(figure.prop("active")), figure.prop("active", setTimeout(function () { 4143 Work._register.hover.active = !1; 4144 }, 2e3))); 4145 // var react = $("#work-projects").get()[0].getBoundingClientRect(); 4146 var s = 0; 4147 var targetItem = anchor_item.find('a').offset().left - 40; 4148 if ($scope.hasClass('ha_title_tips_img_pos--left')) { 4149 // Work._register.hover.targetX = currentReact.left - figure.width(); // for left side 4150 Work._register.hover.targetX = -(figure.width() + 10); // for left side 4151 } else { 4152 Work._register.hover.targetX = currentReact.width + 10; // for right side 4153 } 4154 // Work._register.hover.targetY = targetMiddle; 4155 Work._register.hover.targetY = e.pageY - (currentWrapperReact.top + window.scrollY); 4156 if (!Work._register.hover.visible && (Work._register.hover.currentX || Work._register.hover.currentY)) { 4157 Work._register.hover.visible = true; 4158 figure.addClass("visible"); 4159 } 4160 }, 4161 move_image: function move_image() { 4162 if (figure.length) { 4163 Work._register.hover.currentX += (Work._register.hover.targetX - Work._register.hover.currentX) * 0.09; 4164 Work._register.hover.currentY += (Work._register.hover.targetY - Work._register.hover.currentY) * 0.09; 4165 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)"); 4166 if (Work._register.hover.active) { 4167 requestAnimationFrame(function () { 4168 Work._interaction.hover.move_image(); 4169 }); 4170 } 4171 } 4172 } 4173 } 4174 } 4175 }; 4176 Work._init(); 4177 } 4178 }; 4179 elementorFrontend.hooks.addAction('frontend/element_ready/ha-title-tips.default', TitleTips); 4180 4181 // Loop Tab 4182 var LoopTabBase = elementorModules.frontend.handlers.Base.extend({ 4183 onInit: function onInit() { 4184 elementorModules.frontend.handlers.Base.prototype.onInit.apply(this, arguments); 4185 this.wrapper = this.$element.find(".ha-loop-tab-wrapper"); 4186 this.run(); 4187 }, 4188 onElementChange: debounce(function (changedProp) { 4189 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']; 4190 if ($keys.indexOf(changedProp) !== -1) { 4191 this.run(); 4192 } 4193 }, 300), 4194 getReadySettings: function getReadySettings() { 4195 var settings = {}; 4196 var tab_action = this.getElementSettings('tab_action'); 4197 if (tab_action) settings.tab_action = tab_action; 4198 var tab_transition_delay = this.getElementSettings('tab_transition_delay'); 4199 if (tab_transition_delay) settings.tab_transition_delay = tab_transition_delay; 4200 var item_width = this.getElementSettings('tab_nav_item_width'); 4201 if (item_width) settings.item_width = item_width['size']; 4202 var item_height = this.getElementSettings('tab_nav_item_height'); 4203 if (item_height) settings.item_height = item_height['size']; 4204 var stroke_ry = this.getElementSettings('tab_nav_item_border_radius'); 4205 if (stroke_ry) settings.stroke_ry = stroke_ry['size']; 4206 var stroke_width = this.getElementSettings('tab_nav_item_stroke_width'); 4207 if (stroke_width) settings.stroke_width = stroke_width['size']; 4208 return $.extend({}
4208, this.getSettings(), settings); 4209 }, 4210 run: function run() { 4211 var settings = this.getReadySettings(); 4212 var currentIndex = 0; 4213 var isHovered = false; 4214 var nextIndex = 1; 4215 var animationInProgress = false; 4216 var pillBorderAnim = undefined; 4217 var hoverMode = settings.tab_action === 'on_hover'; 4218 var $wrapper = this.wrapper; 4219 var tabs = $wrapper.find(".ha-loop-tab-nav-item"); 4220 var contents = $wrapper.find(".ha-loop-tab_content"); 4221 var animationTime = settings.tab_transition_delay || 8000; 4222 var itemWidth = settings.item_width || 280; 4223 var itemHeight = settings.item_height && settings.item_height >= 45 ? settings.item_height : settings.item_height ? 45 : 65; 4224 var maxRY = parseFloat(itemHeight / 2); 4225 var strokeRY = settings.stroke_ry >= maxRY ? maxRY : settings.stroke_ry; 4226 var strokeWidth = settings.stroke_width || 2; 4227 var initialBgColor = ''; 4228 var parentElement = $wrapper.parents('.e-parent'); 4229 if (parentElement.length > 0) { 4230 parentElement.css({ 4231 position: 'relative', 4232 overflow: 'inherit' 4233 }); 4234 4235 // Append background containers for each tab 4236 tabs.each(function (idx, tab) { 4237 var bgColor = $(tab).attr('container-bgcolors'); 4238 initialBgColor = idx === 0 && bgColor ? JSON.parse(bgColor) : ''; 4239 parentElement.append("<div class=\"ha-loop-tab-bgcontainer ha-loop-tab-bgcontainer-".concat(idx, "\" style=\"background:").concat(JSON.parse(bgColor), ";\"></div>")); 4240 if (initialBgColor != '') { 4241 $(".ha-loop-tab-bgcontainer-".concat(currentIndex)).addClass("ha-loop-tab-active-bg"); 4242 } 4243 }); 4244 } 4245 4246 // Hadling HoverMode of mobile devices 4247 window.addEventListener("resize", function () { 4248 if (window.innerWidth <= 767) { 4249 hoverMode = false; 4250 } else { 4251 hoverMode = settings.tab_action === 'on_hover'; 4252 } 4253 }); 4254 if (window.innerWidth <= 767) { 4255 hoverMode = false; 4256 } else { 4257 hoverMode = settings.tab_action === 'on_hover'; 4258 } 4259 4260 // Tab Navigation hadling 4261 var handleAnimationEnd = function handleAnimationEnd(targetIndex) { 4262 return function () { 4263 if (!animationInProgress) return; 4264 animationInProgress = false; 4265 4266 // Hide the SVG for the previous tab 4267 var previousTab = $(tabs[currentIndex]); 4268 if (previousTab.find('.tab-border')[0].width > 0) { 4269 var _previousTab$find$; 4270 previousTab.find('.tab-border').css({ 4271 visibility: "hidden", 4272 strokeDashoffset: (_previousTab$find$ = previousTab.find('.tab-border')[0]) === null || _previousTab$find$ === void 0 ? void 0 : _previousTab$find$.getTotalLength() 4273 }); 4274 } 4275 activateTab(targetIndex); 4276 4277 // Hide the SVG for the active tab 4278 var activeTab = $(tabs[targetIndex]); 4279 activeTab.find('.tab-border').css({ 4280 visibility: "hidden" 4281 }); 4282 4283 // Only for mobile device 4284 smoothScrollTabs(tabs[targetIndex]); 4285 4286 // Add unique class to the corresponding background container 4287 $(".ha-loop-tab-bgcontainer").removeClass("ha-loop-tab-active-bg"); 4288 $(".ha-loop-tab-bgcontainer-".concat(targetIndex)).addClass("ha-loop-tab-active-bg"); 4289 requestAnimationFrame(function () { 4290 startSvgAnimation((targetIndex + 1) % tabs.length); 4291 }); 4292 }; 4293 }; 4294 4295 // Tab animation handling 4296 var startSvgAnimation = function startSvgAnimation(index) { 4297 if (hoverMode || animationInProgress) return; 4298 tabs.removeClass("filling"); 4299 var $nextTab = $(tabs[index]); 4300 var svgElement = $nextTab.find('.tab-svg')[0]; 4301 if (!svgElement) return; 4302 if (window.innerWidth <= 767) { 4303 svgElement.setAttribute('width', 130); 4304 svgElement.setAttribute('height', 55); 4305 svgElement.setAttribute('viewBox', "0 0 130 55"); 4306 svgElement.style.width = 130 + 'px'; 4307 svgElement.style.height = 55 + 'px'; 4308 } else { 4309 svgElement.setAttribute('width', itemWidth); 4310 svgElement.setAttribute('height', itemHeight + 2); 4311 svgElement.setAttribute('viewBox', "0 0 ".concat(itemWidth, " ").concat(itemHeight)); 4312 svgElement.style.height = itemHeight + 2 + 'px'; 4313 } 4314 var borderElement = $nextTab.find('.tab-border')[0]; 4315 if (!borderElement) return; 4316 4317 // Make SVG visible only when animation starts 4318 $nextTab.find('.tab-border').css("visibility", "visible"); 4319 if (borderElement.getBBox().width !== 0) { 4320 if (window.innerWidth <= 767) { 4321 strokeWidth = 2; 4322 borderElement.style.width = 127 + 'px'; 4323 borderElement.style.height = 52 + 'px'; 4324 borderElement.style.x = 1; 4325 borderElement.style.y = 1; 4326 borderElement.setAttribute('x', 1); 4327 borderElement.setAttribute('y', 1); 4328 borderElement.setAttribute('rx', 26); 4329 borderElement.setAttribute('ry', 26); 4330 4331 // Set styles 4332 borderElement.style.rx = 26; 4333 borderElement.style.ry = 26; 4334 } else { 4335 // Set attr 4336 if (strokeWidth > 4) { 4337 borderElement.setAttribute('x', 3); 4338 borderElement.setAttribute('y', 3); 4339 } else if (strokeWidth > 2) { 4340 borderElement.setAttribute('x', 2); 4341 borderElement.setAttribute('y', 2); 4342 } else { 4343 borderElement.setAttribute('x', 1); 4344 borderElement.setAttribute('y', 1); 4345 } 4346 borderElement.setAttribute('rx', strokeRY); 4347 borderElement.setAttribute('ry', strokeRY); 4348 4349 // Set styles 4350 borderElement.style.rx = strokeRY; 4351 borderElement.style.ry = strokeRY; 4352 if (strokeWidth > 4) { 4353 borderElement.style.width = itemWidth - strokeWidth + 'px'; 4354 borderElement.style.height = itemHeight - strokeWidth + 'px'; 4355 borderElement.style.x = 3; 4356 borderElement.style.y = 3; 4357 } else if (strokeWidth > 2) { 4358 borderElement.style.width = itemWidth - 1 - strokeWidth + 'px'; 4359 borderElement.style.height = itemHeight - 2 + 'px'; 4360 borderElement.style.x = 2; 4361 } else { 4362 borderElement.style.width = itemWidth - 2 + 'px'; 4363 borderElement.style.height = itemHeight - 2 + 'px'; 4364 borderElement.style.x = 1; 4365 borderElement.style.y = 1; 4366 } 4367 } 4368 var length = borderElement.getTotalLength() + 5; 4369 borderElement.style.strokeDasharray = length.toString(); 4370 borderElement.style.strokeDashoffset = length.toString(); 4371 4372 // Create animation 4373 pillBorderAnim = borderElement.animate([{ 4374 strokeDashoffset: length, 4375 strokeWidth: strokeWidth 4376 }, { 4377 strokeDashoffset: 0, 4378 strokeWidth: strokeWidth, 4379 offset: 0.98, 4380 easing: "cubic-bezier(0.11, 0, 0.5, 0)" 4381 }, { 4382 strokeDashoffset: 0, 4383 strokeWidth: strokeWidth, 4384 easing: "ease-out" 4385 }], { 4386 duration: animationTime, 4387 delay: 0, 4388 fill: "forwards" 4389 }); 4390 } 4391 if (!pillBorderAnim) return; 4392 4393 // Ensure animation finishes correctly and triggers the next tab 4394 pillBorderAnim.onfinish = handleAnimationEnd(index); 4395 $nextTab.addClass("filling"); 4396 animationInProgress = true; 4397 nextIndex = index; 4398 }; 4399 var activateTab = function activateTab(index) { 4400 currentIndex = index; 4401 tabs.removeClass("active"); 4402 contents.removeClass("active"); 4403 $(tabs[index]).addClass("active"); 4404 $(contents[index]).addClass("active"); 4405 }; 4406 4407 // Hover handling 4408 tabs.hover(function () { 4409 if (window.innerWidth <= 767) return; 4410 if (hoverMode) { 4411 var index = $(this).index(); 4412 activateTab(index); 4413 // Update the active background container 4414 $(".ha-loop-tab-bgcontainer").removeClass("ha-loop-tab-active-bg"); 4415 $(".ha-loop-tab-bgcontainer-".concat(index)).addClass("ha-loop-tab-active-bg"); 4416 return; 4417 } 4418 isHovered = true; 4419 var $thisTab = $(this); 4420 var borderElement = $thisTab.find(".tab-border")[0]; 4421 4422 // Pause only if this tab is the one currently animating 4423 if ($thisTab.hasClass("filling") && borderElement && animationInProgress && pillBorderAnim) { 4424 pillBorderAnim.pause(); 4425 } 4426 }, function () { 4427 if (window.innerWidth <= 767) return; 4428 if (hoverMode) return; 4429 isHovered = false;
4430 var $thisTab = $(this); 4431 var borderElement = $thisTab.find(".tab-border")[0]; 4432 4433 // Resume only if this tab was animating 4434 if ($thisTab.hasClass("filling") && borderElement && animationInProgress && pillBorderAnim) { 4435 pillBorderAnim.play(); 4436 } 4437 }); 4438 4439 // Click handling 4440 tabs.click(function (e) { 4441 var clickedTab = $(e.currentTarget); 4442 var clickedIndex = clickedTab.index(); 4443 if (clickedIndex === currentIndex) return; 4444 4445 // Cancel any ongoing animation 4446 if (animationInProgress && pillBorderAnim) { 4447 pillBorderAnim.cancel(); 4448 animationInProgress = false; 4449 } 4450 4451 // Hide all SVGs before setting the new active one 4452 tabs.find(".tab-border").css({ 4453 visibility: "hidden", 4454 strokeDashoffset: function strokeDashoffset() { 4455 return this.getTotalLength(); 4456 } 4457 }); 4458 4459 // Activate the clicked tab 4460 activateTab(clickedIndex); 4461 4462 // Update the active background container 4463 $(".ha-loop-tab-bgcontainer").removeClass("ha-loop-tab-active-bg"); 4464 $(".ha-loop-tab-bgcontainer-".concat(clickedIndex)).addClass("ha-loop-tab-active-bg"); 4465 var nextTabIndex = (clickedIndex + 1) % tabs.length; 4466 setTimeout(function () { 4467 startSvgAnimation(nextTabIndex); 4468 }, 200); 4469 smoothScrollTabs(e.currentTarget); 4470 }); 4471 4472 // Double-click handling only applicable for mobile 4473 tabs.dblclick(function (e) { 4474 if (window.innerWidth > 767) return; 4475 var clickedTab = $(e.currentTarget); 4476 var clickedIndex = clickedTab.index(); 4477 animationInProgress = true; 4478 4479 // Stop all animations when double-clicked 4480 if (animationInProgress && pillBorderAnim) { 4481 pillBorderAnim.cancel(); 4482 } 4483 }); 4484 4485 // Only for mobile devices 4486 var smoothScrollTabs = function smoothScrollTabs(clickedTab) { 4487 if (window.innerWidth > 767) return; 4488 var container = $wrapper.find('.ha-loop-tab-nav')[0]; 4489 if (!container) return; 4490 var containerRect = container.getBoundingClientRect(); 4491 var itemRect = clickedTab.getBoundingClientRect(); 4492 var scrollPosition = container.scrollLeft + (itemRect.left - containerRect.left) - containerRect.width / 3 + itemRect.width / 3; 4493 container.scrollTo({ 4494 left: scrollPosition, 4495 behavior: 'smooth' 4496 }); 4497 }; 4498 4499 // Initial setup 4500 activateTab(0); 4501 startSvgAnimation(1); 4502 window.addEventListener("resize", function () { 4503 activateTab(0); 4504 startSvgAnimation(1); 4505 }); 4506 } 4507 }); 4508 4509 // Loop Tab 4510 elementorFrontend.hooks.addAction("frontend/element_ready/ha-loop-tab.default", function ($scope) { 4511 elementorFrontend.elementsHandler.addHandler(LoopTabBase, { 4512 $element: $scope 4513 }); 4514 }); 4515 var MultiScroll = function MultiScroll($scope) { 4516 var wrap = $scope.find(".ha-multi-scroll-wrap"); 4517 var wrap_inner = $scope.find(".ha-multi-scroll-inner"); 4518 var multi_id = $scope.data("id"); 4519 var multiscroll = $scope.find(".ha-multi-scroll-inner-" + multi_id); 4520 var is_editor = $scope.hasClass("elementor-element-edit-mode"); 4521 var options = wrap.data("settings"); 4522 var device_mode = $("body").attr("data-elementor-device-mode"); 4523 var $left_sections = $scope.find('.ms-left .ms-section'); 4524 var $right_sections = $scope.find('.ms-right .ms-section'); 4525 if (is_editor) { 4526 $(document).find('#multiscroll-nav').remove(); 4527 try { 4528 $.fn.multiscroll.destroy(); 4529 } catch (err) { 4530 console.log(err); 4531 } 4532 } 4533 var $settings = { 4534 loopBottom: options.loopBottom, 4535 loopTop: options.loopTop, 4536 anchors: options.anchors, 4537 navigation: options.dots, 4538 //Dot enable 4539 navigationTooltips: options.dotsTooltips, 4540 navigationPosition: options.dotsPosition + ' ' + options.dotsVertical, 4541 normalScrollElements: null, 4542 menu: options.menu,
4543 leftWidth: options.leftWidth, 4544 rightWidth: options.rightWidth, 4545 navigationInject: wrap_inner, 4546 paddingTop: 0, 4547 paddingBottom: 0 4548 }; 4549 multiscroll.multiscroll($settings); 4550 function check_device(device_mode) { 4551 if (device_mode.includes("tablet") || device_mode.includes("mobile")) { 4552 $.fn.multiscroll.destroy(); 4553 $('html, body').css({ 4554 'overflow': 'visible', 4555 'height': 'auto' 4556 }); 4557 } else { 4558 $.fn.multiscroll.build(); 4559 $('html, body').css({ 4560 'overflow': 'hidden', 4561 'height': '100%' 4562 }); 4563 } 4564 } 4565 check_device(device_mode); 4566 if (is_editor && options.menu) { 4567 // If menu is enabled in editor mode 4568 $(options.menu).on('click', 'a', function (e) { 4569 e.preventDefault(); 4570 var target = $(this).parent().attr('data-menuanchor'); 4571 $.fn.multiscroll.moveTo(target); 4572 }); 4573 } 4574 $(window).on("resize", function () { 4575 var device_mode = $("body").attr("data-elementor-device-mode"); 4576 check_device(device_mode); 4577 }); 4578 }; 4579 elementorFrontend.hooks.addAction("frontend/element_ready/ha-multi-scroll.default", MultiScroll); 4580 var ScrollSequence = function ScrollSequence($scope) { 4581 // For Scroll Sequence editor mode 4582 var get_ID = sessionStorage.getItem('haScrollSequenceChangeApply'); 4583 if (get_ID && get_ID == $scope.data('id')) { 4584 $scope.trigger("click"); 4585 $("body,html,document").scrollTop($scope.offset().top); // for scroll to the widget top 4586 sessionStorage.removeItem('haScrollSequenceChangeApply'); 4587 } // For Scroll Sequence editor mode end 4588 4589 var element = $scope.find('.ha-scroll-sequence-wrap'); 4590 if (!element.length) return; 4591 var settings = element.data('settings'), 4592 canvas_wrap = element.find('.ha-scroll-sequence-canvas-wrap'), 4593 is_editor = $scope.hasClass("elementor-element-edit-mode"), 4594 apply_to = settings.apply_to, 4595 target_wrap = '.ha-scroll-sequence-canvas--' + settings.widget_id + ' .ha-scroll-sequence-canvas-wrap-inner', 4596 image_links = [], 4597 folder_path = '', 4598 name_prefix = '', 4599 number_format = 1, 4600 image_type = 'jpg', 4601 total_image = 0, 4602 parent_wrapper, 4603 contid, 4604 containerSS; 4605 if ("gallery" == settings.image_source) { 4606 image_links = settings.images; 4607 } else if ("server" == settings.image_source) { 4608 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); 4609 } 4610 canvas_wrap.remove(); 4611 if ('body' == apply_to) { 4612 parent_wrapper = $(document).find('body'); 4613 containerSS = "body"; 4614 } else if ('container' == apply_to) { 4615 parent_wrapper = $scope.closest('.e-con'); 4616 contid = parent_wrapper.data('id'); 4617 containerSS = ".elementor-element-" + contid; 4618 } else if ('section' == apply_to) { 4619 parent_wrapper = $scope.closest('.elementor-section'); 4620 contid = parent_wrapper.data('id'); 4621 containerSS = ".elementor-element-" + contid; 4622 } else if ('column' == apply_to) { 4623 parent_wrapper = $scope.closest('.elementor-column'); 4624 if (parent_wrapper) { 4625 contid = parent_wrapper.data('id'); 4626 containerSS = ".elementor-element-" + contid; 4627 } 4628 } 4629 if (is_editor) { 4630 try { 4631 parent_wrapper.find('.ha-scroll-sequence-canvas-wrap').remove(); 4632 } catch (err) { 4633 console.log(err); 4634 } 4635 } 4636 parent_wrapper.prepend(canvas_wrap); 4637 $(target_wrap).HappySequencer({ 4638 links: image_links, 4639 // Folder where the images are stored 4640 count: total_image // Number of frames (0 to 50 = 51 frames total) 4641 }, function () { 4642 //console.log('All frames loaded.'); 4643 }); 4644 function createImageLink(folder_path, name_prefix, number_format, image_type, total_image) { 4645 var imgGallery = []; 4646 if (!isNaN(number_format) && folder_path !== '' && total_image && ['jpg', 'png', 'webp'].includes(image_type)) { 4647 for (var i = 1; i <= total_image; i++) { 4648 var paddedNumber = i.toString().padStart(number_format, '0'); 4649 var imgUrl = "".concat(folder_path, "/").concat(name_prefix).concat(pad
4649dedNumber, ".").concat(image_type); 4650 imgGallery.push(imgUrl); 4651 } 4652 } 4653 return imgGallery; 4654 } 4655 }; 4656 elementorFrontend.hooks.addAction('frontend/element_ready/ha-scroll-sequence.default', ScrollSequence); 4657 var ScrollTabs = function ScrollTabs($scope) { 4658 content_1(); 4659 function content_1() { 4660 var contentwrap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.ha-scroll-tab-content-wrapper'; 4661 var navItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.ha-scroll-tab-nav-item'; 4662 var $contentWrapper = $scope.find('.ha-scroll-tab-content-wrapper'); 4663 var totalInnerSection = $contentWrapper.find('.ha-scroll-tab-content-section').length; 4664 var $navItems = $scope.find('.ha-scroll-tab-nav-item'); 4665 // const sectionHeight = 668; 4666 var sectionHeight = $contentWrapper.height(); 4667 var isScrolling = false; 4668 var isAnimating = false; 4669 // let scrollTimer = null; 4670 var animDuration = 10; 4671 var debounceTime = 200; 4672 4673 // Handle navigation item clicks 4674 $navItems.on('click', debounce(function () { 4675 var sectionIndex = parseInt($(this).data('section')); 4676 scrollToSection(sectionIndex); 4677 }, debounceTime)); 4678 4679 // Scroll to specific section 4680 function scrollToSection(sectionIndex) { 4681 isScrolling = true; 4682 isAnimating = true; 4683 var targetScroll = sectionIndex * sectionHeight; 4684 $contentWrapper.animate({ 4685 scrollTop: targetScroll 4686 }, animDuration, function () { 4687 isScrolling = false; 4688 isAnimating = false; 4689 // Ensure final state is correct after animation 4690 updateActiveStates(sectionIndex); 4691 }); 4692 } 4693 function getCurrentSection(deltaY, target) { 4694 var sectionIndex = null; 4695 if (deltaY < 0) { 4696 if (target.hasClass('ha-scroll-tab-content-section')) { 4697 sectionIndex = parseInt(target.data('section')); 4698 } else if (target.closest('.ha-scroll-tab-content-section').length > 0) { 4699 sectionIndex = parseInt(target.closest('.ha-scroll-tab-content-section').data('section')); 4700 } 4701 } else if (deltaY > 0) { 4702 if (target.hasClass('ha-scroll-tab-content-section')) { 4703 sectionIndex = parseInt(target.data('section')); 4704 } else if (target.closest('.ha-scroll-tab-content-section').length > 0) { 4705 sectionIndex = parseInt(target.closest('.ha-scroll-tab-content-section').data('section')); 4706 } 4707 } 4708 return sectionIndex; 4709 } 4710 4711 // Update active states for navigation 4712 function updateActiveStates(activeIndex) { 4713 // Only update if not currently animating to prevent blinking and intermediate activations 4714 if (!isAnimating) { 4715 $navItems.removeClass('active'); 4716 $navItems.filter("[data-section=\"".concat(activeIndex, "\"]")).addClass('active'); 4717 } 4718 } 4719 4720 // Handle scroll event on content wrapper 4721 $contentWrapper.on('scroll', debounce(function () { 4722 if (isScrolling || isAnimating) return; 4723 var scrollTop = $(this).scrollTop(); 4724 var currentSection = Math.round(scrollTop / sectionHeight); 4725 if (false == isAnimating) { 4726 isAnimating = true; 4727 var targetScroll = currentSection * sectionHeight; 4728 $contentWrapper.animate({ 4729 scrollTop: targetScroll 4730 }, animDuration, function () { 4731 isAnimating = false; 4732 updateActiveStates(currentSection); 4733 }); 4734 } 4735 4736 // Only update active states if not animating 4737 if (false == isAnimating) { 4738 updateActiveStates(currentSection); 4739 } 4740 }, debounceTime)); 4741 4742 // Handle wheel scrolling for smoother section transitions 4743 $contentWrapper.on('wheel', debounce(function (e) { 4744 var scrollTop = $(this).scrollTop(); 4745 var currentSection = Math.round(scrollTop / sectionHeight); 4746 var delta = e.originalEvent.deltaY; 4747 var maxScroll = $contentWrapper[0].scrollHeight - $contentWrapper.height(); 4748 var present = getCurrentSection(delta, $(e.target)); 4749 4750 // Allow normal page scroll when at top and scrolling up 4751 if (scrollTop <= 0 && delta < 0) { 4752 return; // Don't prevent default, allow page scroll 4753 } 4754 4755 // Allow normal page scroll when at bottom and scrolling down 4756 if (scrollTop >= maxScroll && delta > 0) { 4757 return; // Don't prevent default, allow page scroll 4758 } 4759 4760 // Custom section scrolling for middle content 4761 e.preventDefault(); 4762 var targetSection = currentSection; 4763 if (e.originalEvent.deltaY < 0) { 4764 // Scrolling up 4765 targetSection = 0 == present ? 0 : present - 1; 4766 } else if (e.originalEvent.deltaY > 0) { 4767 // Scrolling down 4768 targetSection = totalInnerSection - 0 == present ? present : present + 1; 4769 }
4770 if (targetSection !== currentSection && false == isAnimating) { 4771 scrollToSection(targetSection); 4772 // $contentWrapper.trigger( "scroll" ); 4773 } 4774 }, debounceTime)); 4775 4776 // Handle general page wheel scrolling to detect when over content wrapper 4777 $(document).on('wheel', debounce(function (e) { 4778 var $target = $(e.target); 4779 4780 // If scrolling over content wrapper or its children, let the content wrapper handle it 4781 if ($target.closest('.ha-scroll-tab-content-wrapper').length > 0) { 4782 return; 4783 } 4784 4785 // For other areas, allow normal page scrolling 4786 }, debounceTime)); 4787 } 4788 }; 4789 elementorFrontend.hooks.addAction('frontend/element_ready/ha-scroll-tabs.default', ScrollTabs); 4790 var advancedPricingTable = function advancedPricingTable($scope) { 4791 var currentIndex = 0; 4792 var table = $scope.find('.ha-adv-pricing-table-wrap'); 4793 var data = table.data('price-settings'); 4794 var tiers = data; 4795 4796 // console.log(tiers); 4797 // console.log(data); 4798 4799 function advancePrice(priceContainer, items) { 4800 contentManage(priceContainer, items, 0); 4801 priceContainer.find('.ha-adv-pricing-table-slider-dot').on('click', function () { 4802 // const index = $('.slider-dot').index(this); 4803 var index = priceContainer.find('.ha-adv-pricing-table-slider-dot').index(this); 4804 // setTier(index); 4805 contentManage(priceContainer, items, index); 4806 var sliderContainer = priceContainer.find('.ha-adv-pricing-table-slider-container.style-1'); 4807 //console.log(sliderContainer); 4808 if (0 < sliderContainer.length) { 4809 sliderControl(sliderContainer, items, index); 4810 } 4811 }); 4812 var $style_1 = priceContainer.find('.ha-adv-pricing-table-slider-container.style-1'); 4813 if (0 < $style_1.length) { 4814 $style_1.find('input[type="range"]').on('input', function (e) { 4815 var value = parseInt($(this).val()); 4816 // setTier(value); 4817 contentManage(priceContainer, items, value); 4818 4819 // var sliderContainer = priceContainer.find('.ha-adv-pricing-table-slider-container.style-1'); 4820 //console.log($style_1); 4821 // if ( 0 < $style_1.length ) { 4822 sliderControl($style_1, items, value); 4823 // } 4824 }); 4825 } 4826 var $style_2 = priceContainer.find('.ha-adv-pricing-table-slider-container.style-2 input[type="range"]'); 4827 if (0 < $style_2.length) { 4828 $style_2.rangeslider({ 4829 polyfill: false, 4830 onInit: function onInit() { 4831 var range = ''; 4832 var $ruler = $('<div class="rangeslider__ruler" />'); 4833 var step = 1; 4834 // var i = 0; 4835 var i = this.min; 4836 while (i <= this.max) { 4837 range += i + ' '; 4838 i = i + step; 4839 } 4840 // $ruler[0].innerHTML = getRulerRange(this.min, this.max, 1); 4841 $ruler[0].innerHTML = range; 4842 this.$range.prepend($ruler); 4843 }, 4844 onSlide: function onSlide(position, value) { 4845 // console.log(position); 4846 //console.log(value); 4847 contentManage(priceContainer, items, value); 4848 } 4849 }); 4850 } 4851 var $style_3 = priceContainer.find('.ha-adv-pricing-table-slider-container.style-3'); 4852 if (0 < $style_3.length) { 4853 $style_3.find('input[type="range"]').on('input', function (e) { 4854 var value = parseInt($(this).val()); 4855 contentManage(priceContainer, items, value); 4856 simpleSliderControl($style_3, items, value); 4857 }); 4858 } 4859 var $style_4 = priceContainer.find('.ha-adv-pricing-table-slider-container.style-4'); 4860 if (0 < $style_4.length) { 4861 $style_4.find('input[type="range"]').on('input', function (e) { 4862 var value = parseInt($(this).val()); 4863 contentManage(priceContainer, items, value); 4864 simpleSliderControl($style_4, items, value); 4865 }); 4866 } 4867 var $style_5 = priceContainer.find('.ha-adv-pricing-table-slider-container.style-5'); 4868 if (0 < $style_5.length) { 4869 $style_5.find('input[type="range"]').on('input', function (e) { 4870 var value = parseInt($(this).val()); 4871 contentManage(priceContainer, items, value); 4872 simpleSliderControl($style_5, items, value); 4873 }); 4874 } 4875 } 4876 function contentManage(priceContainer, items, index) { 4877 var tier = items[index]; 4878 //console.log('Selected Tier:', tier); 4879 // Update text content 4880 priceContainer.find('[data-plan-name]').text(tier.plan_name); 4881 var priceDisplay = priceContainer.find('.ha-adv-pricing-table-price-display');
4882 priceDisplay.find('[data-currency]').text(tier.symbol); 4883 var price = priceDisplay.find('.ha-adv-pricing-table-current-price'); 4884 price.find('[data-price]').text(tier.price); 4885 // price.addClass('hm-super-btn-st-9'); 4886 4887 // currentIndex > index 4888 // price.css('animation', `haAdvPricingTableLetterroll cubic-bezier(0.4, 0, 0.2, 1) 0.5s`); 4889 // currentIndex > index ? price.css('animation', 'haAdvPricingTableLetterroll cubic-bezier(0.4, 0, 0.2, 1) 0.5s') : price.css('animation', 'haAdvPricingTableBackroll cubic-bezier(0.4, 0, 0.2, 1) 0.5s'); ha-adv-pricing-table-price-display 4890 4891 if (index > currentIndex) { 4892 priceDisplay.css('animation', "haAdvPricingTableLetterroll cubic-bezier(0.4, 0, 0.2, 1) 0.5s"); 4893 currentIndex = index; 4894 } 4895 if (index < currentIndex) { 4896 priceDisplay.css('animation', 'haAdvPricingTableBackroll cubic-bezier(0.4, 0, 0.2, 1) 0.5s'); 4897 currentIndex = index; 4898 } 4899 var t = setTimeout(function () { 4900 priceDisplay.removeAttr('style'); 4901 // .css('animation', ''); 4902 clearTimeout(t); 4903 }, 500); 4904 priceContainer.find('[data-price-period]').text(tier.period); 4905 //console.log(tier.plan_related_text); 4906 4907 if (tier.plan_related_text) { 4908 var plan_related = "<span>".concat(tier.plan_related_text, "</span>"); 4909 if (tier.plan_related_icon) { 4910 plan_related = "<i class=\"".concat(tier.plan_related_icon, "\"></i>") + plan_related; 4911 } 4912 priceContainer.find('[data-savings]').html(plan_related); 4913 priceContainer.find('[data-savings]').css('display', ''); 4914 } else { 4915 priceContainer.find('[data-savings]').css('display', 'none'); 4916 } 4917 // priceContainer.find('[data-savings]').text(tier.plan_related_text + '<i class="fas fa-check"></i>'); 4918 4919 priceContainer.find('[data-cta-button]').text(tier.button_text); 4920 // priceContainer.find('[data-cta-button]').attr('class', `ha-adv-pricing-table-btn ${tier.buttonClass}`); 4921 priceContainer.find('[data-cta-button]').attr(tier.button_attr); 4922 4923 // Update original price visibility .ha-adv-pricing-table-original-price 4924 var originalPriceEl = priceContainer.find('.ha-adv-pricing-table-original-price'); 4925 // const originalPriceEl = priceContainer.find('[data-original-price]'); 4926 if (tier.original_price) { 4927 originalPriceEl.css('display', ''); 4928 originalPriceEl.find('[data-original-price]').text("".concat(tier.original_price)); 4929 } else { 4930 originalPriceEl.css('display', 'none'); 4931 } 4932 4933 // Update features 4934 var featuresEle = priceContainer.find('[data-features]'); 4935 var features_list = ''; 4936 //featuresEle.html(`${tier.features_desc}`); 4937 4938 tier.features_desc.forEach(function (element) { 4939 features_list += "<li>"; 4940 if (element.icon) { 4941 features_list += "<i class=\"".concat(element.icon, "\"></i>"); 4942 } 4943 if (element.feature && !element.tooltip) { 4944 features_list += "<div class=\"ha-adv-pricing-table-feature-text\">".concat(element.feature, "</div>"); 4945 } 4946 if (element.tooltip) { 4947 features_list += "<div class=\"ha-adv-pricing-table-feature-text ha-adv-pricing-table-feature-tooltip\">".concat(element.feature, "<span class=\"ha-adv-pricing-table-feature-tooltip-text\">").concat(element.tooltip, "</span></div>"); 4948 } 4949 features_list += "</li>"; 4950 }); 4951 featuresEle.html("<ul>".concat(features_list, "</ul>")); 4952 } 4953 function sliderControl(sliderContainer, items, index) { 4954 var sliderTrack = sliderContainer.find('.ha-adv-pricing-table-slider-track'); 4955 var sliderThumb = sliderContainer.find('.ha-adv-pricing-table-slider-thumb'); 4956 var sliderDots = sliderContainer.find('.ha-adv-pricing-table-slider-dots-container'); 4957 4958 // Use the Pythagorean theorem to calculate the distance 4959 // const distance = Math.hypot(aX - bX, aY - bY); 4960 4961 var trackWidth = sliderTrack.outerWidth(); // 24 is thumb width 4962 var thumbWidth = sliderThumb.outerWidth(); 4963 var percentage = index / (items.length - 1) * 100; 4964 var position = percentage / 100 * (trackWidth - thumbWidth); 4965 // $sliderThumb.css('left', `${position}px`); 4966 4967 var withoutPointertrackWidth = trackWidth - 24; 4968 var width = withoutPointertrackWidth / (items.length - 1) * index; 4969 // const width = ((trackWidth / tiers.length) * (index + 1)); 4970 // $sliderThumb.css('left', `${position}px`); 4971 if (100 == percentage) { 4972 //$sliderThumb.css('width', `calc(${percentage}%`); 4973 // $sliderThumb.css('width', `calc(${width}%`); 4974 sliderThumb.css('width', "calc(".concat(width, "px + 24px")); 4975 } else if (0 == percentage) { 4976 //$sliderThumb.css('width', `calc(${percentage}% + 24px`); 4977 // $sliderThumb.css('width', `calc(${width}% + 24px`); 4978 sliderThumb.css('width', "calc(24px)"); 4979 } else { 4980 //$sliderThumb.css('width', `calc(${percentage}% + 12px`); 4981 // $sliderThumb.css('width', `calc(${width}% + 12px`); 4982 sliderThumb.css('width', "calc(".concat(width, "px + 24px")); 4983 // $sliderThumb.css('width', `calc(${width}px + 12px`); 4984 } 4985 // $sliderThumb.css('width', `${width}%`); 4986 4987 //console.log('value', index); 4988 //console.log('length', items.length); 4989 //console.log('percentage',percentage); 4990 //console.log('width',width); 4991 //console.log('trackWidth',trackWidth); 4992 //console.log('trackWidth',(trackWidth / 6)); 4993 //console.log('================='); 4994 4995 // Update slider dots 4996 sliderDots.find('.ha-adv-pricing-table-slider-dot').each(function (i) { 4997 $(this).toggleClass('active', i === index); 4998 }); 4999 } 5000 5001 // this is for simple slider style 3, 4, 5 5002 function simpleSliderControl(sliderContainer, items, index) { 5003 var rangeWrap = sliderContainer.find('.ha-adv-pricing-table-slider-range-wrap'); 5004 var sliderThumb = sliderContainer.find('.ha-adv-pricing-table-slider-range-thumb'); 5005 var dotsContainer = sliderContainer.find('.ha-adv-pricing-table-slider-dots-container'); 5006 // const textContainer = sliderContainer.find('.text-container'); 5007 5008 var rangerThumb = 20; 5009 if (sliderContainer.hasClass('style-4')) { 5010 rangerThumb = 24; 5011 } 5012 var rangeWrapWidth = rangeWrap.outerWidth(); // 24 is thumb width 5013 var thumbWidth = sliderThumb.outerWidth(); 5014 var percentage = index / (items.length - 1) * 100; 5015 5016 // const withoutPointertrackWidth = ( rangeWrapWidth - 24 ); 5017 var withoutPointertrackWidth = rangeWrapWidth - rangerThumb; 5018 var width = withoutPointertrackWidth / (items.length - 1) * index; 5019 if (100 == percentage) { 5020 sliderThumb.css('width', "calc(".concat(width, "px + ").concat(rangerThumb, "px")); 5021 } else if (0 == percentage) { 5022 sliderThumb.css('width', "calc(".concat(rangerThumb, "px)")); 5023 } else { 5024 sliderThumb.css('width', "calc(".concat(width, "px + ").concat(rangerThumb, "px")); 5025 } 5026 5027 // console.log('value', index); 5028 // console.log('length', items.length); 5029 // console.log('percentage',percentage); 5030 // console.log('width',width); 5031 // console.log('rangeWrapWidth',rangeWrapWidth); 5032 // console.log('rangeWrapWidth',(rangeWrapWidth / 6)); 5033 // console.log('================='); 5034 5035 // Update slider dots 5036 dotsContainer.find('div').each(function (i) { 5037 $(this).toggleClass('active', i === index); 5038 }); 5039 5040 // textContainer.find('div').each(function (i) { 5041 // $(this).toggleClass('active', i === index); 5042 // }); 5043 5044 // return; 5045 } 5046 advancePrice(table, tiers); 5047 }; 5048 elementorFrontend.hooks.addAction('frontend/element_ready/ha-advanced-pricing-table.default', advancedPricingTable); 5049 var SuperButton = function SuperButton($scope) { 5050 if (elementorFrontend.isEditMode()) { 5051 return; 5052 } 5053 var $btn_wrap = $scope.find('.ha-super-btn-stl-10'); 5054 if ($btn_wrap.length > 0) { 5055 var $btn = $btn_wrap.find('button'); 5056 $btn.on('click', function (e) { 5057 e.preventDefault(); 5058 $btn_wrap.toggleClass("open"); 5059 }); 5060 $(document).on('click', function (e) { 5061 if (e.target.closest(".ha-super-btn-stl-10")) { 5062 return; 5063 } 5064 if ($btn_wrap.hasClass("open")) { 5065 $btn_wrap.removeClass("open"); 5066 } 5067 }); 5068 $(window).on('scroll', function () { 5069 if ($btn_wrap.hasClass("open")) { 5070 $btn_wrap.removeClass("open"); 5071 } 5072 }); 5073 } 5074 }; 5075 elementorFrontend.hooks.addAction('frontend/element_ready/ha-super-button.default', SuperButton); 5076 }); 5077})(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.