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 gmap_initialize_map(); 91 } 92 93 94 /////////////////////////////////////////////////////////////////////// 95 // primary nav links are triggers only 96 $('#navprimary ul.level1 > li > a.parentlink').on('click', function() { 97 return false; 98 }); 99 // show/hide responsive nav dropdown 100 $('#navprimary a.navlabel').on('click', function() { 101 var href = $.attr(this, 'href'); 102 if ($(href).hasClass('closed')) { 103 $('#navprimary .level1').removeClass('open').addClass('closed'); 104 $(href).removeClass('closed').addClass('open'); 105 } else { 106 $(href).removeClass('open').addClass('closed'); 107 } 108 return false; 109 }); 110 111 // google map 112 if($("#location-map").length) { 113 gmap_initialize_map("location-map"); 114 } 115 116 // make video responsive (constrained to YouTube for now) 117 $('#site_main iframe').each(function() { 118 var iframeHeight = $(this).attr('height'); 119 var iframeWidth = $(this).attr('width'); 120 var iframeSrc = $(this).attr('src'); 121 if(iframeHeight && iframeWidth && iframeSrc.includes('youtube')) { 122 var paddingTop = (iframeHeight / iframeWidth) * 100; 123 $(this).wrap('<div class="responsive-video" style="padding-top:' + paddingTop + '%;"></div>'); 124 } 125 }); 126 127 // #RWI-0586 [BW,JJ] Add pausible carousels 128 var carouselElement = $('.carousel-pausible'); 129 carouselElement.each(function(){ 130 var $carousel = $(this); 131 132 $carousel.find('.btn-control').click(function() { 133 // carousel is playing, we will pause it 134 if ($(this).attr('data-c-play') == 'true') { 135 $(this).attr('data-c-play', 'false'); 136 $(this).find('i').toggleClass('fa-play fa-pause'); 137 $(this).find('.btn-control-text').text('Play Slideshow'); 138 $carousel.carousel('pause'); 139 } 140 // carousel is paused, we will play it 141 else { 142 $(this).attr('data-c-play', 'true'); 143 $(this).find('i').toggleClass('fa-play fa-pause'); 144 $(this).find('.btn-control-text').text('Pause Slideshow'); 145 $carousel.carousel('cycle'); 146 } 147 }); 148 }); 149 150 // [WB] set nav search input focus 151 const navSearch = document.querySelector('.dropdown-search #nav_search') 152 const searchTerms = document.querySelector('.dropdown-search #search_terms') 153 if(navSearch && searchTerms) { 154 navSearch.addEventListener('shown.bs.dropdown', function () { 155 searchTerms.focus() 156 }) 157 } 158 159 // Add aria-label to external links in specific areas 160 // Links with target="_blank" that don't already have aria-describedby 161 $( 162 '.eyebrow-notice a[target="_blank"]:not([aria-describedby]), ' + 163 '.muni-info-text a[target="_blank"]:not([aria-describedby]), ' + 164 '#site_main > :not(.document-folders):not(.document-links):not(.carousel):not(#home-slideshow):not(.container #home_intro .carousel) a[target="_blank"]:not([aria-describedby])' 165 ).attr('aria-describedby', 'new_window_description'); 166 167}); 168 169// PROMO HEIGHT
170$(window).on("load",function() { 171 var promo_height = []; 172 if ($('.carousel-inner').html()) { 173 $('.carousel-item.promo').each(function() { 174 promo_height.push($(this).outerHeight(true)); 175 }); 176 var biggest = Math.max(...promo_height); 177 // console.log(promo_height); 178 $('.carousel-inner-promo').height(biggest); 179 // console.log(biggest); 180 } 181 else { console.log('no html'); } 182 $('.invisible').removeClass('invisible'); 183}); 184 185 186function stripEOLN(formElement) { 187 for(i=0; i<formElement.elements.length; i++) { 188 if(formElement.elements[i].type == 'textarea') { 189 formElement.elements[i].value = formElement.elements[i].value.replace(/[\r\n]/g," "); 190 } 191 } 192} 193 194 195 196//////////////////////////////////////////////////////////////////////////// 197//////////////////////////////////////////////////////////////////////////// 198 199 // Google Maps 200 var map_initialized = false; 201 var map = []; 202 var bounds = new google.maps.LatLngBounds (); 203 var geocoder; 204 var infoWindow = new google.maps.InfoWindow; 205 var maxZoom = 14; 206 var fitBounds = true; 207 208 function setWindowContent(index) { 209 return item_bubble_array[index]; 210 } 211 212 /* 213 // clear arrays 214 var item_ids_array = []; 215 var item_loc_array = []; 216 var item_lat_array = []; 217 var item_lon_array = []; 218 var item_bubble_array = []; 219 */ 220 221 222function gmap_initialize_map(element_id) { 223 var myOptions = { 224 zoom: 7, 225 mapTypeId: google.maps.MapTypeId.HYBRID, 226 mapTypeControl: true, 227 zoomControl: true 228 }; 229 map['MS'] = new google.maps.Map(document.getElementById(element_id),myOptions); 230 231 $("body").append("<div id='gms' style='display:none'><strong>Array of size "+item_loc_array.length+"</strong></div>"); 232 for(i=0;i<item_loc_array.length;i++) { 233 if(!isNaN(parseFloat(item_lat_array[i])) && !isNaN(parseFloat(item_lon_array[i]))) { 234 showLatLon(item_lat_array[i],item_lon_array[i],'MS',true,fitBounds,i); 235 $("#gms").append("<span id='debug-latlon-"+item_ids_array[i]+"'>"+" (#"+i+"):"+item_lat_array[i]+" * "+item_lat_array[i]+"</span>"); 236 } else { 237 codeAddress(item_loc_array[i],'MS',true,fitBounds,i); 238 $("#gms").append("<span id='debug-addr-"+item_ids_array[i]+"'>"+" (#"+i+"):"+item_loc_array[i]+"</span>"); 239 } 240 } 241 242 // RWI-0505 [WB] commented out below and moved here 243 if(fitBounds) { 244 google.maps.event.addListenerOnce(map['MS'], 'zoom_changed', function () { 245 if (map['MS'].getZoom() > maxZoom) map['MS'].setZoom(maxZoom); 246 }); 247 } 248} 249 250 /* 251 * The functions "codeAddress" and "showLatLon" work on the same map. 252 * "showLatLon" is used if there is a lat/lon pair present; 253 * "codeAddress" is used if not (to geocode an address). 254 * note that Google allows only a maximum (10) geocode requests per page. 255 */ 256 257 function codeAddress(query,mapIndex,showMarker,fitBounds,markerIndex) { 258 259 if(typeof showMarker=='undefined') showMarker = true; 260 if(typeof fitBounds=='undefined') fitBounds = false; 261 if(typeof icontype=='undefined') icontype = 'member'; 262 var address = query; 263 geocoder = new google.maps.Geocoder(); 264 geocoder.geocode( { 'address': address}, function(results, status) { 265 if (status == google.maps.GeocoderStatus.OK) { 266 267 bounds.extend (results[0].geometry.location); 268 if(fitBounds) { 269 map[mapIndex].fitBounds (bounds); 270 /*google.maps.event.addListenerOnce(map[mapIndex], 'zoom_changed', function() { 271 if (map[mapIndex].getZoom() > maxZoom) map[mapIndex].setZoom(maxZoom); 272 });*/ 273 } else { 274 map[mapIndex].setCenter(results[0].geometry.location); 275 } 276 277 if(showMarker) { 278 var marker = new google.maps.Marker({ 279 map: map[mapIndex], 280 position: results[0].geometry.location 281 }); 282 google.maps.event.addListener(marker, 'click', function() { 283 infoWindow.setContent(setWindowContent(markerIndex)); 284 infoWindow.open(map[mapIndex],marker); 285 }); 286 } 287 288 $("#gms").append("<em id='debug-worked-"+markerIndex+"'>"+markerIndex+" worked: "+address+"</em>"); 289 } else { 290 $("#gms").append("<em id='debug-broke-"+markerIndex+"'>"+markerIndex+" unsuccessful ("+status+"): "+address+"</em>"); 291// alert("Geocode was not successful for the following reason: " + status); 292 } 293 }); 294 } 295 296 function showLatLon(qlat,qlon,mapIndex,showMarker,fitBounds,markerIndex) { 297 298 if(typeof showMarker=='undefined') showMarker = true; 299 if(typeof fitBounds=='undefined') fitBounds = false;
300 if(typeof icontype=='undefined') icontype = 'member'; 301 302 var myLatLng = new google.maps.LatLng(qlat, qlon); 303 304 305 bounds.extend (myLatLng); 306 if(fitBounds) { 307 map[mapIndex].fitBounds (bounds); 308 /*google.maps.event.addListenerOnce(map[mapIndex], 'zoom_changed', function() { 309 if (map[mapIndex].getZoom() > maxZoom) map[mapIndex].setZoom(maxZoom); 310 });*/ 311 } else { 312 map[mapIndex].setCenter(myLatLng); 313 } 314 315 if(showMarker) { 316 var marker = new google.maps.Marker({ 317 map: map[mapIndex], 318 position: myLatLng 319 }); 320 google.maps.event.addListener(marker, 'click', function() { 321 infoWindow.setContent(setWindowContent(markerIndex)); 322 infoWindow.open(map[mapIndex],marker); 323 }); 324 } 325 326 $("#gms").append("<em id='debug-latlon-"+markerIndex+"'>"+markerIndex+" worked: "+qlat+"/"+qlon+"</em>"); 327 328 } 329
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.