PageSourceSearch

https://www.jeffwonginsurance.com/PTMSCMS/lib/locLayout/site/common/js/plugins.js

js jeffwonginsurance.com collected 2026-10-06 13:03:48 UTC 13,795 bytes, 456 lines download raw bytes

1(function( $ ) {
2	$.fn.rotator = function(options){
3
4		var rotatorIndex = 0;	
5		var rotatorVisibleItems = options.visibleItems;
6
7		var rotatorWidth = parseInt(this.find('.rotator-item').width()) + parseInt(this.find('.rotator-item').css('margin-right'));
8		var rotatorCount = this.find('.rotator-item').length;
9
10		var rotatorWindow = this.find('.rotator-window');
11		var prevButton = this.find('.prev');
12		var nextButton = this.find('.next');
13                
14                var animating = false;
15
16		if( rotatorCount > rotatorVisibleItems ) {
17			nextButton.addClass('active');
18		}
19
20		nextButton.click(function(){
21			if(rotatorIndex < rotatorCount -rotatorVisibleItems ){
22                            if(!animating)
23                            {
24                                mleft = rotatorWindow.css('margin-left').replace('px', '');
25                                newMleft = new String(parseInt(mleft) - rotatorWidth);
26                                rotatorWindow.animate({
27                                        'margin-left': newMleft + 'px'
28                                }, 1000, function(){
29                                    animating = false;
30                                });
31                                rotatorIndex++;
32                                animating = true;
33                            }
34			}
35			if(rotatorIndex == rotatorCount -rotatorVisibleItems){
36				if($(this).hasClass('active')){
37					$(this).removeClass('active');
38				}
39			}
40			if(!prevButton.hasClass('active')){
41				prevButton.addClass('active');
42			}
43			return false;
44		});
45
46		prevButton.click(function(){
47			if(rotatorIndex > 0 ){
48                            if(!animating)
49                            {
50				mleft = rotatorWindow.css('margin-left').replace('px', '');
51				newMleft = new String(parseInt(mleft) + rotatorWidth);
52				rotatorWindow.animate({
53					'margin-left': newMleft + 'px'
54				}, 1000, function(){
55                                    animating = false;
56                                });
57				rotatorIndex--;
58                                animating = true;
59                            }
60			}
61			if(rotatorIndex == 0){
62				if($(this).hasClass('active')){
63					$(this).removeClass('active');
64				}
65			}
66			if(!nextButton.hasClass('active')){
67				nextButton.addClass('active');
68			}
69			return false;
70		});
71	};
72	
73})( jQuery );
74
75(function( $ ) {
76	$.fn.fadeRotator = function(){
77
78                var fadeRotator = this;
79
80		var rotatorIndex = 0;	
81		var currentItem = null;
82                var rotatorCount = fadeRotator.find('.rotator-item').length;
83
84		var prevButton = fadeRotator.find('.prev');
85		var nextButton = fadeRotator.find('.next');
86                
87                fadeRotator.find('.rotator-item').css('display', 'none');
88                
89                currentItem = fadeRotator.find('.rotator-item:first-child');
90                
91                currentItem.fadeIn();
92                
93		nextButton.click(function(){
94                    
95			if((rotatorIndex + 1) < rotatorCount ){
96                            
97                            rotatorIndex++;
98                            
99                            var nextItem = fadeRotator.find('.rotator-item:nth-child(' + (rotatorIndex + 1) + ')');
100                            
101                            currentItem.fadeOut(300, function() {
102                                nextItem.fadeIn(300);
103                            });
104                            
105                            currentItem = nextItem;
106                            
107			}
108			if(rotatorIndex == rotatorCount){
109				if($(this).hasClass('active')){
110					$(this).removeClass('active');
111				}
112			}
113			if(!prevButton.hasClass('active')){
114				prevButton.addClass('active');
115			}
116			return false;
117		});
118
119		prevButton.click(function(){
120			if(rotatorIndex > 0 ){
121                            rotatorIndex--;
122                            
123                            var nextItem = fadeRotator.find('.rotator-item:nth-child(' + (rotatorIndex + 1) + ')');
124                            
125                            currentItem.fadeOut(300, function() {
126                                nextItem.fadeIn(300);
127                            });
128                            
129                            currentItem = nextItem;
130			}
131			if(rotatorIndex == 0){
132				if($(this).hasClass('active')){
133					$(this).removeClass('active');
134				}
135			}
136			if(!nextButton.hasClass('active')){
137				nextButton.addClass('active');
138			}
139			return false;
140		});
141	};
142	
143})( jQuery );
144
145
146
147(function( $ ) {
148	$.fn.testimonials = function(){
149		this.find(".testimonial-rotator").children().first().show();
150
151		var setTestimonialInterval;
152		var showNextTestimonial = function(){
153			var currentItem = $('.testimonial:visible').first();
154
155				currentItem.fadeOut('slow', function(){
156					var nextItem = currentItem.next();
157					if(nextItem.length == 0){
158						nextItem = $('.testimonial').first();
159					}
160					nextItem.fadeIn('slow');
161			nextItem.jScrollPane({autoReinitialise: true});
162				}); 
163		}
164
165		if($('.testimonial').length > 1){
166			setTestimonialInterval = setInterval(showNextTestimonial, 13000);
167			
168			this.hover(
169				function(){
170					clearInterval(setTestimonialInterval);
171				},
172				function(){
173					setTestimonialInterval = setInterval(showNextTestimonial, 13000);
174				}
175			);
176
177			$('.testimonial-prev').click(function(){
178
179				clearInterval(setTestimonialInterval);
180					var currentItem = $('.testimonial:visible').first();
181					currentItem.fadeOut('slow', function(){
182						var prevItem = currentItem.prev();
183	  				if(prevItem.length == 0){
184	  					prevItem = $('.testimonial').last();
185	  				}
186						prevItem.fadeIn('slow');
187					setTestimonialInterval = setInterval(showNextTestimonial, 13000);
188					});
189			});
190
191			$('.testimonial-next').click(function(){
192				clearInterval(setTestimonialInterval);
193				showNextTestimonial();
194					setTestimonialInterval = setInterval(showNextTestimonial, 13000);
195			});
196		}
197		
198	};
199	
200})( jQuery );
201
202
203(function( $ ) {
204	$.fn.carriers = function(){
205				$('.provider').first().show();
206  				$('.provider').each(function(){
207  					$(this).css("background-image", "url('" +$(this).attr('rel') + "')");
208
209  					// IE hax
210  					$(this).css('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + $(this).attr('rel') + "', sizingMethod='scale')");
211  					$(this).css('-ms-filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + $(this).attr('rel') + "', sizingMethod='scale')");
212  				});
213
214
215  				if($('.provider').length > 1){
216	  				setInterval(function(){
217		  				var currentProvider = $('.provider:visible').first();
218
219		  				currentProvider.fadeOut('slow', function(){
220		  					var nextProvider = currentProvider.next();
221			  				if(nextProvider.length == 0){
222			  					nextProvider = $('.provider').first();
223			  				}
224		  					nextProvider.fadeIn('slow');
225		  				});
226					}, 5000);
227	  			}
228		
229	};
230	
231})( jQuery );
232
233(function( $ ) {
234    
235	$.fn.getDirections = function(latitude, longitude){
236
237            $("#origin").unbind('keypress').on('keypress', function(event){
238                
239                if (event.which == 13) {
240                    
241                    event.preventDefault();
242                    
243                    getDirections(latitude, longitude);
244                }
245                
246            });
247
248            $('#submitButton').unbind('click').on('click', function(event){
249
250                getDirections(latitude, longitude);
251
252            });
253
254        }
255        
256})( jQuery );
257
258(function( $ ) {
259    
260	$.fn.iconRotator = function(options){
261        
262            var rotator = $(this);
263            
264            if(rotator.find('.rotator-item').length != 0)
265            {
266                var rotatorFirstItem = rotator.find('.rotator-item').first();
267                var arrowFirst = rotator.find('.rotator-prev').first();
268
269                var itemWidth = parseInt(rotatorFirstItem.width()) + parseInt(rotatorFirstItem.css('margin-left')) + parseInt(rotatorFirstItem.css('margin-right'));
270                var arrowWidth = parseInt(arrowFirst.width()) + parseInt(arrowFirst.css('margin-left')) + parseInt(arrowFirst.css('margin-right'));
271
272                var totalItems = rotator.find('.rotator-item').length
273                var allItemWidth = (totalItems * itemWidth);
274
275                var visibleItems = 0;
276
277                if(allItemWidth <= rotator.width())
278                {
279                    //we dont need arrows
280                    rotator.css('width', allItemWidth);
281                    rotator.css('margin-left', 'auto');
282                    rotator.css('margin-right', 'auto'); 
283                    rotator.find('.rotator-prev').css('display', 'none');
284                    rotator.find('.rotator-next').css('display', 'none');
285                    rotator.find('.rotator-items').css('width', '100%');
286
287                    visibleItems = totalItems;
288                }
289                else
290                {
291                    var allocatedWidth = arrowWidth * 2;
292
293                    do
294                    {
295                        visibleItems++;
296
297                        allocatedWidth += itemWidth;
298
299                    }while(allocatedWidth < rotator.width())
300
301                    if(allocatedWidth > rotator.width() && visibleItems)
302                    {
303                        visibleItems--;
304
305                        allocatedWidth -= itemWidth;
306
307                        var leftOverSpace = rotator.width() - allocatedWidth;
308                        var itemMarginRight = leftOverSpace / visibleItems;
309
310                        rotator.find('.rotator-item').css('margin-left', itemMarginRight);
311
312                        itemWidth = parseInt(rotatorFirstItem.width()) + parseInt(rotatorFirstItem.css('margin-left')) + parseInt(rotatorFirstItem.css('margin-right'));
313                    }
314
315                }
316
317                var prevButton = rotator.find('.prev');
318                var nextButton = rotator.find('.next');
319                var rotatorWindow = rotator.find('.rotator-window');
320                var rotatorAnimating = false;
321
322                prevButton.on('click', function(){
323
324                   if(!rotatorAnimating) 
325                   {
326                       rotatorAnimating = true;
327
328                       var currentOffset = parseInt(rotatorWindow.css('margin-left'));
329
330                       if(currentOffset < 0)
331                       {
332                           currentOffset += itemWidth;
333
334                           rotatorWindow.animate({'margin-left': currentOffset + 'px'}, 300, function(){
335
336                               rotatorAnimating = false;
337
338                               if(currentOffset >= 0)
339                               {
340                                   rotator.find('.rotator-prev').removeClass('active');
341                               }
342
343                           });
344                       }
345                       else
346                       {
347                           rotatorAnimating = false;
348                       }
349
350                   }
351
352                });
353
354                nextButton.on('click', function(){
355
356                   if(!rotatorAnimating) 
357                   {
358                       rotatorAnimating = true;
359
360                       var currentOffset = parseInt(rotatorWindow.css('margin-left'));
361
362                       var visibleItemOffset = visibleItems * itemWidth;
363
364                       if(currentOffset + (totalItems * itemWidth) >= rotator.width())
365                       {
366                           currentOffset -= itemWidth;
367
368                           rotatorWindow.animate({'margin-left': currentOffset + 'px'}, 300, function(){
369
370                               rotatorAnimating = false;
371
372                               if((currentOffset * -1) + visibleItemOffset >= allItemWidth)
373                               {
374                                   rotator.find('.rotator-prev').removeClass('active');
375                               }
376
377                           });
378
379                       }
380                       else
381                       {
382                           rotatorAnimating = false;
383                       }
384                   }
385
386                });
387
388            }
389            else
390            {
391                rotator.css('height', '0px');
392                rotator.find('.rotator-prev').css('display', 'none');
393                rotator.find('.rotator-next').css('display', 'none');
394            }
395            
396        }
397        
398})( jQuery );
399
400function getDirections(latitude, longitude)
401{
402    var origin = $('#origin').val();
403    if ($('#destination').length > 0) {
404        var destination = $('#destination').val();
405    } else {
406        var destination = new google.maps.LatLng(latitude, longitude);
407    }
408    var container = $('#directionsRenderer');
409
410    var service = new google.maps.DirectionsService();
411    var renderer = new google.maps.DirectionsRenderer();
412
413    var request = {
414            origin: origin,
415            destination: destination,
416            travelMode: google.maps.DirectionsTravelMode.DRIVING
417    }
418
419    container.empty();
420
421    $('.print-directions').remove();
422
423    renderer.setPanel( container.get(0) );
424
425    service.route(request, function(response, status){
426
427            if( status == google.maps.DirectionsStatus.OK ) {
428
429                    renderer.setDirections(response);
430
431                    $('#directionsPage .print').css('display', 'block');
432
433            } else {
434
435                    container.html('<p><em>Directions not available for the specified address.</em></p>');
436
437            }
438
439    });
440}
441
442(function( $ ) {
443	$.fn.theySeeMeScrollin = function(theyHatin){
444	    
445	    //we be scrollin' to da top on iframe loads
446	    $('iframe').on('load', function(){
447
448		 $('html,body').animate({
449		   scrollTop: 0
450		 }, 1000);
451
452	    });
453	    
454	}
455})( jQuery );
456

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.