PageSourceSearch

https://couleecitywa.org/js/public_mi.js?date=20261008224901

js couleecitywa.org collected 2026-10-09 02:49:09 UTC 5,660 bytes, 186 lines download raw bytes

1$(document).ready(function(){
2	// RWI-0682 [WB] documents expand/collapse
3	$(document).on('click', '.nested-folder', function(e) {
4		e.preventDefault();
5		const $contents = $(this).next('div');
6		const $icon = $(this).find('span');
7		if($contents.is(':visible')) {
8			$contents.hide();
9			$icon.removeClass('fa-folder-open').addClass('fa-folder-closed');
10		} else {
11			$contents.show();
12			$icon.removeClass('fa-folder-closed').addClass('fa-folder-open');
13		}
14	});
15
16	// validation
17	if($("#subscribe-form").length) {
18		$("#subscribe-form").validate({
19			rules:{
20				subscriber_email: {
21					required: function(element) {
22						return $("#subscriber_phone").val() == '';
23					}
24				},
25				subscriber_phone: {
26					required: function(element) {
27						return ( !$("#subscriber_email").val() );
28					}
29				}
30			}
31		});
32	}
33	if($("#unsubscribe-form").length) {
34		$("#unsubscribe-form").validate({
35			rules:{
36				subscriber_phone2: {
37					required: function(element) {
38						return $("#subscriber_email").val() == '';
39					}
40				},
41				subscriber_email: {
42					required: function(element) {
43						return $("#subscriber_phone2").val() == '';
44					}
45				}
46			}
47		});
48	}
49
50	// hide alerts for this user (for this session)
51	$("#site_alerts .close").on('click', function(){
52		console.log("closing alerts...");
53		$.ajax({
54			type: "POST",
55			url: '/dismiss_alert.html',
56			data: 'dismiss=1',
57			success: function scs(data){
58				console.log("dismissed alert, ", data);
59			}
60		});
61	});
62
63	// show automatic alert
64	if($("#modal_alert_automatic").length) {
65		var alertModal = new bootstrap.Modal(document.getElementById('modal_alert_automatic'));
66		alertModal.show();
67		$("#modal_alert_automatic").on("hide.bs.modal",function(e) {
68			// dismiss and store in session
69			console.log("hiding automatic modal.");
70			$.ajax({
71				url:   "/dismiss_alert.html"
72				,type: "POST"
73				,data: {
74					alert_id: $(this).attr("data-alert-id")
75				}
76			});
77		});
78	}
79
80	// payment address box
81	if($("#payment-address").length) {
82		$("#payment-address").detach().insertAfter("#site_main h1:eq(0)");
83	}
84	if($(".billpay-direct-link").length) {
85		$(".billpay-direct-link.small").detach().appendTo("#payment-address");
86	}
87
88	if($("#google-map").length) {
89		$("#google-map").detach().prependTo(".entry-content:eq(0)");
90	}
91
92
93	///////////////////////////////////////////////////////////////////////
94	// primary nav links are triggers only
95	$('#navprimary ul.level1 > li > a.parentlink').on('click', function() {
96    return false;
97	});
98	// show/hide responsive nav dropdown
99	$('#navprimary a.navlabel').on('click', function() {
100    var href = $.attr(this, 'href');
101		if ($(href).hasClass('closed')) {
102			$('#navprimary .level1').removeClass('open').addClass('closed');
103			$(href).removeClass('closed').addClass('open');
104		}	else {
105			$(href).removeClass('open').addClass('closed');
106		}
107    return false;
108	});
109
110	// make video responsive (constrained to YouTube for now)
111	$('#site_main iframe').each(function() {
112		var iframeHeight = $(this).attr('height');
113		var iframeWidth = $(this).attr('width');
114		var iframeSrc = $(this).attr('src');
115		if(iframeHeight && iframeWidth && iframeSrc.includes('youtube')) {
116			var paddingTop = (iframeHeight / iframeWidth) * 100;
117			$(this).wrap('<div class="responsive-video" style="padding-top:' + paddingTop + '%;"></div>');
118		}
119	});
120
121	// #RWI-0586 [BW,JJ] Add pausible carousels
122	var carouselElement = $('.carousel-pausible');
123	carouselElement.each(function(){
124		var $carousel = $(this);
125
126		$carousel.find('.btn-control').click(function() {
127			// carousel is playing, we will pause it
128			if ($(this).attr('data-c-play') == 'true') {
129				$(this).attr('data-c-play', 'false');
130				$(this).find('i').toggleClass('fa-play fa-pause');
131				$(this).find('.btn-control-text').text('Play Slideshow');
132				$carousel.carousel('pause');
133			}
134			// carousel is paused, we will play it
135			else {
136				$(this).attr('data-c-play', 'true');
137				$(this).find('i').toggleClass('fa-play fa-pause');
138				$(this).find('.btn-control-text').text('Pause Slideshow');
139				$carousel.carousel('cycle');
140			}
141		});
142	});
143
144	// [WB] set nav search input focus
145    const navSearch = document.querySelector('.dropdown-search #nav_search')
146    const searchTerms = document.querySelector('.dropdown-search #search_terms')
147    if(navSearch && searchTerms) {
148        navSearch.addEventListener('shown.bs.dropdown', function () {
149            searchTerms.focus()
150        })
151    }
152
153    // Add aria-label to external links in specific areas
154    // Links with target="_blank" that don't already have aria-describedby
155    $(
156        '.eyebrow-notice a[target="_blank"]:not([aria-describedby]), ' +
157        '.muni-info-text a[target="_blank"]:not([aria-describedby]), ' +
158        '#site_main > :not(.document-folders):not(.document-links):not(.carousel):not(#home-slideshow):not(.container #home_intro .carousel) a[target="_blank"]:not([aria-describedby])'
159    ).attr('aria-describedby', 'new_window_description');
160	
161});
162
163// PROMO HEIGHT
164$(window).on("load",function() {
165	var promo_height = [];
166	if ($('.carousel-inner').html()) {
167		$('.carousel-item.promo').each(function() {
168			promo_height.push($(this).outerHeight(true));
169		});
170		var biggest = Math.max(...promo_height);
171		// console.log(promo_height);
172		$('.carousel-inner-promo').height(biggest);
173		// console.log(biggest);
174	}
175	else { console.log('no html'); }
176	$('.invisible').removeClass('invisible');
177});
178
179
180function stripEOLN(formElement) {
181   for(i=0; i<formElement.elements.length; i++) {
182      if(formElement.elements[i].type == 'textarea') {
183         formElement.elements[i].value = formElement.elements[i].value.replace(/[\r\n]/g," ");
184      }
185   }
186}

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.