1( function( $, elementor ) { 2 3 'use strict'; 4 5 var JetTricks = { 6 7 init: function() { 8 elementor.hooks.addAction( 'frontend/element_ready/section', JetTricks.elementorSection ); 9 elementor.hooks.addAction( 'frontend/element_ready/column', JetTricks.elementorColumn ); 10 elementor.hooks.addAction( 'frontend/element_ready/widget', JetTricks.elementorWidget ); 11 12 var widgets = { 13 'jet-view-more.default' : JetTricks.widgetViewMore, 14 'jet-unfold.default' : JetTricks.widgetUnfold, 15 'jet-hotspots.default' : JetTricks.widgetHotspots 16 }; 17 18 $.each( widgets, function( widget, callback ) { 19 elementor.hooks.addAction( 'frontend/element_ready/' + widget, callback ); 20 }); 21 }, 22 23 elementorSection: function( $scope ) { 24 var $target = $scope, 25 sectionId = $scope.data( 'id' ), 26 editMode = Boolean( elementor.isEditMode() ), 27 settings = {}; 28 29 if ( window.JetTricksSettings && window.JetTricksSettings.elements_data.sections.hasOwnProperty( sectionId ) ) { 30 settings = window.JetTricksSettings.elements_data.sections[ sectionId ]; 31 } 32 33 if ( editMode ) { 34 settings = JetTricks.sectionEditorSettings( sectionId ); 35 } 36 37 if ( ! settings ) { 38 return false; 39 } 40 41 if ( jQuery.isEmptyObject( settings ) ) { 42 return false; 43 } 44 45 if ( 'false' === settings.particles || '' === settings.particles_json ) { 46 return false; 47 } 48 49 var particlesId = 'jet-tricks-particles-instance-' + sectionId, 50 particlesJson = JSON.parse( settings.particles_json ); 51 52 $scope.prepend( '<div id="' + particlesId + '" class="jet-tricks-particles-section__instance"></div>' ); 53 54 tsParticles.load( particlesId, particlesJson ); 55 56 }, 57 58 elementorColumn: function( $scope ) { 59 var $target = $scope, 60 $parentSection = $scope.closest( '.elementor-section' ), 61 isLegacyModeActive = !!$target.find( '> .elementor-column-wrap' ).length, 62 $window = $( window ), 63 columnId = $target.data( 'id' ), 64 editMode = Boolean( elementor.isEditMode() ), 65 settings = {}, 66 stickyInstance = null, 67 stickyInstanceOptions = { 68 topSpacing: 50, 69 bottomSpacing: 50, 70 containerSelector: isLegacyModeActive ? '.elementor-row' : '.elementor-container', 71 innerWrapperSelector: isLegacyModeActive ? '.elementor-column-wrap' : '.elementor-widget-wrap', 72 }, 73 $observerTarget = $target.find('.elementor-element'); 74 75 if ( ! editMode ) { 76 settings = $target.data( 'jet-settings' ); 77 78 if ( $target.hasClass( 'jet-sticky-column' ) ) { 79 80 if ( -1 !== settings['stickyOn'].indexOf( elementorFrontend.getCurrentDeviceMode() ) ) { 81 82 stickyInstanceOptions.topSpacing = settings['topSpacing']; 83 stickyInstanceOptions.bottomSpacing = settings['bottomSpacing']; 84 85 imagesLoaded( $parentSection, function() { 86 $target.data( 'stickyColumnInit', true ); 87 stickyInstance = new StickySidebar( $target[0], stickyInstanceOptions ); 88 } ); 89 90 var targetMutation = $target[0], 91 config = { attributes: true, childList: true, subtree: true }; 92 93 var callbackMutation = function( mutationsList, observer ) { 94 for( var mutation of mutationsList ) { 95 if ( 'attributes' === mutation.type ) { 96 $target[0].style.height = 'auto'; 97 } 98 } 99 }; 100 101 var observer = new MutationObserver( callbackMutation ); 102 observer.observe( targetMutation, config ); 103 104 $window.on( 'resize.JetTricksStickyColumn orientationchange.JetTricksStickyColumn', JetTricksTools.debounce( 50, resizeDebounce ) ); 105 106 MutationObserver = window.MutationObserver || window.WebKitMutationObserver; 107 108 var observer = new MutationObserver( function( mutations ) { 109 if ( stickyInstance ) { 110 mutations.forEach( function(mutation){ 111 if (mutation.attributeName === 'class') { 112 setTimeout( function() { 113 stickyInstance.destroy(); 114 stickyInstance = new StickySidebar( $target[0], stickyInstanceOptions ); 115 }, 100 ); 116 } else { 117 stickyInstance.destroy(); 118 stickyInstance = new StickySidebar( $target[0], stickyInstanceOptions ); 119 } 120 } ) 121 } 122 } ); 123 124 $observerTarget.each( function(){ 125 observer.observe( $( this )[0], { 126 subtree: true, 127 childList: true, 128 attributes: true 129 } ); 130 } ) 131 } 132 } 133 } else { 134 135 return false;
136 137 settings = JetTricks.columnEditorSettings( columnId ); 138 139 if ( 'true' === settings['sticky'] ) { 140 $target.addClass( 'jet-sticky-column' ); 141 142 if ( -1 !== settings['stickyOn'].indexOf( elementorFrontend.getCurrentDeviceMode() ) ) { 143 stickyInstanceOptions.topSpacing = settings['topSpacing']; 144 stickyInstanceOptions.bottomSpacing = settings['bottomSpacing']; 145 146 $target.data( 'stickyColumnInit', true ); 147 stickyInstance = new StickySidebar( $target[0], stickyInstanceOptions ); 148 149 $window.on( 'resize.JetTricksStickyColumn orientationchange.JetTricksStickyColumn', JetTricksTools.debounce( 50, resizeDebounce ) ); 150 } 151 } 152 } 153 154 function resizeDebounce() { 155 var currentDeviceMode = elementorFrontend.getCurrentDeviceMode(), 156 availableDevices = settings['stickyOn'] || [], 157 isInit = $target.data( 'stickyColumnInit' ); 158 159 if ( -1 !== availableDevices.indexOf( currentDeviceMode ) ) { 160 161 if ( ! isInit ) { 162 $target.data( 'stickyColumnInit', true ); 163 stickyInstance = new StickySidebar( $target[0], stickyInstanceOptions ); 164 stickyInstance.updateSticky(); 165 } 166 } else { 167 $target.data( 'stickyColumnInit', false ); 168 stickyInstance.destroy(); 169 } 170 } 171 172 }, 173 174 elementorWidget: function( $scope ) { 175 var parallaxInstance = null, 176 satelliteInstance = null, 177 tooltipInstance = null; 178 179 parallaxInstance = new jetWidgetParallax( $scope ); 180 parallaxInstance.init(); 181 182 satelliteInstance = new jetWidgetSatellite( $scope ); 183 satelliteInstance.init(); 184 185 tooltipInstance = new jetWidgetTooltip( $scope ); 186 tooltipInstance.init(); 187 188 }, 189 190 getElementorElementSettings: function( $scope ) { 191 192 if ( window.elementorFrontend && window.elementorFrontend.isEditMode() && $scope.hasClass( 'elementor-element-edit-mode' ) ) { 193 return JetTricks.getEditorElementSettings( $scope ); 194 } 195 196 return $scope.data( 'settings' ) || {}; 197 }, 198 199 getEditorElementSettings: function( $scope ) { 200 var modelCID = $scope.data( 'model-cid' ), 201 elementData; 202 203 if ( ! modelCID ) { 204 return {}; 205 } 206 207 if ( ! elementor.hasOwnProperty( 'config' ) ) { 208 return {}; 209 } 210 211 if ( ! elementor.config.hasOwnProperty( 'elements' ) ) { 212 return {}; 213 } 214 215 if ( ! elementor.config.elements.hasOwnProperty( 'data' ) ) { 216 return {}; 217 } 218 219 elementData = elementor.config.elements.data[ modelCID ]; 220 221 if ( ! elementData ) { 222 return {}; 223 } 224 225 return elementData.toJSON(); 226 }, 227 228 widgetViewMore: function( $scope ) { 229 var $target = $scope.find( '.jet-view-more' ), 230 instance = null, 231 settings = $target.data( 'settings' ); 232 233 instance = new jetViewMore( $target, settings ); 234 instance.init(); 235 }, 236 237 widgetUnfold: function( $scope ) { 238 var $target = $scope.find( '.jet-unfold' ), 239 $button = $( '.jet-unfold__button', $target ), 240 $mask = $( '.jet-unfold__mask', $target ), 241 $content = $( '.jet-unfold__content', $target ), 242 $contentInner = $( '.jet-unfold__content-inner', $target), 243 $trigger = $( '.jet-unfold__trigger', $target), 244 $separator = $( '.jet-unfold__separator', $target ), 245 settings = $.extend( {}, $target.data( 'settings' ), JetTricks.getElementorElementSettings( $scope ) ), 246 maskBreakpointsHeights = [], 247 prevBreakpoint = '', 248 unfoldDuration = settings['unfoldDuration'] || settings['unfold_duration'], 249 foldDuration = settings['foldDuration'] || settings['fold_duration'], 250 unfoldEasing = settings['unfoldEasing'] || settings['unfold_easing'], 251 foldEasing = settings['foldEasing'] || settings['fold_easing'], 252 maskHeightAdv = 20, 253 heightCalc = '', 254 autoHide = settings['autoHide'] || false, 255 autoHideTime = settings['autoHideTime'] && 0 != settings['autoHideTime']['size'] ? settings['autoHideTime']['size'] : 5, 256 hideOutsideClick = settings['hideOutsideClick'] || false, 257 autoHideTrigger, 258 activeBreakpoints = elementor.config.responsive.activeBreakpoints; 259 260 maskBreakpointsHeights['desktop'] = []; 261 maskBreakpointsHeights['widescreen'] = []; 262 263 maskBreakpointsHeights['desktop']['maskHeight'] = '' != settings['mask_height']['size'] ? settings['mask_height']['size'] : 50; 264 265 prevBreakpoint = 'desktop'; 266
267 Object.keys( activeBreakpoints ).reverse().forEach( function( breakpointName ) { 268 269 if ( 'widescreen' === breakpointName ) { 270 maskBreakpointsHeights['widescreen']['maskHeight'] = '' != settings['mask_height_widescreen']['size'] ? settings['mask_height_widescreen']['size'] : maskBreakpointsHeights['desktop']['maskHeight']; 271 } else { 272 maskBreakpointsHeights[breakpointName] = []; 273 274 maskBreakpointsHeights[breakpointName]['maskHeight'] = '' != settings['mask_height_' + breakpointName]['size'] ? settings['mask_height_' + breakpointName]['size'] : maskBreakpointsHeights[prevBreakpoint]['maskHeight']; 275 276 prevBreakpoint = breakpointName; 277 } 278 } ); 279 280 onLoaded(); 281 282 if ( 'true' === hideOutsideClick ) { 283 $( document ).on( 'click', function( event ) { 284 let container = $target; 285 if ( !container.is( event.target ) && 0 === container.has( event.target ).length && $target.hasClass( 'jet-unfold-state' ) ) { 286 $button.trigger( 'click' ); 287 } 288 } ) 289 } 290 291 $target.one('transitionend webkitTransitionEnd oTransitionEnd', onLoaded ); 292 293 function onLoaded() { 294 var deviceHeight = getDeviceHeight(); 295 296 heightCalc = deviceHeight + maskHeightAdv; 297 298 if ( heightCalc < $contentInner.height() ) { 299 300 if ( ! $target.hasClass( 'jet-unfold-state' ) ) { 301 $separator.css( { 302 'opacity': '1' 303 } ); 304 } 305 306 if ( ! $target.hasClass( 'jet-unfold-state' ) ) { 307 $mask.css( { 308 'height': deviceHeight 309 } ); 310 } else { 311 $mask.css( { 312 'height': $contentInner.outerHeight() 313 } ); 314 } 315 $trigger.css( 'display', 'flex' ); 316 } else { 317 $trigger.hide(); 318 $mask.css( { 319 'height': '100%' 320 } ); 321 $content.css( { 322 'max-height': 'none' 323 } ); 324 $separator.css( { 325 'opacity': '0' 326 } ); 327 } 328 } 329 330 $( window ).on( 'resize.jetWidgetUnfold orientationchange.jetWidgetUnfold', JetTricksTools.debounce( 50, function(){ 331 onLoaded(); 332 } ) ); 333 334 $button.on( 'click.jetUnfold', function() { 335 var $this = $( this ), 336 $buttonText = $( '.jet-unfold__button-text', $this ), 337 unfoldText = $this.data( 'unfold-text' ), 338 foldText = $this.data( 'fold-text' ), 339 $buttonIcon = $( '.jet-unfold__button-icon', $this ), 340 unfoldIcon = $this.data( 'unfold-icon' ), 341 foldIcon = $this.data( 'fold-icon' ), 342 contentHeight = $contentInner.outerHeight(), 343 deviceHeight = getDeviceHeight(); 344 345 if ( ! $target.hasClass( 'jet-unfold-state' ) ) { 346 $target.addClass( 'jet-unfold-state' ); 347 348 $separator.css( { 349 'opacity': '0' 350 } ); 351 352 $buttonIcon.html( foldIcon ); 353 $buttonText.html( foldText ); 354 355 anime( { 356 targets: $mask[0], 357 height: contentHeight, 358 duration: unfoldDuration['size'], 359 easing: unfoldEasing, 360 complete: function( anim ) { 361 // Recalculate listing masonry. 362 $( document ).trigger( 'jet-engine/listing/recalculate-masonry' ); 363 } 364 } ); 365 366 if ( 'true' === autoHide ) { 367 autoHideTrigger = setTimeout( function() { 368 $button.trigger( 'click' ); 369 }, autoHideTime * 1000 ); 370 } 371 } else { 372 clearTimeout( autoHideTrigger ); 373 374 $target.removeClass( 'jet-unfold-state' ); 375 376 $separator.css( { 377 'opacity': '1' 378 } ); 379 380 $buttonIcon.html( unfoldIcon ); 381 $buttonText.html( unfoldText ); 382 383 anime( { 384 targets: $mask[0], 385 height: deviceHeight, 386 duration: foldDuration['size'], 387 easing: foldEasing, 388 complete: function( anim ) { 389 if ( 'true' === settings['foldScrolling'] ) { 390 $( 'html, body' ).animate( { 391 scrollTop: $target.offset().top 392 }, 300 ); 393 } 394 395 // Recalculate listing masonry. 396 $( document ).trigger( 'jet-engine/listing/recalculate-masonry' ); 397 } 398 } ); 399 } 400 } ); 401 402 function getDeviceHeight() { 403 var deviceMode = elementor.getCurrentDeviceMode(); 404 405 return maskBreakpointsHeights[deviceMode]['maskHeight']; 406 } 407 }, 408 409 widgetHotspots: function( $scope ) { 410 var $target = $scope.find( '.jet-hotspots' ), 411 $hotspots = $( '.jet-hotspots__item', $target), 412 settings = $target.data( 'settings' ), 413 editMode = Boolean( elementor.isEditMode() ), 414 itemActiveClass = 'jet-hotspots__item--active'; 415 416 $target.imagesLoaded().progress( function() { 417 $target.addClass( 'image-loaded' ); 418 } ); 419 420 $hotspots.each( function( index ) { 421 var $this = $( this ), 422 horizontal = $this.data( 'horizontal-position' ), 423 vertical = $this.data( 'vertical-position' ), 424 itemSelector = $this[0], 425 options = {}; 426 427 $this.css( { 428 'left': horizontal + '%', 429 'top': vertical + '%' 430 } ); 431 432 if ( itemSelector._tippy ) { 433 itemSelector._tippy.destroy(); 434 } 435 436 options = { 437 arrow: settings['tooltipArrow'] ? true : false, 438 placement: settings['tooltipPlacement'], 439 trigger: settings['tooltipTrigger'], 440 appendTo: $target[0], 441 hideOnClick: 'manual' !== settings['tooltipTrigger'], 442 maxWidth: 'none', 443 allowHTML: true, 444 popperOptions: { 445 strategy: 'fixed', 446 }, 447 onShow() { 448 $( itemSelector ).addClass( itemActiveClass ); 449 }, 450 onHidden() { 451 $( itemSelector ).removeClass( itemActiveClass ); 452 } 453 } 454 455 if ( 'manual' != settings['tooltipTrigger'] ) { 456 options['duration'] = [ settings['tooltipShowDuration']['size'], settings['tooltipHideDuration']['size'] ]; 457 options['animation'] = settings['tooltipAnimation']; 458 options['delay'] = settings['tooltipDelay']; 459 } 460 461 tippy( [ itemSelector ], options ); 462 463 if ( 'manual' === settings['tooltipTrigger'] && itemSelector._tippy ) { 464 itemSelector._tippy.show(); 465 } 466 467 if ( settings['tooltipShowOnInit'] && itemSelector._tippy ) { 468 itemSelector._tippy.show(); 469 } 470 471 } ); 472 }, 473 474 columnEditorSettings: function( columnId ) { 475 var editorElements = null, 476 columnData = {}; 477 478 if ( ! window.elementor.hasOwnProperty( 'elements' ) ) { 479 return false;
480 } 481 482 editorElements = window.elementor.elements; 483 484 if ( ! editorElements.models ) { 485 return false; 486 } 487 488 $.each( editorElements.models, function( index, obj ) { 489 490 $.each( obj.attributes.elements.models, function( index, obj ) { 491 if ( columnId == obj.id ) { 492 columnData = obj.attributes.settings.attributes; 493 } 494 } ); 495 496 } ); 497 498 return { 499 'sticky': columnData['jet_tricks_column_sticky'] || false, 500 'topSpacing': columnData['jet_tricks_top_spacing'] || 50, 501 'bottomSpacing': columnData['jet_tricks_bottom_spacing'] || 50, 502 'stickyOn': columnData['jet_tricks_column_sticky_on'] || [ 'desktop', 'tablet', 'mobile'] 503 } 504 505 }, 506 507 sectionEditorSettings: function( sectionId ) { 508 var editorElements = null, 509 sectionData = {}; 510 511 if ( ! window.elementor.hasOwnProperty( 'elements' ) ) { 512 return false; 513 } 514 515 editorElements = window.elementor.elements; 516 517 if ( ! editorElements.models ) { 518 return false; 519 } 520 521 $.each( editorElements.models, function( index, obj ) { 522 if ( sectionId == obj.id ) { 523 sectionData = obj.attributes.settings.attributes; 524 } 525 } ); 526 527 return { 528 'particles': sectionData['section_jet_tricks_particles'] || 'false', 529 'particles_json': sectionData['section_jet_tricks_particles_json'] || '', 530 } 531 532 } 533 534 }; 535 536 $( window ).on( 'elementor/frontend/init', JetTricks.init ); 537 538 var JetTricksTools = { 539 debounce: function( threshold, callback ) { 540 var timeout; 541 542 return function debounced( $event ) { 543 function delayed() { 544 callback.call( this, $event ); 545 timeout = null; 546 } 547 548 if ( timeout ) { 549 clearTimeout( timeout ); 550 } 551 552 timeout = setTimeout( delayed, threshold ); 553 }; 554 }, 555 556 widgetEditorSettings: function( widgetId ) { 557 var editorElements = null, 558 widgetData = {}; 559 560 if ( ! window.elementor.hasOwnProperty( 'elements' ) ) { 561 return false; 562 } 563 564 editorElements = window.elementor.elements; 565 566 if ( ! editorElements.models ) { 567 return false; 568 } 569 570 $.each( editorElements.models, function( index, obj ) { 571 572 $.each( obj.attributes.elements.models, function( index, obj ) { 573 574 $.each( obj.attributes.elements.models, function( index, obj ) { 575 if ( widgetId == obj.id ) { 576 widgetData = obj.attributes.settings.attributes; 577 } 578 } ); 579 580 } ); 581 582 } ); 583 584 return { 585 'speed': widgetData['jet_tricks_widget_parallax_speed'] || { 'size': 50, 'unit': '%'}, 586 'parallax': widgetData['jet_tricks_widget_parallax'] || 'false', 587 'invert': widgetData['jet_tricks_widget_parallax_invert'] || 'false', 588 'stickyOn': widgetData['jet_tricks_widget_parallax_on'] || [ 'desktop', 'tablet', 'mobile'], 589 'satellite': widgetData['jet_tricks_widget_satellite'] || 'false', 590 'satelliteType': widgetData['jet_tricks_widget_satellite_type'] || 'text', 591 'satellitePosition': widgetData['jet_tricks_widget_satellite_position'] || 'top-center', 592 'tooltip': widgetData['jet_tricks_widget_tooltip'] || 'false', 593 'tooltipDescription': widgetData['jet_tricks_widget_tooltip_description'] || 'Lorem Ipsum', 594 'tooltipPlacement': widgetData['jet_tricks_widget_tooltip_placement'] || 'top', 595 'tooltipArrow': 'true' === widgetData['jet_tricks_widget_tooltip_arrow'] ? true : false, 596 'xOffset': widgetData['jet_tricks_widget_tooltip_x_offset'] || 0, 597 'yOffset': widgetData['jet_tricks_widget_tooltip_y_offset'] || 0, 598 'tooltipAnimation': widgetData['jet_tricks_widget_tooltip_animation'] || 'shift-toward', 599 'tooltipTrigger': widgetData['jet_tricks_widget_tooltip_trigger'] || 'mouseenter', 600 'customSelector': widgetData['jet_tricks_widget_tooltip_custom_selector'] || '', 601 'zIndex': widgetData['jet_tricks_widget_tooltip_z_index'] || '999', 602 'delay': widgetData['jet_tricks_widget_tooltip_delay'] || '0' 603 } 604 } 605 } 606 607 /** 608 * Jet jetViewMore Class 609 * 610 * @return {void} 611 */ 612 window.jetViewMore = function( $selector, settings ) { 613 var self = this, 614 $window = $( window ), 615 $button = $( '.jet-view-more__button', $selector ), 616 defaultSettings = { 617 sections: {}, 618 effect: 'move-up', 619 showall: false 620 }, 621 settings = $.extend( {}, defaultSettings, settings ), 622 sections = settings['sections'], 623 sectionsData = {}, 624 buttonVisible = true, 625 editMode = Boolean( elementor.isEditMode() ); 626 627 /** 628 * Init 629 */ 630 self.init = function() { 631 self.setSectionsData(); 632 633 if ( editMode ) { 634 return false;
635 } 636 637 // Add Events 638 $button.on( 'click', function() { 639 640 for ( var section in sectionsData ) { 641 var $section = sectionsData[ section ]['selector']; 642 643 if ( ! settings.showall ) { 644 if ( ! sectionsData[ section ]['visible'] ) { 645 sectionsData[ section ]['visible'] = true; 646 $section.addClass( 'view-more-visible' ); 647 $section.addClass( 'jet-tricks-' + settings['effect'] + '-effect' ); 648 649 break; 650 } 651 } else { 652 sectionsData[ section ]['visible'] = true; 653 $section.addClass( 'view-more-visible' ); 654 $section.addClass( 'jet-tricks-' + settings['effect'] + '-effect' ); 655 } 656 657 } 658 659 for ( var section in sectionsData ) { 660 buttonVisible = true; 661 662 if ( sectionsData[ section ]['visible'] ) { 663 buttonVisible = false; 664 } 665 } 666 667 if ( ! buttonVisible ) { 668 $button.css( { 'display': 'none' } ); 669 } 670 671 } ); 672 }; 673 674 self.setSectionsData = function() { 675 676 for ( var section in sections ) { 677 var $selector = $( '#' + sections[ section ] ); 678 679 if ( ! editMode ) { 680 $selector.addClass( 'jet-view-more-section' ); 681 } else { 682 $selector.addClass( 'jet-view-more-section-edit-mode' ); 683 } 684 685 sectionsData[ section ] = { 686 'section_id': sections[ section ], 687 'selector': $selector, 688 'visible': false, 689 } 690 } 691 }; 692 }; 693 694 /** 695 * [jetWidgetParallax description] 696 * @param {[type]} $scope [description] 697 * @return {[type]} [description] 698 */ 699 window.jetWidgetParallax = function( $scope ) { 700 var self = this, 701 $target = $( '> .elementor-widget-container', $scope ), 702 $section = $scope.closest( '.elementor-top-section' ), 703 widgetId = $scope.data('id'), 704 settings = {}, 705 editMode = Boolean( elementor.isEditMode() ), 706 $window = $( window ), 707 isSafari = !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/), 708 platform = navigator.platform, 709 safariClass = isSafari ? 'is-safari' : '', 710 macClass = 'MacIntel' == platform ? ' is-mac' : ''; 711 712 /** 713 * Init 714 */ 715 self.init = function() { 716 717 $scope.addClass( macClass ); 718 719 if ( ! editMode ) { 720 settings = $scope.data( 'jet-tricks-settings' ); 721 } else { 722 settings = JetTricksTools.widgetEditorSettings( widgetId ); 723 } 724 725 if ( ! settings ) { 726 return false; 727 } 728 729 if ( 'undefined' === typeof settings ) { 730 return false; 731 } 732 733 if ( 'false' === settings['parallax'] || 'undefined' === typeof settings['parallax'] ) { 734 return false; 735 } 736 737 $window.on( 'scroll.jetWidgetParallax resize.jetWidgetParallax', self.scrollHandler ).trigger( 'resize.jetWidgetParallax' ); 738 }; 739 740 self.scrollHandler = function( event ) { 741 var speed = +settings['speed']['size'] * 0.01, 742 invert = 'true' == settings['invert'] ? -1 : 1, 743 winHeight = $window.height(), 744 winScrollTop = $window.scrollTop(), 745 offsetTop = $scope.offset().top, 746 thisHeight = $scope.outerHeight(), 747 sectionHeight = $section.outerHeight(), 748 positionDelta = winScrollTop - offsetTop + ( winHeight / 2 ), 749 abs = positionDelta > 0 ? 1 : -1, 750 posY = abs * Math.pow( Math.abs( positionDelta ), 0.85 ), 751 availableDevices = settings['stickyOn'] || [], 752 currentDeviceMode = elementorFrontend.getCurrentDeviceMode(); 753 754 posY = invert * Math.ceil( speed * posY ); 755 756 if ( -1 !== availableDevices.indexOf( currentDeviceMode ) ) { 757 $target.css( { 758 'transform': 'translateY(' + posY + 'px)' 759 } ); 760 } else { 761 $target.css( { 762 'transform': 'translateY(0)' 763 } ); 764 } 765 }; 766 }; 767 768 /** 769 * [jetWidgetSatellite description] 770 * @param {[type]} $scope [description] 771 * @return {[type]} [description] 772 */ 773 window.jetWidgetSatellite = function( $scope ) { 774 var self = this, 775 widgetId = $scope.data('id'), 776 settings = {}, 777 editMode = Boolean( elementor.isEditMode() ); 778 779 /** 780 * Init 781 */ 782 self.init = function() { 783 784 if ( ! editMode ) { 785 settings = $scope.data( 'jet-tricks-settings' ); 786 } else { 787 settings = JetTricksTools.widgetEditorSettings( widgetId ); 788 } 789 790 if ( ! settings ) { 791 return false;
792 } 793 794 if ( 'undefined' === typeof settings ) { 795 return false; 796 } 797 798 if ( 'false' === settings['satellite'] || 'undefined' === typeof settings['satellite'] ) { 799 return false; 800 } 801 802 $scope.addClass( 'jet-satellite-widget' ); 803 804 $( '.jet-tricks-satellite', $scope ).addClass( 'jet-tricks-satellite--' + settings['satellitePosition'] ); 805 }; 806 }; 807 808 /** 809 * [jetWidgetTooltip description] 810 * @param {[type]} $scope [description] 811 * @return {[type]} [description] 812 */ 813 window.jetWidgetTooltip = function( $scope ) { 814 var self = this, 815 widgetId = $scope.data('id'), 816 widgetSelector = $scope[0], 817 tooltipSelector = widgetSelector, 818 settings = {}, 819 editMode = Boolean( elementor.isEditMode() ), 820 delay, 821 tooltipEvent = editMode ? 'click' : 'mouseenter'; 822 823 /** 824 * Init 825 */ 826 self.init = function() { 827 828 if ( ! editMode ) { 829 settings = $scope.data( 'jet-tricks-settings' ); 830 } else { 831 settings = JetTricksTools.widgetEditorSettings( widgetId ); 832 } 833 834 if ( widgetSelector._tippy ) { 835 widgetSelector._tippy.destroy(); 836 } 837 838 if ( ! settings ) { 839 return false; 840 } 841 842 if ( 'undefined' === typeof settings ) { 843 return false; 844 } 845 846 if ( 'false' === settings['tooltip'] || 'undefined' === typeof settings['tooltip'] || '' === settings['tooltipDescription'] ) { 847 return false; 848 } 849 850 $scope.addClass( 'jet-tooltip-widget' ); 851 852 if ( settings['customSelector'] ) { 853 tooltipSelector = $( settings['customSelector'], $scope )[0]; 854 } 855 856 if ( editMode && ! $( '#jet-tricks-tooltip-content-' + widgetId )[0] ) { 857 var template = $( '<div>', { 858 id: 'jet-tricks-tooltip-content-' + widgetId, 859 class: 'jet-tooltip-widget__content' 860 } ); 861 862 template.html( settings['tooltipDescription'] ); 863 $scope.append( template ); 864 } 865 866 tippy( 867 [ tooltipSelector ], 868 { 869 content: $scope.find( '.jet-tooltip-widget__content' )[0].innerHTML, 870 allowHTML: true, 871 appendTo: widgetSelector, 872 arrow: settings['tooltipArrow'] ? true : false, 873 placement: settings['tooltipPlacement'], 874 offset: [ settings['xOffset'], settings['yOffset'] ], 875 animation: settings['tooltipAnimation'], 876 trigger: settings['tooltipTrigger'], 877 interactive: true, 878 zIndex: settings['zIndex'], 879 maxWidth: 'none', 880 delay: settings['delay']['size'] ? settings['delay']['size'] : 0, 881 popperOptions: { 882 strategy: 'fixed', 883 }, 884 } 885 ); 886 887 if ( editMode && widgetSelector._tippy ) { 888 widgetSelector._tippy.show(); 889 } 890 891 }; 892 }; 893 894}( jQuery, window.elementorFrontend ) );
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.