PageSourceSearch

https://townofwhitakers.org/_assets_/js/scripts.js?t=1743096946543

js townofwhitakers.org collected 2026-10-04 13:26:49 UTC 15,683 bytes, 477 lines download raw bytes

1
2
3/*-----------------------------------------------------------------------------------
4
5	Theme Name: Colorville
6	Front-end developer: Richard Opiniano
7	Author Design: Samir Alley @samiralley
8	Author URI: http://www.revize.com/
9	Date: 9/12/22
10
11-----------------------------------------------------------------------------------*/
12
13(function($) {
14
15
16(function($) {
17
18	'use strict';
19
20	var $window = $(window),
21		$body = $('body');
22
23	/*!
24	 * IE10 viewport hack for Surface/desktop Windows 8 bug
25	 * Copyright 2014-2015 Twitter, Inc.
26	 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
27	 */
28
29	// See the Getting Started docs for more information:
30	// http://getbootstrap.com/getting-started/#support-ie10-width
31	if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
32		var msViewportStyle = document.createElement('style');
33		msViewportStyle.appendChild(
34			document.createTextNode(
35			  '@-ms-viewport{width:auto!important}'
36			)
37		); document.querySelector('head').appendChild(msViewportStyle);
38	}
39
40	// RZ Class
41	if(typeof RZ !== "undefined"){
42		if(RZ.login){
43			$body.addClass("user-logged-in");
44		} else{
45			$body.addClass("user-not-logged-in");
46		}
47		if(RZ.pageid === "index"){
48			$("#video-bg").YTPlayer();
49		}
50	}
51
52	// Keyboard Navigation: Nav, flyout
53	var isClick = false;
54	$("#nav li a, #flyout  li a, a, button, .toggle, .toggle2").on('focusin', function(e) {
55		if( isClick === false ) {
56			$(".focused").removeClass("focused");
57			$(e.currentTarget).parents("#nav li, #flyout li").addClass("focused");
58			$(".opened:not(.focused) ul:visible,.opened2:not(.focused) ul:visible").slideUp().parent().removeClass("opened opened2");
59		} else {
60			$(".focused").removeClass("focused");
61			isClick = false;
62		}
63	});
64
65	// prevent focused class changes on click - This way arrows wont pop when clicking nav links
66	$("#nav a,#flyout a").on('mousedown',function(){
67		isClick = true;
68	});
69
70	// Search Toggle
71	$('#search-toggle').on('click',function(e){
72		$('#search').stop().slideToggle(200);
73		$(this).toggleClass('fa-search fa-close');
74	});
75
76	// Navigation Toggle
77	$("#nav-toggle").on("click", function(){
78		$("#nav").stop().slideToggle();
79		$(this).toggleClass("fa-bars fa-close");
80	});
81
82	// Menu Arrows and Toggles
83	$("#nav >li>ul,#flyout >li>ul").addClass('first-level');
84	$("#nav  li ul ul").addClass('second-level');
85	$("#nav>li:has(ul)").each(function(){
86		$('<a href="#" class="fa fa-angle-down toggle" tabindex="0" aria-haspopup="true" aria-expanded="false" id="dropdown-toggle-'+$(this).index()+'" aria-label="Show Dropdown for '+ $(this).find('a:first').text() +'"></a>').insertAfter($(this).find('a:first'));
87		$(this).find('ul:first').attr('aria-labelledby', 'dropdown-toggle-'+$(this).index());
88	});
89	$('#nav li ul>li:has(ul)').each(function(index) {
90		$('<a href="#" class="fa fa-angle-down toggle2" tabindex="0" aria-haspopup="true" aria-expanded="false" id="sub-dropdown-toggle-'+index+'" aria-label="Show Dropdown for '+ $(this).find('a:first').text() +'"></a>').insertAfter($(this).find('a:first'));
91		$(this).find('ul:first').attr('aria-labelledby', 'sub-dropdown-toggle-'+index);
92	});
93	$('#flyout >li:has(ul)').each(function() {
94		$('<a href="#" class="fa fa-angle-down toggle" tabindex="0" aria-haspopup="true" aria-expanded="false" id="flyout-dropdown-toggle-'+$(this).index()+'" aria-label="Show Flyout for '+ $(this).find('a:first').text() +'"></a>').insertAfter($(this).find('a:first'));
95		$(this).find('ul:first').attr('aria-labelledby', 'flyout-dropdown-toggle-'+$(this).index());
96	});
97
98	function addNavClass() {
99		if ($window.width() < 992) {
100			// Insert needed for mobile
101			if ($("#homepage").length) {
102				$("#slider-caption").css("margin-top", "");
103			}
104		} else{
105			// Insert needed for desktop
106			$('#nav ul, #flyout ul').css('display', '');
107			var headPos = $("#header-inner").parent().innerHeight();
108			if ($("#homepage").length) {
109				$("#slider-caption").css("margin-top", "");
110				var contPos = $("#slider-caption").position().top;
111				if (contPos < headPos + 50) {
112					$("#slider-caption").css("margin-top", headPos + 50);
113				}
114			}
115		}
116	}
117	addNavClass();
118	$window.resize(addNavClass);
119	window.addEventListener("load", function() { addNavClass(); }); // Catch fonts finishing
120
121	$(".toggle").on("click keydown",function(e) {
122		if (e.keyCode === 13 || e.type === 'click') {
123			e.preventDefault();
124			var $parent = $(this).parent();
125			var $parentLi = $parent.parent();
126			$parent.toggleClass('opened');
127			if($parent.addClass('active') && $(this).next('.first-level').is(":visible")){
128				$(this).next('.first-level').slideUp();
129				$parent.removeClass('active');
130				$(this).attr({'aria-expanded': 'false'});
131			} else {
132				$(this).attr({'aria-expanded': 'true'});
133				$(".first-level").slideUp("slow");
134				$parent.addClass('active');
135				$(this).next('.first-level').slideToggle();
136			}
137		}
138	});
139	$(".toggle2").on("click keydown",function(e) {
140		if (e.keyCode === 13 || e.type === 'click') {
141			e.preventDefault();
142			var $parent = $(this).parent();
143			var $parentLi = $parent.parent();
144			$parent.toggleClass('opened2');
145			if($parent.addClass('active') && $(this).next('.second-level').is(":visible")){
146				$(this).next('.second-level').slideUp();
147				$parent.removeClass('active');
148				$(this).attr({'aria-expanded': 'false'});
149			} else {
150				$(this).attr({'aria-expanded': 'true'});
151				$(".second-level").slideUp("slow");
152				$parent.addClass('active');
153				$(this).next('.second-level').slideToggle();
154			}
155		}
156	});
157
158	// close nav if left
159	$(".desktop *").focus(function(e){
160		var $opened = $(".opened");
161		var $opened2 = $(".opened2");
162		if( $opened.length > 0 || $opened2.length > 0 ) {
163			if( $(".opened :focus").length < 1 ){
164				$opened.children("ul").slideUp();
165				$opened.removeClass("opened");
166				$(".opened2").removeClass("opened2");
167			}
168			if( $(".opened2 :focus").length < 1 ){
169				$opened2.children("ul").slideUp();
170				$opened2.removeClass("opened2");
171			}
172		}
173	});
174
175	// Flyout
176	var flyout = $('#flyout'),
177		flyoutwrap = $('#flyout-wrap');
178
179	if (flyout.text().length){
180		flyoutwrap.prepend('<div id="flyout-toggle" class="hidden-lg hidden-md"><i class="fa fa-bars"></i> Sub Menu</div>');
181	}
182
183	$("#flyout-toggle").on("click", function(){
184		flyout.slideToggle();
185		$(this).toggleClass("active");
186	});
187
188
189	function fillSide(){
190		var whiteSpace = parseFloat($('.container').css('margin-right')) + 15;
191		$('.fillLeft').css('margin-left',-whiteSpace);
192		$('.fillLeft.withPadding').css('padding-left',whiteSpace);
193		$('.fillRight').css('margin-right',-whiteSpace);
194		$('.fillRight.withPadding').css('padding-right',whiteSpace);
195	}
196	fillSide();
197	$window.resize(fillSide);
198
199	/*
200	* E-Notify Auto submit
201	*/
202	$.urlParam=function(n){var e=new RegExp("[?&]"+n+"=([^]*)").exec(window.location.href);return null==e?null:e[1]||0};
203	var $enotify = $('iframe[src*="/revize/plugins/notify/notify.jsp"]');
204	if( $enotify.length > 0 ){
205		var emailStr = $.urlParam("email");
206		if( emailStr != null ){
207			$enotify.attr("src", $enotify.attr("src") + "&email=" + emailStr);
208		}
209	}
210
211	// Make sure all calendars have unique ids
212	$('iframe[name="calendar"]').each(function (index, calendar) {
213		calendar.id = 'calendar-' + index;
214	});
215
216	// Start Frame Resizer
217	function resizeIframe(height, frameElement) {
218		if ( frameElement ) {
219			frameElement.height = "";
220			frameElement.height = height;
221		}
222	}
223
224	var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
225	var eventHandler = window[eventMethod];
226	var messageEvent = eventMethod === "attachEvent" ? "onmessage" : "message";
227	eventHandler(messageEvent, function (e) {
228		if ( Array.isArray(e.data) ) {
229			if( e.data[0] === "setCalHeight" || e.data[0] === "setNotifyHeight") {
230				var frames = document.querySelectorAll('iframe');
231				for( var i = 0; i < frames.length; i++ ) {
232					if( frames[i].contentWindow === e.source ){
233						resizeIframe(e.data[1], frames[i]);
234					}
235				}
236			}
237		}
238	});
239	// End Frame Resizer
240
241	// Alert Close Caching
242	if ($("div.alert").length) {
243		var hide = window.sessionStorage && parseInt(window.sessionStorage.getItem("alertClosed")) > 1;
244		if (!hide || $(".user-logged-in").length != 0) {
245			$("div.alert").addClass('show');
246		}
247		$("div.alert button.close").on('click', function(e) {
248			if (window.sessionStorage) {
249				window.sessionStorage.setItem("alertClosed",parseInt(window.sessionStorage.getItem("alertClosed")||0)+1);
250			}
251		});
252	}
253
254	var $translateButton = $('#translate-button');
255	$translateButton.on('keydown click', function(e){
256		if (e.keyCode === 13 || e.type === 'click') {
257			$('#translation-links ul').stop().fadeToggle();
258			$translateButton.attr('aria-expanded', !('true' === $translateButton.attr('aria-expanded')));
259		}
260	});
261
262	$('#translation-links ul').on('mouseleave',function(){
263		$(this).fadeOut();
264		$translateButton.attr('aria-expanded', false);
265	});
266
267	function removeCookieString(value, domain) {
268		domain = domain ? 'domain='+domain+'; ' : '';
269		return value+'; expires=Thu, 01 Jan 1970 00:00:01 GMT; '+domain+'path=/';
270	}
271
272	function unsetGoogtransCookie() {
273		for (var domains = window.location.hostname.split('.'); domains.length >= 2; domains.shift()) {
274			var cookieString = removeCookieString('googtrans=unset', domains.join('.'));
275			document.cookie=cookieString;
276			if	(domains.length === 2) {
277				cookieString = removeCookieString('googtrans=unset', '.'+domains.join('.'));
278				document.cookie=cookieString;
279			}
280		}
281		document.cookie=removeCookieString('googtrans=unset');
282	}
283
284	if (document.cookie.split(';').some(function(item) { return item.trim().startsWith('googtrans=/auto/en'); })) {
285		unsetGoogtransCookie();
286	}
287
288	 // Translate Script
289	var translateURL = "//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit";
290	$.getScript(translateURL);
291	$('#translation-links a').click(function() {
292        var lang = $(this).data('lang');
293        var $frame = $('iframe.skiptranslate');
294        if (lang === 'English') {
295            $frame.contents().find('span.text:contains("English")').parent().parent().get(0).click();
296            return;
297        }
298        if (!$frame.length) {
299            return false;
300        }
301        var $el = $frame.contents().find('span.text:contains(' + lang + ')').parent().parent().get(0).click();
302        console.log($el);
303        if (!$el) {
304            $frame.contents().find('span.text:contains("English")').parent().parent().get(0);
305        }
306        
307        $el.click();
308        return false;
309    });
310
311	// Tiny Slider
312	if (typeof tns !== "undefined") {
313		$('.tiny-slider').each(function(i, el) {
314			tns({
315				autoplay: true,
316				autoplayTimeout: 5000,
317				container: el,
318				items: 1,
319				lazyload: true,
320				lazyloadSelector: '.tns-lazy-img', // accompanied with data src or data-style
321				mode: "gallery",
322				preventScrollOnTouch: 'force',
323				nav: false,
324				controlsText: [
325				'<i class="fa fa-angle-left"></i>',
326				'<i class="fa fa-angle-right"></i>'
327				]
328			});
329		});
330	}
331
332	// Responsive Tables
333	$('.post table:not(.layout-table):not(.not-responsive)').wrap('<div class="table-responsive"></div>');
334	$('.layout-table').attr('role', 'presentation');
335
336	$window.ready(function(){
337
338		if ($('#flyout-wrap').length){
339			$('main').css('position','relative');
340			$('<div id="flyout-bg"></div>').prependTo('#main');
341		}
342
343		function flyoutBG(){
344			var flyoutWidth = $('#flyout-wrap').outerWidth();
345			$('#flyout-bg').width(flyoutWidth);
346		}
347		flyoutBG();
348		$window.resize(flyoutBG);
349
350
351		$('#alert-close').on('click',function(){
352			$('#alert-top').slideUp(300);
353		})
354
355		// matchHeight
356		if(typeof $.fn.matchHeight !== "undefined"){
357			$('.equal').matchHeight({
358				//defaults
359				byRow: true,
360				property: 'height', // height or min-height
361				target: null,
362				remove: false
363			});
364		}
365
366		// Animations http://www.oxygenna.com/tutorials/scroll-animations-using-waypoints-js-animate-css
367		function onScrollInit( items, trigger ) {
368			items.each( function() {
369				var osElement = $(this),
370					osAnimationClass = osElement.data('os-animation'),
371					osAnimationDelay = osElement.data('os-animation-delay');
372
373				osElement.css({
374					'-moz-animation-delay':     osAnimationDelay,
375					'animation-delay':          osAnimationDelay,
376					'-webkit-animation-delay':  osAnimationDelay
377				});
378
379				var osTrigger = ( trigger ) ? trigger : osElement;
380
381				if(typeof $.fn.waypoint !== "undefined"){
382					osTrigger.waypoint(function() {
383						osElement.addClass('animated').addClass(osAnimationClass);
384					},{
385						triggerOnce: true,
386						offset: '100%'
387					});
388				}
389			});
390		}
391		onScrollInit($('.os-animation'));
392
393		//#Smooth Scrolling
394		$('a[href*="#"]').not('[href="#"]').not('[href*="#collapse"]').not('[data-toggle*="collapse"]').click(function(event) {
395			if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) {
396				var target = $(this.hash);
397				target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
398				if (target.length) {
399					event.preventDefault();
400					$('html,body').animate({
401						scrollTop: target.offset().top
402					}, 1000, function() {
403						var $target = $(target);
404						$target.focus();
405						if ($target.is(":focus")) {
406							return false;
407						} else {
408							$target.attr('tabindex','-1');
409							$target.focus();
410							$target.removeAttr('tabindex');
411						};
412					});
413				}
414			}
415		});
416
417		/*global jQuery */
418		/*!
419		* FlexVerticalCenter.js 1.0
420		*
421		* Copyright 2011, Paul Sprangers http://paulsprangers.com
422		* Released under the WTFPL license
423		* http://sam.zoy.org/wtfpl/
424		*
425		* Date: Fri Oct 28 19:12:00 2011 +0100
426		*/
427		$.fn.flexVerticalCenter = function( options ) {
428			var settings = $.extend({
429				cssAttribute:   'margin-top', // the attribute to apply the calculated value to
430				verticalOffset: 0,            // the number of pixels to offset the vertical alignment by
431				parentSelector: null,         // a selector representing the parent to vertically center this element within
432				debounceTimeout: 25,          // a default debounce timeout in milliseconds
433				deferTilWindowLoad: false     // if true, nothing will take effect until the $(window).load event
434			}, options || {});
435
436			return this.each(function(){
437				var $this   = $(this); // store the object
438				var debounce;
439
440				// recalculate the distance to the top of the element to keep it centered
441				var resizer = function () {
442
443					var parentHeight = (settings.parentSelector && $this.parents(settings.parentSelector).length) ?
444						$this.parents(settings.parentSelector).first().height() : $this.parent().height();
445
446					$this.css(
447						settings.cssAttribute, ( ( ( parentHeight - $this.height() ) / 2 ) + parseInt(settings.verticalOffset) )
448					);
449				};
450
451				// Call on resize. Opera debounces their resize by default.
452				$(window).resize(function () {
453					clearTimeout(debounce);
454					debounce = setTimeout(resizer, settings.debounceTimeout);
455				});
456
457				if (!settings.deferTilWindowLoad) {
458					// call it once, immediately.
459					resizer();
460				}
461
462				// Call again to set after window (frames, images, etc) loads.
463				$(window).on('load', function () {
464					resizer();
465				});
466
467			});
468
469		};
470		$('.v-align').flexVerticalCenter();
471
472	}); // Ready
473
474})(jQuery);
475
476
477})(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.