PageSourceSearch

https://www.explorehbg.com/includes/public/managed/v_a2e6ae52_569e…/plugins/nav/virtuals/js/shared_footer.js

js explorehbg.com collected 2026-09-29 17:20:52 UTC 9,140 bytes, 295 lines download raw bytes

1// This file will be run in the footer on every page.
2// It should be used for content that relates
3// to your site as a whole, it should not be used for
4// plugin-specific js
5
6require(["jquery", "site_gtm", "sv_siteFoundation", "domReady!"], function($, gtm) {
7
8	$(document).foundation();
9
10	'use strict';
11
12	// global
13	var Modernizr = window.Modernizr, $body = $( 'body' );
14
15	$.DLMenu = function( options, element ) {
16		this.$el = $( element );
17		this._init( options );
18	};
19
20	// the options
21	$.DLMenu.defaults = {
22		// classes for the animation effects
23		animationClasses : { classin : 'dl-animate-in-2', classout : 'dl-animate-out-2' },
24		// callback: click a link that has a sub menu
25		// el is the link element (li); name is the level name
26		onLevelClick : function( el, name ) { return false; },
27		// callback: click a link that does not have a sub menu
28		// el is the link element (li); ev is the event obj
29		onLinkClick : function( el, ev ) { return false; },
30		backLabel: 'Back',
31		// Change to "true" to use the active item as back link label.
32		useActiveItemAsBackLabel: false,
33		// Change to "true" to add a navigable link to the active item to its child
34		// menu.
35		useActiveItemAsLink: true
36	};
37
38	$.DLMenu.prototype = {
39		_init : function( options ) {
40
41			// options
42			this.options = $.extend( true, {}, $.DLMenu.defaults, options );
43			// cache some elements and initialize some variables
44			this._config();
45
46			var animEndEventNames = {
47					'WebkitAnimation' : 'webkitAnimationEnd',
48					'OAnimation' : 'oAnimationEnd',
49					'msAnimation' : 'MSAnimationEnd',
50					'animation' : 'animationend'
51				},
52				transEndEventNames = {
53					'WebkitTransition' : 'webkitTransitionEnd',
54					'MozTransition' : 'transitionend',
55					'OTransition' : 'oTransitionEnd',
56					'msTransition' : 'MSTransitionEnd',
57					'transition' : 'transitionend'
58				};
59			// animation end event name
60			this.animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ] + '.dlmenu';
61			// transition end event name
62			this.transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ] + '.dlmenu';
63			// support for css animations and css transitions
64			this.supportAnimations = Modernizr.cssanimations;
65			this.supportTransitions = Modernizr.csstransitions;
66
67			this._initEvents();
68
69		},
70		_config : function() {
71			this.open = false;
72			this.$container = this.$el.parent('.mobile-nav');
73			this.$trigger = this.$el.children( '.dl-trigger' );
74			this.$menu = this.$el.children( 'ul.dl-menu' );
75			this.$menuitems = this.$menu.find( 'li:not(.dl-back)' );
76			this.$el.find( 'ul.dl-submenu' ).prepend( '<li class="dl-back"><a href="#">' + this.options.backLabel + '<div class="mobileNavItemButton"></div></a></li>' );
77			this.$back = this.$menu.find( 'li.dl-back' );
78
79			// Set the label text for the back link.
80			if (this.options.useActiveItemAsBackLabel) {
81				this.$back.each(function() {
82					var $this = $(this),
83						parentLabel = $this.parents('li:first').find('a:first').text();
84
85					$this.find('a').html(parentLabel);
86				});
87			}
88			// If the active item should also be a clickable link, create one and put
89			// it at the top of our menu.
90			if (this.options.useActiveItemAsLink) {
91				this.$el.find( 'ul.dl-submenu' ).prepend(function() {
92					var parentli = $(this).parents('li:not(.dl-back):first').find('a:first');
93					return '<li class="dl-parent"><a href="' + parentli.attr('href') + '">' + parentli.text() + '<div class="mobileNavItemButton"></div></a></li>';
94				});
95			}
96
97		},
98		_initEvents : function() {
99
100			var self = this;
101
102			this.$trigger.on( 'click.dlmenu', function() {
103				if( self.open ) {
104					self._closeMenu();
105				}
106				else {
107					self._openMenu();
108					// clicking somewhere else makes the menu close
109					$body.off( 'click' ).children().on( 'click.dlmenu', function() {
110						self._closeMenu() ;
111					} );
112					
113					self.$container.addClass('active');
114				}
115				return false;
116			} );
117
118			this.$menuitems.on( 'click.dlmenu', function( event ) {
119
120				event.stopPropagation();
121
122				var $item = $(this),
123					$submenu = $item.children( 'ul.dl-submenu' );
124
125				// Only go to the next menu level if one exists AND the link isn't the
126				// one we added specifically for navigating to parent item pages.
127				if( ($submenu.length > 0) && !($(event.currentTarget).hasClass('dl-subviewopen'))) {
128
129					var $flyin = $submenu.clone().css( 'opacity', 0 ).insertAfter( self.$menu ),
130						onAnimationEndFn = function() {
131							self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classout ).addClass( 'dl-subview' );
132							$item.addClass( 'dl-subviewopen' ).parents( '.dl-subviewopen:first' ).removeClass( 'dl-subviewopen' ).addClass( 'dl-subview' );
133							$flyin.remove();
134						};
135
136					setTimeout( function() {
137						$flyin.addClass( self.options.animationClasses.classin );
138						self.$menu.addClass( self.options.animationClasses.classout );
139						if( self.supportAnimations ) {
140							self.$menu.on( self.animEndEventName, onAnimationEndFn );
141						}
142						else {
143						}
144						onAnimationEndFn.call();
145
146						self.options.onLevelClick( $item, $item.children( 'a:first' ).text() );
147					} );
148
149					return false;
150
151				}
152				else {
153					self.options.onLinkClick( $item, event );
154				}
155
156			} );
157
158			this.$back.on( 'click.dlmenu', function( event ) {
159
160				var $this = $( this ),
161					$submenu = $this.parents( 'ul.dl-submenu:first' ),
162					$item = $submenu.parent(),
163
164					$flyin = $submenu.clone().insertAfter( self.$menu );
165
166				var onAnimationEndFn = function() {
167					self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classin );
168					$flyin.remove();
169				};
170
171				setTimeout( function() {
172					$flyin.addClass( self.options.animationClasses.classout );
173					self.$menu.addClass( self.options.animationClasses.classin );
174					if( self.supportAnimations ) {
175						self.$menu.on( self.animEndEventName, onAnimationEndFn );
176					}
177					else {
178					}
179					onAnimationEndFn.call();
180
181					$item.removeClass( 'dl-subviewopen' );
182
183					var $subview = $this.parents( '.dl-subview:first' );
184					if( $subview.is( 'li' ) ) {
185						$subview.addClass( 'dl-subviewopen' );
186					}
187					$subview.removeClass( 'dl-subview' );
188				} );
189
190				return false;
191
192			} );
193
194		},
195		closeMenu : function() {
196			if( this.open ) {
197				this._closeMenu();
198			}
199		},
200		_closeMenu : function() {
201			var self = this,
202				onTransitionEndFn = function() {
203					self.$menu.off( self.transEndEventName );
204					self._resetMenu();
205				};
206
207			this.$menu.removeClass( 'dl-menuopen' );
208			this.$menu.addClass( 'dl-menu-toggle' );
209			this.$trigger.removeClass( 'dl-active' );
210
211			if( this.supportTransitions ) {
212				this.$menu.on( this.transEndEventName, onTransitionEndFn );
213			}
214			else {
215				onTransitionEndFn.call();
216			}
217
218			self.$container.removeClass('active');
219			this.open = false;
220		},
221		openMenu : function() {
222			if( !this.open ) {
223				this._openMenu();
224			}
225		},
226		_openMenu : function() {
227			var self = this;
228			// clicking somewhere else makes the menu close
229			$body.off( 'click' ).on( 'click.dlmenu', function() {
230				self._closeMenu() ;
231			} );
232			this.$menu.addClass( 'dl-menuopen dl-menu-toggle' ).on( this.transEndEventName, function() {
233				$( this ).removeClass( 'dl-menu-toggle' );
234			} );
235			this.$trigger.addClass( 'dl-active' );
236			this.open = true;
237		},
238		// resets the menu to its original state (first level of options)
239		_resetMenu : function() {
240			this.$menu.removeClass( 'dl-subview' );
241			this.$menuitems.removeClass( 'dl-subview dl-subviewopen' );
242		}
243	};
244
245	var logError = function( message ) {
246		if ( window.console ) {
247			window.console.error( message );
248		}
249	};
250
251	$.fn.dlmenu = function( options ) {
252		if ( typeof options === 'string' ) {
253			var args = Array.prototype.slice.call( arguments, 1 );
254			this.each(function() {
255				var instance = $.data( this, 'dlmenu' );
256				if ( !instance ) {
257					logError( "cannot call methods on dlmenu prior to initialization; " +
258					"attempted to call method '" + options + "'" );
259					return;
260				}
261				if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
262					logError( "no such method '" + options + "' for dlmenu instance" );
263					return;
264				}
265				instance[ options ].apply( instance, args );
266			});
267		}
268		else {
269			this.each(function() {
270				var instance = $.data( this, 'dlmenu' );
271				if ( instance ) {
272					instance._init();
273				}
274				else {
275					instance = $.data( this, 'dlmenu', new $.DLMenu( options, this ) );
276				}
277			});
278		}
279		return this;
280	};
281
282	$('[data-sv-dl-menu]').dlmenu();
283
284	gtm.update();
285
286});
287
288// Lazy-load FontAwesome
289(function() {
290	var css = document.createElement('link');
291	css.href = 'https://use.fontawesome.com/releases/v5.14.0/css/all.css';
292	css.rel = 'stylesheet';
293	css.type = 'text/css';
294	document.getElementsByTagName('head')[0].appendChild(css);
295})();

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.