PageSourceSearch

https://www.cincinnati-oh.gov/themes/cityofcincinnati-bootstrap4/js/core/base.js

js cincinnati-oh.gov collected 2026-09-24 08:43:06 UTC 7,693 bytes, 250 lines download raw bytes

1// Placeholder toggle jQuery extension
2$.fn.togglePlaceholder = function() {
3    return this.each(function() {
4        $(this)
5        .data("holder", $(this).attr("placeholder"))
6        .focusin(function(){
7            $(this).attr('placeholder','');
8        })
9        .focusout(function(){
10            $(this).attr('placeholder',$(this).data('holder'));
11        });
12    });
13};
14
15$().ready(function() {
16
17	// Placeholder toggle
18	$("[placeholder]").togglePlaceholder();
19
20	$(".tabs .nav-tabs > li > a").click(function(e) {
21		e.preventDefault();
22		$($(this).val('href')).tab('show');
23	});
24	
25	$("header .search-toggle a").click(function(e) {
26		e.preventDefault();
27		$(this).blur();
28		
29		$("body").toggleClass("search-bar-open");
30		$(".searchWrap").toggleClass("show");
31	});
32
33	// Mobile navigation toggle
34	$(".visible-xs .navbar-toggle").on("click", function(e) {
35		$("body").toggleClass("mobile-menu-open");
36	});
37
38	// Mobile dropdown menu toggle
39	$(".submenu-toggle").on("click", function(e) {
40		e.preventDefault();
41		$(this).parent().toggleClass("open");
42		$(this).find("i").toggleClass("fa-angle-down").toggleClass("fa-angle-up");
43	});
44
45	// Mobile submenu toggle
46	$(".mobile-submenu .menu-title > a").on("click", function(e) {
47		e.preventDefault();
48		$(this).parent().parent().toggleClass("show");
49	});
50
51	// Quick Tabs
52	$("#quick-tabs nav ul.nav > li > a").click(function(e) {
53		if ($(this).hasClass("link")) {
54			return true;
55		} else {
56			e.preventDefault();
57	
58			if ($("#quick-tabs").is(".expanded")) {
59			    if ($(this).parent().is(".active")) {
60			    	$("body").removeClass("quick-links-open");
61			    	// close panel
62			    	$("#quick-tabs.expanded").removeClass("expanded");
63			    } else {
64			    	// previous active tab
65			    	$("#quick-tabs ul > li.active").removeClass("active");
66			    	// current active tab
67					$(this).parent().addClass("active");
68	
69					// previous active tab panel
70			    	$("#quick-tabs .quick-tab-content .quick-tab.active").removeClass("active");
71			    	// current active tab panel
72			    	$($(this).val('href')[0].hash).addClass("active");
73			    }
74	
75			} else {
76				$("body").addClass("quick-links-open");
77				// previous active tab
78			    $("#quick-tabs ul > li.active").removeClass("active");
79			    // current active tab
80				$(this).parent().addClass("active");
81	
82				// previous active tab panel
83				$("#quick-tabs .quick-tab-content .quick-tab.active").removeClass("active");
84			    // current active tab panel
85			    $($(this).val('href')[0].hash).addClass("active");
86	
87			    // open panel
88			    $("#quick-tabs").addClass("expanded");
89			}
90		}
91	});
92
93	// Quick Tabs overlay	
94	$("#qt-overlay").on("click", function(e) {
95		e.preventDefault();
96		$("body").removeClass("quick-links-open");
97		// close panel
98		$("#quick-tabs.expanded").removeClass("expanded");
99	});
100
101	// Back to Top
102	$(".back-to-top").on("click", function(e) {
103		e.preventDefault();
104		$("body,html").animate({
105			scrollTop: 0
106		}, 800);
107		return false;
108	});
109	
110	// Setup responsive tables in all body content - with selective exclusion
111	$(".primary-content table").addClass("table").not(".nonResponsive").wrap("<div class='table-responsive'>");
112	
113	//Enable swiping...
114	$(".carousel-inner").swipe({
115		//Generic swipe handler for all directions
116		swipeLeft: function(event, direction, distance, duration, fingerCount) {
117			$(this).parent().carousel('next'); 
118		},
119		swipeRight: function() {
120			$(this).parent().carousel('prev'); 
121		},
122		//Default is 75px, set to 0 for demo so any distance triggers swipe
123		threshold: 0
124	});
125	
126	/*	Optional: bootstrap's navbar doesn't stick the parent on dropdown hover.
127		this fixes that.
128	*/
129	$(".hidden-xs .navItem > .dropdown-menu").hover(function() {
130		$(this).parent().toggleClass("open");
131	});
132
133	// Home Hero text toggle
134	$("#homeHeroTextToggle").on("click", function(e) {
135		e.preventDefault();
136		$(".home-hero .home-hero-text").fadeToggle('fast');
137		$(".home-hero .flex-control-nav").fadeToggle('fast');
138	});
139	
140	$("ul[class^='linkList']").not(".linkList-wrapper ul").not(".right ul").before($("<div></div>").addClass("linkList-wrapper"));
141	
142	/********************
143		Responsively handle columnized linkLists
144	*********************/
145	/* Default to 1 col everywhere on mobile (this is mostly to clear any previous columns as required) */
146	$.breakpoint({
147		condition: function () {
148			return matchMedia('(max-width: 767px)').matches;
149		},
150		enter: function (p) {
151			$(".linkList-wrapper").empty();
152			$("ul[class^='linkList']").not(".linkList-wrapper ul").css({ display: "block" });
153		}
154	});
155
156	/* 1 col on tablet, 2 cols on desktop */
157	$.breakpoint({
158		condition: function () {
159			return matchMedia('(min-width: 992px)').matches;
160		},
161		enter: function (p) {
162			$((p ? p + " " : "") + "ul.linkList-sm1-md2").not(".linkList-wrapper ul").not(".right ul").each(function() {
163				$(this).css({ display: "none" });
164				$(this).prev(".linkList-wrapper").html(
165					$(this).clone().css({ display: "block" })
166				).columnize({ columns: 2, buildOnce: true, lastNeverTallest: true });
167			});
168		}
169	});
170
171	/* 2 cols on tablet, 2 cols on desktop */
172	$.breakpoint({
173		condition: function () {
174			return matchMedia('(min-width: 768px)').matches;
175		},
176		enter: function (p) {
177			$((p ? p + " " : "") + "ul.linkList-sm2-md2").not(".linkList-wrapper ul").not(".right ul").each(function() {
178				$(this).css({ display: "none" });
179				$(this).prev(".linkList-wrapper").html(
180					$(this).clone().css({ display: "block" })
181				).columnize({ columns: 2, buildOnce: true, lastNeverTallest: true });
182			});
183		}
184	});
185
186	/* 2 cols on tablet, 3 cols on desktop */
187	$.breakpoint({
188		condition: function () {
189			return matchMedia('(min-width: 768px) and (max-width: 991px)').matches;
190		},
191		enter: function (p) {
192			$((p ? p + " " : "") + "ul.linkList-sm2-md3").not(".linkList-wrapper ul").not(".right ul").each(function() {
193				$(this).css({ display: "none" });
194				$(this).prev(".linkList-wrapper").html(
195					$(this).clone().css({ display: "block" })
196				).columnize({ columns: 2, buildOnce: true, lastNeverTallest: true });
197			});
198		}
199	});
200	$.breakpoint({
201		condition: function () {
202			return matchMedia('(min-width: 992px)').matches;
203		},
204		enter: function (p) {
205			$((p ? p + " " : "") + "ul.linkList-sm2-md3").not(".linkList-wrapper ul").not(".right ul").each(function() {
206				$(this).css({ display: "none" });
207				$(this).prev(".linkList-wrapper").html(
208					$(this).clone().css({ display: "block" })
209				).columnize({ columns: 3, buildOnce: true, lastNeverTallest: true });
210			});
211		}
212	});
213
214	/* 3 cols on tablet, 3 cols on desktop */
215	$.breakpoint({
216		condition: function () {
217			return matchMedia('(min-width: 768px) and (max-width: 991px)').matches;
218		},
219		enter: function (p) {
220			$((p ? p + " " : "") + "ul.linkList-sm3-md3").not(".linkList-wrapper ul").not(".right ul").each(function() {
221				$(this).css({ display: "none" });
222				$(this).prev(".linkList-wrapper").html(
223					$(this).clone().css({ display: "block" })
224				).columnize({ columns: 3, buildOnce: true, lastNeverTallest: true });
225			});
226		}
227	});
228	$.breakpoint({
229		condition: function () {
230			return matchMedia('(min-width: 992px)').matches;
231		},
232		enter: function (p) {
233			$((p ? p + " " : "") + "ul.linkList-sm3-md3").not(".linkList-wrapper ul").not(".right ul").each(function() {
234				$(this).css({ display: "none" });
235				$(this).prev(".linkList-wrapper").html(
236					$(this).clone().css({ display: "block" })
237				).columnize({ columns: 3, buildOnce: true, lastNeverTallest: true });
238			});
239		}
240	});
241	
242	$(".accordion").on("shown.bs.collapse", function(args) {
243		$($.breakpoint.breakpoints).each(function() {
244			if ($(this)[0].condition()) {
245				$(this)[0].enter("#" + args.target.id);
246			}
247		});
248	});
249
250});

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.