PageSourceSearch

https://www.hazirticaretsitesi.com/wp-content/themes/platinum/assets/js/viewportchecker.js?ver=5.7.19

js hazirticaretsitesi.com collected 2026-09-26 06:47:53 UTC 6,168 bytes, 219 lines download raw bytes

1/*
2    Version 1.3.2
3    The MIT License (MIT)
4
5    Copyright (c) 2014 Dirk Groenen
6
7    Permission is hereby granted, free of charge, to any person obtaining a copy of
8    this software and associated documentation files (the "Software"), to deal in
9    the Software without restriction, including without limitation the rights to
10    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11    the Software, and to permit persons to whom the Software is furnished to do so,
12    subject to the following conditions:
13
14    The above copyright notice and this permission notice shall be included in all
15    copies or substantial portions of the Software.
16*/
17
18(function($){
19    $.fn.viewportChecker = function(useroptions){
20        // Define options and extend with user
21        var options = {
22            classToAdd: 'visible',
23            offset: 100,
24            callbackFunction: function(elem){}
25        };
26        $.extend(options, useroptions);
27
28        // Cache the given element and height of the browser
29        var $elem = this,
30            windowHeight = $(window).height();
31
32        this.checkElements = function(){
33            // Set some vars to check with
34            var scrollElem = ((navigator.userAgent.toLowerCase().indexOf('webkit') != -1) ? 'body' : 'html'),
35                viewportTop = $(scrollElem).scrollTop(),
36                viewportBottom = (viewportTop + windowHeight);
37
38            $elem.each(function(){
39                var $obj = $(this);
40                // If class already exists; quit
41                if ( $obj.hasClass(options.classToAdd) && options.classToAdd != '' ){
42                    return;
43                }
44
45                // define the top position of the element and include the offset which makes is appear earlier or later
46                var elemTop = Math.round( $obj.offset().top ) + options.offset,
47                    elemBottom = elemTop + ($obj.height());
48
49                // Add class if in viewport
50                if ((elemTop < viewportBottom) && (elemBottom > viewportTop) && this.done != true){
51                    $obj.addClass(options.classToAdd);
52
53                    // Do the callback function. Callback wil send the jQuery object as parameter
54                    options.callbackFunction($obj);
55                }
56            });
57        };
58
59        // Run checkelements on load and scroll
60        $(window).scroll(this.checkElements);
61        this.checkElements();
62
63        // On resize change the height var
64        $(window).resize(function(e){
65            windowHeight = e.currentTarget.innerHeight;
66        });
67    };
68
69
70	$(document).ready(function( $ ){
71		$('.animated').each(function(){
72		
73			var delay = this.className.split('delay-')[1];
74			if( delay ){
75				$(this).css({
76					'-webkit-animation-delay' : delay.split(' ')[0],
77					'animation-delay' : delay.split(' ')[0]
78				});
79			}
80		
81			var type = this.className.split('eff-')[1];
82			if( type ){
83				type = type.split(' ')[0];
84				$(this).addClass('effHidden').viewportChecker({
85				   	 classToAdd: type+' effVisible',
86				   	 offset: 100, 
87				   	 callbackFunction: function(obj){
88				   	 
89					   obj.get(0).done = true;
90					   	 
91			   	 		var clasz = obj.attr('class');
92			   	 		
93			   	 		var delay = 1500;
94			   	 		var claszz = '';
95			   	 		if( clasz.indexOf('delay-') > -1 ){
96				   	 		delay = clasz.split('delay-')[1].split('ms')[0];
97				   	 	}	
98				   	 	delay = parseInt(delay);
99				   	 	if( !delay ){
100					   	 	delay = 1500;
101				   	 	}else if(delay != 1500){
102					   	 	delay += 1500;
103				   	 	}
104	
105				   	 	if( clasz.indexOf('eff-') > -1 ){	
106				   	 		var claszz = clasz.split('eff-')[1].split(' ')[0];
107			   	 		}
108	
109				   	 	setTimeout(function( a , b ){
110				   	 		if( a != null ){
111							   	 a.removeClass('effHidden');
112							   	 a.removeClass('effVisible');
113							   	 a.removeClass('animated');
114							   	 a.removeClass( b );
115							   	 a.removeClass( 'eff-'+b );
116						   	 }
117					   	}, delay , obj , claszz );
118					   	
119				   	 }    
120				});
121			}
122		});
123		$('.counter').each(function(){
124			this.target = parseInt( this.innerHTML );
125			this.innerHTML = '0';
126			$(this).viewportChecker({
127				callbackFunction: function( elm ){
128			
129					if( elm.html() == elm.get(0).target ){
130						return;
131					}
132					
133					elm.get(0).starter = 0;
134					elm.get(0).loop = function(){
135						if( this.starter < this.target ){
136							this.starter += 1+(this.target/100);
137							this.innerHTML = parseInt(this.starter);
138							setTimeout( function(){elm.get(0).loop()}, 10+(Math.random()*100) );
139						}else{
140							this.innerHTML = this.target;
141						}
142					}
143					elm.get(0).loop();
144				}
145			});
146		});	
147		
148		
149		$('.piechart').each(function(){
150	
151			$(this).viewportChecker({
152				callbackFunction: function( elm ){
153					
154					var data = elm.attr('data-option');
155					if( data == 'loaded' ){
156						return;
157					}			
158					
159					elm.attr( 'rel', 'loaded' );
160					
161					data = data.split('|');
162	
163					var options = {
164						percentage: data[0],
165						speed: 30,
166						fontSize: data[1],
167						diameter: data[2],
168						lineColor: data[3],
169						remainingLineColor: 'rgba(200,200,200,0.4)',
170						lineWidth: data[4]
171
172					}
173	
174					if( data[3] == '#fff' ){
175						elm.find('canvas').eq(0).ClassyLoader3( options );
176					}else if( $(elm).hasClass('white') ){
177						elm.find('canvas').eq(0).ClassyLoader4( options );
178					}else{
179						elm.find('canvas').eq(0).ClassyLoader( options );
180					}	
181					
182				}
183			});
184		});
185			
186		
187		$('#menu-onepage a').each(function(){
188	
189			if( $(this).attr('href').indexOf('#') > -1 ){
190				
191				var id =  $(this).attr('href').split('#')[1];
192				if( id != '' ){
193					$( '#'+id ).viewportChecker({
194						callbackFunction: function( elm ){
195							clearTimeout( document.optimer );
196							document.optimer = setTimeout( function(){
197								$('#menu-onepage li.active').removeClass('active');
198								$('#menu-onepage a').each(function(){
199									if( $(this).attr('href') == '#'+elm.attr('id') ){
200										$(this).closest('li').addClass('active');
201									}
202								});	
203							}, 300 );					
204						},
205						classToAdd: ''
206					});
207				}
208			}
209			
210		});
211	
212	});
213
214})(jQuery);
215
216
217
218
219

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.