PageSourceSearch

https://www.richmondma.org/_assets_/js/scripts.js

js richmondma.org collected 2026-09-25 06:08:31 UTC 7,889 bytes, 267 lines download raw bytes

1/*-----------------------------------------------------------------------------------
2
3	Theme Name:Town of Richmond, Massachusetts
4	Author HTML, CSS, and JavaScript:Richard Opiniano
5	Author Design:Tom Gooden @good3n
6	Author URI:http://www.revize.com/
7	Date:9/25/17
8
9-----------------------------------------------------------------------------------*/
10
11(function($) {
12
13	'use strict';
14
15	var $window = $(window),
16		$body = $('body');
17
18	/*!
19	 * IE10 viewport hack for Surface/desktop Windows 8 bug
20	 * Copyright 2014-2015 Twitter, Inc.
21	 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
22	 */
23
24	// See the Getting Started docs for more information:
25	// http://getbootstrap.com/getting-started/#support-ie10-width
26	if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
27		var msViewportStyle = document.createElement('style');
28		msViewportStyle.appendChild(
29			document.createTextNode(
30			  '@-ms-viewport{width:auto!important}'
31			)
32		); document.querySelector('head').appendChild(msViewportStyle);
33	}
34
35	$window.ready(function(){
36
37		$("#top-links a[href*='https://public.coderedweb.com']").addClass('external').css('color','red');
38
39		$('<li><a href="./">HOME</a></li>').prependTo('#freeform #nav');
40
41		// $('iframe').each(function(){
42		// 	var thisIframe = $(this);
43		// 	var iframeSrc = thisIframe.attr('src');
44		// 	console.log(iframeSrc);
45		// 	if (iframeSrc.indexOf("youtube") >= 0){
46		// 		console.log('its there');
47		// 		thisIframe.css('width','100%');
48		// 	}
49		// });
50
51		$('#logo h1').each(function() {
52		    var $this = $(this);
53		    $this.html($this.html().replace(/(\S+)\s*$/, '<div>$1</div>'));
54		});
55
56		if (RZ.pagetemplatename === 'faq'){
57			$('#flyout-wrap,.entry').removeClass('equal');
58		}
59
60		$('.sliderbtn').clone(true,true).appendTo('header');
61
62        $('#quick-links select').change(function(){
63            window.location.href = $(this).find(':selected').attr('value');
64        });
65
66		// RZ Class
67		if(typeof $.fn.RZ !== "undefined"){
68		 if(RZ.login){
69		  $body.addClass("user-logged-in");
70		 } else{
71			 $body.addClass("user-not-logged-in");
72		 }
73		}
74
75		// Search Toggle
76		$('#search-toggle').on('click',function(e){
77			$('#search').stop().slideToggle(200);
78			$('#top-links').stop().slideToggle(200);
79			$(this).toggleClass('fa-search fa-close');
80		});
81
82		// Navigation Toggle
83		$("#nav-toggle").on("click", function(){
84			$("#nav").stop().slideToggle();
85			$(this).toggleClass("active fa-bars fa-close");
86		});
87
88		// Menu Arrows
89		$("#nav > li:has(ul)").addClass('first-parent').children("a,span").append('<i class="fa fa-angle-down down-arrow">');
90
91		// Menu Toggles
92		$("#nav >li:has(ul)").children("a,span").append('<i class="fa fa-angle-down toggle">');
93		$("#nav li li:has(ul)").children("a,span").append('<i class="fa fa-angle-down toggle2">');
94
95		function addNavClass() {
96            $('#toggles-wrap>div').height($('#logo').outerHeight());
97            $('#toggles-wrap>div').width($('#logo').outerHeight());
98			if ($window.width() < 992) {
99				$("#nav >li>ul").addClass('first-level');
100				$("#nav  li ul ul").addClass('second-level');
101
102			} else{
103					$("#nav >li>ul").removeClass('first-level').css('display','');
104					$("#nav  li ul ul").removeClass('second-level').css('display','');
105			}
106		}
107		addNavClass();
108		$window.resize(addNavClass);
109
110		$(".toggle").click(function(e) {
111				e.preventDefault();
112			if($(this).parent().next('.first-level').is(":visible")){
113				$(this).parent().next('.first-level').slideUp();
114			} else {
115				$(".first-level").slideUp("slow");
116				$(this).parent().next('.first-level').slideToggle();
117			}
118		});
119
120		$(".toggle2").click(function(e) {
121				e.preventDefault();
122			if($(this).parent().next('.second-level').is(":visible")){
123				$(this).parent().next('.second-level').slideUp();
124			} else {
125				$(".second-level").slideUp("slow");
126				$(this).parent().next('.second-level').slideToggle();
127			}
128		});
129
130		// Flyout
131		var flyout = $('#flyout'),
132			flyoutwrap = $('#flyout-wrap');
133
134		if (flyout.text().length){
135			flyoutwrap.prepend('<div id="flyout-toggle"><i class="fa fa-bars"></i> Sub Menu</div>');
136		}
137
138		$("#flyout-toggle").on("click", function(){
139			flyout.slideToggle();
140			$(this).toggleClass("active");
141		});
142
143		$("#flyout li:has(ul)").children("a,span").append('<i class="fa fa-angle-down toggle-children">');
144		$("#flyout ul").addClass('flyout-children');
145
146		var flyoutChildren = $('.flyout-children');
147
148		$(".toggle-children").click(function(e) {
149				e.preventDefault();
150			if($(this).parent().next(flyoutChildren).is(":visible")){
151				$(this).parent().next(flyoutChildren).slideUp();
152			} else {
153				$(flyoutChildren).slideUp("slow");
154				$(this).parent().next(flyoutChildren).slideToggle();
155			}
156		});
157
158		// Owl Slider
159		if(typeof $.fn.owlCarousel !== "undefined"){
160			$("#owl-slider").owlCarousel();
161		}
162
163		// matchHeight
164		if(typeof $.fn.matchHeight !== "undefined"){
165			$('.equal').matchHeight({
166				//defaults
167				byRow: true,
168				property: 'height', // height or min-height
169				target: null,
170				remove: false
171			});
172		}
173
174		// bxSlider
175		if(typeof $.fn.bxSlider !== "undefined"){
176			$('.bxslider').bxSlider({
177				mode:'fade',
178				auto:($('.bxslider').children().length < 2) ? false : true,
179				pager: false
180			});
181		}
182
183		/*global jQuery */
184		/*!
185		* FlexVerticalCenter.js 1.0
186		*
187		* Copyright 2011, Paul Sprangers http://paulsprangers.com
188		* Released under the WTFPL license
189		* http://sam.zoy.org/wtfpl/
190		*
191		* Date: Fri Oct 28 19:12:00 2011 +0100
192		*/
193		$.fn.flexVerticalCenter = function( options ) {
194			var settings = $.extend({
195				cssAttribute:   'margin-top', // the attribute to apply the calculated value to
196				verticalOffset: 0,            // the number of pixels to offset the vertical alignment by
197				parentSelector: null,         // a selector representing the parent to vertically center this element within
198				debounceTimeout: 25,          // a default debounce timeout in milliseconds
199				deferTilWindowLoad: false     // if true, nothing will take effect until the $(window).load event
200			}, options || {});
201
202			return this.each(function(){
203				var $this   = $(this); // store the object
204				var debounce;
205
206				// recalculate the distance to the top of the element to keep it centered
207				var resizer = function () {
208
209					var parentHeight = (settings.parentSelector && $this.parents(settings.parentSelector).length) ?
210						$this.parents(settings.parentSelector).first().height() : $this.parent().height();
211
212					$this.css(
213						settings.cssAttribute, ( ( ( parentHeight - $this.height() ) / 2 ) + parseInt(settings.verticalOffset) )
214					);
215				};
216
217				// Call on resize. Opera debounces their resize by default.
218				$(window).resize(function () {
219					clearTimeout(debounce);
220					debounce = setTimeout(resizer, settings.debounceTimeout);
221				});
222
223				if (!settings.deferTilWindowLoad) {
224					// call it once, immediately.
225					resizer();
226				}
227
228				// Call again to set after window (frames, images, etc) loads.
229				$(window).load(function () {
230					resizer();
231				});
232
233			});
234
235		};
236		$('.v-align').flexVerticalCenter();
237
238
239		// Remove matchHeight on document center pages
240		if($('#RZdocument_center').length){
241			$('.aside,.entry').matchHeight({remove:true});
242
243			if(window.matchMedia("(min-width: 992px)").matches){
244				setInterval(function(){
245					if($('.post').outerHeight() + 300 > $('.entry').outerHeight()){
246						$('.aside').css('height',$('.entry').outerHeight() + 'px');
247					}
248				}, 200);
249			}
250		}
251
252        function minHeight(){
253            var windowHeight = $(window).outerHeight();
254            var bodyHeight = $('body').outerHeight();
255            if (bodyHeight <= windowHeight){
256                $('main').css('padding-bottom', windowHeight - bodyHeight);
257            } else {
258                $('main').css('padding-bottom','0');
259            }
260        }
261        minHeight();
262        $window.resize(minHeight);
263
264
265	}); // Ready
266
267})(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.