PageSourceSearch

https://www.heal-link.gr/wp-content/themes/porto/js/appearanimate.js?ver=7.8.4

js heal-link.gr collected 2026-09-24 09:42:02 UTC 6,899 bytes, 250 lines download raw bytes

1( function( $ ) {
2	window.theme = window.theme || {};
3	if ( typeof window.theme.animation_support == 'undefined' ) {
4		theme.animation_support = !window.jQuery( 'html' ).hasClass( 'no-csstransitions' );
5		theme.getOptions = function( opts ) {
6			if ( typeof ( opts ) == 'object' ) {
7				return opts;
8			} else if ( typeof ( opts ) == 'string' ) {
9				try {
10					return JSON.parse( opts.replace( /'/g, '"' ).replace( ';', '' ) );
11				} catch ( e ) {
12					return {};
13				}
14			} else {
15				return {};
16			}
17		}
18		theme.execPluginFunction = function( functionName, context ) {
19			var args = Array.prototype.slice.call( arguments, 2 );
20			var namespaces = functionName.split( "." );
21			var func = namespaces.pop();
22
23			for ( var i = 0; i < namespaces.length; i++ ) {
24				context = context[namespaces[i]];
25			}
26
27			return context[func].apply( context, args );
28		}
29		theme.mergeOptions = function( obj1, obj2 ) {
30			var obj3 = {};
31			for ( var attrname in obj1 ) { obj3[attrname] = obj1[attrname]; }
32			for ( var attrname in obj2 ) { obj3[attrname] = obj2[attrname]; }
33			return obj3;
34		}
35		theme.dynIntObsInit = function( selector, functionName, pluginDefaults ) {
36			var $el;
37			if ( typeof selector == 'string' ) {
38				$el = document.querySelectorAll( selector );
39			} else {
40				$el = selector;
41			}
42
43			Array.prototype.forEach.call( $el, function( obj ) {
44				var $this = $( obj ),
45					opts;
46				if ( $this.data( 'observer-init' ) ) {
47					return;
48				}
49
50				var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) );
51				if ( pluginOptions )
52					opts = pluginOptions;
53
54				var mergedPluginDefaults = theme.mergeOptions( pluginDefaults, opts )
55
56				var intersectionObserverOptions = {
57					rootMargin: '0px 0px 200px 0px',
58					thresholds: 0
59				}
60				if ( mergedPluginDefaults.accY ) {
61					intersectionObserverOptions.rootMargin = '0px 0px ' + Number( mergedPluginDefaults.accY ) + 'px 0px';
62				}
63
64				var observer = new IntersectionObserver( function( entries ) {
65					for ( var i = 0; i < entries.length; i++ ) {
66						var entry = entries[i];
67						if ( entry.intersectionRatio > 0 ) {
68							theme.execPluginFunction( functionName, $this, mergedPluginDefaults );
69
70							// Unobserve
71							observer.unobserve( entry.target );
72						}
73					}
74				}, intersectionObserverOptions );
75
76				observer.observe( obj );
77				$this.data( 'observer-init', true );
78			} );
79		}
80	}
81} )( window.jQuery );
82
83// Animate
84( function( theme, $ ) {
85	'use strict';
86
87	theme = theme || {};
88
89	var instanceName = '__animate';
90
91	var Animate = function( $el, opts ) {
92		return this.initialize( $el, opts );
93	};
94
95	Animate.defaults = {
96		accX: 0,
97		accY: -120,
98		delay: 1,
99		duration: 1000
100	};
101
102	Animate.prototype = {
103		initialize: function( $el, opts ) {
104			if ( $el.data( instanceName ) ) {
105				return this;
106			}
107
108			this.$el = $el;
109
110			this
111				.setData()
112				.setOptions( opts )
113				.build();
114
115			return this;
116		},
117
118		setData: function() {
119			this.$el.data( instanceName, true );
120
121			return this;
122		},
123
124		setOptions: function( opts ) {
125			this.options = $.extend( true, {}, Animate.defaults, opts, {
126				wrapper: this.$el
127			} );
128
129			return this;
130		},
131
132		build: function() {
133			var self = this,
134				$el = this.options.wrapper,
135				delay = 0,
136				duration = 0;
137
138			if ( $el.data( 'appear-animation-svg' ) ) {
139				$el.find( '[data-appear-animation]' ).each( function() {
140					var $this = $( this ),
141						opts;
142
143					var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) );
144					if ( pluginOptions )
145						opts = pluginOptions;
146
147					$this.themeAnimate( opts );
148				} );
149
150				return this;
151			}
152
153			$el.addClass( 'appear-animation' );
154
155			var el_obj = $el.get( 0 );
156
157			delay = Math.abs( $el.data( 'appear-animation-delay' ) ? $el.data( 'appear-animation-delay' ) : self.options.delay );
158			duration = Math.abs( $el.data( 'appear-animation-duration' ) ? $el.data( 'appear-animation-duration' ) : self.options.duration );
159			if ( 'undefined' !== typeof $el.data( 'appear-animation' ) && $el.data( 'appear-animation' ).includes( 'revealDir' ) ) {
160				if ( delay > 1 ) {
161					el_obj.style.setProperty( '--porto-reveal-animation-delay', delay + 'ms' );
162				}
163				if ( duration != 1000 ) {
164					el_obj.style.setProperty( '--porto-reveal-animation-duration', duration + 'ms' );
165				}
166				if ( $el.data( 'animation-reveal-clr' ) ) {
167					el_obj.style.setProperty(  '--porto-reveal-clr', $el.data( 'animation-reveal-clr' ) );
168				}
169			} else {
170				if ( delay > 1 ) {
171					el_obj.style.animationDelay = delay + 'ms';
172				}
173				if ( duration != 1000 ) {
174					el_obj.style.animationDuration = duration + 'ms';
175				}				
176			}
177
178			/*if ( $el.find( '.porto-lazyload:not(.lazy-load-loaded)' ).length ) {
179				$el.find( '.porto-lazyload:not(.lazy-load-loaded)' ).trigger( 'appear' );
180			}*/
181			$el.addClass( $el.data( 'appear-animation' ) + ' appear-animation-visible' );
182
183			return this;
184		}
185	};
186
187	// expose to scope
188	$.extend( theme, {
189		Animate: Animate
190	} );
191
192	// jquery plugin
193	$.fn.themeAnimate = function( opts ) {
194		return this.map( function() {
195			var $this = $( this );
196
197			if ( $this.data( instanceName ) ) {
198				return $this;
199			} else {
200				return new theme.Animate( $this, opts );
201			}
202
203		} );
204	};
205
206} ).apply( this, [window.theme, jQuery] );
207
208
209( function( theme, $ ) {
210    theme = theme || {};
211	
212	var funcAnimate = function( $wrap, wrapObj ) {
213        // Animate
214		if ( $.fn.themeAnimate && typeof wrapObj != 'undefined' ) {
215
216			$( function() {
217				var svgAnimates = wrapObj.querySelectorAll( 'svg [data-appear-animation]' );
218				if ( svgAnimates.length ) {
219					$( svgAnimates ).closest( 'svg' ).attr( 'data-appear-animation-svg', '1' );
220				}
221				var $animates = wrapObj.querySelectorAll( '[data-plugin-animate], [data-appear-animation], [data-appear-animation-svg]' );
222				if ( $animates.length ) {
223					var animateResize = function() {
224						if ( window.innerWidth < 768 ) {
225							window.removeEventListener( 'resize', animateResize );
226							$animates.forEach( function( o ) {
227								o.classList.add( 'appear-animation-visible' );
228							} );
229						}
230					};
231					if ( theme.animation_support ) {
232						window.addEventListener( 'resize', animateResize );
233						theme.dynIntObsInit( $animates, 'themeAnimate', theme.Animate.defaults );
234					} else {
235						$animates.forEach( function( o ) {
236							o.classList.add( 'appear-animation-visible' );
237						} );
238					}
239				}
240			} );
241		} 
242	}
243
244	funcAnimate( '', document.body );
245    $( document.body ).on( 'porto_after_async_init', function( e, $wrap, wrapObj ) {
246		if ( theme.isAsyncInit != -1 ) { // not initial
247			funcAnimate( $wrap, wrapObj );	
248		}
249    } );
250} ).apply( this, [window.theme, 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.