PageSourceSearch

https://www.ironridge.com/wp-content/themes/astra-child-ironridge/js/main.js?ver=1.0.17

js ironridge.com collected 2026-09-26 04:36:00 UTC 19,808 bytes, 758 lines download raw bytes

1jQuery(document).ready(function($){
2
3	/** Open external links on new window. */
4	var h = window.location.host.toLowerCase();
5	jQuery( "a[href^='http']:not([href*='" + h + "']), form[action^='http']:not([action*='" + h + "']), a[href$='.pdf'], a[href$='.doc'], a[href$='.mp3'], a[href$='.m4a'], a[href$='.wav']" ).attr( 'target', '_blank' ).each( function() {
6		if ( jQuery( this ).is( 'a' ) ) {
7			/* Add the rel="noopener" attribute, keeping the current value (if exists). */
8			let rel = $( this ).attr( 'rel' );
9			if ( 'undefined' == typeof rel ) {
10				rel = '';
11			}
12			rel = rel.split( ' ' );
13			if ( ! rel.includes( 'noopener' ) ) {
14				rel.push( 'noopener' );
15			}
16			rel = rel.join( ' ' ).trim();
17			$( this ).attr( 'rel', rel );
18		}
19	} );
20
21	/** Make mobile menu parent links clickable. */
22	$( '.plus-mobile-menu-content .menu-item-has-children > .menu-link' ).each(function(){
23		$(this).after( '<button><span class="screen-reader-text">Open</button></button>' );
24		$(this).off( 'click' );
25		$(this).parent().children('button').on( 'click', function(){
26			var menuItem = $(this).parent();
27			var submenu = $(this).parent().children( 'ul' );
28			if ( menuItem.hasClass( 'opened' ) ) {
29				submenu.slideUp( 400 ); 
30				menuItem.removeClass( 'opened' );
31				$(this).html( '<span class="screen-reader-text">Open</button>' );
32			} else {
33				submenu.slideDown( 400 );
34				menuItem.addClass( 'opened' );
35				$(this).html( '<span class="screen-reader-text">Close</button>' );
36			}
37		});
38	});
39
40	/**
41	 * Add desktop submenu toggle buttons.
42	 */
43	function openSubmenu( $menuItem ) {
44		$( '.elementor-location-header .opened.menu-item .submenu-toggle-button' ).each(function(){
45			var text = $(this).closest( '.menu-item' ).find( '.menu-link' ).text();
46			$(this).html( '<span class="screen-reader-text">Open "' + text + '" Submenu</span>' );
47		});
48		$( '.elementor-location-header .opened.menu-item .dropdown-menu' ).slideUp();
49		$( '.elementor-location-header .opened.menu-item' ).removeClass( 'opened' );
50
51		$menuItem.find( '.submenu-toggle-button' ).each(function(){
52			var text = $(this).closest( '.menu-item' ).find( '.menu-link' ).text();
53			$(this).html( '<span class="screen-reader-text">Close "' + text + '" Submenu</span>' );
54		});
55		$menuItem.addClass( 'opened' );
56	}
57
58	function closeSubmenu( $menuItem ) {
59		$menuItem.find( '.submenu-toggle-button' ).each(function(){
60			var text = $(this).closest( '.menu-item' ).find( '.menu-link' ).text();
61			$(this).html( '<span class="screen-reader-text">Open "' + text + '" Submenu</span>' )
62		});
63		$menuItem.removeClass( 'opened' );
64	}
65
66	$( '.elementor-location-header .menu-item-has-children > a' ).each(function(){
67		var text = $(this).text();
68		$(this).after( '<div class="submenu-toggle"><button class="submenu-toggle-button"><span class="screen-reader-text">Open "' + text + '" Submenu</span></button></div>' );
69	});
70
71	$( '.elementor-location-header .menu-item-has-children' ).on( 'mouseenter', function(){
72		if ( $(window).width() < 992 ) {
73			return;
74		}
75		$( '.active-toggle' ).removeClass( 'active-toggle' );
76		openSubmenu( $(this ) );
77	});
78
79	$( '.elementor-location-header .menu-item-has-children' ).on( 'mouseleave', function(){
80		if ( $(window).width() < 992 ) {
81			return;
82		}
83		$( '.active-toggle' ).removeClass( 'active-toggle' );
84		closeSubmenu( $(this ) );
85	});
86
87	$( '.submenu-toggle-button' ).on( 'click', function(){
88		$( '.active-toggle' ).removeClass( 'active-toggle' );
89		var $submenu = $(this).closest( '.menu-item' );
90
91		if ( $submenu.hasClass( 'opened' ) ) {
92			closeSubmenu( $submenu );
93
94			$this = $submenu.find( '.dropdown-menu' );
95			$others = $( '.elementor-location-header .dropdown-menu' ).not( $this );
96			
97			$others.slideUp();
98			$this.slideUp();
99		} else {
100			openSubmenu( $submenu );
101			$(this).addClass( 'active-toggle' );
102
103			$this = $submenu.find( '.dropdown-menu' );
104			$others = $( '.elementor-location-header .dropdown-menu' ).not( $this );
105			
106			$others.slideUp();
107			$this.slideDown();
108		}
109	});
110
111	/** Fix WAVE errors on mega menu: Broken ARIA menu. */
112	jQuery( '.dropdown-menu a' ).attr( 'role', 'menuitem' );
113
114	console.log( '.elementor-location-header .nav a[href="' + location.protocol + '//' + location.host + location.pathname + '"]' );
115	$( '.elementor-location-header .nav a[href="' + location.protocol + '//' + location.host + location.pathname + '"]' ).each(function(){
116		$(this).parent( 'li' ).addClass( 'current-menu-item' );
117		$(this).closest( '.menu-item').addClass( 'current-menu-parent' );
118		$(this).parents( '.menu-item' ).addClass( 'current-menu-ancestor' );
119	});
120
121	/** Add a more specific aria-label to footer menus. */
122	$( '.elementor-location-footer nav' ).each(function(){
123		var title = $(this).closest( '.elementor-widget-wp-widget-nav_menu' ).attr( 'menu-title' );
124		$(this).attr( 'aria-label', title );
125	});
126});
127
128/**
129 * 360 Product Viewer Custom Shortcode
130 */
131function replace360Icons() {
132	var $ = jQuery;
133
134	$(document).find('.ir-360-custom-wrapper div img[src*="/skin/marker2.png"]' ).filter(':visible').each( function() {
135		$( this ).attr('src', window.location.origin + '/wp-content/uploads/2017/11/ir-circle-trans.png' );
136	});
137
138	$(document).find('.ir-360-custom-wrapper' ).find( 'img[src*="/skin/marker2-rollover.png"]' ).each( function() {
139		$( this ).attr('src', window.location.origin + '/wp-content/uploads/2017/11/ir-circle.png' );
140	});
141}
142
143jQuery(document).ready(function($){
144
145	$( '.ir-360-custom-wrapper .panel_nav_container a' ).on( 'click', function(e) {
146		e.preventDefault();
147		var $this = $(this);
148		var $value = $this.text();
149		var $accessVal = $this.parent().siblings('.accessories_nav_container').find('a.active').text();
150		$(this).addClass('active');
151		$(this).siblings().removeClass('active');
152		if( $value === 'ON' ) {
153			if( $accessVal && $accessVal === 'ON' ) {
154				$( '.ir-360-custom-wrapper .panels-on' ).addClass('hidden');
155				$( '.ir-360-custom-wrapper .panels-off' ).addClass('hidden');
156				$( '.ir-360-custom-wrapper .accessories-on-panels-on' ).removeClass('hidden');
157				$( '.ir-360-custom-wrapper .accessories-on-panels-off' ).addClass('hidden');
158			} else {
159				$( '.ir-360-custom-wrapper .panels-on' ).removeClass('hidden');
160				$( '.ir-360-custom-wrapper .panels-off' ).addClass('hidden');
161				$( '.ir-360-custom-wrapper .accessories-on-panels-on' ).addClass('hidden');
162				$( '.ir-360-custom-wrapper .accessories-on-panels-off' ).addClass('hidden');
163			}
164		} else {
165			if( $accessVal && $accessVal === 'ON' ) {
166				$( '.ir-360-custom-wrapper .panels-on' ).addClass('hidden');
167				$( '.ir-360-custom-wrapper .panels-off' ).addClass('hidden');
168				$( '.ir-360-custom-wrapper .accessories-on-panels-on' ).addClass('hidden');
169				$( '.ir-360-custom-wrapper .accessories-on-panels-off' ).removeClass('hidden');
170			} else {
171				$( '.ir-360-custom-wrapper .panels-on' ).addClass('hidden');
172				$( '.ir-360-custom-wrapper .panels-off' ).removeClass('hidden');
173				$( '.ir-360-custom-wrapper .accessories-on-panels-on' ).addClass('hidden');
174				$( '.ir-360-custom-wrapper .accessories-on-panels-off' ).addClass('hidden');
175			}
176		}
177	});
178
179	$( '.ir-360-custom-wrapper .accessories_nav_container a' ).on( 'click', function(e) {
180		e.preventDefault();
181		var $this = $(this);
182		var $value = $this.text();
183		var $panelsVal = $this.parent().siblings('.panel_nav_container').find('a.active').text();
184		$this.addClass('active');
185		$this.siblings().removeClass('active');
186		if( $value === 'ON' ) {
187			if ( $panelsVal === 'ON' ) {
188				$( '.ir-360-custom-wrapper .panels-on' ).addClass('hidden');
189				$( '.ir-360-custom-wrapper .panels-off' ).addClass('hidden');
190				$( '.ir-360-custom-wrapper .accessories-on-panels-on' ).removeClass('hidden');
191				$( '.ir-360-custom-wrapper .accessories-on-panels-off' ).addClass('hidden');
192			} else {
193				$( '.ir-360-custom-wrapper .panels-on' ).addClass('hidden');
194				$( '.ir-360-custom-wrapper .panels-off' ).addClass('hidden');
195				$( '.ir-360-custom-wrapper .accessories-on-panels-on' ).addClass('hidden');
196				$( '.ir-360-custom-wrapper .accessories-on-panels-off' ).removeClass('hidden');
197			}
198		} else {
199			if ( $panelsVal === 'ON' ) {
200				$( '.ir-360-custom-wrapper .panels-on' ).removeClass('hidden');
201				$( '.ir-360-custom-wrapper .panels-off' ).addClass('hidden');
202				$( '.ir-360-custom-wrapper .accessories-on-panels-on' ).addClass('hidden');
203				$( '.ir-360-custom-wrapper .accessories-on-panels-off' ).addClass('hidden');
204			} else {
205				$( '.ir-360-custom-wrapper .panels-on' ).addClass('hidden');
206				$( '.ir-360-custom-wrapper .panels-off' ).removeClass('hidden');
207				$( '.ir-360-custom-wrapper .accessories-on-panels-on' ).addClass('hidden');
208				$( '.ir-360-custom-wrapper .accessories-on-panels-off' ).addClass('hidden');
209			}
210		}
211	});	
212
213});
214
215jQuery( window ).on( 'load', function($) {
216	setTimeout(function(){
217		replace360Icons();
218	}, 500);
219});
220
221/**
222 * Event Category Map
223 */
224function initMap() {
225	EVENT_CATEGORY_MAP.Geocoder = new google.maps.Geocoder();
226
227	EVENT_CATEGORY_MAP.maps.forEach( function( map ) {
228		map.Map = new google.maps.Map( document.getElementById( 'map-' + map.category ), {
229			zoom: 4,
230			center: {
231				lat: 37.2583613,
232				lng: -99.6528204,
233			},
234			styles: [
235				{
236					"featureType": "administrative",
237					"elementType": "all",
238					"stylers": [
239						{
240							"color": "#ff0000"
241						}
242					]
243				},
244				{
245					"featureType": "administrative",
246					"elementType": "geometry",
247					"stylers": [
248						{
249							"color": "#ff0000"
250						}
251					]
252				},
253				{
254					"featureType": "administrative",
255					"elementType": "geometry.stroke",
256					"stylers": [
257						{
258							"visibility": "on"
259						},
260						{
261							"color": "#0096aa"
262						},
263						{
264							"weight": "0.30"
265						},
266						{
267							"saturation": "-75"
268						},
269						{
270							"lightness": "5"
271						},
272						{
273							"gamma": "1"
274						}
275					]
276				},
277				{
278					"featureType": "administrative",
279					"elementType": "labels",
280					"stylers": [
281						{
282							"color": "#ff0000"
283						}
284					]
285				},
286				{
287					"featureType": "administrative",
288					"elementType": "labels.text",
289					"stylers": [
290						{
291							"visibility": "on"
292						},
293						{
294							"color": "#ff0000"
295						}
296					]
297				},
298				{
299					"featureType": "administrative",
300					"elementType": "labels.text.fill",
301					"stylers": [
302						{
303							"color": "#ffffff"
304						},
305						{
306							"saturation": "-75"
307						},
308						{
309							"lightness": "5"
310						}
311					]
312				},
313				{
314					"featureType": "administrative",
315					"elementType": "labels.text.stroke",
316					"stylers": [
317						{
318							"color": "#5d5d5d"
319						},
320						{
321							"visibility": "on"
322						},
323						{
324							"weight": "4"
325						},
326						{
327							"saturation": "-28"
328						},
329						{
330							"lightness": "0"
331						}
332					]
333				},
334				{
335					"featureType": "administrative",
336					"elementType": "labels.icon",
337					"stylers": [
338						{
339							"visibility": "on"
340						},
341						{
342							"weight": "1"
343						},
344						{
345							"color": "#ebbd86"
346						}
347					]
348				},
349				{
350					"featureType": "administrative.locality",
351					"elementType": "all",
352					"stylers": [
353						{
354							"visibility": "on"
355						},
356						{
357							"hue": "#ff0000"
358						}
359					]
360				},
361				{
362					"featureType": "landscape",
363					"elementType": "all",
364					"stylers": [
365						{
366							"color": "#649d19"
367						},
368						{
369							"saturation": "0"
370						},
371						{
372							"lightness": "0"
373						}
374					]
375				},
376				{
377					"featureType": "landscape",
378					"elementType": "geometry.fill",
379					"stylers": [
380						{
381							"color": "#649d19"
382						}
383					]
384				},
385				{
386					"featureType": "landscape",
387					"elementType": "labels.text",
388					"stylers": [
389						{
390							"visibility": "on"
391						}
392					]
393				},
394				{
395					"featureType": "landscape",
396					"elementType": "labels.text.stroke",
397					"stylers": [
398						{
399							"color": "#740bd6"
400						},
401						{
402							"visibility": "off"
403						}
404					]
405				},
406				{
407					"featureType": "poi",
408					"elementType": "all",
409					"stylers": [
410						{
411							"visibility": "off"
412						},
413						{
414							"color": "#ffffff"
415						}
416					]
417				},
418				{
419					"featureType": "road",
420					"elementType": "all",
421					"stylers": [
422						{
423							"color": "#707070"
424						},
425						{
426							"visibility": "simplified"
427						},
428						{
429							"saturation": "-75"
430						},
431						{
432							"lightness": "5"
433						},
434						{
435							"gamma": "1"
436						}
437					]
438				},
439				{
440					"featureType": "road",
441					"elementType": "labels.text",
442					"stylers": [
443						{
444							"visibility": "on"
445						},
446						{
447							"color": "#ffe146"
448						},
449						{
450							"weight": 8
451						},
452						{
453							"saturation": "-28"
454						},
455						{
456							"lightness": "0"
457						}
458					]
459				},
460				{
461					"featureType": "road",
462					"elementType": "labels.text.fill",
463					"stylers": [
464						{
465							"visibility": "on"
466						},
467						{
468							"color": "#0096aa"
469						},
470						{
471							"weight": 8
472						},
473						{
474							"lightness": "5"
475						},
476						{
477							"gamma": "1"
478						},
479						{
480							"saturation": "-75"
481						}
482					]
483				},
484				{
485					"featureType": "road",
486					"elementType": "labels.icon",
487					"stylers": [
488						{
489							"visibility": "off"
490						}
491					]
492				},
493				{
494					"featureType": "transit",
495					"elementType": "all",
496					"stylers": [
497						{
498							"visibility": "simplified"
499						},
500						{
501							"color": "#0096aa"
502						},
503						{
504							"saturation": "-75"
505						},
506						{
507							"lightness": "5"
508						},
509						{
510							"gamma": "1"
511						}
512					]
513				},
514				{
515					"featureType": "water",
516					"elementType": "geometry.fill",
517					"stylers": [
518						{
519							"visibility": "on"
520						},
521						{
522							"color": "#3a85c5"
523						},
524						{
525							"saturation": "0"
526						},
527						{
528							"lightness": "0"
529						},
530						{
531							"gamma": "1"
532						}
533					]
534				},
535				{
536					"featureType": "water",
537					"elementType": "labels.text",
538					"stylers": [
539						{
540							"visibility": "simplified"
541						},
542						{
543							"color": "#ffe146"
544						},
545						{
546							"saturation": "-28"
547						},
548						{
549							"lightness": "0"
550						}
551					]
552				},
553				{
554					"featureType": "water",
555					"elementType": "labels.icon",
556					"stylers": [
557						{
558							"visibility": "off"
559						}
560					]
561				}
562			],
563		});
564	});
565
566	Object.entries( EVENT_CATEGORY_MAP.venues ).forEach( entry => {
567		const [ venueId, venue ] = entry;
568		
569		if ( 'undefined' !== typeof( venue.lat ) && 'undefined' !== venue.lng ) {
570			addMarkers( venueId, venue );
571		} else {
572			EVENT_CATEGORY_MAP.Geocoder
573				.geocode( venue.geocode )
574				.then( ( { results } ) => {
575					venue.lat = results[0].geometry.location.lat();
576					venue.lng = results[0].geometry.location.lng();
577
578					jQuery.ajax({
579						type: 'post',
580						url: EVENT_CATEGORY_MAP.ajax.url,
581						data: {
582							action: 'event_category_map_add_venue_latlng',
583							nonce: EVENT_CATEGORY_MAP.ajax.nonce,
584							venue_id: venueId,
585							lat: venue.lat,
586							lng: venue.lng,
587						}
588					});
589
590					addMarkers( venueId, venue );
591				})
592				.catch((e) =>{
593					console.log( "Geocode was not successful for the following reason: " + e );
594					console.log( venue );
595				});
596		}
597	});
598}
599
600function addMarkers( venueId, venue ) {
601	EVENT_CATEGORY_MAP.maps.forEach( function( map ) {
602		if ( 'undefined' !== typeof( map.markers[ venueId ] ) ) {
603			let events = '';
604			Object.values( map.markers[ venueId ].events ).forEach( event => {
605				events +=
606					'<div class="event-category-map-venue-event">'
607						+ '<h3 class="event-category-map-venue-event-title">'
608							+ '<a href="' + event.url + '">'
609								+ event.title
610							+ '</a>'
611						+ '</h3>'
612						+ '<div class="event-category-map-venue-event-date">'
613							+ event.date
614						+ '</div>'
615					+ '</div>';
616			});
617
618			map.markers[ venueId ].InfoWindow = map.InfoWindow = new google.maps.InfoWindow({
619				content:
620					'<div class="event-category-map-venue">'
621						+ '<div class="event-category-map-venue-info">'
622							+ '<h2 class="event-category-map-venue-title">' + venue.title + '</h2>'
623							+ '<div class="event-category-map-venue-address">'
624								+ venue.address
625							+ '</div>'
626						+ '</div>'
627						+ events
628					+ '</div>',
629			});
630			
631			map.markers[ venueId ].Marker = new google.maps.Marker({
632				map: map.Map,
633				position: {
634					lat: venue.lat,
635					lng: venue.lng,
636				},
637				title: venue.name,
638			});
639
640			map.markers[ venueId ].Marker.addListener( 'cli
640ck', () => {
641				map.markers[ venueId ].InfoWindow.open({
642					map: map.Map,
643					anchor: map.markers[ venueId ].Marker,
644					shouldFocus: false,
645				});
646			});
647		}
648	});
649}
650
651/** Add aria-label to .g-recaptcha-response */
652if ( 'undefined' != typeof( gform ) ) {
653	gform.addAction('gform_post_recaptcha_render', function (elem) {
654		$response = jQuery( elem ).find( '.g-recaptcha-response' );
655		$response.attr( 'aria-hidden', 'true' );
656		$response.attr( 'aria-label', 'Ignore this field.' );
657	});	
658}
659
660/**
661 * Experience Validator
662 * 
663 * Add checkbox to validate the user has experience before allowing to log in or enroll.
664 */
665( function( $ ) {
666	function allowEnroll() {
667		$( 'body.postid-5121' ).find( '#btn-join, #loginform #wp-submit' )
668			.prop( 'disabled', false )
669			.attr( 'title', '' );
670	}
671
672	function denyEnroll() {
673		$( 'body.postid-5121' ).find( '#btn-join, #loginform #wp-submit' )
674			.prop( 'disabled', true )
675			.attr( 'title', 'Please check the box to confirm you have prior experience installing solar systems to proceed.' );
676	}
677
678	$( 'body.postid-5121' ).find( '#btn-join, #loginform #wp-submit' )
679		.before(
680			'<div id="experience-validator">'
681			+ '<input id="experience-validator-input" type="checkbox">'
682			+ '<label id="experience-validator-label" for="experience-validator-input">'
683				+ 'Please check the box to confirm you have prior experience installing solar systems to proceed.'
684			+ '</label>'
685			+ '</div>'
686		);
687	
688	denyEnroll();
689	
690	$( '#experience-validator-input' ).on( 'change', function() {
691		if ( $( this ).is( ':checked' ) ) {
692			allowEnroll();
693		} else {
694			denyEnroll();
695		}
696	} );
697} )( jQuery );
698
699/**
700 * Popup Videos
701 * 
702 * Prevent popup videos to keep playing after closing the popup (error occurs in Chrome).
703 */
704( function( $ ) {
705	$( document ).on( 'pumBeforeOpen', '.pum', function() {
706		let $iframes = $( this ).find( 'iframe' );
707		$iframes.each( function() {
708			let src = $( this ).data( 'removed-src' );
709			if ( src ) {
710				$( this ).attr( 'src', src );
711			}
712		} );
713	} );
714
715	$( document ).on( 'pumAfterClose', '.pum', function() {
716		let $iframes = $( this ).find( 'iframe' );
717		$iframes.each( function() {
718			$( this ).data( 'removed-src', $( this ).attr( 'src' ) );
719			$( this ).attr( 'src', 'about:blank' );
720		} );
721	} );
722} )( jQuery );
723
724/**
725 * Single Course Demo Video
726 * 
727 * Add play/pause button to Single Course Demo Video.
728 */
729( function( $ ) {
730	$( window ).on( 'elementor/frontend/init', function() {
731		elementorFrontend.hooks.addAction( 'frontend/element_ready/video.default', function( $scope ) {
732			if ( $scope.is( '#single-course-demo-video' ) ) {
733				$scope.append( '<button id="single-course-demo-video-button"><i class="fa-solid fa-pause" title="Pause"></i></button>' );
734
735				let player = new Vimeo.Player( $scope.find( 'iframe' ) );
736				let button = $( '#single-course-demo-video-button' );
737
738				button.on( 'click', function( paused ) {
739					player.getPaused().then( function( paused ) {
740						if ( paused ) {
741							player.play().then( function() {
742								button.html( '<i class="fa-solid fa-pause" title="Pause"></i>' );
743							} ).catch( function( error ) {
744								console.log( error );
745							} );
746						} else {
747							player.pause().then( function() {
748								button.html( '<i class="fa-solid fa-play" title="Play"></i>' );
749							} ).catch( function( error ) {
750								console.log( error );
751							} );
752						}
753					} );
754				} );
755			}
756		} );
757	} );
758} )( 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.