PageSourceSearch

http://www.madeiracity.com/_assets_/js/scripts.js

js madeiracity.com collected 2026-10-02 13:27:51 UTC 17,566 bytes, 567 lines download raw bytes

1/*-----------------------------------------------------------------------------------
2
3	Theme Name: The City of Madeira, Ohio
4	Front-end developer: Suman Shrestha
5	Author Design: Mary Charara
6	Author URI: http://www.revize.com/
7	Date: 13/02/2024
8
9-----------------------------------------------------------------------------------*/
10
11function getCellCoords(elem) {
12	if (elem.tagName !== 'TD' && elem.tagName !== 'TH') return null;
13	
14	var result = {};
15	
16	// The y-coord is simply the number of <tr> elements that precede our parent, plus our parent.
17	result.y = $(elem).parent('tr').prevAll('tr').length;
18	
19	var rows = $(elem).parents('tbody').eq(0).find("tr"),
20			matrix = [],
21			row = null,
22			cells = null,
23			cell = null,
24			colspan = null,
25			rowspan = null,
26			rowIndex = null,
27			colIndex = null;
28	
29	result.x = null;
30	for (var i = 0; i < rows.length && result.x === null; i++) {
31		matrix[i] = matrix[i] || [];
32		row = rows[i];
33		cells = $(row).children('td, th');
34		
35		for (var j = 0; j < cells.length && result.x === null; j++) {
36			cell = cells[j];
37			colspan = (cell.attributes['colspan']) ? parseInt(cell.attributes['colspan'].value) : 1;
38			rowspan = (cell.attributes['rowspan']) ? parseInt(cell.attributes['rowspan'].value) : 1;
39			
40			rowIndex = row.rowIndex;
41			matrix[rowIndex] = matrix[rowIndex] || [];
42			
43			colIndex = null;
44			for (var l = 0; l <= matrix[rowIndex].length && colIndex === null; l++) {
45				if (!matrix[rowIndex][l]) colIndex = l;
46			}
47			
48			if (cell === elem) { // Short circuit if possible.
49				result.x = colIndex;
50				break;
51			}
52			
53			for (var k = rowIndex; k < rowIndex + rowspan; k++) {
54				for (var l = colIndex; l < colIndex + colspan; l++) {
55					matrix[k] = matrix[k] || [];
56					matrix[k][l] = 1;
57				}
58			}
59		}
60	}
61	
62	return result;
63}
64
65function RZRenderMini(elementList) {
66
67	$('.mini-calendar').css('display', 'block');
68
69	function hasEventClick() {
70		$('.fc-day-top.day-has-event a').on('click', function(){
71			$('.fc-left .fc-button-group+.fc-button-group').css('opacity', '1');
72			$('.fc-left .fc-button-group+.fc-button-group button').css('cursor', 'pointer');
73			$('.fc-left .fc-button-group+.fc-button-group button').css('pointer-events', 'all');
74			$('.fc-left .fc-prev-button').css('opacity', '0').css('pointer-events', 'none');
75			$('.fc-left .fc-next-button').css('opacity', '0').css('pointer-events', 'none');
76		})
77	}
78
79	function eachEvent(){
80		$('a.fc-day-grid-event.fc-start').each(function(){
81			var eventIndex = getCellCoords(this.parentElement).x;
82			$(this).parents("table").eq(0).find("thead td").eq(eventIndex).addClass('day-has-event');
83		});
84
85		hasEventClick()
86	}
87
88	eachEvent();
89	hasEventClick()
90
91	$('.fc-left .fc-button-group > .fc-dayGridMonth-button')
92	.add('.fc-left .fc-button-group > .fc-prev-button')
93	.add('.fc-left .fc-button-group > .fc-next-button')
94	.add('.fc-left .fc-button-group > .fc-today-button')
95	.on('click', function(){
96		eachEvent();
97	});
98
99	$('.fc-left .fc-button-group+.fc-button-group .fc-dayGridMonth-button').on('click', function(){
100		$('.fc-left .fc-button-group+.fc-button-group').css('opacity', '0');
101		$('.fc-left .fc-button-group+.fc-button-group button').css('pointer-events', 'none');
102		$('.fc-left .fc-prev-button').css('opacity', '1').css('pointer-events', 'all');
103		$('.fc-left .fc-next-button').css('opacity', '1').css('pointer-events', 'all');
104		hasEventClick();
105	})
106
107	$('.fc-left .fc-button-group+.fc-button-group .fc-today-button').on('click', function(){
108		$('.fc-left .fc-button-group+.fc-button-group').css('opacity', '1');
109	})
110}
111
112(function($) {
113
114	'use strict';
115
116	var $window = $(window),
117	$body = $('body'),
118	$html = $('html'),
119	$rzBarWrap = $('#rz-bar-wrap'),
120	$rzBtnsContainer = $('.rz-btns-container');
121
122	/*!
123	 * IE10 viewport hack for Surface/desktop Windows 8 bug
124	 * Copyright 2014-2015 Twitter, Inc.
125	 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
126	 */
127
128	// See the Getting Started docs for more information:
129	// http://getbootstrap.com/getting-started/#support-ie10-width
130	if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
131		var msViewportStyle = document.createElement('style');
132		msViewportStyle.appendChild(
133			document.createTextNode(
134			  '@-ms-viewport{width:auto!important}'
135			)
136		); document.querySelector('head').appendChild(msViewportStyle);
137	}
138
139	// RZ Class + remove revize bar
140	if(typeof RZ !== "undefined"){
141		if(RZ.login){
142			$body.addClass("user-logged-in");
143		} else{
144			$body.addClass("user-not-logged-in");
145			// remove revize bar 
146			$rzBarWrap.remove();
147			$rzBtnsContainer.remove();
148		}
149	}
150
151	$window.ready(function(){	
152		// Video for slider
153		if($('body').attr('id') == 'homepage'){
154			$("#sliderVideo").YTPlayer();
155		}
156	});
157
158	// Keyboard Navigation: Nav, flyout
159	var isClick = false;
160	$("#nav li a, #flyout  li a, a, button, .toggle, .toggle2").on('focusin', function(e) {
161		if( isClick === false ) {
162			$(".focused").removeClass("focused");
163			$(e.currentTarget).parents("#nav li, #flyout li").addClass("focused");
164			$(".opened:not(.focused) ul:visible,.opened2:not(.focused) ul:visible").slideUp().parent().removeClass("opened opened2");
165		} else {
166			$(".focused").removeClass("focused");
167			isClick = false;
168		}
169	});
170
171	// for revize buttons container
172	$rzBtnsContainer.each(function(){ 
173		if($rzBtnsContainer.html().trim()==""){
174			$rzBtnsContainer.closest(".has-edit-buttons").removeClass("has-edit-buttons");
175		} else {
176			$rzBtnsContainer.closest(".has-edit-buttons").addClass('yes-has-edit-buttons');
177		} 
178	});
179
180	// responsive views from revize bar 
181	var urlParams = new URLSearchParams(window.location.search); //get all parameters
182	var hidebar = urlParams.get('hidebar'); //extract the hidebar parameter - this will return NULL if hidebar isn't a parameter
183	
184	if(hidebar) { //check if hidebar parameter is set to anything
185		$body.removeClass("user-logged-in").addClass("hide-edit-btns");
186	}
187
188	// prevent focused class changes on click - This way arrows wont pop when clicking nav links
189	$("#nav a, #flyout a").on('mousedown',function(){
190		isClick = true;
191	});
192
193	// Search Toggle
194	$('#search-toggle').on('click',function(e){
195		$('#search').stop().slideToggle(200);
196		$(this).toggleClass('fa-search fa-close');
197	});
198
199	// Navigation Toggle
200	$("#nav-toggle").on("click", function(){
201		$("#nav").stop().slideToggle();
202		$(this).toggleClass("fa-bars fa-close");
203	});
204
205
206	// Menu Arrows and Toggles
207	$("#nav >li>ul,#flyout >li>ul").addClass('first-level');
208	$("#nav li ul ul").addClass('second-level');
209	$("#nav>li:has(ul)").each(function(){
210		$('<a href="#" class="fa fa-angle-down toggle d-lg-none" 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'));
211		$(this).find('ul:first').attr('aria-labelledby', 'dropdown-toggle-'+$(this).index());
212	});
213	$('#nav li ul>li:has(ul)').each(function(index) {
214		$('<a href="#" class="fa fa-angle-down toggle2 d-lg-none" 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'));
215		$(this).find('ul:first').attr('aria-labelledby', 'sub-dropdown-toggle-'+index);
216	});
217	$('#flyout >li:has(ul)').each(function() {
218		$('<a href="#" class="fa fa-angle-down toggle d-lg-none" 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'));
219		$(this).find('ul:first').attr('aria-labelledby', 'flyout-dropdown-toggle-'+$(this).index());
220	});
221
222	function addNavClass() {
223		if ($window.width() < 992) {
224			// Insert needed for mobile
225		} else{
226			// Insert needed for desktop
227			$('#nav ul,#flyout ul').css('display', '');
228		}
229	}
230	addNavClass();
231	$window.resize(addNavClass);
232
233	$(".toggle").on("click keydown",function(e) {
234		if (e.keyCode === 13 || e.type === 'click') {
235			e.preventDefault();
236			var $parent = $(this).parent();
237			var $parentLi = $parent.parent();
238			$parent.toggleClass('opened');
239			if($parent.addClass('active') && $(this).next('.first-level').is(":visible")){
240				$(this).next('.first-level').slideUp();
241				$parent.removeClass('active');
242				$(this).attr({'aria-expanded': 'false'});
243			} else {
244				$(this).attr({'aria-expanded': 'true'});
245				$(".first-level").slideUp("slow");
246				$parent.addClass('active');
247				$(this).next('.first-level').slideToggle();
248			}
249		}
250	});
251	$(".toggle2").on("click keydown",function(e) {
252		if (e.keyCode === 13 || e.type === 'click') {
253			e.preventDefault();
254			var $parent = $(this).parent();
255			var $parentLi = $parent.parent();
256			$parent.toggleClass('opened2');
257			if($parent.addClass('active') && $(this).next('.second-level').is(":visible")){
258				$(this).next('.second-level').slideUp();
259				$parent.removeClass('active');
260				$(this).attr({'aria-expanded': 'false'});
261			} else {
262				$(this).attr({'aria-expanded': 'true'});
263				$(".second-level").slideUp("slow");
264				$parent.addClass('active');
265				$(this).next('.second-level').slideToggle();
266			}
267		}
268	});
269
270	// close nav if left
271	$(".desktop *").focus(function(e){
272		var $opened = $(".opened");
273		var $opened2 = $(".opened2");
274		if( $opened.length > 0 || $opened2.length > 0 ) {
275			if( $(".opened :focus").length < 1 ){
276				$opened.children("ul").slideUp();
277				$opened.removeClass("opened");
278				$(".opened2").removeClass("opened2");
279			}
280			if( $(".opened2 :focus").length < 1 ){
281				$opened2.children("ul").slideUp();
282				$opened2.removeClass("opened2");
283			}
284		}
285	});
286
287	// Flyout
288	var flyout = $('#flyout'),
289		flyoutwrap = $('#flyout-wrap');
290
291	if (flyout.text().length){
292		flyoutwrap.prepend('<div id="flyout-toggle" class="d-lg-none"><i class="fa fa-bars"></i> Sub Menu</div>');
293	}
294
295	$("#flyout-toggle").on("click", function(){
296		flyout.slideToggle();
297		$(this).toggleClass("active");
298	});
299
300	// Make sure all calendars have unique ids
301	$('iframe[name="calendar"]').each(function (index, calendar) {
302		calendar.id = 'calendar-' + index;
303	});
304
305	// needed for revize bar
306	$('[data-toggle="tooltip"]').tooltip({trigger:"hover"})
307
308	$(window).on("scroll", function() {
309		if($(window).scrollTop() > 0) {
310			$(".sticky-header").addClass("sticky-top");
311		} else {
312			//remove the background property so it comes transparent again (defined in your css)
313		   $(".sticky-header").removeClass("sticky-top");
314		}
315	});
316
317	// Start Frame Resizer
318	function resizeIframe(height, frameElement) {
319		if ( frameElement ) {
320			frameElement.height = "";
321			frameElement.height = height;
322		}
323	}
324
325	var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
326	var eventHandler = window[eventMethod];
327	var messageEvent = eventMethod === "attachEvent" ? "onmessage" : "message";
328	eventHandler(messageEvent, function (e) {
329		if ( Array.isArray(e.data) ) {
330			if( e.data[0] === "setCalHeight" || e.data[0] === "setNotifyHeight") {
331				var frames = document.querySelectorAll('iframe');
332				for( var i = 0; i < frames.length; i++ ) {
333					if( frames[i].contentWindow === e.source ){
334						resizeIframe(e.data[1], frames[i]);
335					}
336				}
337			}
338		}
339	});
340	// End Frame Resizer
341
342	$('.tab').click(function(e){
343		e.preventDefault();
344		$('.tab').removeClass('current');
345		$(this).addClass('current');
346		var tabIndex = $(this).index();
347		$('.tab-content').stop().slideUp();
348		$('.tab-content').eq(tabIndex).stop().slideDown();
349	});
350
351	// Alert Close Caching
352	if ($("div.alert").length) {
353		var hide = window.sessionStorage && parseInt(window.sessionStorage.getItem("alertClosed")) > 1;
354		if (!hide || $(".user-logged-in").length != 0) {
355			$("div.alert").addClass('show');
356		}
357		$("div.alert button.close").on('click', function(e) {
358			if (window.sessionStorage) {
359				window.sessionStorage.setItem("alertClosed",parseInt(window.sessionStorage.getItem("alertClosed")||0)+1);
360			}
361		});
362	}
363
364	var $translateButton = $('#translate-button');
365	$('#translation-links a').attr('href','javascript:void()')
366	$translateButton.on('keydown click', function(e){
367		if (e.keyCode === 13 || e.type === 'click') {
368			$('#translation-links ul').stop().fadeToggle();
369			$translateButton.attr('aria-expanded', !('true' === $translateButton.attr('aria-expanded')));
370		}
371	});
372
373	$('#translation-links ul').on('mouseleave',function(){
374		$(this).fadeOut();
375		$translateButton.attr('aria-expanded', false);
376	});
377
378	function removeCookieString(value, domain) {
379		domain = domain ? 'domain='+domain+'; ' : '';
380		return value+'; expires=Thu, 01 Jan 1970 00:00:01 GMT; '+domain+'path=/';
381	}
382
383	function unsetGoogtransCookie() {
384		for (var domains = window.location.hostname.split('.'); domains.length >= 2; domains.shift()) {
385			var cookieString = removeCookieString('googtrans=unset', domains.join('.'));
386			document.cookie=cookieString;
387			if	(domains.length === 2) {
388				cookieString = removeCookieString('googtrans=unset', '.'+domains.join('.'));
389				document.cookie=cookieString;
390			}
391		}
392		document.cookie=removeCookieString('googtrans=unset');
393	}
394
395	if (document.cookie.split(';').some(function(item) { return item.trim().startsWith('googtrans=/auto/en'); })) {
396		unsetGoogtransCookie();
397	}
398
399	 // Translate Script
400	var translateURL = "//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit";
401    $.getScript(translateURL);
402    $('#translation-links a').click(function() {
403        var lang = $(this).data('lang');
404        var $frame = $('iframe.skiptranslate');
405        if (lang === 'English') {
406            $frame.contents().find('span.text:contains("English")').parent().parent().get(0).click();
407            return;
408        }
409        if (!$frame.length) {
410            return false;
411        }
412        var $el = $frame.contents().find('span.text:contains(' + lang + ')').parent().parent().get(0).click();
413        console.log($el);
414        if (!$el) {
415            $frame.contents().find('span.text:contains("English")').parent().parent().get(0);
416        }
417        
418        $el.click();
419        return false;
420    });
421
422
423	// Tiny Slider
424	if (typeof tns !== "undefined") {
425		$('.tiny-slider').each(function(i, el) {
426			tns({
427				autoplay: true,
428				autoplayTimeout: 8000,
429				container: el,
430				items: 1,
431				lazyload: true,
432				lazyloadSelector: '.tns-lazy-img', // accompanied with data src or data-style
433				mode: "gallery",
434				preventScrollOnTouch: 'force',
435                nav: false,
436                controlsText: [
437                    '<i class="fa fa-chevron-left" aria-hidden="true"></i>',
438                    '<i class="fa fa-chevron-right" aria-hidden="true"></i>'
439                ],
440				loop: false,
441                autoplayButtonOutput: false
442			});
443		});
444
445		$('#qlinks .tiny-carousel').each(function(i, el) {
446			var $el = $(el);
447			var tinyItemCount = $el.children().length;
448			var tinyItemData = $el.data('tinyItems') ? $el.data('tinyItems') : 6;
449			tns({
450				container: el,
451				items: Math.min(tinyItemCount, tinyItemData),
452				lazyload: true,
453				lazyloadSelector: '.tns-lazy-img', // accompanied with data src or data-style
454				preventScrollOnTouch: 'force',
455				nav: false,
456				controlsText: [
457					'<i class="fa fa-chevron-left" aria-hidden="true"></i>',
458					'<i class="fa fa-chevron-right" aria-hidden="true"></i>'
459				],
460				autoplayButtonOutput: false,
461				loop: false,
462				responsive:{
463					1600:{
464						items: 6
465					},
466					1199:{
467						items: 4
468					},
469					991:{
470						items: 4
471					},
472					767:{
473						items: 3
474					},
475					479:{
476						items: 2
477					},
478					0:{
479						items: 1
480					}
481				}
482			});
483		});
484
485	
486	
487		$('#news .tiny-carousel').each(function(i, el) {
488			var $el = $(el);
489			var tinyItemCount = $el.children().length;
490			var tinyItemData = $el.data('tinyItems') ? $el.data('tinyItems') : 2;
491			tns({
492				container: el,
493				items: Math.min(tinyItemCount, tinyItemData),
494				lazyload: true,
495				lazyloadSelector: '.tns-lazy-img', // accompanied with data src or data-style
496				preventScrollOnTouch: 'force',
497				nav: false,
498				controlsText: [
499					'<i class="fa fa-chevron-left" aria-hidden="true"></i>',
500					'<i class="fa fa-chevron-right" aria-hidden="true"></i>'
501				],
502				loop: false,
503				autoplayButtonOutput: false,
504				responsive:{
505					1199:{
506						items: 2
507					},
508					991:{
509						items: 2
510					},
511					767:{
512						items: 1
513					},
514					479:{
515						items: 1
516					},
517					0:{
518						items: 1
519					}
520				}
521			});
522		});
523	}
524
525	// matchHeight
526	if(typeof $.fn.matchHeight !== "undefined"){
527		$('.equal').matchHeight({
528			//defaults
529			byRow: true,
530			property: 'height', // height or min-height
531			target: null,
532			remove: false
533		});
534
535		$('#qlinks .q-header').matchHeight();
536		$('#news .newspara').matchHeight();
537	}		
538
539	//#Smooth Scrolling
540	$('a[href*="#"]').not('[href="#"]').not('[href*="#collapse"]').not('.faq-header').click(function(event) {
541		if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) {
542			var target = $(this.hash);
543			target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
544			if (target.length) {
545				event.preventDefault();
546				$('html,body').animate({
547					scrollTop: target.offset().top
548				}, 1000, function() {
549					var $target = $(target);
550					$target.focus();
551					if ($target.is(":focus")) {
552						return false;
553					} else {
554						$target.attr('tabindex','-1');
555						$target.focus();
556						$target.removeAttr('tabindex');
557					};
558				});
559			}
560		}
561	});
562	
563	if ($("[id^=rzletter-]").length) {
564		$.getScript("https://revizenewsletter.com/js/widget.js");
565	}
566	
567})(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.