1$(document).ready(function(){ 2 //RWI-0547 [FX] 2023-12-21 View more & view less 3 $(document).on("click",".view-more-documents",function(e){ 4 $(this).closest('ul').find('li').each(function(index, value) { 5 if ($(this).hasClass("document-item")) { 6 // $(this).show(); 7 $(this).fadeIn( 200 ); 8 } else { 9 $(this).hide(); 10 } 11 // if (index === 3) { 12 // $(this).css( "opacity","" ); 13 // } 14 }); 15 $(".view-less-documents").closest("li").show(); 16 }); 17 $(document).on("click",".view-less-documents",function(e){ 18 $(this).closest('ul').find('li').each(function(index, value) { 19 if ($(this).hasClass("document-item") && index > 9) { 20 $(this).fadeOut( 200); 21 22 } else { 23 $(this).show(); 24 } 25 // if (index === 3) { 26 // $(this).css( "opacity","0.4" ); 27 // } 28 29 }); 30 $(".view-more-documents").closest("li").show(); 31 $(this).closest("li").hide(); 32 }); 33 // validation 34 if($("#subscribe-form").length) { 35 $("#subscribe-form").validate({ 36 rules:{ 37 subscriber_email: { 38 required: function(element) { 39 return $("#subscriber_phone").val() == ''; 40 } 41 }, 42 subscriber_phone: { 43 required: function(element) { 44 return ( $("#subscriber_carrier").val() != '' || !$("#subscriber_email").val() ); 45 } 46 }, 47 subscriber_carrier: { 48 required: function(element) { 49 return $("#subscriber_phone").val() != ''; 50 } 51 } 52 } 53 }); 54 } 55 if($("#unsubscribe-form").length) { 56 $("#unsubscribe-form").validate({ 57 rules:{ 58 subscriber_phone: { 59 required: function(element) { 60 return $("#subscriber_email").val() == ''; 61 } 62 }, 63 subscriber_email: { 64 required: function(element) { 65 return $("#subscriber_phone").val() == ''; 66 } 67 } 68 } 69 }); 70 } 71 if($("#contact-form").length) { 72 $("#contact-form").validate(); 73 } 74 if($("#meter-reading-form").length) { 75 $("#meter-reading-form").validate(); 76 } 77 78 // payment address box 79 if($("#payment-address").length) { 80 $("#payment-address").detach().prependTo(".entry-content:eq(0)"); 81 } 82 if($(".billpay-direct-link").length) { 83 $(".billpay-direct-link.small").detach().appendTo("#payment-address"); 84 } 85 86 if($("#google-map-wrapper").length) { 87 $("#google-map-wrapper").detach().prependTo(".entry-content:eq(0)"); 88 gmap_initialize_map(); 89 } 90 91 92 // ajax submit for subscribe form 93 $("#subscribe-form").on('submit', function(e){ 94 e.preventDefault(); 95 96 $.ajax({
97 type: "POST", 98 url: "subscribe.html", 99 data: $( "#subscribe-form" ).serialize(), 100 success: function(data){ 101 console.log('Subscribe - success. ', data); 102 $( "#modal_subscribe .modal-body" ).html( data ); 103 $( "#modal_subscribe .modal-footer" ).hide(); 104 }, 105 error: function(data){ 106 console.log('Subscribe - failure. ', data); 107 $( "#modal_subscribe .modal-message" ).html( data.responseText ? data.responseText : '<div class="alert alert-danger">Unknown error. Please try again.</div>' ); 108 } 109 }); 110 }); 111 112 // ajax submit for unsubscribe form 113 // RWI-0381 convert unsubscribe modal to page DC 12/02/21 114 // commented out modal support in case it's needed in the future 115 $("#unsubscribe-form").on('submit', function(e){ 116 e.preventDefault(); 117/* 118 $( "#modal_unsubscribe .modal-message" ).html(); 119 120 if( !$(this).find("[name='subscriber_email']").val() 121 && !$(this).find("[name='subscriber_phone']").val() ) { 122 123 $( "#modal_unsubscribe .modal-message" ).html( '<div class="alert alert-danger">Please enter either an email address or a phone number.</div>' ); 124 return false; 125 } 126 127*/ 128 if( $(this).find("[name='g-recaptcha-response']").length 129 && !$(this).find("[name='g-recaptcha-response']").val() ) { 130 131// $( "#modal_unsubscribe .modal-message" ).html( '<div class="alert alert-danger">Please check the box to prove you\'re a human.</div>' ); 132 $( "#form-message" ).html( '<div class="alert alert-danger">Please check the box to prove you\'re a human.</div>' ); 133 $("#form-message-row").removeClass("hidden"); 134 return false; 135 } 136 137 $.ajax({
138 type: "POST", 139 url: "unsubscribe.html", 140 data: $( "#unsubscribe-form" ).serialize(), 141 success: function(data){ 142// console.log(data); 143// $( "#modal_unsubscribe .modal-body" ).html( data ); 144 $( "#form-message" ).html( data ); 145 $( '#form-message-row').removeClass("hidden"); 146// $( "#modal_unsubscribe .modal-footer" ).hide(); 147 $( "#submit-button" ).hide(); 148 } 149 }); 150 }); 151 152 // set header text position 153 setTimeout(set_header_text_position,100); 154 setTimeout(set_header_text_position,1000); 155 $(window).on('resize',set_header_text_position); 156 157 // 2018-04-11 [BW,JJ] 158 // iOS 11 input elements in fixed modals 159 var bodyPosition; 160 $(document).on("show.bs.modal",function(){ 161 bodyPosition = $("body").css("position"); 162 $("body").css("position","fixed"); 163 $("body").css("width","100%"); 164 }); 165 $(document).on("hide.bs.modal",function(){ 166 $("body").css("position",bodyPosition); 167 $("body").css("width",''); 168 }); 169 170 // #RWI-0586 [BW,JJ] Add pausible carousels 171 var carouselElement = $('.carousel-pausible'); 172 carouselElement.each(function(){ 173 var $carousel = $(this); 174 175 $carousel.find('.btn-control').click(function() { 176 // carousel is playing, we will pause it 177 if ($(this).attr('data-c-play') == 'true') { 178 $(this).attr('data-c-play', 'false'); 179 $(this).find('i').toggleClass('fa-play fa-pause'); 180 $(this).find('.btn-control-text').text('Play Slideshow'); 181 $carousel.carousel('pause'); 182 } 183 // carousel is paused, we will play it 184 else { 185 $(this).attr('data-c-play', 'true'); 186 $(this).find('i').toggleClass('fa-play fa-pause'); 187 $(this).find('.btn-control-text').text('Pause Slideshow'); 188 $carousel.carousel('cycle'); 189 } 190 }); 191 }); 192 193 // Add aria-describedby to external links in specific areas 194 // Links with target="_blank" that don't already have aria-describedby 195 $( 196 '.eyebrow-content a[target="_blank"]:not([aria-describedby]), ' + 197 '.muni-info-text a[target="_blank"]:not([aria-describedby]), ' + 198 '#content > :not(.documents):not(.carousel) a[target="_blank"]:not([aria-describedby])' 199 ).attr('aria-describedby', 'new_window_description'); 200 201}); 202 203 204 205/** 206 * set_header_text_position function. 207 * 208 * In the "masthead" (header) area, if both the image and the text box are present, 209 * we check the image's width (relative to its CSS max-width). If the image is 210 * smaller than the max width, we bring the text over to the left, so that it is 211 * a consistent distance away from the logo. 212 * 213 * @since 2018-02-26 214 */ 215function set_header_text_position() { 216 var $mb = $(".masthead-brand"); 217 var $mb_img = $mb.find(".masthead-brand-image"); 218 var $mb_txt = $mb.find(".masthead-brand-text"); 219 console.log('set_header_text_position()'); 220 if( $mb_img.length && $mb_txt.length ) { 221 var img_max_width = parseInt( $mb_img.css('max-width') ); 222 223 console.log( 'found widths: '+ img_max_width + ', ' + $mb_img.outerWidth() ); 224 225 if( img_max_width && $mb_img.outerWidth() < img_max_width ) { 226 console.log('moving header text'); 227 $mb_txt.css('left', ($mb_img.outerWidth() + 15) + 'px'); 228 } 229 } 230} 231 232 233 234function stripEOLN(formElement) { 235 for(i=0; i<formElement.elements.length; i++) { 236 if(formElement.elements[i].type == 'textarea') { 237 formElement.elements[i].value = formElement.elements[i].value.replace(/[\r\n]/g," "); 238 } 239 } 240} 241 242 243 244//////////////////////////////////////////////////////////////////////////// 245//////////////////////////////////////////////////////////////////////////// 246 247 // Google Maps 248 var map_initialized = false; 249 var map = []; 250 var bounds = new google.maps.LatLngBounds (); 251 var geocoder; 252 var infoWindow = new google.maps.InfoWindow; 253 var maxZoom = 14; 254 var fitBounds = true; 255 256 function setWindowContent(index) { 257 return item_bubble_array[index]; 258 } 259 260 // clear arrays 261 var item_ids_array = []; 262 var item_loc_array = []; 263 var item_lat_array = []; 264 var item_lon_array = []; 265 var item_bubble_array = []; 266 267 268function gmap_initialize_map() { 269 var myOptions = { 270 zoom: 7, 271 mapTypeId: google.maps.MapTypeId.HYBRID 272 }; 273 map['MS'] = new google.maps.Map(document.getElementById("google-map"),myOptions); 274 275 $("body").append("<div id='gms' style='display:none'><strong>Array of size "+item_loc_array.length+"</strong></div>"); 276 for(i=0;i<item_loc_array.length;i++) { 277 if(item_lat_array[i] && item_lon_array[i]) { 278 showLatLon(item_lat_array[i],item_lon_array[i],'MS',true,fitBounds,i); 279 $("#gms").append("<span id='debug-latlon-"+item_ids_array[i]+"'>"+" (#"+i+"):"+item_lat_array[i]+" * "+item_lat_array[i]+"</span>"); 280 } else { 281 codeAddress(item_loc_array[i],'MS',true,fitBounds,i); 282 $("#gms").append("<span id='debug-addr-"+item_ids_array[i]+"'>"+" (#"+i+"):"+item_loc_array[i]+"</span>"); 283 } 284 } 285 286 // RWI-0505 [WB] commented out below and moved here 287 if(fitBounds) { 288 google.maps.event.addListenerOnce(map['MS'], 'zoom_changed', function () { 289 if (map['MS'].getZoom() > maxZoom) map['MS'].setZoom(maxZoom); 290 }); 291 } 292 293} 294 295 296 /* 297 * The functions "codeAddress" and "showLatLon" work on the same map. 298 * "showLatLon" is used if there is a lat/lon pair present; 299 * "codeAddress" is used if not (to geocode an address). 300 * note that Google allows only a maximum (10) geocode requests per page. 301 */ 302 303 304 function codeAddress(query,mapIndex,showMarker,fitBounds,markerIndex) { 305 306 if(typeof showMarker=='undefined') showMarker = true; 307 if(typeof fitBounds=='undefined') fitBounds = false; 308 if(typeof icontype=='undefined') icontype = 'member'; 309 var address = query; 310 geocoder = new google.maps.Geocoder(); 311 geocoder.geocode( { 'address': address}, function(results, status) { 312 if (status == google.maps.GeocoderStatus.OK) { 313 314 bounds.extend (results[0].geometry.location); 315 if(fitBounds) { 316 map[mapIndex].fitBounds (bounds); 317 /*google.maps.event.addListenerOnce(map[mapIndex], 'zoom_changed', function() { 318 if (map[mapIndex].getZoom() > maxZoom) map[mapIndex].setZoom(maxZoom); 319 });*/ 320 } else { 321 map[mapIndex].setCenter(results[0].geometry.location); 322 } 323 324 if(showMarker) { 325 var marker = new google.maps.Marker({ 326 map: map[mapIndex], 327 position: results[0].geometry.location 328 }); 329 google.maps.event.addListener(marker, 'click', function() { 330 infoWindow.setContent(setWindowContent(markerIndex)); 331 infoWindow.open(map[mapIndex],marker); 332 }); 333 } 334 335 $("#gms").append("<em id='debug-worked-"+markerIndex+"'>
335"+markerIndex+" worked: "+address+"</em>"); 336 } else { 337 $("#gms").append("<em id='debug-broke-"+markerIndex+"'>"+markerIndex+" unsuccessful ("+status+"): "+address+"</em>"); 338// alert("Geocode was not successful for the following reason: " + status); 339 } 340 }); 341 } 342 343 function showLatLon(qlat,qlon,mapIndex,showMarker,fitBounds,markerIndex) { 344 345 if(typeof showMarker=='undefined') showMarker = true; 346 if(typeof fitBounds=='undefined') fitBounds = false; 347 if(typeof icontype=='undefined') icontype = 'member'; 348 349 var myLatLng = new google.maps.LatLng(qlat, qlon); 350 351 352 bounds.extend (myLatLng); 353 if(fitBounds) { 354 map[mapIndex].fitBounds (bounds); 355 /*google.maps.event.addListenerOnce(map[mapIndex], 'zoom_changed', function() { 356 if (map[mapIndex].getZoom() > maxZoom) map[mapIndex].setZoom(maxZoom); 357 });*/ 358 } else { 359 map[mapIndex].setCenter(myLatLng); 360 } 361 362 if(showMarker) { 363 var marker = new google.maps.Marker({ 364 map: map[mapIndex], 365 position: myLatLng 366 }); 367 google.maps.event.addListener(marker, 'click', function() { 368 infoWindow.setContent(setWindowContent(markerIndex)); 369 infoWindow.open(map[mapIndex],marker); 370 }); 371 } 372 373 $("#gms").append("<em id='debug-latlon-"+markerIndex+"'>"+markerIndex+" worked: "+qlat+"/"+qlon+"</em>"); 374 375 }
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.