PageSourceSearch

https://rendezvousbay.com/wp-content/themes/rendezvous-bay-theme/library/js/scripts.js

js rendezvousbay.com collected 2026-10-08 23:23:32 UTC 15,958 bytes, 513 lines download raw bytes

1/*
2 * Bones Scripts File
3 * Author: Eddie Machado
4 *
5 * This file should contain any js scripts you want to add to the site.
6 * Instead of calling it in the header or throwing it inside wp_head()
7 * this file will be called automatically in the footer so as not to
8 * slow the page load.
9 *
10 * There are a lot of example functions and tools in here. If you don't
11 * need any of it, just remove it. They are meant to be helpers and are
12 * not required. It's your world baby, you can do whatever you want.
13*/
14
15
16/*
17 * Get Viewport Dimensions
18 * returns object with viewport dimensions to match css in width and height properties
19 * ( source: http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript )
20*/
21function updateViewportDimensions() {
22	var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight;
23	return { width:x,height:y };
24}
25// setting the viewport width
26var viewport = updateViewportDimensions();
27
28
29/*
30 * Throttle Resize-triggered Events
31 * Wrap your actions in this function to throttle the frequency of firing them off, for better performance, esp. on mobile.
32 * ( source: http://stackoverflow.com/questions/2854407/javascript-jquery-window-resize-how-to-fire-after-the-resize-is-completed )
33*/
34var waitForFinalEvent = (function () {
35	var timers = {};
36	return function (callback, ms, uniqueId) {
37		if (!uniqueId) { uniqueId = "Don't call this twice without a uniqueId"; }
38		if (timers[uniqueId]) { clearTimeout (timers[uniqueId]); }
39		timers[uniqueId] = setTimeout(callback, ms);
40	};
41})();
42
43// how long to wait before deciding the resize has stopped, in ms. Around 50-100 should work ok.
44var timeToWaitForLast = 100;
45
46
47/*
48 * Here's an example so you can see how we're using the above function
49 *
50 * This is commented out so it won't work, but you can copy it and
51 * remove the comments.
52 *
53 *
54 *
55 * If we want to only do it on a certain page, we can setup checks so we do it
56 * as efficient as possible.
57 *
58 * if( typeof is_home === "undefined" ) var is_home = $('body').hasClass('home');
59 *
60 * This once checks to see if you're on the home page based on the body class
61 * We can then use that check to perform actions on the home page only
62 *
63 * When the window is resized, we perform this function
64 * $(window).resize(function () {
65 *
66 *    // if we're on the home page, we wait the set amount (in function above) then fire the function
67 *    if( is_home ) { waitForFinalEvent( function() {
68 *
69 *	// update the viewport, in case the window size has changed
70 *	viewport = updateViewportDimensions();
71 *
72 *      // if we're above or equal to 768 fire this off
73 *      if( viewport.width >= 768 ) {
74 *        console.log('On home page and window sized to 768 width or more.');
75 *      } else {
76 *        // otherwise, let's do this instead
77 *        console.log('Not on home page, or window sized to less than 768.');
78 *      }
79 *
80 *    }, timeToWaitForLast, "your-function-identifier-string"); }
81 * });
82 *
83 * Pretty cool huh? You can create functions like this to conditionally load
84 * content and other stuff dependent on the viewport.
85 * Remember that mobile devices and javascript aren't the best of friends.
86 * Keep it light and always make sure the larger viewports are doing the heavy lifting.
87 *
88*/
89
90/*
91 * We're going to swap out the gravatars.
92 * In the functions.php file, you can see we're not loading the gravatar
93 * images on mobile to save bandwidth. Once we hit an acceptable viewport
94 * then we can swap out those images since they are located in a data attribute.
95*/
96function loadGravatars() {
97  // set the viewport using the function above
98  viewport = updateViewportDimensions();
99  // if the viewport is tablet or larger, we load in the gravatars
100  if (viewport.width >= 768) {
101  jQuery('.comment img[data-gravatar]').each(function(){
102    jQuery(this).attr('src',jQuery(this).attr('data-gravatar'));
103  });
104	}
105} // end function
106
107//$("#preloader").fadeIn();
108/*
109 * Put all your regular jQuery in here.
110*/
111jQuery(document).ready(function($) {
112
113//$("#loadingDiv").show();
114var nImages = $("img").length;
115var loadCounter = 0;
116//binds onload event listner to images
117$("img").on("load", function() {
118    loadCounter++;
119    if(nImages === loadCounter) {
120        //$(this).parent().show();
121        $("#preloader-overlay").fadeOut();
122    }
123}).each(function() {
124    // attempt to defeat cases where load event does not fire
125    // on cached images
126    if(this.complete) $(this).trigger("load");
127            $("#preloader-overlay").fadeOut();
128});
129
130$("a").click(function() {
131    //$("#preloader-overlay").fadeIn();
132});
133
134//PIKABU
135// All options are optional
136/*
137var pikabu = new Pikabu({
138    // Specify left and right sidebar widths independently
139    widths: {
140        left: '70%',
141        right: '70%'
142    }
143});
144*/
145//$('.menu-link').bigSlide();
146/*
147jQuery('.menu-link').bigSlide({
148  	'side': 'right',
149  	'easyClose': true,
150  	'speed': 500,
151  	'activeBtn' : 'activeBtn'
152  });
153*/
154/*
155$('.menu-link').click(function(e) {
156   $('body').toggleClass('no-scroll');
157});
158*/
159/*
160$('.menu-link').click(function(e) {
161	//e.preventDefault(); 
162	//if (menu.state === 'closed') { 
163		$('body').css('overflow', 'hidden');
164		$('.mobile-nav').css('overflow', 'scroll');
165		//$('.mobile-nav').css('overflow-scrolling', 'touch');
166		
167	//} else { 
168		//menu.close(); 
169		//body.css('overflow', 'auto'); 
170	//}
171});
172*/
173
174/*
175	jQuery("#menu-item-2196 a").click(function(event) {
176	//jQuery("#menu-item-2196 a").addEvent("click", function(event){
177		event.preventDefault();
178	  
179	 var SM = new SimpleModal({"btn_ok":"Confirm button"});
180	      SM.addButton("Close", "btn");
181	      SM.show({
182	        "model":"modal",
183	        "title":"Privacy",
184	        "contents":"Your message..."
185	      }); 
186	});
187*/
188  /*
189   * Let's fire off the gravatar function
190   * You can remove this if you don't need it
191  */
192  loadGravatars();
193  
194  // Can also be used with $(document).ready()
195  //$(window).load(function() {
196    /*$('.flexslider').flexslider({
197      animation: "slide",
198      controlNav: false
199    });*/
200  //});
201    
202    
203$( window ).resize(function() {
204	viewport = updateViewportDimensions();
205	//console.log(viewport.width);
206});
207
208    //MENU
209    if (viewport.width >= 1030) {
210	    var timer;
211	    $("ul.nav>li").mouseenter(function() {
212	        var that = this;
213	        timer = setTimeout(function(){
214	            $(that).find("ul:first").slideDown(200);
215	        }, 350);
216	    }).mouseleave(function(event) {
217	        clearTimeout(timer);
218	        
219	        //this is the original element the event handler was assigned to
220	        	   var e = event.toElement || event.relatedTarget;
221	        	
222	        	//check for all children levels (checking from bottom up)
223	        	while(e && e.parentNode && e.parentNode != window) {
224	        	    if (e.parentNode == this||  e == this) {
225	        	        if(e.preventDefault) e.preventDefault();
226	        	        return false;
227	        	    }
228	        	    e = e.parentNode;
229	        	}
230
231	        $(this).find("ul").slideUp(200);
232	    });
233	    
234	    
235	    $( "ul.sub-menu>li" )
236	      .mouseover(function() {
237	        $(this).find("ul").slideDown();
238	      })
239	      .mouseout(function(event) {
240	    }); 
241	    
242	    
243	    
244	    $( "ul.nav>li" )
245          .mouseover(function() {
246            $(this).find("ul:first").delay( 0 ).slideDown(200);
247          })
248          .mouseout(function(event) {
249    
250          		//this is the original element the event handler was assigned to
251          		   var e = event.toElement || event.relatedTarget;
252          		
253          		//check for all children levels (checking from bottom up)
254          		while(e && e.parentNode && e.parentNode != window) {
255          		    if (e.parentNode == this||  e == this) {
256          		        if(e.preventDefault) e.preventDefault();
257          		        return false;
258          		    }
259          		    e = e.parentNode;
260          		}
261          		
262          		//Do something u need here
263            	$(this).find("ul").slideUp(200);
264          });
265	    
266	    
267    }
268    
269    /*
270    if (viewport.width < 768) {
271	    $("ul.nav>li").each(function( index ) {
272	      if($(this).children("ul").length) {
273	             // the clicked on <li> has a <ul> as a direct child
274	      }
275	      else{
276	      	$(this).find("i").hide();
277	      }
278	    });
279	    
280	    $("ul.nav>li i").click(function() {
281	        
282	        if($(this).hasClass("fa-caret-down")){
283	        	$(this).removeClass("fa-caret-down").addClass("fa-caret-up");
284				$(this).parent().find("ul:first").slideDown(400);
285			}
286			else{
287				$(this).removeClass("fa-caret-up").addClass("fa-caret-down");
288				$(this).parent().find("ul:first").slideUp(400);
289			}
290			//
291	    });  	    
292    }
293    */
294//});    
295
296      /*
297      $("#logo img").hover(
298      	function(){this.src = this.src.replace("_off","_on");},
299      	function(){this.src = this.src.replace("_on","_off");
300      });*/
301      
302      
303      $(document).scroll(function() {
304          var scrolltop = $(document).scrollTop();
305          
306          ////////////
307          //pullquote scroller
308          ////////////
309          /*
310          var image_url = $('.large-pullquote').css('background-image'),
311              image;
312          
313          // Remove url() or in case of Chrome url("")
314          image_url = image_url.match(/^url\("?(.+?)"?\)$/);
315          
316          if (image_url[1]) {
317              image_url = image_url[1];
318              image = new Image();
319          
320              // just in case it is not already loaded
321              $(image).load(function () {
322                  //alert(image.width + 'x' + image.height);
323                  var offset = $('.large-pullquote').offset();
324                  var windowheight = $(window).height();
325                  var headerheight = $('.large-pullquote').height();
326                  //scrolltop
327                  
328                  //var scrollPoint = ((windowheight - offset.top) / image.height) * 100;
329                  var inViewTop = (((scrolltop+windowheight)-offset.top));
330                  var inViewBottom = (((scrolltop+windowheight)-offset.top));
331                  
332                  
333                  if(){
334	                  console.log(image.height + " | " + scrolltop + " | " + offset.top);
335	                  //console.log(scrollPoint);
336	              }
337              });
338          
339              image.src = image_url;
340          }
341          */
342          
343          //$('.large-pullquote').css('background-position', 'left ' + ((scrolltop)) + 'px');
344
345          if (scrolltop > 100 && $("#logo #word-logo").is(":visible") ) {
346              //$("#logo img").src = $("#logo img").src.replace("_off","_on");
347              $("#logo #word-logo").hide();
348              $("#logo #flower-logo").fadeIn(1200);
349              
350              $("#logo").css( "padding", "8px" );
351              $("#logo").css( "border-bottom", "none" );
352              $("#logo").css( "-webkit-box-shadow", "none" );
353              $("#logo").css( "-moz-box-shadow", "none" );
354              $("#logo").css( "box-shadow", "none" );
355              //$("#logo img").src = $("#logo img").src.replace("_on","_off");
356          }
357          if (scrolltop < 100 && $("#logo #flower-logo").is(":visible")) {
358              //$("#logo img").src = $("#logo img").src.replace("_off","_on");
359              $("#logo #flower-logo").hide();
360              $("#logo #word-logo").fadeIn(1200);
361              $("#logo").css( "-webkit-box-shadow", "0px 0px 8px 0px rgba(0,0,0,0.2)" );
362              $("#logo").css( "-moz-box-shadow", "0px 0px 8px 0px rgba(0,0,0,0.2)" );
363              $("#logo").css( "box-shadow", "0px 0px 8px 0px rgba(0,0,0,0.2)" );
364              
365              $("#logo").css( "padding", "1em" );
366              $("#logo").css( "border-bottom", "4px solid #00425c" );
367              
368              //$("#logo img").src = $("#logo img").src.replace("_on","_off");
369          }
370
371      });
372      
373      /*
374    	var vimeoPlayers = jQuery('.flexslider').find('iframe'), player; 			
375    	for (var i = 0, length = vimeoPlayers.length; i < length; i++) {
376    			player = vimeoPlayers[i]; 
377    			$f(player).addEvent('ready', ready); 		
378    	}
379    	
380    	function addEvent(element, eventName, callback) { 	    	
381    		if (element.addEventListener) { 		    	
382    			element.addEventListener(eventName, callback, false) 		    
383    		} else { 	      		
384    			element.attachEvent(eventName, callback, false); 	      	
385    		} 	    
386    	} 	    
387    	
388    	function ready(player_id) { 	
389    		console.log("ready");
390    	    	
391    		var froogaloop = $f(player_id); 	    	
392    		froogaloop.addEvent('play', function(data) { 		    	
393    			jQuery('.flexslider').flexslider("pause");
394    			console.log('play');	    
395    		}); 		    
396    		froogaloop.addEvent('pause', function(data) { 			    
397    			jQuery('.flexslider').flexslider("play"); 		    
398    		});
399    		
400            froogaloop.addEvent('finish', function(data) {
401            	jQuery('.flexslider').flexslider("play");
402                console.log('finish');
403            });
404            
405    	}
406    	*/
407    	
408    	/*////////////////
409    	
410    	// Listen for the ready event for any vimeo video players on the page
411            var player = $('#player_1')[0];
412            $f(player).addEvent('ready', ready);
413
414            function addEvent(element, eventName, callback) {
415                if (element.addEventListener) {
416                    element.addEventListener(eventName, callback, false);
417                }
418                else {
419                    element.attachEvent(eventName, callback, false);
420                }
421            }
422
423            function ready(player_id) {
424                console.log('ready!');
425                var froogaloop = $f(player_id);
426
427                function onPlay() {
428                        froogaloop.addEvent('play', function(data) {
429                            console.log('play');
430                        });
431                }
432
433
434                function onFinish() {
435                        froogaloop.addEvent('finish', function(data) {
436                            console.log('finish');
437                        });
438                }
439
440                onPlay();
441                onFinish();
442            }
443
444    	////////////////*/
445    	
446    	
447    	/*
448    	jQuery(".flexslider")     
449    	.flexslider({       
450    		animation: "slide",
451    		useCSS: false,       
452    		//animationLoop: false,       
453    		smoothHeight: true,       
454    		before: function(slider){         
455    			if (slider.slides.eq(slider.currentSlide).find('iframe').length !== 0)
456    			      $f( slider.slides.eq(slider.currentSlide).find('iframe').attr('id') ).api('pause');       
457    		}   
458    	});
459    	*/
460    	
461    	jQuery(".flexslider")     
462    	.flexslider({       
463    		animation: "slide",
464    		useCSS: false,
465    		controlNav: false,
466    		//smoothHeight: true
467    	});
468    	/*
469    	jQuery(function() {
470    	    jQuery( ".accordion" ).accordion({
471    	    	heightStyle: "content",
472    	    	collapsible: true,
473    	    	active: false
474    	    });
475    	});
476		*/
477
478}); /* end of as page load scripts */
479
480/*
481$(document).mousemove(function(e) {
482	//$('.tooltip').hide();
483    
484	var mousex = e.pageX + 20; //Get X coordinates
485	var mousey = e.pageY + 10; //Get Y coordinates
486	
487	if((mousey+100)>$(window).height()){
488		$('.mapplic-tooltip').css({ top: mousey-100 ,left: mousex });
489	}
490	else if((mousex+200)>$(window).width()){
491		$('.mapplic-tooltip').css({ top: mousey ,left: mousex-200});
492	}
493	else{
494		$('.mapplic-tooltip').css({ top: mousey, left: mousex });
495	}
496
497});
498*/
499/*
500var wrapper_top = jQuery("#sidebar1").offset().top;
501jQuery(window).scroll(function (){
502    var wrapper_height = jQuery("#sidebar1").height();
503 
504    // Affixes Progress Bars
505  var top = jQuery(this).scrollTop();
506    if (top > wrapper_top - 10) {
507        jQuery("#sidebar1").addClass("affix");
508    }
509    else {
510        jQuery("#sidebar1").removeClass("affix");
511    }
512 });
513 */

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.