PageSourceSearch

https://exclusive-executive-resumes.com/wp-content/themes/prs/library/js/scripts.js

js exclusive-executive-resumes.com collected 2026-09-26 03:54:45 UTC 7,121 bytes, 223 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
108/*
109 * Put all your regular jQuery in here.
110*/
111jQuery(document).ready(function($) {
112
113/* JP added line */
114
115$('.header .wrapper').css('max-width','1600px');
116
117  /*
118   * Let's fire off the gravatar function
119   * You can remove this if you don't need it
120  */
121  loadGravatars();
122
123  /* Toggle sub menu items on mobile */
124	if (screen.width < 1100) {
125		jQuery(".menu-item-has-children").click(function(){
126			jQuery(".sub-menu", this).toggle();
127			jQuery(this).toggleClass('active');
128			jQuery("> a", this).toggleClass('active-arrow');
129		});
130		/* Insert mega menu */
131		$( ".mega-menu-mobile" ).insertAfter( ".show-mega-menu" );
132		$('.show-mega-menu').click(function(){
133			$('.mega-menu-mobile').toggle();
134		});
135	}
136	if (screen.width >= 1101) {
137		$('.show-mega-menu').hover(
138			function(){
139				$('.mega-menu-desktop').show();
140			},
141			function(){
142				$('.mega-menu-desktop').hide();
143			}
144		);
145		$('.mega-menu-desktop').hover(
146			function(){
147				$(this).show();
148			},
149			function(){
150				$(this).hide();
151			}
152		);
153	}
154	//Animate scroll to section
155	$('a[href*=\\#]:not([href=\\#])').click(function() {
156		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
157		  var target = $(this.hash);
158		  target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
159		  if (target.length) {
160			$('html,body').animate({
161			  scrollTop: target.offset().top
162			}, 1000);
163			return false;
164		  }
165		}
166	  });
167	/* Accordion */
168	$('.accordion').find('.accordion-toggle').click(function(){
169
170      //Expand or collapse this panel
171      $(this).next().slideToggle('fast');
172
173      //Hide the other panels
174      $(".accordion-content").not($(this).next()).slideUp('fast');
175	  $(".accordion-toggle").not($(this)).removeClass('active');
176
177	  //Change arrow state on accordion
178	  $(".accordion-toggle", this).toggle();
179	  $(this).toggleClass('active');
180	  $(".accordion-toggle:after", this).toggleClass('active-arrow');
181
182    });
183	/* Add Body Class on Gforms Submission */
184	$(document).on('gform_confirmation_loaded', function(){
185		$("body").addClass("gravity-form-submitted");
186		Cookies.set('sample-resume-cookie', 'value', { expires: 180 });
187	});
188	/* Add Body Class on Cookie */
189	// Commented out to always set the cookie so that the popup can be disabled
190	// EKB September 15, 2022
191	//if (Cookies.get('sample-resume-cookie')){
192		$("body").addClass("gravity-form-submitted");
193	//}
194	/* Disable right click on images */
195	$(document).on('contextmenu', 'img', function() {
196		return false;
197	});
198
199	/*open video lightbox*/
200	$("#video-open").click(function(){
201		$(".video-overlay").show();
202		$(".video-lightbox").show();
203	});
204	/*open video lightbox*/
205	$("#boxclose").click(function(){
206		$(".video-overlay").hide();
207		$(".video-lightbox").hide();
208	});
209	
210	/* Search popup */
211	$('.header-search-icon').click(function() {
212		$('.search-popup').fadeIn();
213	});	
214	$('.search-close').click(function() {
215		$('.search-popup').fadeOut();
216	});
217	
218	/* Phone numbers on mobile */
219	$('.header-phone.mobile').click(function() {
220		$('.header-phone-number.mobile').toggle();
221	});	
222
223}); /* end of as page load scripts */

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.