1'use strict'; 2 3( function ( $, w ) { 4 5 var $window = $( w ); 6 7 function debounce(func, wait, immediate) { 8 var timeout; 9 return function() { 10 var context = this, args = arguments; 11 var later = function() { 12 timeout = null; 13 if (!immediate) func.apply(context, args); 14 }; 15 var callNow = immediate && !timeout; 16 clearTimeout(timeout); 17 timeout = setTimeout(later, wait); 18 if (callNow) func.apply(context, args); 19 }; 20 } 21 22 $window.on( 'elementor/frontend/init', function() { 23 24 var ModuleHandler = elementorModules.frontend.handlers.Base, 25 HoverAnimator; 26 27 HoverAnimator = ModuleHandler.extend( { 28 29 can_hover: window.matchMedia( '(hover: hover)' ).matches, 30 31 onInit: function() { 32 33 ModuleHandler.prototype.onInit.apply( this, arguments ); 34 35 if( this.isHoverAnimatorContainer() ) { 36 this.$element.addClass( 'ob-is-hoveranimator' ); 37 } 38 if( this.isHoverAnimatorWidget() ) { 39 40 if( ! this.isEdit && ! this.can_hover && 'yes' === this.getElementSettings( '_ob_allow_hoveranimator_touch' ) ) { 41 this.$element.removeClass( 'ob-is-hoveranimal' ); 42 return; 43 } 44 45 this.$element.addClass( 'ob-is-hoveranimal' ); 46 this.run(); 47 } 48 49 }, 50 51 isHoverAnimatorContainer: function() { 52 return ( this.getElementSettings( '_ob_column_hoveranimator' ) === 'yes' ); 53 }, 54 55 isHoverAnimatorWidget: function() { 56 return ( this.getElementSettings( '_ob_allow_hoveranimator' ) === 'yes' ); 57 }, 58 59 onElementChange: function( changedProp ) { 60 /* Column / Container */ 61 if( changedProp === '_ob_column_hoveranimator' ) { 62 if( 'yes' === this.getElementSettings( '_ob_column_hoveranimator' ) ) this.$element.addClass( 'ob-is-hoveranimator' ); 63 else this.$element.removeClass( 'ob-is-hoveranimator' ); 64 } 65 /* Widgets */ 66 if( changedProp === '_ob_allow_hoveranimator' ) { 67 if( 'yes' === this.getElementSettings( '_ob_allow_hoveranimator' ) ) { 68 this.$element.addClass( 'ob-is-hoveranimal' ); 69 this.run(); 70 } else this.$element.removeClass( 'ob-is-hoveranimal' ); 71 } 72 /* Widget props */ 73 if( [ '_ob_hoveranimator_opacity_hover', '_ob_hoveranimator_y_hover', '_ob_hoveranimator_y_hover_alt', '_ob_hoveranimator_x_hover', '_ob_hoveranimator_x_hover_alt', '_ob_hoveranimator_rot_hover', '_ob_hoveranimator_scalex_hover', '_ob_hoveranimator_scaley_hover', '_ob_hoveranimator_blur_hover' ].indexOf( changedProp ) !== -1 ) { 74 debounce( function() { 75 this.run(); 76 }, 500 ); 77 } 78 }, 79 80 runHoverAnimator: function() { 81 82 // var myself = this.$element.children('div').first(); 83 var myself = this.$element.children('h1, h2, h3, h4, h5, h6, p, div, span').first(); 84 85 86 var parent_column = myself.parent().closest( '.ob-is-hoveranimator' ); 87 if( parent_column.length ) { 88 89 var top_alt, left_alt, text_node; 90 var col_id = parent_column.data( 'id' ); 91 92 var opacity = this.getElementSettings( '_ob_hoveranimator_opacity_hover' ) || 1; 93 var pos_y = this.getElementSettings( '_ob_hoveranimator_y_hover' ) || 0; 94 var pos_y_alt = this.getElementSettings( '_ob_hoveranimator_y_hover_alt' ) || ''; 95 var pos_x = this.getElementSettings( '_ob_hoveranimator_x_hover' ) || 0; 96 var pos_x_alt = this.getElementSettings( '_ob_hoveranimator_x_hover_alt' ) || ''; 97 var rot = this.getElementSettings( '_ob_hoveranimator_rot_hover' ) || 0; 98 var scale_x = this.getElementSettings( '_ob_hoveranimator_scalex_hover' ) || 1; 99 var scale_y = this.getElementSettings( '_ob_hoveranimator_scaley_hover' ) || 1; 100 var blur = this.getElementSettings( '_ob_hoveranimator_blur_hover' ) || 0; 101 102 // alt values chckpoint 103 if( '' != $.trim( pos_x_alt ) && undefined !== pos_x_alt ) left_alt = 'calc(' + pos_x_alt + ')'; 104 else left_alt = pos_x.size + pos_x.unit; 105 if( '' != $.trim( pos_y_alt ) && undefined !== pos_y_alt ) to
105p_alt = 'calc(' + pos_y_alt + ')'; 106 else top_alt = pos_y.size + pos_y.unit; 107 108 var hover_css = { 109 'opacity': opacity.size, 110 'top': top_alt, 111 'left': left_alt, 112 'transform': 'rotate(' + rot.size + 'deg) scaleX(' + scale_x.size + ') scaleY(' + scale_y.size + ')', 113 'filter': 'blur(' + blur.size + blur.unit + ')' 114 }; 115 116 parent_column.on( 'mouseenter.' + col_id, function() { 117 myself.css( hover_css ); 118 } ); 119 parent_column.on( 'mouseleave.' + col_id, function() { 120 myself.removeAttr( 'style' ); 121 } ); 122 123 } 124 125 }, 126 127 run: function() { 128 if( this.isHoverAnimatorWidget() ) this.runHoverAnimator(); 129 }, 130 131 } ); 132 133 var handlersList = { 134 'container': HoverAnimator, 135 'column': HoverAnimator, 136 'widget': HoverAnimator, 137 }; 138 139 $.each( handlersList, function( widgetName, handlerClass ) { 140 elementorFrontend.hooks.addAction( 'frontend/element_ready/' + widgetName, function( $scope ) { 141 elementorFrontend.elementsHandler.addHandler( handlerClass, { $element: $scope } ); 142 } ); 143 } ); 144 145 } ); 146 147 148} ( jQuery, window ) );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.