1( function( $ ) { 2 3 var hotspotInterval = []; 4 var UAELLoginForm = UAELLoginForm || {}; 5 var hoverFlag = false; 6 var isElEditMode = false; 7 window.is_fb_loggedin = false; 8 var id = window.location.hash.substring( 1 ); 9 var pattern = new RegExp( "^[\\w\\-]+$" ); 10 var sanitize_input = pattern.test( id ); 11 12 /** 13 * Function to fetch widget settings. 14 */ 15 var getWidgetSettings = function ($element) { 16 var widgetSettings = {}, 17 modelCID = $element.data( 'model-cid' ); 18 19 if ( isElEditMode && modelCID ) { 20 var settings = elementorFrontend.config.elements.data[ modelCID ], 21 settingsKeys = elementorFrontend.config.elements.keys[ settings.attributes.widgetType || settings.attributes.elType ]; 22 23 jQuery.each( 24 settings.getActiveControls(), 25 function( controlKey ) { 26 if ( -1 !== settingsKeys.indexOf( controlKey ) ) { 27 widgetSettings[ controlKey ] = settings.attributes[ controlKey ]; 28 } 29 } 30 ); 31 } else { 32 widgetSettings = $element.data( 'settings' ) || {}; 33 } 34 35 return widgetSettings; 36 }; 37 38 /** 39 * Function for Before After Slider animation. 40 * 41 */ 42 var UAELBASlider = function( $element ) { 43 44 $element.css( 'width', '100%' ); 45 46 var closest_section = $element.closest('.elementor-section'); 47 if ( 0 != closest_section.length ) { 48 $element.css( 'height', ' ' ); 49 } 50 var closest_container = $element.closest('.e-con'); 51 if ( 0 != closest_container.length ) { 52 $element.css( 'height', '100%' ); 53 } 54 55 max = -1; 56 57 $element.find( "img" ).each(function() { 58 if( max < $(this).width() ) { 59 max = $(this).width(); 60 } 61 }); 62 63 $element.css( 'width', max + 'px' ); 64 } 65 66 /** 67 * Function for GF Styler select field. 68 * 69 */ 70 var WidgetUAELGFStylerHandler = function( $scope, $ ) { 71 72 if ( 'undefined' == typeof $scope ) 73 return; 74 75 // Check if any element with the class 'uael-gf-check-default-yes' exists in the document 76 if ( ! $scope.hasClass('uael-gf-check-default-yes')) { 77 const inputs = $scope.find(".gfield-choice-input, .ginput_container_consent input"); 78 79 inputs.each(function() { 80 const input = $(this); 81 82 input.on("focus", function() { 83 const label = $scope.find(`label[for="${this.id}"]`); 84 if (label.length) { 85 label.addClass("uael-gf-highlight-label"); 86 } 87 }); 88 89 input.on("blur", function() { 90 const label = $scope.find(`label[for="${this.id}"]`); 91 if (label.length) { 92 label.removeClass("uael-gf-highlight-label"); 93 } 94 }); 95 }); 96 } 97 98 var confirmation_div = $scope.find( '.gform_confirmation_message' ); 99 var form_title = $scope.find( '.uael-gf-form-title' ); 100 var form_desc = $scope.find( '.uael-gf-form-desc' ); 101 102 $scope.find('select:not([multiple])').each(function() { 103 var gfSelectField = $( this ); 104 if( gfSelectField.next().hasClass('chosen-container') ) { 105 gfSelectField.next().wrap( "<span class='uael-gf-select-custom'></span>" ); 106 } else { 107 gfSelectField.wrap( "<span class='uael-gf-select-custom'></span>" ); 108 } 109 }); 110 111 112 if( $scope.hasClass( 'uael-gf-ajax-yes' ) ){ 113 //AJAX form submission 114 jQuery( document ).on( 'gform_confirmation_loaded', function( event, formId ){ 115 // code to be trigger when confirmation page is loaded 116 form_title.hide(); 117 form_desc.hide(); 118 }); 119 } else { 120 //Hide the forms title and description after submit. 121 if( confirmation_div.length > 0 ){ 122 form_title.hide(); 123 form_desc.hide(); 124 } else { 125 form_title.show(); 126 form_desc.show(); 127 } 128 } 129 130 if( typeof gform !== 'undefined' ){ 131 gform.addAction( 'gform_input_change', function( elem ) { 132 if( $scope.find( '.gfield_radio .gchoice_button' ).length && ! $scope.hasClass( 'uael-gf-check-default-yes' ) && 'radio' == $scope.find( elem ).attr( 'type' ) ){ 133 if( $scope.find( elem ).parent().hasClass( 'uael-radio-active') ){ 134 $scope.find( elem ).parent().removeClass( 'uael-radio-active' ); 135 } else { 136 $scope.find( '.gchoice_button' ).removeClass( 'uael-radio-active' ); 137 $scope.find( elem ).parent().addClass( 'uael-radio-active' ); 138 } 139 } 140 }, 10, 3 ); 141 } 142 } 143
144 /** 145 * Function for Caldera Styler select field. 146 * 147 */ 148 var WidgetUAELCafStylerHandler = function( $scope, $ ) { 149 150 if ( 'undefined' == typeof $scope ) 151 return; 152 153 var cafSelectFields = $scope.find('select'); 154 cafSelectFields.wrap( "<div class='uael-caf-select-custom'></div>" ); 155 156 checkRadioField( $scope ); 157 158 $( document ).on( 'cf.add', function(){ 159 checkRadioField( $scope ); 160 }); 161 162 // Check if custom span exists after radio field. 163 function checkRadioField( $scope ) { 164 165 $scope.find('input:radio').each(function() { 166 167 var $this = $( this ); 168 169 var radioField = $this.next().hasClass('uael-caf-radio-custom'); 170 171 if( radioField ) { 172 return; 173 } else { 174 $this.after( "<span class='uael-caf-radio-custom'></span>" ); 175 } 176 177 }); 178 179 } 180 } 181 182 /** 183 * Function for CF7 Styler select field. 184 * 185 */ 186 var WidgetUAELCF7StylerHandler = function( $scope, $ ) { 187 188 if ( 'undefined' == typeof $scope ) 189 return; 190 191 const inputs = $scope.find(".wpcf7-checkbox input[type='checkbox'], .wpcf7-acceptance input[type='checkbox'], .wpcf7-radio input[type='radio']"); 192 193 inputs.each(function() { 194 const input = $(this); 195 196 input.on("focus", function() { 197 const label = input.closest(".wpcf7-list-item").find(".wpcf7-list-item-label").first(); 198 if (label.length) { 199 label.addClass("uael-cf7-highlight-label"); 200 } 201 }); 202 203 input.on("blur", function() { 204 const label = input.closest(".wpcf7-list-item").find(".wpcf7-list-item-label").first(); 205 if (label.length) { 206 label.removeClass("uael-cf7-highlight-label"); 207 } 208 }); 209 }); 210 var cf7SelectFields = $scope.find('select:not([multiple])'), 211 cf7Loader = $scope.find('span.ajax-loader'); 212 213 214 cf7SelectFields.wrap( "<span class='uael-cf7-select-custom'></span>" ); 215 216 cf7Loader.wrap( "<div class='uael-cf7-loader-active'></div>" ); 217 218 var wpcf7event = document.querySelector( '.wpcf7' ); 219 220 if( null !== wpcf7event ) { 221 wpcf7event.addEventListener( 'wpcf7submit', function( event ) { 222 var cf7ErrorFields = $scope.find('.wpcf7-not-valid-tip'); 223 cf7ErrorFields.wrap( "<span class='uael-cf7-alert'></span>" ); 224 }, false ); 225 } 226 227 } 228 229 /** 230 * Function for Fancy Text animation. 231 * 232 */ 233 var UAELFancyText = function() { 234 235 var id = $( this ).data( 'id' ); 236 var $this = $( this ).find( '.uael-fancy-text-node' ); 237 var animation = $this.data( 'animation' ); 238 var fancystring = $this.data( 'strings' ); 239 var nodeclass = '.elementor-element-' + id; 240 241 var typespeed = $this.data( 'type-speed' ); 242 var backspeed = $this.data( 'back-speed' ); 243 var startdelay = $this.data( 'start-delay' ); 244 var backdelay = $this.data( 'back-delay' ); 245 var loop = $this.data( 'loop' ); 246 var showcursor = $this.data( 'show_cursor' ); 247 var cursorchar = $this.data( 'cursor-char' ); 248 249 var speed = $this.data('speed'); 250 var pause = $this.data('pause'); 251 var mousepause = $this.data('mousepause'); 252 253 if ( 'type' == animation ) { 254 $( nodeclass + ' .uael-typed-main' ).typed({ 255 strings: fancystring, 256 typeSpeed: typespeed, 257 startDelay: startdelay, 258 backSpeed: backspeed, 259 backDelay: backdelay, 260 loop: loop, 261 showCursor: showcursor, 262 cursorChar: cursorchar, 263 }); 264 265 } else if ( 'slide' == animation ) { 266 $( nodeclass + ' .uael-fancy-text-slide' ).css( 'opacity', '1' ); 267 $( nodeclass + ' .uael-slide-main' ).vTicker('init', { 268 strings: fancystring, 269 speed: speed, 270 pause: pause, 271 mousePause: mousepause, 272 }); 273 } else { 274 275 UAELEffects._animateHeadline( 276 $( nodeclass ).find( '.uael-slide-main_ul' ), $this 277 ); 278 } 279 } 280 281 /** 282 * Hotspot Tooltip handler Function. 283 * 284 */ 285 var WidgetUAELHotspotHandler = function( $scope, $ ) { 286 287 if ( 'undefined' == typeof $scope ) { 288 return; 289 } 290 291 var id = $scope.data( 'id' ); 292 var $this = $scope.find( '.uael-hotspot-container' ); 293 var side = $this.data( 'side' ); 294 var trigger = $this.data( 'hotspottrigger' ); 295 var arrow = $this.data( 'arrow' ); 296 var distance = $this.data( 'distance' ); 297 var delay = $this.data( 'delay' ); 298 var animation = $this.data( 'animation' ); 299 var anim_duration = $this.data( 'animduration' ); 300 var uaelclass = 'uael-tooltip-wrap-' + id + ' uael-hotspot-tooltip'; 301 var zindex = $this.data( 'zindex' ); 302 var autoplay = $this.data( 'autoplay' ); 303 var repeat = $this.data( 'repeat' ); 304 var overlay = $this.data( 'overlay' ); 305 306 var length = $this.data( 'length' ); 307 var tour_interval = $this.data( 'tourinterval' ); 308 var action_autoplay = $this.data( 'autoaction' ); 309 var sid; 310 var scrolling = false;
311 var viewport_position = $this.data( 'hotspotviewport' ); 312 var tooltip_maxwidth = $this.data( 'tooltip-maxwidth' ); 313 var tooltip_minwidth = $this.data( 'tooltip-minwidth' ); 314 315 if( 'custom' == trigger ) { 316 passtrigger = 'click'; 317 } else { 318 passtrigger = trigger; 319 } 320 clearInterval( hotspotInterval[ id ] ); 321 322 // Declare & pass values to Tooltipster js function. 323 function tooltipsterCall( selector, triggerValue ) { 324 $( selector ).tooltipster({ 325 theme: ['tooltipster-noir', 'tooltipster-noir-customized'], 326 minWidth: tooltip_minwidth, 327 maxWidth: tooltip_maxwidth, 328 side : side, 329 trigger : triggerValue, 330 arrow : arrow, 331 distance : distance, 332 delay : delay, 333 animation : animation, 334 uaelclass : uaelclass, 335 zIndex : zindex, 336 interactive : true, 337 animationDuration : anim_duration, 338 }); 339 } 340 341 // Disable prev & next nav for 1st & last tooltip. 342 function tooltipNav() { 343 if( 'yes' != repeat ) { 344 $( ".uael-prev-" + id + '[data-tooltipid="1"]' ).addClass( "inactive" ); 345 $( ".uael-next-" + id + '[data-tooltipid="' + length + '"]' ).addClass( "inactive" ); 346 } 347 } 348 349 // Execute Tooltipster function 350 tooltipsterCall( '.uael-hotspot-main-' + id, trigger ); 351 352 // Tooltip execution for tour functionality. 353 function sectionInterval() { 354 355 hotspotInterval[ id ] = setInterval( function() { 356 var $open_hotspot_node = $( '.uael-hotspot-main-' + id + '.open' ); 357 sid = $open_hotspot_node.data( 'uaeltour' ); 358 359 if( ! hoverFlag ) { 360 $open_hotspot_node.trigger( 'click' ); 361 if( 'yes' == repeat ) { 362 if ( ! elementorFrontend.isEditMode() ) { 363 if( sid == length ) { 364 sid = 1; 365 } else { 366 sid = sid + 1; 367 } 368 $('.uael-hotspot-main-' + id + '[data-uaeltour="' + sid + '"]').trigger( 'click' ); 369 $( window ).on( 'scroll', checkScroll ); 370 371 function checkScroll() { 372 if( !scrolling ) { 373 scrolling = true; 374 (!window.requestAnimationFrame) ? setTimeout(updateSections, 300) : window.requestAnimationFrame(updateSections); 375 } 376 } 377 378 function updateSections() { 379 var halfWindowHeight = $(window).height()/2, 380 scrollTop = $(window).scrollTop(), 381 section = $scope.find( '.uael-hotspot-container' ); 382 383 if( ! (section.offset().top - halfWindowHeight < scrollTop ) && ( section.offset().top + section.height() - halfWindowHeight > scrollTop) ) { 384 } else { 385 var hotspot_main = $( '.uael-hotspot-main-' + id + '.open' ); 386 hotspot_main.tooltipster( 'close' ); 387 hotspot_main.removeClass( 'open' ); 388 clearInterval( hotspotInterval[ id ] ); 389 buttonOverlay(); 390 $( overlay_id ).show(); 391 } 392 scrolling = false; 393 } 394 } else { 395 if( sid < length ) { 396 sid = sid + 1; 397 $('.uael-hotspot-main-' + id + '[data-uaeltour="' + sid + '"]').trigger( 'click' ); 398 } 399 else if( sid == length ) { 400 clearInterval( hotspotInterval[ id ] ); 401 buttonOverlay(); 402 $( overlay_id ).show(); 403 } 404 } 405 406 } else if( 'no' == repeat ) { 407 if( sid < length ) { 408 sid = sid + 1; 409 $( '.uael-hotspot-main-' + id + '[data-uaeltour="' + sid + '"]' ).trigger( 'click' ); 410 } 411 else if( sid == length ) { 412 clearInterval( hotspotInterval[ id ] ); 413 buttonOverlay(); 414 $( overlay_id ).show(); 415 } 416 } 417 } 418 419 tour_interval = $( '.uael-hotspot-container' ).data( 'tourinterval' ); 420 tour_interval = parseInt( tour_interval ); 421 }, tour_interval ); 422 } 423 424 // Execute Tooltip execution for tour functionality 425 function tourPlay() { 426 427 clearInterval( hotspotInterval[ id ] ); 428 429 // Open previous tooltip on trigger 430 $( '.uael-prev-' + id ).off('click.prevtrigger').on( 'click.prevtrigger', function(e) { 431 clearInterval( hotspotInterval[ id ] ); 432 var sid = $(this).data( 'tooltipid' ); 433 if( sid <= length ) { 434 $( '.uael-hotspot-main-' + id + '[data-uaeltour="' + sid + '"]' ).trigger( 'click' ); 435 if( 'yes' == repeat ) { 436 if( sid == 1 ) { 437 sid = length + 1; 438 } 439 } 440 sid = sid - 1; 441 $( '.uael-hotspot-main-' + id + '[data-uaeltour="' + sid + '"]' ).trigger( 'click' ); 442 } 443 if( 'yes' == autoplay ) { 444 sectionInterval(); 445 } 446 }); 447 448 // Open next tooltip on trigger 449 $( '.uael-next-' + id ).off('click.nexttrigger').on( 'click.nexttrigger', function(e) { 450 clearInterval( hotspotInterval[ id ] ); 451 var sid = $(this).data( 'tooltipid' ); 452 if( sid <= length ) { 453 $( '.uael-hotspot-main-' + id + '[data-uaeltour="' + sid + '"]' ).trigger( 'click' ); 454 if( 'yes' == repeat ) { 455 if( sid == length ) { 456 sid = 0; 457 } 458 } 459 sid = sid + 1; 460 $( '.uael-hotspot-main-' + id + '[data-uaeltour="' + sid + '"]' ).trigger( 'click' ); 461 } 462 if( 'yes' == autoplay ) { 463 sectionInterval(); 464 } 465 }); 466 467 $( '.uael-tour-end-' + id ).off('click.endtour').on( 'click.endtour', function(e) { 468 clearInterval( hotspotInterval[ id ] ); 469 e.preventDefault(); 470 var hotspot_main = $( '.uael-hotspot-main-' + id + '.open' ); 471 hotspot_main.tooltipster( 'close' ); 472 hotspot_main.removeClass( 'open' ); 473 474 if( 'auto' == action_autoplay && 'yes' == autoplay ) { 475 $( '.uael-hotspot-main-' + id ).css( "pointer-events", "none" ); 476 } else { 477 buttonOverlay();
478 $( overlay_id ).show(); 479 } 480 }); 481 482 // Add & remove open class for tooltip. 483 $( '.uael-hotspot-main-' + id ).off('click.triggertour').on('click.triggertour', function(e) { 484 var $this = $(this); 485 if ( ! $this.hasClass('open') ) { 486 $this.tooltipster( 'open' ); 487 $this.addClass( 'open' ); 488 if( 'yes' == autoplay ) { 489 $this.css( "pointer-events", "visible" ); 490 $( '.uael-hotspot-main-' + id + '.open' ).on( 'mouseenter mouseleave', function(){ 491 hoverFlag = true; 492 }, function(){ 493 hoverFlag = false; 494 }); 495 } 496 } else { 497 $this.tooltipster( 'close' ); 498 $this.removeClass( 'open' ); 499 if( 'yes' == autoplay ) { 500 $this.css( "pointer-events", "none" ); 501 } 502 } 503 }); 504 505 //Initialy open first tooltip by default. 506 if( 'yes' == autoplay ) { 507 $( '.uael-hotspot-main-' + id ).css( "pointer-events", "none" ); 508 tooltipNav(); 509 $( '.uael-hotspot-main-' + id + '[data-uaeltour="1"]' ).trigger( 'click' ); 510 sectionInterval(); 511 } else if( 'no' == autoplay ) { 512 $( '.uael-hotspot-main-' + id ).css( "pointer-events", "none" ); 513 tooltipNav(); 514 $( '.uael-hotspot-main-' + id + '[data-uaeltour="1"]' ).trigger( 'click' ); 515 } 516 } 517 518 // Add button overlay when tour ends. 519 function buttonOverlay() { 520 if( 'custom' == trigger ) { 521 if( 'yes' == overlay ) { 522 if( 'yes' == autoplay ) { 523 var overlay_id = $scope.find( '.uael-hotspot-overlay' ); 524 var button_id = $scope.find( '.uael-overlay-button' ); 525 526 if( ! isElEditMode ) { 527 $( button_id ).off().on( 'click', function(e) { 528 $( overlay_id ).hide(); 529 tourPlay(); 530 }); 531 } 532 } 533 } else if( 'auto' == action_autoplay && 'yes' == autoplay ) { 534 if( ! isElEditMode ) { 535 536 // Create an Intersection Observer instance. 537 var observer = new IntersectionObserver(function(entries) { 538 entries.forEach(function(entry) { 539 // If the element is in the viewport 540 if (entry.isIntersecting) { 541 tourPlay(entry.target); // Call the 'tourPlay' function when the element enters the viewport 542 } 543 }); 544 }, { 545 root: null, // Use the viewport as the root 546 rootMargin: viewport_position + '%', // Adjust the margin to trigger at the desired viewport position 547 threshold: 0 // Trigger as soon as the element enters the viewport 548 }); 549 550 // Start observing the $this element 551 observer.observe($this[0]); 552 } 553 } else { 554 tourPlay(); 555 } 556 } 557 } 558 559 // Start of hotspot functionality. 560 if( 'custom' == trigger ) { 561 562 var overlay_id = $scope.find( '.uael-hotspot-overlay' ); 563 buttonOverlay(); 564 } else { 565 clearInterval( hotspotInterval[ id ] ); 566 } 567 568 } 569 570 /** 571 * Price Table Tooltip handler Function. 572 * 573 */ 574 var WidgetUAELPriceTableHandler = function( $scope, $ ) { 575 576 if ( 'undefined' == typeof $scope ) { 577 return; 578 } 579 580 var id = $scope.data( 'id' ); 581 var $this = $scope.find( '.uael-price-table-features-list' ); 582 var side = $this.data( 'side' ); 583 var trigger = $this.data( 'hotspottrigger' ); 584 var arrow = $this.data( 'arrow' ); 585 var distance = $this.data( 'distance' ); 586 var delay = $this.data( 'delay' ); 587 var animation = $this.data( 'animation' ); 588 var anim_duration = $this.data( 'animduration' ); 589 var uaelclass = 'uael-price-table-wrap-' + id; 590 var uaelclassStrikeTooltip = 'uael-price-table-wrap-' + id; 591 var zindex = $this.data( 'zindex' ); 592 var length = $this.data( 'length' ); 593 var tooltip_maxwidth = $this.data( 'tooltip-maxwidth' ); 594 var tooltip_minwidth = $this.data( 'tooltip-minwidth' ); 595 var responsive = $this.data( 'tooltip-responsive' ); 596 var enable_tooltip = $this.data( 'enable-tooltip' ); 597 var pricing_container = $scope.find( '.uael-pricing-container' ); 598 var strike_tooltip = pricing_container.data( 'strike-tooltip' ); 599 var strike_tooltip_position = pricing_container.data( 'strike-tooltip-position' ); 600 var strike_tooltip_hide = pricing_container.data( 'strike-tooltip-hide' ); 601 602 uaelclass += ' uael-price-table-tooltip uael-features-tooltip-hide-' + responsive; 603 $this.addClass( 'uael-features-tooltip-hide-' + responsive ); 604 605 uaelclassStrikeTooltip += ' uael-strike-price-tooltip uael-strike-tooltip-hide-' + strike_tooltip_hide; 606 $this.addClass( 'uael-strike-tooltip-hide-' + strike_tooltip_hide ); 607 608 // Declare & pass values to Tooltipster js function. 609 function tableTooltipsterCall( selector, triggerValue ) { 610 $( selector ).tooltipster({ 611 theme: ['tooltipster-noir', 'tooltipster-noir-customized'], 612 minWidth: tooltip_minwidth, 613 maxWidth: tooltip_maxwidth, 614 side : side, 615 trigger : triggerValue, 616 arrow : arrow, 617 distance : distance, 618 delay : delay, 619 animation : animation, 620 zIndex : zindex, 621 interactive : true, 622 animationDuration : anim_duration, 623 uaelclass: uaelclass 624 }); 625 } 626 627 if( 'yes' === enable_tooltip ){ 628 // Execute Tooltipster function 629 tableTooltipsterCall( '.uael-price-table-content-' + id, trigger ); 630 } 631 632 if ( 'yes' === strike_tooltip ) { 633 $( '.uael-strike-tooltip' ).tooltipster( 634 { 635 theme: ['tooltipster-noir', 'tooltipster-noir-customized'], 636 side : strike_tooltip_position, 637 trigger : 'hover', 638 arrow : true, 639 distance : 6, 640 delay : 300, 641 animation : 'fade', 642 zIndex : 99, 643 interactive : true, 644 animationDuration : 350, 645 uaelclass: uaelclass 646 } 647 ); 648 } 649 } 650
651 /** 652 * Before After Slider handler Function. 653 * 654 */ 655 var WidgetUAELBASliderHandler = function( $scope, $ ) { 656 657 if ( 'undefined' == typeof $scope ) 658 return; 659 660 var selector = $scope.find( '.uael-ba-container' ); 661 var initial_offset = selector.data( 'offset' ); 662 var move_on_hover = selector.data( 'move-on-hover' ); 663 var orientation = selector.data( 'orientation' ); 664 665 $scope.css( 'width', '' ); 666 $scope.css( 'height', '' ); 667 668 if( 'yes' == move_on_hover ) { 669 move_on_hover = true; 670 } else { 671 move_on_hover = false; 672 } 673 674 $scope.imagesLoaded( function() { 675 676 UAELBASlider( $scope ); 677 678 $scope.find( '.uael-ba-container' ).twentytwenty( 679 { 680 default_offset_pct: initial_offset, 681 move_on_hover: move_on_hover, 682 orientation: orientation 683 } 684 ); 685 686 $( window ).on( 'resize', function( e ) { 687 UAELBASlider( $scope ); 688 } ); 689 } ); 690 }; 691 692 /** 693 * Fancy text handler Function. 694 * 695 */ 696 var WidgetUAELFancyTextHandler = function( $scope, $ ) { 697 698 if ( 'undefined' == typeof $scope ) { 699 return; 700 } 701 var node_id = $scope.data( 'id' ); 702 var selector = document.querySelector('.elementor-element-' + node_id); 703 704 if ( selector ) { 705 var observer = new IntersectionObserver(function(entries) { 706 entries.forEach(function(entry) { 707 if (entry.isIntersecting) { 708 UAELFancyText.call(selector); 709 observer.unobserve(selector); 710 } 711 }); 712 }, { 713 root: null, 714 threshold: 0.1 715 }); 716 717 observer.observe(selector); 718 } 719 720 }; 721 722 /** 723 * 724 * Timeline handler Function. 725 * 726 */ 727 var WidgetUAELTimelineHandler = function( $scope, $ ) { 728 729 if ( 'undefined' == typeof $scope ) 730 return; 731 732 // Define variables. 733 var $this = $scope.find( '.uael-timeline-node' ); 734 var timeline_main = $scope.find(".uael-timeline-main"); 735 736 if ( timeline_main.length < 1 ) { 737 return false; 738 } 739 740 var animate_border = $scope.find(".animate-border"); 741 var timeline_icon = $scope.find(".uael-timeline-marker"); 742 var line_inner = $scope.find(".uael-timeline__line__inner"); 743 var line_outer = $scope.find(".uael-timeline__line"); 744 var $icon_class = $scope.find(".uael-timeline-marker"); 745 var $card_last = $scope.find(".uael-timeline-field:last-child"); 746 747 var timeline_start_icon = $icon_class.first().position(); 748 var timeline_end_icon = $icon_class.last().position(); 749 750 line_outer.css('top', timeline_start_icon.top ); 751 752 var timeline_card_height = $card_last.height(); 753 754 var last_item_top = $card_last.offset().top - $this.offset().top; 755 756 var $last_item, parent_top; 757 758 if( $scope.hasClass('uael-timeline-arrow-center')) { 759 760 line_outer.css('bottom', timeline_end_icon.top ); 761 762 parent_top = last_item_top - timeline_start_icon.top; 763 $last_item = parent_top + timeline_end_icon.top; 764 765 } else if( $scope.hasClass('uael-timeline-arrow-top')) { 766 767 var top_height = timeline_card_height - timeline_end_icon.top; 768 line_outer.css('bottom', top_height ); 769 770 $last_item = last_item_top; 771 772 } else if( $scope.hasClass('uael-timeline-arrow-bottom')) { 773 774 var bottom_height = timeline_card_height - timeline_end_icon.top; 775 line_outer.css('bottom', bottom_height ); 776 777 parent_top = last_item_top - timeline_start_icon.top; 778 $last_item = parent_top + timeline_end_icon.top; 779 780 } 781 782 var elementEnd = $last_item + 20; 783 784 var initial_height = 0; 785 786 line_inner.height(initial_height); 787 788 var num = 0; 789 790 // Callback function for all event listeners. 791 function uaelTimelineFunc() { 792 timeline_main = $scope.find(".uael-timeline-main"); 793 if ( timeline_main.length < 1 ) { 794 return false; 795 } 796 797 var $document = $(document); 798 // Repeat code for window resize event starts. 799 timeline_start_icon = $icon_class.first().position(); 800 timeline_end_icon = $icon_class.last().position(); 801 802 $card_last = $scope.find(".uael-timeline-field").last(); 803 804 line_outer.css('top', timeline_start_icon.top ); 805 806 timeline_card_height = $card_last.height(); 807 808 last_item_top = $card_last.offset().top - $this.offset().top; 809 810 if( $scope.hasClass('uael-timeline-arrow-center')) { 811 812 line_outer.css('bottom', timeline_end_icon.top ); 813 parent_top = last_item_top - timeline_start_icon.top; 814 $last_item = parent_top + timeline_end_icon.top; 815 816 } else if( $scope.hasClass('uael-timeline-arrow-top')) { 817 818 var top_height = timeline_card_height - timeline_end_icon.top; 819 line_outer.css('bottom', top_height ); 820 $last_item = last_item_top; 821 822 } else if( $scope.hasClass('uael-timeline-arrow-bottom')) { 823 824 var bottom_height = timeline_card_height - timeline_end_icon.top; 825 line_outer.css('bottom', bottom_height ); 826 parent_top = last_item_top - timeline_start_icon.top; 827 $last_item = parent_top + timeline_end_icon.top; 828 } 829 elementEnd = $last_item + 20; 830 831 // Repeat code for window resize event ends. 832
833 var viewportHeight = document.documentElement.clientHeight; 834 var viewportHeightHalf = viewportHeight/2; 835 var elementPos = $this.offset().top; 836 var new_elementPos = elementPos + timeline_start_icon.top; 837 838 var photoViewportOffsetTop = new_elementPos - $document.scrollTop(); 839 840 if (photoViewportOffsetTop < 0) { 841 photoViewportOffsetTop = Math.abs(photoViewportOffsetTop); 842 } else { 843 photoViewportOffsetTop = -Math.abs(photoViewportOffsetTop); 844 } 845 846 if ( elementPos < (viewportHeightHalf) ) { 847 848 if ( (viewportHeightHalf) + Math.abs(photoViewportOffsetTop) < (elementEnd) ) { 849 line_inner.height((viewportHeightHalf) + photoViewportOffsetTop); 850 }else{ 851 if ( (photoViewportOffsetTop + viewportHeightHalf) >= elementEnd ) { 852 line_inner.height(elementEnd); 853 } 854 } 855 } else { 856 if ( (photoViewportOffsetTop + viewportHeightHalf) < elementEnd ) { 857 if (0 > photoViewportOffsetTop) { 858 line_inner.height((viewportHeightHalf) - Math.abs(photoViewportOffsetTop)); 859 ++num; 860 } else { 861 line_inner.height((viewportHeightHalf) + photoViewportOffsetTop); 862 } 863 } else { 864 if ( (photoViewportOffsetTop + viewportHeightHalf) >= elementEnd ) { 865 line_inner.height(elementEnd); 866 } 867 } 868 } 869 870 var timeline_icon_pos, timeline_card_pos; 871 var elementPos, elementCardPos; 872 var timeline_icon_top, timeline_card_top; 873 timeline_icon = $scope.find(".uael-timeline-marker"); 874 animate_border = $scope.find(".animate-border"); 875 876 for (var i = 0; i < timeline_icon.length; i++) { 877 878 timeline_icon_pos = $(timeline_icon[i]).offset().top; 879 timeline_card_pos = $(animate_border[i]).offset().top; 880 881 elementPos = $this.offset().top; 882 elementCardPos = $this.offset().top; 883 884 timeline_icon_top = timeline_icon_pos - $document.scrollTop(); 885 timeline_card_top = timeline_card_pos - $document.scrollTop(); 886 887 if ( ( timeline_card_top ) < ( ( viewportHeightHalf ) ) ) { 888 889 animate_border[i].classList.remove("out-view"); 890 animate_border[i].classList.add("in-view"); 891 892 } else { 893 // Remove classes if element is below than half of viewport. 894 animate_border[i].classList.add("out-view"); 895 animate_border[i].classList.remove("in-view"); 896 } 897 898 if ( ( timeline_icon_top ) < ( ( viewportHeightHalf ) ) ) { 899 900 // Add classes if element is above than half of viewport. 901 timeline_icon[i].classList.remove("out-view-timeline-icon"); 902 timeline_icon[i].classList.add("in-view-timeline-icon"); 903 904 } else { 905 906 // Remove classes if element is below than half of viewport. 907 timeline_icon[i].classList.add("out-view-timeline-icon"); 908 timeline_icon[i].classList.remove("in-view-timeline-icon"); 909 910 } 911 } 912 913 } 914 // Listen for events. 915 window.addEventListener("load", uaelTimelineFunc); 916 window.addEventListener("resize", uaelTimelineFunc); 917 window.addEventListener("scroll", uaelTimelineFunc); 918 window.addEventListener("click", function() { 919 uaelTimelineFunc(); 920 }); 921 922 var post_selector = $scope.find( '.uael-days' ); 923 924 var node_id = $scope.data( 'id' ); 925 926 if ( post_selector.hasClass( 'uael-timeline-infinite-load' ) ) { 927 928 $( window ).scroll( function(){ 929 $('.elementor-element-' + node_id + ' .uael-timeline-wrapper').jscroll({ 930 loadingHtml: '<img src="' + uael_post_loader_script.post_loader + '" />', 931 nextSelector: '#uael-timeline-' + node_id + ' a.next', 932 contentSelector: '.elementor-element-' + node_id + ' .uael-timeline-main', 933 callback: function() { 934 window.addEventListener("load", uaelTimelineFunc); 935 window.addEventListener("resize", uaelTimelineFunc); 936 window.addEventListener("scroll", uaelTimelineFunc); 937 } 938 }); 939 }); 940 941 } 942 }; 943 944 /* 945 * 946 * Radio Button Switcher JS Function. 947 * 948 */ 949 var WidgetUAELContentToggleHandler = function( $scope, $ ) { 950 951 if ( 'undefined' == typeof $scope ) { 952 return; 953 } 954 955 var rbs_section_1 = $scope.find( ".uael-rbs-section-1" ); 956 var rbs_section_2 = $scope.find( ".uael-rbs-section-2" ); 957 var main_btn = $scope.find( ".uael-main-btn" ); 958 var switch_type = main_btn.attr( 'data-switch-type' ); 959 var rbs_label_1 = $scope.find( ".uael-sec-1" ); 960 var rbs_label_2 = $scope.find( ".uael-sec-2" ); 961 var current_class; 962 963 switch ( switch_type ) { 964 case 'round_1': 965 current_class = '.uael-switch-round-1'; 966 break; 967 case 'round_2': 968 current_class = '.uael-switch-round-2'; 969 break; 970 case 'rectangle': 971 current_class = '.uael-switch-rectangle'; 972 break; 973 case 'label_box': 974 current_class = '.uael-switch-label-box'; 975 break; 976 default: 977 current_class = 'No Class Selected'; 978 break; 979 } 980 var rbs_switch = $scope.find( current_class ); 981 982 if( '' !== id && sanitize_input ){ 983 if ( id === 'content-1' || id === 'content-2' ) { 984 UAELContentToggle._openOnLink( $scope, rbs_switch ); 985 } 986 } 987 988 setTimeout( function(){ 989 990 if( rbs_switch.is( ':checked' ) ) { 991 rbs_section_1.hide();
992 rbs_section_2.show(); 993 } else { 994 rbs_section_1.show(); 995 rbs_section_2.hide(); 996 } 997 }, 100 ); 998 999 rbs_switch.on( 'click', function(e){ 1000 rbs_section_1.toggle(); 1001 rbs_section_2.toggle(); 1002 }); 1003 1004 /* Label 1 Click */ 1005 rbs_label_1.on( 'click', function(e){ 1006 // Uncheck 1007 rbs_switch.prop( "checked", false); 1008 rbs_section_1.show(); 1009 rbs_section_2.hide(); 1010 1011 }); 1012 1013 /* Label 2 Click */ 1014 rbs_label_2.on('click', function(e){ 1015 // Check 1016 rbs_switch.prop( "checked", true); 1017 rbs_section_1.hide(); 1018 rbs_section_2.show(); 1019 }); 1020 }; 1021 1022 UAELContentToggle = { 1023 /** 1024 * Open specific section on click of link 1025 * 1026 */ 1027 1028 _openOnLink: function( $scope, rbs_switch ){ 1029 1030 var node_id = $scope.data( 'id' ); 1031 var node = '.elementor-element-' + node_id; 1032 var node_toggle = '#uael-toggle-init' + node; 1033 1034 $( 'html, body' ).animate( { 1035 scrollTop: $( '#uael-toggle-init' ).find( '.uael-rbs-wrapper' ).offset().top 1036 }, 500 ); 1037 1038 if( id === 'content-1' ) { 1039 1040 $( node_toggle + ' .uael-rbs-content-1' ).show(); 1041 $( node_toggle + ' .uael-rbs-content-2' ).hide(); 1042 rbs_switch.prop( "checked", false ); 1043 } else { 1044 1045 $( node_toggle + ' .uael-rbs-content-2' ).show(); 1046 $( node_toggle + ' .uael-rbs-content-1' ).hide(); 1047 rbs_switch.prop( "checked", true ); 1048 } 1049 } 1050 } 1051 1052 /** 1053 * Video Gallery handler Function. 1054 * 1055 */ 1056 var WidgetUAELVideoGalleryHandler = function( $scope, $ ) { 1057 1058 if ( 'undefined' == typeof $scope ) { 1059 return; 1060 } 1061 1062 var selector = $scope.find( '.uael-video-gallery-wrap' ); 1063 var layout = selector.data( 'layout' ); 1064 var action = selector.data( 'action' ); 1065 var all_filters = selector.data( 'all-filters' ); 1066 var $tabs_dropdown = $scope.find('.uael-filters-dropdown-list'); 1067 1068 if ( selector.length < 1 ) { 1069 return; 1070 } 1071 1072 if ( 'lightbox' == action ) { 1073 $scope.find( '.uael-vg__play_full' ).fancybox(); 1074 } else if ( 'inline' == action ) { 1075 $scope.find( '.uael-vg__play_full' ).on( 'click', function( e ) { 1076 1077 e.preventDefault(); 1078 1079 var iframe = $( "<iframe/>" ); 1080 var $this = $( this ); 1081 var vurl = $this.data( 'url' ); 1082 var overlay = $this.closest( '.uael-video__gallery-item' ).find( '.uael-vg__overlay' ); 1083 var wrap_outer = $this.closest( '.uael-video__gallery-iframe' ); 1084 1085 iframe.attr( 'src', vurl ); 1086 iframe.attr( 'frameborder', '0' ); 1087 iframe.attr( 'allowfullscreen', '1' ); 1088 iframe.attr( 'allow', 'autoplay;encrypted-media;' ); 1089 1090 wrap_outer.html( iframe ); 1091 wrap_outer.attr( 'style', 'background:#000;' ); 1092 overlay.hide(); 1093 1094 } ); 1095 } 1096 1097 // If Carousel is the layout. 1098 if( 'carousel' == layout ) { 1099 1100 var slider_options = selector.data( 'vg_slider' ); 1101 1102 if ( selector.find( '.uael-video__gallery-iframe' ).imagesLoaded( { background: true } ) ) 1103 { 1104 selector.slick( slider_options ); 1105 } 1106 } 1107 1108 $( 'html' ).on( 'click', function() { 1109 $tabs_dropdown.removeClass( 'show-list' ); 1110 }); 1111 1112 $scope.on( 'click', '.uael-filters-dropdown-button', function(e) { 1113 e.stopPropagation(); 1114 $tabs_dropdown.addClass( 'show-list' ); 1115 }); 1116 1117 // If Filters is the layout. 1118 if( selector.hasClass( 'uael-video-gallery-filter' ) ) { 1119 1120 var filters = $scope.find( '.uael-video__gallery-filters' ); 1121 var def_cat = '*'; 1122 var filter_cat; 1123 1124 if( '' !== id && sanitize_input ) { 1125 var select_filter = filters.find("[data-filter='" + '.' + id.toLowerCase() + "']"); 1126 1127 if ( select_filter.length > 0 ) { 1128 def_cat = '.' + id.toLowerCase(); 1129 select_filter.siblings().removeClass( 'uael-filter__current' ); 1130 select_filter.addClass( 'uael-filter__current' ); 1131 } 1132 } 1133 1134 if ( filters.length > 0 ) { 1135 1136 var def_filter = filters.data( 'default' ); 1137 1138 if ( '' !== def_filter ) { 1139 1140 def_cat = def_filter; 1141 def_cat_sel = filters.find( '[data-filter="' + def_filter + '"]' ); 1142 1143 if ( def_cat_sel.length > 0 ) { 1144 def_cat_sel.siblings().removeClass( 'uael-filter__current' ); 1145 def_cat_sel.addClass( 'uael-filter__current' ); 1146 } 1147 1148 if ( all_filters.indexOf( def_cat.replace(/\./g, "") ) === -1) { 1149 def_cat = '*'; 1150 } 1151 } 1152 } 1153 1154 var $obj = {}; 1155 1156 selector.imagesLoaded( { background: '.item' }, function( e ) { 1157 1158 $obj = selector.isotope({ 1159 filter: def_cat, 1160 layoutMode: 'masonry', 1161 itemSelector: '.uael-video__gallery-item', 1162 }); 1163 1164 selector.find( '.uael-video__gallery-item' ).resize( function() { 1165 $obj.isotope( 'layout' ); 1166 }); 1167 }); 1168 1169 $scope.find( '.uael-video__gallery-filter' ).on( 'click', function() { 1170 1171 $( this ).siblings().removeClass( 'uael-filter__current' ); 1172 $( this ).addClass( 'uael-filter__current' ); 1173 1174 var value = $( this ).data( 'filter' ); 1175 1176 if( '*' === value ) { 1177 filter_cat = $scope.find('.uael-video-gallery-wrap').data('filter-default'); 1178 } else { 1179 filter_cat = value.replace( '.filter-', "" ); 1180 } 1181 1182 if( $scope.find( '.uael-video__gallery-filters' ).data( 'default' ) ){ 1183 var def_filter = $scope.find( '.uael-video__gallery-filters' ).data( 'default' ); 1184 var def_filter_length = def_filter.length - 8; 1185 } 1186 else{ 1187 var def_filter = $scope.find('.uael-video-gallery-wrap').data('filter-default'); 1188 var def_filter_length = def_filter.length; 1189 } 1190 var ajax_str_img_text = $scope.find( '.uael-filter__current' ).text(), 1191 ajax_str_filter_text = $scope.find( '.uael-filters-dropdown-list .uael-filter__current' ).text(), 1192 url = window.location.hash.replace( '#', '' ), 1193 str_replace_text = ajax_str_img_text.replace( ajax_str_filter_text,'' ), 1194 str_cat_text = ajax_str_img_text.replace( str_replace_text,'' );
1195 if( ( !url && ( window.screen.availWidth > 768 ) ) || url ){ 1196 str_cat_text = ajax_str_img_text.replace( ajax_str_filter_text,'' ); 1197 } 1198 if( url && ( window.screen.availWidth < 768 ) ){ 1199 str_cat_text = ajax_str_img_text.replace( str_replace_text,'' ); 1200 } 1201 1202 $scope.find( '.uael-filters-dropdown-button' ).text( str_cat_text ); 1203 selector.isotope( { filter: value } ); 1204 }); 1205 1206 if( $scope.find( '.uael-video__gallery-filters' ).data( 'default' ) ){ 1207 var def_filter = $scope.find( '.uael-video__gallery-filters' ).data( 'default' ); 1208 var def_filter_length = def_filter.length - 8; 1209 } 1210 else{ 1211 var def_filter = $scope.find('.uael-video-gallery-wrap').data('filter-default'); 1212 var def_filter_length = def_filter.length; 1213 } 1214 1215 var str_vid_text = $scope.find( '.uael-filter__current' ).first().text(); 1216 $scope.find( '.uael-filters-dropdown-button' ).text( str_vid_text ); 1217 } 1218 } 1219 1220 /* 1221 * Image Gallery handler Function. 1222 * 1223 */ 1224 var WidgetUAELImageGalleryHandler = function( $scope, $ ) { 1225 1226 if ( 'undefined' == typeof $scope ) { 1227 return; 1228 } 1229 1230 var $justified_selector = $scope.find('.uael-img-justified-wrap'); 1231 var row_height = $justified_selector.data( 'rowheight' ); 1232 var lastrow = $justified_selector.data( 'lastrow' ); 1233 var $tabs_dropdown = $scope.find('.uael-filters-dropdown-list'); 1234 1235 var img_gallery = $scope.find('.uael-image-lightbox-wrap'); 1236 var lightbox_actions = []; 1237 var fancybox_node_id = 'uael-fancybox-gallery-' + $scope.data( 'id' ); 1238 var lightbox_loop = img_gallery.data( 'lightbox-gallery-loop' ); 1239 var default_filter; 1240 1241 if ( $scope.find( '.uael-masonry-filters' ).data( 'default' ) ) { 1242 default_filter = $scope.find( '.uael-masonry-filters' ).data( 'default' ); 1243 } else { 1244 default_filter = $scope.find( '.uael-img-gallery-wrap' ).data( 'filter-default' ) 1245 } 1246 1247 if( img_gallery.length > 0 ) { 1248 lightbox_actions = JSON.parse( img_gallery.attr('data-lightbox_actions') ); 1249 } 1250 1251 var fancyboxInit = { 1252 initializeLightbox: function ( imgNode ) { 1253 $scope.find( imgNode + ' [data-fancybox="uael-gallery"]' ).fancybox({ 1254 buttons: lightbox_actions, 1255 animationEffect: "fade", 1256 baseClass: fancybox_node_id, 1257 loop: lightbox_loop, 1258 afterClose: function () { 1259 $scope.find('.uael-grid-item').removeAttr('aria-hidden').attr('inert', 'true'); 1260 setTimeout(function() { 1261 $scope.find('.uael-grid-item').removeAttr('inert').attr('aria-hidden', 'true'); 1262 }, 500); 1263 } 1264 }); 1265 } 1266 } 1267 1268 if ( undefined !== default_filter ) { 1269 if ( '' === default_filter || 'All' === default_filter ) { 1270 fancyboxInit.initializeLightbox( '.uael-grid-item' ); 1271 } else { 1272 fancyboxInit.initializeLightbox( '.uael-grid-item.' + default_filter.substr( 1 ) ); 1273 } 1274 } 1275 1276 $scope.on( 1277 'click', 1278 '.uael-masonry-filter', 1279 function (){ 1280 var $this = $( this ); 1281 var filter = $this.attr( 'data-filter' ); 1282 if ( '*' === filter ) { 1283 fancyboxInit.initializeLightbox( '.uael-grid-item' ); 1284 } else { 1285 fancyboxInit.initializeLightbox( '.uael-grid-item.' + filter.substr( 1 ) ); 1286 } 1287 } 1288 ); 1289 1290 if ( $justified_selector.length > 0 ) { 1291 $justified_selector.imagesLoaded( function() { 1292 }) 1293 .done(function( instance ) { 1294 $justified_selector.justifiedGallery({ 1295 rowHeight : row_height, 1296 lastRow : lastrow, 1297 selector : 'div', 1298 waitThumbnailsLoad : true, 1299 }); 1300 }); 1301 } 1302 1303 $('html').on('click', function() { 1304 $tabs_dropdown.removeClass( 'show-list' ); 1305 }); 1306 1307 $scope.on( 'click', '.uael-filters-dropdown-button', function(e) { 1308 e.stopPropagation(); 1309 $tabs_dropdown.addClass( 'show-list' ); 1310 }); 1311 1312 /* Carousel */ 1313 $('.uael-img-carousel-wrap').each(function () { 1314 var $slider_selector = $(this); 1315 var slider_options = {}; 1316 var dataAttribute = $slider_selector.attr('data-image_carousel'); 1317 if( dataAttribute ) { 1318 slider_options = JSON.parse(dataAttribute); 1319 } 1320 var adaptiveImageHeight = function ( slick ) { 1321 var node = slick.$slider, 1322 post_active = node.find('.slick-slide.slick-active'), 1323 max_height = -1; 1324 post_active.each(function () { 1325 var $this = $(this), 1326 this_height = $this.innerHeight(); 1327 if ( max_height < this_height ) { 1328 max_height = this_height; 1329 } 1330 }); 1331 node.find('.slick-list.draggable').animate({ height: max_height }, { duration: 200, easing: 'linear' }); 1332 }; 1333 var initSlick = function () { 1334 if ($slider_selector.hasClass('slick-initialized')) { 1335 $slider_selector.slick('unslick'); 1336 } 1337 $slider_selector.slick(slider_options); 1338 adaptiveImageHeight($slider_selector.slick('getSlick')); 1339 }; 1340 // Ensure images are loaded before initializing 1341 $scope.imagesLoaded(function () { 1342 initSlick(); 1343 $slider_selector.on('afterChange', function () { 1344 adaptiveImageHeight($slider_selector.slick('getSlick')); 1345 }); 1346 $slider_selector.find('.uael-grid-item').resize(function () { 1347 setTimeout(function () { 1348 $slider_selector.slick('setPosition'); 1349 }, 300); 1350 }); 1351 }); 1352 }); 1353 1354 1355 1356 /* Grid */ 1357 if ( ! isElEditMode ) { 1358 1359 var selector = $scope.find( '.uael-img-grid-masonry-wrap' ); 1360 1361 if ( selector.length < 1 ) { 1362 return; 1363 } 1364 1365 if ( ! ( selector.hasClass('uael-masonry') || selector.hasClass('uael-cat-filters') ) ) { 1366 return; 1367 } 1368 1369 var layoutMode = 'fitRows'; 1370 var filter_cat; 1371 1372 if ( selector.hasClass('uael-masonry') ) { 1373 layoutMode = 'masonry'; 1374 } 1375 1376 var filters = $scope.find('.uael-masonry-filters'); 1377 var def_cat = '*'; 1378 1379 if( '' !== id && sanitize_input ) {
1380 var select_filter = filters.find("[data-filter='" + '.' + id.toLowerCase() + "']"); 1381 1382 if ( select_filter.length > 0 ) { 1383 def_cat = '.' + id.toLowerCase(); 1384 select_filter.siblings().removeClass('uael-current'); 1385 select_filter.addClass('uael-current'); 1386 } 1387 } 1388 1389 if ( filters.length > 0 ) { 1390 1391 var def_filter = filters.attr('data-default'); 1392 1393 if ( '' !== def_filter ) { 1394 1395 def_cat = def_filter; 1396 def_cat_sel = filters.find('[data-filter="'+def_filter+'"]'); 1397 1398 if ( def_cat_sel.length > 0 ) { 1399 def_cat_sel.siblings().removeClass('uael-current'); 1400 def_cat_sel.addClass('uael-current'); 1401 } 1402 } 1403 } 1404 1405 if ( $justified_selector.length > 0 ) { 1406 $justified_selector.imagesLoaded( function() { 1407 }) 1408 .done(function( instance ) { 1409 $justified_selector.justifiedGallery({ 1410 filter: def_cat, 1411 rowHeight : row_height, 1412 lastRow : lastrow, 1413 selector : 'div', 1414 }); 1415 }); 1416 } else { 1417 var masonaryArgs = { 1418 // set itemSelector so .grid-sizer is not used in layout 1419 filter : def_cat, 1420 itemSelector : '.uael-grid-item', 1421 percentPosition : true, 1422 layoutMode : layoutMode, 1423 hiddenStyle : { 1424 opacity : 0, 1425 }, 1426 }; 1427 1428 var $isotopeObj = {}; 1429 1430 $scope.imagesLoaded( function(e) { 1431 $isotopeObj = selector.isotope( masonaryArgs ); 1432 }); 1433 } 1434 1435 // bind filter button click 1436 $scope.on( 'click', '.uael-masonry-filter', function() { 1437 1438 var $this = $(this); 1439 var filterValue = $this.attr('data-filter'); 1440 1441 $this.siblings().removeClass('uael-current'); 1442 $this.addClass('uael-current'); 1443 1444 if( '*' === filterValue ) { 1445 filter_cat = $scope.find('.uael-img-gallery-wrap').data('filter-default'); 1446 } else { 1447 filter_cat = filterValue.substr(1); 1448 } 1449 1450 if( $scope.find( '.uael-masonry-filters' ).data( 'default' ) ){ 1451 var def_filter = $scope.find( '.uael-masonry-filters' ).data( 'default' ); 1452 } 1453 else{ 1454 var def_filter = '.' + $scope.find('.uael-img-gallery-wrap').data( 'filter-default' ); 1455 } 1456 var ajax_str_img_text = $scope.find( '.uael-masonry-filters-wrapper .uael-current' ).text(), 1457 ajax_str_filter_text = $scope.find( '.uael-filters-dropdown-list .uael-current' ).text(), 1458 url = window.location.hash.replace( '#', '' ), 1459 str_replace_text = ajax_str_img_text.replace( ajax_str_filter_text,'' ), 1460 str_cat_text = ajax_str_img_text.replace( str_replace_text,'' ); 1461 if( ( !url && ( window.screen.availWidth > 768 ) ) || url ){ 1462 str_cat_text = ajax_str_img_text.replace( ajax_str_filter_text,'' ); 1463 } 1464 if( url && ( window.screen.availWidth < 768 ) ){ 1465 str_cat_text = ajax_str_img_text.replace( str_replace_text,'' ); 1466 } 1467 $scope.find( '.uael-filters-dropdown-button' ).text( str_cat_text ); 1468 1469 if ( $justified_selector.length > 0 ) { 1470 $justified_selector.justifiedGallery({ 1471 filter: filterValue, 1472 rowHeight : row_height, 1473 lastRow : lastrow, 1474 selector : 'div', 1475 }); 1476 } else { 1477 $isotopeObj.isotope({ filter: filterValue }); 1478 } 1479 }); 1480 if( $scope.find( '.uael-masonry-filters' ).data( 'default' ) ){ 1481 var def_filter = $scope.find( '.uael-masonry-filters' ).data( 'default' ); 1482 } 1483 else{ 1484 var def_filter = '.' + $scope.find('.uael-img-gallery-wrap').data( 'filter-default' ); 1485 } 1486 1487 var str_img_text = $scope.find( '.uael-filters-dropdown-list .uael-current' ).text(); 1488 $scope.find( '.uael-filters-dropdown-button' ).text( str_img_text ); 1489 } 1490 }; 1491 1492 UAELVideo = { 1493 1494 /** 1495 * Auto Play Video 1496 * 1497 */ 1498 1499 _play: function( selector,outer_wrap ) { 1500 1501 var iframe = $( "<iframe/>" ); 1502 var vurl = selector.data( 'src' ); 1503 1504 if ( 0 == selector.find( 'iframe' ).length ) { 1505 1506 if( outer_wrap.hasClass( 'uael-video-type-vimeo' ) || outer_wrap.hasClass( 'uael-video-type-youtube' ) || outer_wrap.hasClass( 'uael-video-type-wistia' ) || outer_wrap.hasClass( 'uael-video-type-bunny' ) ){ 1507 iframe.attr( 'src', vurl ); 1508 } 1509 iframe.attr( 'frameborder', '0' ); 1510 iframe.attr( 'allowfullscreen', '1' ); 1511 iframe.attr( 'allow', 'autoplay;encrypted-media;' ); 1512 selector.html( iframe ); 1513 if( outer_wrap.hasClass( 'uael-video-type-hosted' ) ) { 1514 var hosted_video_html = JSON.parse( outer_wrap.data( 'hosted-html' ) ); 1515 iframe.ready( function() { 1516 var hosted_video_iframe = iframe.contents().find( 'body' ).css( {"margin":"0px"} ); 1517 hosted_video_iframe.html( hosted_video_html ); 1518 iframe.contents().find( 'video' ).css( {"width":"100%", "height":"100%"} );
1519 iframe.contents().find( 'video' ).attr( 'autoplay','autoplay' ); 1520 }); 1521 } 1522 1523 } 1524 1525 selector.closest( '.uael-video__outer-wrap' ).find( '.uael-vimeo-wrap' ).hide(); 1526 } 1527 } 1528 1529 UAELEffects = { 1530 1531 _animateHeadline : function( $headlines, $widget_data ) { 1532 1533 $headlines.each( function() { 1534 1535 var headline = $( this ); 1536 var speed = $widget_data.data( 'speed' ); 1537 1538 setTimeout( function() 1539 { 1540 UAELEffects._hideWord ( headline.find( '.uael-active-heading' ), $widget_data ); 1541 }, 1542 1543 speed ); 1544 }); 1545 }, 1546 1547 _hideWord : function ( $word, $widget_data ) { 1548 1549 var nextWord = UAELEffects._takeNext( $word ); 1550 var animation = $widget_data.data( 'animation' ); 1551 var speed = $widget_data.data( 'speed' ); 1552 1553 if( 'clip' == animation ){ 1554 1555 var clip_speed = $widget_data.data( 'clip_speed' ); 1556 var pause_time = $widget_data.data( 'pause_time' ); 1557 1558 $word.parents( '.uael-slide-main_ul' ).animate( 1559 { width : '0px' }, 1560 clip_speed, function(){ 1561 setTimeout( function(){ 1562 1563 UAELEffects._switchWord( $word, nextWord ); 1564 UAELEffects._showWord( nextWord, $widget_data ); 1565 1566 }, pause_time); 1567 } 1568 ); 1569 } else { 1570 1571 UAELEffects._switchWord( $word, nextWord ); 1572 1573 setTimeout( function() 1574 { 1575 UAELEffects._hideWord( nextWord, $widget_data ) 1576 }, 1577 speed ); 1578 } 1579 }, 1580 1581 _takeNext: function( $word ) { 1582 return ( !$word.is( ':last-child' ) ) ? $word.next() : $word.parent().children().eq( 0 ); 1583 }, 1584 1585 _switchWord: function( $oldWord, $newWord ) { 1586 1587 $oldWord.removeClass( 'uael-active-heading' ).addClass( 'uael-inactive-heading' ); 1588 $newWord.removeClass( 'uael-inactive-heading' ).addClass( 'uael-active-heading' ); 1589 }, 1590 1591 _showWord: function( $word, $widget_data ) { 1592 1593 var animation = $widget_data.data( 'animation' ); 1594 1595 if( 'clip' == animation ) { 1596 1597 var clip_speed = $widget_data.data( 'clip_speed' ); 1598 var pause_time = $widget_data.data( 'pause_time' ); 1599 1600 $word.parents( '.uael-slide-main_ul' ).animate( 1601 { 'width' : $word.width() + 3 }, 1602 clip_speed, 1603 function(){ 1604 setTimeout( function() 1605 { 1606 UAELEffects._hideWord( $word, $widget_data ) 1607 }, 1608 pause_time ); 1609 } 1610 ); 1611 } 1612 } 1613 } 1614 1615 /* 1616 * Video handler Function. 1617 * 1618 */ 1619 var WidgetUAELVideoHandler = function( $scope, $ ) { 1620 1621 if ( 'undefined' == typeof $scope ) { 1622 return; 1623 } 1624 1625 var outer_wrap = $scope.find( '.uael-video__outer-wrap' ); 1626 var inner_wrap = $scope.find( '.uael-video-inner-wrap' ); 1627 var sticky_desktop = outer_wrap.data( 'hidedesktop' ); 1628 var sticky_tablet = outer_wrap.data( 'hidetablet' ); 1629 var sticky_mobile = outer_wrap.data( 'hidemobile' ); 1630 var sticky_margin_bottom = outer_wrap.data( 'stickybottom' ); 1631 var viewport = outer_wrap.data('vsticky-viewport'); 1632 var is_lightbox = outer_wrap.hasClass( 'uael-video-play-lightbox' ); 1633 1634 outer_wrap.off( 'click' ).on( 'click', function( e ) { 1635 if( 'yes' == outer_wrap.data( 'vsticky' ) ) { 1636 var sticky_target = e.target.className; 1637 1638 if( ( sticky_target.toString().indexOf( 'uael-sticky-close-icon' ) >= 0 ) || ( sticky_target.toString().indexOf( 'uael-video-sticky-close' ) >= 0 ) ) { 1639 return false; 1640 } 1641 } 1642 var selector = $( this ).find( '.uael-video__play' ); 1643 1644 if( ! is_lightbox ) { 1645 UAELVideo._play( selector, outer_wrap ); 1646 } 1647 1648 }); 1649 1650 if( ( '1' == outer_wrap.data( 'autoplay' ) || true == outer_wrap.data( 'device' ) ) && ( ! is_lightbox ) ) { 1651 1652 UAELVideo._play( $scope.find( '.uael-video__play' ), outer_wrap ); 1653 } 1654 1655 if( 'yes' == outer_wrap.data( 'vsticky' ) ) { 1656 1657 var observer = new IntersectionObserver( function( entries ) { 1658 entries.forEach(function( entry ) { 1659 if ( ! entry.isIntersecting && entry.boundingClientRect.top < 0 ) { 1660 outer_wrap.removeClass( 'uael-sticky-hide' ); 1661 outer_wrap.addClass( 'uael-sticky-apply' ); 1662 $(document).trigger( 'uael_after_sticky_applied', [ $scope ] ); 1663 } else if ( entry.isIntersecting ) { 1664 outer_wrap.removeClass( 'uael-sticky-apply' ); 1665 outer_wrap.addClass( 'uael-sticky-hide' ); 1666 } 1667 }); 1668 }, { 1669 root: null, // Use the viewport as the root 1670 rootMargin: '0px 0px 0px 0px', // Adjusts when the sticky class is applied 1671 threshold: 0 // Trigger as soon as the top of the element is at the specified offset 1672 }); 1673 1674 // Start observing the outer_wrap element 1675 observer.observe( outer_wrap[0] ); 1676 1677 var close_button = $scope.find( '.uael-video-sticky-close' ); 1678 close_button.off( 'click.closetrigger' ).on( 'click.closetrigger', function(e) { 1679 observer.unobserve( outer_wrap[0] ); // Stop observing the 'outer_wrap' element 1680 outer_wrap.removeClass( 'uael-sticky-apply' ); 1681 outer_wrap.removeClass( 'uael-sticky-hide' ); 1682 }); 1683 checkResize( observer ); 1684 checkScroll(); 1685 1686 window.addEventListener( "scroll", checkScroll ); 1687 $( window ).on( 'resize', function( e ) { 1688 checkResize( observer ); 1689 } ); 1690 1691 } 1692 1693 function checkResize(observer) { 1694 var currentDeviceMode = elementorFrontend.getCurrentDeviceMode(); 1695 1696 if ( ('' !== sticky_desktop && currentDeviceMode === sticky_desktop) || 1697 ('' !== sticky_tablet && currentDeviceMode === sticky_tablet) || 1698 ('' !== sticky_mobile && currentDeviceMode === sticky_mobile)) { 1699 disableSticky( observer ); 1700 } else { 1701 observer.observe( outer_wrap[0] ); // Re-enable observation for the 'outer_wrap' element 1702 } 1703 } 1704 1705 function disableSticky( observer ) { 1706 observer.unobserve( outer_wrap[0] ); // Disable observation 1707 outer_wrap.removeClass( 'uael-sticky-apply' ); 1708 outer_wrap.removeClass( 'uael-sticky-hide' ); 1709 } 1710 1711 function checkScroll() { 1712 if( ! isElEditMode && outer_wrap.hasClass( 'uael-sticky-apply' ) ){ 1713 inner_wrap.draggable({ start: function() { 1714 $( this ).css({ transform: "none", top: $( this ).offset().top + "px", left: $( this ).offset().left + "px" }); 1715 }, 1716 containment: 'window' 1717 }); 1718 } 1719 } 1720 1721 $( document ).on( 'uael_after_sticky_applied', function( e, $scope ) { 1722 var infobar = $scope.find( '.uael-video-sticky-infobar' ); 1723 1724 if( 0 !== infobar.length ) { 1725 var infobar_height = infobar.outerHeight(); 1726 1727 if( $scope.hasClass( 'uael-video-sticky-center_left' ) || $scope.hasClass( 'uael-video-sticky-center_r
1727ight' ) ) { 1728 infobar_height = Math.ceil( infobar_height / 2 ); 1729 inner_wrap.css( 'top', 'calc( 50% - ' + infobar_height + 'px )' ); 1730 } 1731 1732 if( $scope.hasClass( 'uael-video-sticky-bottom_left' ) || $scope.hasClass( 'uael-video-sticky-bottom_right' ) ) { 1733 if( '' !== sticky_margin_bottom ) { 1734 infobar_height = Math.ceil( infobar_height ); 1735 var stick_bottom = infobar_height + sticky_margin_bottom; 1736 inner_wrap.css( 'bottom', stick_bottom ); 1737 } 1738 } 1739 } 1740 }); 1741 1742 // Fix the black border around video on safari. 1743 $(window).on('load', function (){ 1744 setTimeout(function () { 1745 var videoFrame = $('.uael-video__outer-wrap iframe'); 1746 if( videoFrame.length ){ 1747 var bodyInFrame = videoFrame.contents().find('body'); 1748 bodyInFrame.css('margin', '0'); 1749 } 1750 }, 1000); 1751 }); 1752 }; 1753 1754 UAELLoginForm._submitForm = function( $this, widget_wrapper, $scope ) { 1755 var ajaxurl = uael_script.ajax_url; 1756 var user_data = {}; 1757 var recaptcha_field = $scope.find( '.uael-g-recaptcha-field' ); 1758 1759 if ( recaptcha_field.length > 0 ) {
1760 user_data['is_recaptcha_enabled'] = 'yes'; 1761 user_data['recaptcha_token'] = $scope.find( '.uael-g-recaptcha-response' ).val(); 1762 } 1763 1764 1765 }; 1766 1767 window.onLoadUAEReCaptcha = function() { 1768 var reCaptchaFields = $( '.uael-g-recaptcha-field' ), 1769 widgetID; 1770 1771 if ( reCaptchaFields.length > 0 ) { 1772 reCaptchaFields.each( function() { 1773 var self = $( this ), 1774 attrWidget = self.attr( 'data-widgetid' ); 1775 1776 if ( typeof attrWidget !== typeof undefined && attrWidget !== false ) { 1777 return; 1778 } else { 1779 widgetID = grecaptcha.render( $( this ).attr( 'id' ), { 1780 sitekey : self.data( 'sitekey' ), 1781 badge: 'inline', // Set the badge style to inline 1782 callback: function( response ) { 1783 if ( response != '' ) { 1784 self.append( jQuery( '<input>', { 1785 type: 'hidden', 1786 value: response, 1787 class: 'uael-g-recaptcha-response' 1788 })); 1789 } 1790 } 1791 }); 1792 self.attr( 'data-widgetid', widgetID ); 1793 } 1794 }); 1795 } 1796 }; 1797 1798 /* 1799 * Login Form handler Function. 1800 * 1801 */ 1802 var WidgetUAELLoginFormHandler = function( $scope, $ ) { 1803 1804 if ( 'undefined' == typeof $scope ) { 1805 return; 1806 } 1807 1808 var scope_id = $scope.data( 'id' ); 1809 var ajaxurl = uael_script.ajax_url; 1810 var widget_wrapper = $scope.find( '.uael-login-form-wrapper' ); 1811 var form_wrapper = widget_wrapper.find( '.uael-form' ); 1812 var submit_button = $scope.find( '.uael-login-form-submit' ); 1813 var submit_text = submit_button.find( '.elementor-button-text' ); 1814 1815 var username = $scope.find( '.uael-login-form-username' ); 1816 var password = $scope.find( '.uael-login-form-password' ); 1817 var rememberme = $scope.find( '.uael-login-form-remember' ); 1818 1819 if(rememberme.length){ 1820 1821 rememberme.on("focus", function() { 1822 const label = $scope.find("span.uael-login-form-remember"); 1823 label.addClass("uael-login-form-highlight-label"); 1824 }); 1825 1826 rememberme.on("blur", function() { 1827 const label = $scope.find("span.uael-login-form-remember"); 1828 label.removeClass("uael-login-form-highlight-label"); 1829 }); 1830 } 1831 1832 var facebook_button = $scope.find( '.uaelFacebookContentWrapper' ); 1833 var facebook_text = facebook_button.find('.uael-facebook-text'); 1834 1835 var google_button = $scope.find( '.uaelGoogleContentWrapper' ); 1836 1837 var redirect_url = $scope.find( '.uael-login-form-wrapper' ).data( 'redirect-url' ); 1838 var send_email = $scope.find( '.uael-login-form-social-wrapper' ).data( 'send-email' ); 1839 1840 var nonce = $scope.find('.uael-login-form-wrapper' ).data('nonce'); 1841 var recaptcha_field = $scope.find( '.uael-g-recaptcha-field' ); 1842 1843 var ajax_enable = submit_button.data( 'ajax-enable' ); 1844 var toggle_password = $scope.find('.toggle-password'); 1845 1846 $scope.find( '.elementor-field' ).on( 'keyup', function( e ) { 1847 $( this ).siblings( '.uael-register-field-message' ).remove(); 1848 }); 1849 1850 $scope.find( '.uael-password-wrapper' ).on( 'keyup',function(e) { 1851 $( this ).next( '.uael-register-field-message' ).remove(); 1852 }); 1853 1854 toggle_password.on( 'click', function(){ 1855 var $this = $( this ); 1856 $this.toggleClass('fa-eye fa-eye-slash'); 1857 var input = $this.parent().find('input'); 1858 if (input.attr('type') == 'password') { 1859 input.attr('type', 'text'); 1860 } else { 1861 input.attr('type', 'password'); 1862 } 1863 }); 1864 1865 1866 if ( recaptcha_field.length > 0 ) { 1867 if ( elementorFrontend.isEditMode() && undefined == recaptcha_field.attr( 'data-widgetid' ) ) { 1868 onLoadUAEReCaptcha(); 1869 } 1870 1871 grecaptcha.ready( function () { 1872 var recaptcha_id = recaptcha_field.attr( 'data-widgetid' ); 1873 grecaptcha.execute( recaptcha_id ); 1874 }); 1875 } 1876 1877 /** 1878 * Validate form on submit button click. 1879 * 1880 */ 1881 submit_button.on( 'click', function() { 1882 1883 var invalid_field = false; 1884 var error_exists = $scope.find( '.uael-loginform-error' ); 1885 1886 if( '' === username.val() ) { 1887 _printErrorMessages( $scope, username, uael_login_form_script.required ); 1888 invalid_field = true; 1889 } 1890 1891 if( '' === password.val() ) { 1892 _printErrorMessages( $scope, password, uael_login_form_script.required ); 1893 invalid_field = true; 1894 } 1895 1896 if( ! elementorFrontend.isEditMode() ) { 1897 1898 if( 'yes' === ajax_enable ) { 1899 1900 event.preventDefault(); 1901 1902 var $this = $( this ); 1903 UAELLoginForm._submitForm( $this, widget_wrapper, $scope ); 1904 1905 if( ! invalid_field && error_exists.length === 0 ) { 1906 1907 var data = { 1908 'username' : username.val(), 1909 'password' : password.val(), 1910 'rememberme' : rememberme.val() 1911 }; 1912 1913 $.post( ajaxurl, { 1914 action: 'uael_login_form_submit', 1915 data: data, 1916 nonce: nonce, 1917 method: 'post', 1918 dataType: 'json', 1919 beforeSend: function () { 1920 1921 form_wrapper.animate({ 1922 opacity: '0.45' 1923 }, 500 ).addClass( 'uael-form-waiting' ); 1924 1925 if( ! submit_text.hasClass( 'disabled' ) ) { 1926 submit_text.addClass( 'disabled' ); 1927 submit_text.append( '<span class="uael-form-loader"></span>' ); 1928 } 1929 }, 1930 }, function ( response ) { 1931 1932 form_wrapper.animate({ 1933 opacity: '1' 1934 }, 100 ).removeClass( 'uael-form-waiting' ); 1935 1936 submit_text.find( '.uael-form-loader' ).remove(); 1937 submit_text.removeClass( 'disabled' ); 1938 1939 if ( true === response.success ) { 1940 $scope.find( '.uael-register-field-message' ).remove(); 1941 $scope.find( '.uael-form' ).trigger( 'reset' ); 1942 if( undefined === redirect_url ) { 1943 location.reload(); 1944 } else { 1945 window.location = redirect_url; 1946 } 1947 } else if ( false === response.success && 'incorrect_password' === response.data ) { 1948 _printErrorMessages( $scope, password, uael_login_form_script.incorrect_password ); 1949 } else if ( false === response.success && 'invalid_username' === response.data ) { 1950 _printErrorMessages( $scope, username, uael_login_form_script.invali
1950d_username ); 1951 } else if ( false === response.success && 'invalid_email' === response.data ) { 1952 _printErrorMessages( $scope, username, uael_login_form_script.invalid_email ); 1953 } 1954 1955 }); 1956 } 1957 } else { 1958 1959 if( ! invalid_field && error_exists.length === 0 ) { 1960 form_wrapper.animate({ 1961 opacity: '0.45' 1962 }, 500 ).addClass( 'uael-form-waiting' ); 1963 1964 if( ! submit_text.hasClass( 'disabled' ) ) { 1965 submit_text.addClass( 'disabled' ); 1966 submit_text.append( '<span class="uael-form-loader"></span>' ); 1967 } 1968 return true; 1969 } else { 1970 return false; 1971 } 1972 } 1973 } 1974 1975 }); 1976 1977 /** 1978 * Display error messages 1979 * 1980 */ 1981 function _printErrorMessages( $scope, form_field, message ) { 1982 1983 var field_type = form_field.attr( 'name' ); 1984 var password_wrapper = $scope.find( '.uael-password-wrapper' ); 1985 var is_password_error = password_wrapper.next().hasClass( 'uael-register-field-message' ); 1986 var $is_error = form_field.next().hasClass( 'uael-register-field-message' ); 1987 1988 switch( field_type ) { 1989 case 'password': 1990 if( is_password_error ) { 1991 return; 1992 } else { 1993 password_wrapper.after( '<span class="uael-register-field-message"><span class="uael-loginform-error">' + message + '</span></span>' ); 1994 } 1995 break; 1996 default: 1997 if( $is_error ) { 1998 return; 1999 } else { 2000 form_field.after( '<span class="uael-register-field-message"><span class="uael-loginform-error">' + message + '</span></span>' ); 2001 } 2002 } 2003 } 2004 2005 if( ! elementorFrontend.isEditMode() ) { 2006 2007 if( facebook_button.length > 0 ) { 2008 2009 /** 2010 * Login with Facebook. 2011 * 2012 */ 2013 facebook_button.on( 'click', function() { 2014 2015 if( ! is_fb_loggedin ) { 2016 FB.login ( function ( response ) { 2017 if ( response.authResponse ) { 2018 // Get and display the user profile data. 2019 getFbUserData(); 2020 } else { 2021 // $scope.find( '.status' ).addClass( 'error' ).text( 'User cancelled login or did not fully authorize.' ); 2022 } 2023 }, { scope: 'email' } ); 2024 } 2025 2026 }); 2027 2028 // Fetch the user profile data from facebook. 2029 function getFbUserData() { 2030 FB.api( '/me', { fields: 'id, name, first_name, last_name, email, link, gender, locale, picture' }, 2031 function ( response ) { 2032 2033 var userID = FB.getAuthResponse()[ 'userID' ]; 2034 var access_token = FB.getAuthResponse()[ 'accessToken' ]; 2035 2036 window.is_fb_loggedin = true; 2037 2038 var fb_data = { 2039 'id' : response.id, 2040 'name' : response.name, 2041 'first_name' : response.first_name, 2042 'last_name' : response.last_name, 2043 'email' : response.email, 2044 'link' : response.link, 2045 'send_email' : send_email, 2046 }; 2047 2048 $.post( ajaxurl, { 2049 action: 'uael_login_form_facebook', 2050 data: fb_data, 2051 nonce: nonce, 2052 method: 'post', 2053 dataType: 'json', 2054 userID : userID, 2055 security_string : access_token, 2056 beforeSend: function () { 2057 form_wrapper.animate({ 2058 opacity: '0.45' 2059 }, 500 ).addClass( 'uael-form-waiting' ); 2060 2061 if( ! facebook_text.hasClass( 'disabled' ) ) { 2062 facebook_text.addClass( 'disabled' ); 2063 facebook_text.append( '<span class="uael-form-loader"></span>' ); 2064 } 2065 } 2066 }, function ( data ) { 2067 if( data.success === true ) { 2068 2069 form_wrapper.animate({ 2070 opacity: '1' 2071 }, 100 ).removeClass( 'uael-form-waiting' ); 2072 2073 facebook_text.find( '.uael-form-loader' ).remove(); 2074 facebook_text.removeClass( 'disabled' ); 2075 2076 $scope.find( '.status' ).addClass( 'success' ).text( uael_login_form_script.logged_in_message + response.first_name + '!' ); 2077 if( undefined === redirect_url ) { 2078 location.reload(); 2079 } else { 2080 window.location = redirect_url; 2081 } 2082 } else { 2083 location.reload(); 2084 } 2085 }); 2086 2087 }); 2088 2089 } 2090 2091 window.fbAsyncInit = function() { 2092 var app_id = facebook_button.data( 'appid' ); 2093 // FB JavaScript SDK configuration and setup. 2094 FB.init({ 2095 appId : app_id, // FB App ID. 2096 cookie : true, // enable cookies to allow the server to access the session. 2097 xfbml : true, // parse social plugins on this page. 2098 version : 'v2.8' // use graph api version 2.8. 2099 }); 2100 }; 2101 2102 // Load the JavaScript SDK asynchronously. 2103 ( function( d, s, id ) { 2104 2105 var js, fjs = d.getElementsByTagName( s )[0]; 2106 if ( d.getElementById( id ) ) { 2107 return; 2108 } 2109 js = d.createElement( s ); 2110 js.id = id; 2111 js.src = "//connect.facebook.net/en_US/sdk.js"; 2112 fjs.parentNode.insertBefore( js, fjs ); 2113 } ( document, 'script', 'facebook-jssdk' ) ); 2114 } 2115 2116 if( google_button.length > 0 ) { 2117 2118 var client_id = google_button.data( 'clientid' ); 2119 var theme = google_button.data( 'theme' ); 2120 var theme_option = "outline"; 2121 var google_scope_id = document.getElementById( 'uael-google-login-' + scope_id ); 2122 nonce = $scope.find('.uael-login-form-wrapper' ).data('nonce'); 2123 2124 // Load the new Google Identity Services script. 2125 google.accounts.id.initialize({ 2126 client_id: client_id, 2127 callback: handleGoogleSignInResponse,
2128 auto_select: false, 2129 }); 2130 2131 if( 'dark' === theme ) { 2132 theme_option = "filled_blue"; 2133 } 2134 2135 // Customize the button to match your HTML structure. 2136 google.accounts.id.renderButton( 2137 google_scope_id, 2138 { 2139 size: "large", // Large button size 2140 width: 195, 2141 type: "standard", 2142 theme: theme_option, 2143 logo_alignment: "left", 2144 shape: "rectangular", 2145 text: "signin_with" 2146 } 2147 ); 2148 2149 // Callback function to handle the response from GIS. 2150 function handleGoogleSignInResponse( response ) { 2151 var id_token = response.credential; 2152 2153 $.post( ajaxurl, { 2154 action: 'uael_login_form_google', 2155 data: { 2156 'id_token': id_token, 2157 'send_email' : send_email, 2158 }, 2159 nonce: nonce, 2160 method: 'post', 2161 dataType: 'json', 2162 beforeSend: function () { 2163 form_wrapper.animate({ opacity: '0.45' }, 500).addClass('uael-form-waiting'); 2164 } 2165 }, function ( data ) { 2166 if( data.success === true ) { 2167 2168 form_wrapper.animate({ 2169 opacity: '1' 2170 }, 100).removeClass('uael-form-waiting'); 2171 2172 $scope.find('.status').addClass('success').text( uael_login_form_script.logged_in_message + data.username + '!'); 2173 2174 if (typeof redirect_url === 'undefined') { 2175 location.reload(); 2176 } else { 2177 window.location = redirect_url; 2178 } 2179 2180 } else { 2181 console.log( "Login Failed" ); 2182 } 2183 2184 }); 2185 } 2186 } 2187 } 2188 2189 }; 2190 2191 var WidgetUAELFAQHandler = function( $scope, $ ) { 2192 var uael_faq_answer = $scope.find('.uael-faq-accordion > .uael-accordion-content'); 2193 var layout = $scope.find( '.uael-faq-container' ); 2194 var faq_layout = layout.data('layout'); 2195 $scope.find('.uael-accordion-title').on( 'click keypress', 2196 function(e){ 2197 e.preventDefault(); 2198 $this = $(this); 2199 uael_accordion_activate_deactivate($this); 2200 } 2201 ); 2202 function uael_accordion_activate_deactivate($this) { 2203 if('toggle' == faq_layout ) { 2204 if( $this.hasClass('uael-title-active') ){ 2205 $this.removeClass('uael-title-active'); 2206 $this.attr('aria-expanded', 'false'); 2207 } 2208 else{ 2209 $this.addClass('uael-title-active'); 2210 $this.attr('aria-expanded', 'true'); 2211 } 2212 $this.next('.uael-accordion-content').slideToggle( 'normal','swing'); 2213 } 2214 else if( 'accordion' == faq_layout ){ 2215 if( $this.hasClass('uael-title-active') ){ 2216 $this.removeClass( 'uael-title-active'); 2217 $this.next('.uael-accordion-content').slideUp( 'normal','swing', 2218 function(){ 2219 $(this).prev().removeClass('uael-title-active'); 2220 $this.attr('aria-expanded', 'false'); 2221 }); 2222 } else { 2223 if( uael_faq_answer.hasClass('uael-title-active') ){ 2224 uael_faq_answer.removeClass('uael-title-active'); 2225 } 2226 uael_faq_answer.slideUp('normal','swing' , function(){ 2227 $(this).prev().removeClass('uael-title-active'); 2228 }); 2229 2230 $this.addClass('uael-title-active'); 2231 $this.next('.uael-accordion-content').slideDown('normal','swing', function(){ 2232 $(this).prev().addClass('uael-title-active'); 2233 $this.attr('aria-expanded', 'true'); 2234 }); 2235 } 2236 return false; 2237 } 2238 } 2239 } 2240 2241 /** 2242 * Function for FF Styler select field. 2243 * 2244 */ 2245 var WidgetUAELFFStylerHandler = function( $scope, $ ) { 2246 2247 if ( 'undefined' == typeof $scope ) 2248 return; 2249 2250 $scope.find('select:not([multiple])').each(function() { 2251 var gfSelectField = $( this ); 2252 gfSelectField.wrap( "<span class='uael-ff-select-custom'></span>" ); 2253 }); 2254 2255 const inputs = $scope.find(".ff-el-form-check-label input[type='checkbox'], .ff-el-form-check-label input[type='radio']"); 2256 inputs.each(function() { 2257 const input = $(this); 2258 2259 input.on("focus", function() { 2260 input.addClass("uael-ff-highlight-label"); 2261 }); 2262 2263 input.on("blur", function() { 2264 input.removeClass("uael-ff-highlight-label"); 2265 }); 2266 }); 2267 } 2268 2269 /** 2270 * Function for WPF Styler select field. 2271 * 2272 */ 2273 var WidgetUAELWPFStylerHandler = function( $scope, $ ) { 2274 if ( 'undefined' == typeof $scope ){ 2275 return; 2276 } 2277 const inputs = $scope.find(".wpforms-field input[type='checkbox'], .wpforms-field input[type='radio']"); 2278 inputs.each(function() { 2279 const input = $(this); 2280 2281 input.on("focus", function() { 2282 const label = $scope.find(`label[for="${this.id}"]`); 2283 if (label.length) { 2284 label.addClass("uael-wpf-highlight-label"); 2285 } 2286 }); 2287 2288 input.on("blur", function() { 2289 const label = $scope.find(`label[for="${this.id}"]`); 2290 if (label.length) { 2291 label.removeClass("uael-wpf-highlight-label"); 2292 } 2293 }); 2294 }); 2295 } 2296 2297 /** 2298 * Welcome Music handler Function. 2299 */ 2300 var WidgetUAELWelcomeMusicHandler = function ($scope, $){ 2301 if ( 'undefined' == typeof $scope ) { 2302 return; 2303 } 2304 2305 var track = $scope.find( '.uael-welcome-track' ); 2306 var musicContainer = $scope.find( '.uael-welcome-music-container' ); 2307 var autoplay = ( track.length > 0 ) ? track.data( 'autoplay' ) : ''; 2308 var musicVolume = musicContainer.data( 'volume' ); 2309 var audio = ( track.length > 0 ) ? track[0] : ''; 2310 var playPauseBtn = $scope.find( '#uael-play-pause' ); 2311 var play = playPauseBtn.find( '.play' ); 2312 var pause = playPauseBtn.find( '.pause' ); 2313 2314 if ( autoplay ) {
2315 var playPromise = audio.play(); 2316 if ( playPromise ) { 2317 playPromise.catch( ( e ) => { 2318 if ( e.name === 'NotAllowedError' || e.name === 'NotSupportedError' ) { 2319 playPauseBtn.toggleClass( 'uael-pause' ); 2320 playPauseBtn.toggleClass( 'uael-play' ); 2321 } 2322 }).then( () => { 2323 playPauseBtn.toggleClass( 'uael-play' ); 2324 playPauseBtn.toggleClass( 'uael-pause' ); 2325 }); 2326 } 2327 } 2328 2329 playPauseBtn.on( 2330 'click', 2331 function (){ 2332 var $this = $( this ); 2333 if ( $this.hasClass( 'uael-play' ) ) { 2334 audio.play(); 2335 $this.toggleClass( 'uael-play' ); 2336 $this.toggleClass( 'uael-pause' ); 2337 2338 } else { 2339 audio.pause(); 2340 $this.toggleClass( 'uael-pause' ); 2341 $this.toggleClass( 'uael-play' ); 2342 } 2343 } 2344 ); 2345 2346 $( '.uael-welcome-track' ).on( 2347 'ended', 2348 function() { 2349 playPauseBtn.toggleClass( 'uael-pause' ); 2350 play.css( 'display', 'block' ); 2351 playPauseBtn.toggleClass( 'uael-play' ); 2352 pause.css( 'display', 'none' ); 2353 } 2354 ); 2355 2356 if ( !Number.isNaN( Number( musicVolume ) ) && '' !== musicVolume && musicVolume !== undefined && '' !== audio ) { 2357 audio.volume = parseFloat( musicVolume / 100 ); 2358 } 2359 2360 } 2361 2362 /** 2363 * Instagram Feed handler Function. 2364 */ 2365 var WidgetUAELInstagramFeedHandler = function ( $scope, $ ) { 2366 var widgetId = $scope.data( 'id' ), 2367 elementSettings = getWidgetSettings( $scope ), 2368 feed = $scope.find( '.uael-instagram-feed' ).eq( 0 ), 2369 layout = elementSettings.uae_insta_layout_type; 2370 2371 if ( ! feed.length ) { 2372 return; 2373 } 2374 2375 if ( layout === 'masonry' ) { 2376 var grid = $( '#uael-instafeed-' + widgetId ).imagesLoaded( function() { 2377 grid.masonry( 2378 { 2379 itemSelector: '.uael-feed-item', 2380 percentPosition: true 2381 }); 2382 }); 2383 } 2384 } 2385 2386 /** 2387 * Twitter Feed handler Function. 2388 */ 2389 var WidgetUAELTwitterFeedHandler = function ($scope, $){ 2390 /* Carousel */ 2391 var slider_selector = $scope.find('.uael-twitter-feed-carousel'); 2392 if ( slider_selector.length > 0 ) { 2393 2394 var adaptiveImageHeight = function( e, obj ) { 2395 var node = obj.$slider, 2396 post_active = node.find('.slick-slide.slick-active'), 2397 max_height = -1; 2398 2399 post_active.each(function( i ) { 2400 var $this = $( this ), 2401 this_height = $this.innerHeight(); 2402 if( max_height < this_height ) { 2403 max_height = this_height + 50; 2404 } 2405 }); 2406 2407 node.find('.slick-list.draggable').animate({ height: max_height }, { duration: 200, easing: 'linear' }); 2408 max_height = -1; 2409 }; 2410 2411 var slider_options = JSON.parse( slider_selector.attr('data-twitter_carousel_settings') ); 2412 /* Execute when slick initialize */ 2413 slider_selector.on('init', adaptiveImageHeight ); 2414 $scope.imagesLoaded( function(e) { 2415 2416 slider_selector.slick(slider_options); 2417 2418 /* After slick slide change */ 2419 slider_selector.on('afterChange', adaptiveImageHeight ); 2420 var slider_items = slider_selector.find( '.uael-twitter-feed-item' ); 2421 slider_items.on( 'resize', function() { 2422 // Manually refresh positioning of slick 2423 setTimeout(function() { 2424 slider_selector.slick( 'setPosition' ); 2425 }, 300); 2426 }); 2427 }); 2428 } 2429 } 2430 2431 $( window ).on( 'elementor/frontend/init', function () { 2432 2433 var elementor_elements = ['widget', 'section', 'column', 'container']; 2434 2435 if ( elementorFrontend.isEditMode() ) { 2436 isElEditMode = true; 2437 } 2438 2439 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-fancy-heading.default', WidgetUAELFancyTextHandler ); 2440 2441 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-ba-slider.default', WidgetUAELBASliderHandler ); 2442 2443 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-hotspot.default', WidgetUAELHotspotHandler ); 2444 2445 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-timeline.default', WidgetUAELTimelineHandler ); 2446 2447 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-content-toggle.default', WidgetUAELContentToggleHandler ); 2448 2449 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-gf-styler.default', WidgetUAELGFStylerHandler ); 2450 2451 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-cf7-styler.default', WidgetUAELCF7StylerHandler ); 2452 2453 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-image-gallery.default', WidgetUAELImageGalleryHandler ); 2454 2455 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-video.default', WidgetUAELVideoHandler ); 2456 2457 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-video-gallery.default', WidgetUAELVideoGalleryHandler ); 2458 2459 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-caf-styler.default', WidgetUAELCafStylerHandler ); 2460 2461 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-login-form.default', WidgetUAELLoginFormHandler ); 2462 2463 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-faq.default', WidgetUAELFAQHandler ); 2464 2465 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-ff-styler.default', WidgetUAELFFStylerHandler ); 2466 2467 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-wpf-styler.default', WidgetUAELWPFStylerHandler ); 2468 2469 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-price-table.default', WidgetUAELPriceTableHandler ); 2470 2471 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-welcome-music.default', WidgetUAELWelcomeMusicHandler ); 2472 2473 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-instagram-feed.default', WidgetUAELInstagramFeedHandler ); 2474 2475 elementorFrontend.hooks.addAction( 'frontend/element_ready/uael-twitter.default', WidgetUAELTwitterFeedHandler ); 2476 2477 if( isElEditMode ) { 2478 2479 elementor.channels.data.on( 'element:after:duplicate element:after:remove', function( e, arg ) { 2480 $( '.elementor-widget-uael-ba-slider' ).each( function() { 2481 WidgetUAELBASliderHandler( $( this ), $ ); 2482 } ); 2483 } ); 2484
2485 elementor_elements.forEach(element => { 2486 elementor.hooks.addAction( 'panel/open_editor/' + element, function( panel, model, view ) { 2487 var settings_panel = panel.$el; 2488 settings_panel.on( 'change', '[data-setting="display_condition_enable"]', function( event ) { 2489 2490 if ( $( this ).is( ':checked' ) ) { 2491 var GetLocalTimeZone = new Date().getTimezoneOffset(); 2492 GetLocalTimeZone = GetLocalTimeZone == 0 ? 0 : -GetLocalTimeZone; 2493 var uael_secure = ( document.location.protocol === 'https:' ) ? 'secure' : ''; 2494 document.cookie = "GetLocalTimeZone=" + GetLocalTimeZone + ";SameSite=Strict;" + uael_secure; 2495 } else { 2496 document.cookie = "GetLocalTimeZone= ; expires = Thu, 01 Jan 1970 00:00:00 GMT" 2497 } 2498 2499 } ); 2500 } ); 2501 }); 2502 } 2503 2504 }); 2505 2506} )( jQuery );
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.