1jQuery(function($){ 2 3 if ( $.isFunction($.fn.select2) ) { 4 $('select').select2({ 5 minimumResultsForSearch: Infinity 6 }); 7 8 $('.zip-radius-wrapper select').select2({ 9 minimumResultsForSearch: Infinity, 10 width: '100%' 11 }); 12 13 $('.home-header-form select').select2({ 14 minimumResultsForSearch: Infinity, 15 width: '100%' 16 }); 17 18 $('.gform_wrapper select').select2({ 19 minimumResultsForSearch: Infinity, 20 width: '100%' 21 }); 22 23 $('.housing-resources-select-wrapper select').select2({ 24 minimumResultsForSearch: Infinity, 25 width: '100%' 26 }); 27 } 28 29 $(document).on('focus', '.select2', function (e) { 30 if (e.originalEvent) { 31 $(this).prev('select').select2('open'); 32 } 33 }); 34 35 // function autocomplete(inp, arr) { 36 function autocomplete(inp) { 37 /*the autocomplete function takes two arguments, 38 the text field element and an array of possible autocompleted values:*/ 39 var arr = []; 40 var currentFocus; 41 var secondSearchTimer; 42 var jsonRead; 43 44 arr.push(inp.value); 45 46 /*execute a function when someone writes in the text field:*/ 47 inp.addEventListener("input", function(e) { 48 var a, b, i, val = this.value; 49 50 /*close any already open lists of autocompleted values*/ 51 closeAllLists(); 52 if (!val || val.length < 3) { return false;} 53 currentFocus = -1; 54 /*create a DIV element that will contain the items (values):*/ 55 a = document.createElement("DIV"); 56 a.setAttribute("id", this.id + "autocomplete-list"); 57 a.setAttribute("class", "autocomplete-items"); 58 /*append the DIV element as a child of the autocomplete container:*/ 59 this.parentNode.appendChild(a); 60 /*for each item in the array...*/ 61 62 l = document.createElement("DIV"); 63 l.innerHTML = '<img style="margin-top: 5px; margin-bottom: -3px;" src="https://www.pa211.org/wp-content/themes/TwoOneOne/images/Search-Animation-Slim.gif" />'; 64 a.appendChild(l); 65 clearTimeout(secondSearchTimer); 66 secondSearchTimer = setTimeout(function() { 67 if (jsonRead) { 68 jsonRead.abort(); 69 } 70 71 if ($(inp).closest('form').attr('data-search-type') == 'provider-search') { 72 var strUrl = "https://referweb.net/pubres/api/Keyword/?ip={apikey:\"HVTJMTCW\",sn:\"" + val + "\",sid:\"Autocomplete\",kst:\"n\"}"; 73 // var strUrl = "https://navigateresources.solutions/pubres/api/Keyword/?ip={apikey:\"HVTJMTCW\",sn:\"" + val + "\",sid:\"Autocomplete\",kst:\"n\"}"; 74 // var strUrl = "https://www.navigateopen.info/pubres/api/Keyword/?ip={apikey:\"HVTJMTCW\",sn:\"" + val + "\",sid:\"Autocomplete\",kst:\"n\"}"; 75 } else { 76 var strUrl = "https://referweb.net/pubres/api/Keyword/?ip={apikey:\"HVTJMTCW\",sn:\"" + val + "\",sid:\"Autocomplete\",kst:\"k\"}"; 77 // var strUrl = "https://navigateresources.solutions/pubres/api/Keyword/?ip={apikey:\"HVTJMTCW\",sn:\"" + val + "\",sid:\"Autocomplete\",kst:\"k\"}"; 78 // var strUrl = "https://www.navigateopen.info/pubres/api/Keyword/?ip={apikey:\"HVTJMTCW\",sn:\"" + val + "\",sid:\"Autocomplete\",kst:\"n\"}"; 79 } 80 81 jsonRead = $.ajax({ 82 url: strUrl, 83 contentType: "application/json; charset=utf-8", 84 dataType: "json", 85 success: function (data) { 86 a.removeChild(l); 87 var keywordArray = []; 88 var exactArray = []; 89 var regexp = new RegExp('(' + val + ')','gi'); 90 if ((data != null) && (data.length)) { 91 $.each(data, function (index, value) { 92 // if (value.type == 's') { 93 // keywordArray.push(value.keyword); 94 95 // if ($.inArray(value.keyword, arr) < 0) { 96 if ($.inArray(value.keyword, keywordArray) < 0) { 97 // arr.push(value.keyword); 98 keywordArray.push(value.keyword); 99 } 100 // } 101 }); 102 // arr.sort(); 103 // arr.forEach(function(item,i){ 104 // if (arr[i].search(regexp) != -1) { 105 // arr.splice(i, 1); 106 // exactArray.push(item); 107 // } 108 // }); 109 110 // arr = exactArray.concat(arr); 111 arr = keywordArray; 112 113 for (i = 0; i < arr.length; i++) { 114 115 if (arr[i].search(regexp) != -1 || $.inArray(arr[i], keywordArray) >= 0) { 116 117 /*check if the item starts with the same letters as the text field value:*/ 118 // if (arr[i].substr(0, val.length).toUpperCase() == val.toUpperCase()) { 119 /*create a DIV element for each matching element:*/ 120 b = document.createElement("DIV"); 121 /*make the matching letters bold:*/ 122 // b.innerHTML = "<strong>" + arr[i].substr(0, val.length) + "</strong>"; 123 // b.innerHTML += arr[i].substr(val.length); 124 b.innerHTML = arr[i].replace(regexp, '<strong>$1</strong>'); 125 /*insert a input field that will hold the current array item's value:*/ 126 b.innerHTML += "<input type=\"hidden\" value=\"" + arr[i] + "\">"; 127 /*execute a function when someone clicks on the item value (DIV element):*/ 128 b.addEventListener("click", function(e) { 129 /*insert the value for the autocomplete text field:*/ 130 inp.value = this.getElementsByTagName("input")[0].value; 131 /*close the list of autocompleted values, 132 (or any other open lists of autocompleted values:*/ 133 closeAllLists(); 134 }); 135 a.appendChild(b); 136 } 137 } 138 } else { 139 b = document.createElement('DIV'); 140 b.innerHTML = 'No Matching Services'; 141 a.appendChild(b); 142 } 143 }, 144 error: function (xhr, status, error) { 145 //alert("An error has occurred in processing your request. Please resubmit.<br/> if the problem continues, please notify the RTM Designs support staff."); 146 } 147 }); 148 }, 200); 149 }); 150 /*execute a function presses a key on the keyboard:*/ 151 inp.addEventListener("keydown", function(e) { 152 var x = document.getElementById(this.id + "autocomplete-list"); 153 if (x) x = x.getElementsByTagName("div"); 154 if (e.keyCode == 40) { 155 /*If the arrow DOWN key is pressed, 156 increase the currentFocus variable:*/ 157 currentFocus++; 158 /*and and make the current item more visible:*/ 159 addActive(x); 160 } else if (e.keyCode == 38) { //up 161 /*If the arrow UP key is pressed, 162 decrease the currentFocus variable:*/ 163 currentFocus--; 164 /*and and make the current item more visible:*/ 165 addActive(x); 166 } else if (e.keyCode == 13) { 167 /*If the ENTER key is pressed, prevent the form from being submitted,*/ 168 e.preventDefault(); 169 if (currentFocus > -1) { 170 /*and simulate a click on the "active" item:*/ 171 if (x) x[currentFocus].click(); 172 } 173 } 174 }); 175 function addActive(x) { 176 /*a function to classify an item as "active":*/ 177 if (!x) return false;
178 /*start by removing the "active" class on all items:*/ 179 removeActive(x); 180 if (currentFocus >= x.length) currentFocus = 0; 181 if (currentFocus < 0) currentFocus = (x.length - 1); 182 /*add class "autocomplete-active":*/ 183 x[currentFocus].classList.add("autocomplete-active"); 184 } 185 function removeActive(x) { 186 /*a function to remove the "active" class from all autocomplete items:*/ 187 for (var i = 0; i < x.length; i++) { 188 x[i].classList.remove("autocomplete-active"); 189 } 190 } 191 function closeAllLists(elmnt) { 192 /*close all autocomplete lists in the document, 193 except the one passed as an argument:*/ 194 var x = document.getElementsByClassName("autocomplete-items"); 195 for (var i = 0; i < x.length; i++) { 196 if (elmnt != x[i] && elmnt != inp) { 197 x[i].parentNode.removeChild(x[i]); 198 } 199 } 200 201 if (jQuery.inArray($(inp).val(), arr) < 0 && !$(inp).is(':focus')) { 202 $(inp).val(''); 203 } 204 } 205 206 $(document).on("click", function (e) { 207 closeAllLists(e.target); 208 }); 209 210 $(inp).on('focusout', function(e) { 211 setTimeout(function() { 212 closeAllLists(); 213 if (jQuery.inArray($(inp).val(), arr) < 0 && !$(inp).is(':focus')) { 214 $(inp).val(''); 215 } 216 }, 300); 217 }); 218 219 $(inp).closest('form').on('submit', function(e) { 220 221 if (jQuery.inArray($(inp).val(), arr) < 0) { 222 $(inp).val(''); 223 return false; 224 } else {
225 if ($(this).valid()) { 226 if ($(this).parent().hasClass('home-header-form') || $(this).parent().attr('id') == 'get-help-search-form') { 227 if (!$(this).find('#city_zip').val() && !$('.city-zip-popup').hasClass('active')) { 228 $('.city-zip-popup').addClass('active'); 229 return false; 230 } else { 231 return true; 232 } 233 } else { 234 return true; 235 } 236 } else { 237 return false; 238 } 239 } 240 }); 241 } 242 243 /** 244 * initMap 245 * 246 * Renders a Google Map onto the selected jQuery element 247 * 248 * @date 22/10/19 249 * @since 5.8.6 250 * 251 * @param jQuery $el The jQuery element. 252 * @return object The map instance. 253 */ 254 function initMap( $el ) { 255 256 // Find marker elements within map. 257 var $markers = $el.find('.marker'); 258 259 // Create gerenic map. 260 var mapArgs = { 261 zoom : $el.data('zoom') || 16, 262 mapTypeId : google.maps.MapTypeId.ROADMAP 263 }; 264 var map = new google.maps.Map( $el[0], mapArgs ); 265 266 // Add markers. 267 map.markers = []; 268 $markers.each(function(){ 269 initMarker( $(this), map ); 270 }); 271 272 // Center map based on markers. 273 centerMap( map ); 274 275 // Return map instance. 276 return map; 277 } 278 279 /** 280 * initMarker 281 * 282 * Creates a marker for the given jQuery element and map. 283 * 284 * @date 22/10/19 285 * @since 5.8.6 286 * 287 * @param jQuery $el The jQuery element. 288 * @param object The map instance. 289 * @return object The marker instance. 290 */ 291 292 if ($('.acf-map').length > 0) { 293 var infowindow = new google.maps.InfoWindow({ 294 content : '' 295 }); 296 } 297 298 function initMarker( $marker, map ) { 299 300 // var 301 var latlng = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') ); 302 303 // create marker 304 var marker = new google.maps.Marker({ 305 position : latlng, 306 map : map 307 }); 308 309 var divID = $marker.attr('data-id'); 310 311 // add to array 312 map.markers.push( marker ); 313 314 // if marker contains HTML, add it to an infoWindow 315 if( $marker.html() ) { 316 // show info window when marker is clicked & close other markers 317 google.maps.event.addListener(marker, 'click', function() { 318 //swap content of that singular infowindow 319 infowindow.setContent($marker.html()); 320 infowindow.open(map, marker); 321 $('html,body').animate({ 322 scrollTop: $('.search-result-item[data-id="' + divID + '"]').position().top + $('#branding').outerHeight() - 30 323 }, 300); 324 }); 325 326 // close info window when map is clicked 327 google.maps.event.addListener(map, 'click', function(event) { 328 if (infowindow) { 329 infowindow.close(); } 330 }); 331 332 } 333 } 334 335 /** 336 * centerMap 337 * 338 * Centers the map showing all markers in view. 339 * 340 * @date 22/10/19 341 * @since 5.8.6 342 * 343 * @param object The map instance. 344 * @return void 345 */ 346 function centerMap( map ) { 347 348 // Create map boundaries from all map markers. 349 var bounds = new google.maps.LatLngBounds(); 350 map.markers.forEach(function( marker ){ 351 bounds.extend({ 352 lat: marker.position.lat(), 353 lng: marker.position.lng() 354 }); 355 }); 356 357 // Case: Single marker. 358 if( map.markers.length == 1 ){ 359 map.setCenter( bounds.getCenter() ); 360 361 // Case: Multiple markers. 362 } else{ 363 map.fitBounds( bounds ); 364 } 365 } 366 367 function setSameHeight(selector) { 368 var tallest = 0; 369 370 $(selector).each(function() { 371 if ($(this).css('height', 'auto').height() > tallest) { 372 tallest = $(this).height(); 373 } 374 }); 375 376 $(selector).each(function() { 377 $(this).height(tallest); 378 }); 379 } 380 381 function isScrolledIntoView(elem) 382 { 383 if ($(elem).length > 0) { 384 var docViewTop = $(window).scrollTop(); 385 var docViewBottom = docViewTop + $(window).height(); 386 387 var elemTop = $(elem).offset().top; 388 var elemBottom = elemTop + $(elem).outerHeight(); 389 390 return ((elemBottom <= docViewBottom - 20) || (elemTop <= docViewTop + (($(window).height() / 4) * 3))); 391 } else { 392 return false; 393 } 394 } 395 396 function slideHeight() { 397 if ($('.home-header-slideshow').length > 0) { 398 if ($('#home-header .home-header-content').outerHeight() > $(window).width() * 0.25) { 399 $('.home-header-slideshow .slide').height($('#home-header .home-header-content').outerHeight()); 400 } else { 401 $('.home-header-slideshow .slide').height($(window).width() * 0.25); 402 } 403 } 404 } 405 406 function closestEdge(x,y,w,h) { 407 var xDiff, yDiff, xSide, ySide; 408 409 if (w - x >= w/2) { 410 xSide = "left"; 411 xDiff = x; 412 } else if (w - x < w/2) { 413 xSide = "right"; 414 xDiff = w - x; 415 } 416 417 if (h - y >= h/2) { 418 ySide = "top"; 419 yDiff = y; 420 } else if (h - y < h/2) { 421 ySide = "bottom"; 422 yDiff = h - y; 423 } 424 425 var min = Math.min(xDiff, yDiff); 426 switch (min) { 427 case xDiff: 428 return xSide; 429 case yDiff: 430 return ySide; 431 } 432 } 433 434 function printableText(select, formSubmit) { 435 if ($(select).length > 0) { 436 $(formSubmit).data('submit-text', $(formSubmit).val()); 437 console.log($(formSubmit).data('submit-text')); 438 if ($(select).is(':checked')) { 439 $(formSubmit).val('Create Printable Form'); 440 } else { 441 $(formSubmit).val($(formSubmit).data('submit-text')); 442 } 443 } 444 } 445 446 function printableTextOnChange(select, formSubmit) { 447 if ($(select).length > 0) { 448 console.log($(formSubmit).data('submit-text')); 449 $(document).on('change', select, function() { 450 if ($(select).is(':checked')) { 451 $(formSubmit).data('submit-text', $(formSubmit).val()); 452 $(formSubmit).val('Create Printable Form'); 453 } else { 454 $(formSubmit).val($(formSubmit).data('submit-text')); 455 } 456 }); 457 } 458 } 459 460 function repeatFunctions() { 461 462 $('.accordion.active .accordion-content-wrapper').height($('.accordion.active .accordion-content').outerHeight()); 463 464 slideHeight(); 465 setSameHeight('.guided-search-wrapper .guided-search-item-image'); 466 setSameHeight('#home-supporters .supporter'); 467 setSameHeight('.get-help-item-image'); 468 // $('#search-map .acf-map').height($(window).height() - $('#branding').outerHeight()); 469 // $('#search-map .map').height($(window).height() - $('#branding').outerHeight()); 470 $('.search-wrapper').css('min-height', $(window).height() - $('#branding').outerHeight()); 471 if ($('#primary-nav').length > 0) { 472 $('.google-translate-dropdown-content-wrapper').css('max-height', $(window).height() - $('#primary-nav').outerHeight() - $('#primary-nav').position().top); 473 $('#primary-nav .sub-menu').css('max-height', $(window).height() - $('#primary-nav').outerHeight() - $('#primary-nav').position().top); 474 } 475 $('#primary-nav').css('max-height', $(window).height() - $('#branding').outerHeight()); 476 $('#main').css('padding-top', $('#branding').outerHeight()); 477 478 setSameHeight('.home-featured .featured-item-content-wrapper'); 479 } 480 481 function getAway() { 482 window.open("http://weather.com", '_blank'); 483 window.location.replace('https://news.google.com/'); 484 } 485 486 function readCookie(name) { 487 var c = document.cookie.split('; '), 488 cookies = {}, i, C; 489 490 for (i = c.length - 1; i >= 0; i--) { 491 C = c[i].split('='); 492 cookies[C[0]] = C[1]; 493 } 494 495 currentLang = cookies[name]; 496 497 if (currentLang !== undefined) { 498 currentLang = currentLang.split('/'); 499 if (currentLang[2] == 'es') { 500 currentLang[2] = 'es-MX'; 501 } 502 return currentLang[2]; 503 } 504 505 return false;
506 } 507 508 function setLinkLang(lang, oldUrl) { 509 if (oldUrl === undefined) { 510 return false; 511 } 512 513 if (lang) { 514 $('#search-chat a').attr('href', oldUrl + '&rev-lang=' + lang); 515 } else { 516 $('#search-chat a').attr('href', oldUrl); 517 } 518 } 519 520 $(document).ready(function() { 521 522 $("#panic").on("click", function(e) { 523 getAway(); 524 }); 525 526 $(document).keyup(function(e) { 527 if (e.keyCode == 27) { // escape key 528 getAway(); 529 } 530 }); 531 532 $(document).bind('gform_post_render', function(){ 533 $('select').select2({ 534 minimumResultsForSearch: Infinity, 535 width: '100%' 536 }); 537 538 printableText('#choice_9_16_1', '#gform_submit_button_9'); 539 }); 540 541 $('.mobile-menu-button').click(function() { 542 $('#primary-nav').toggleClass('active'); 543 }); 544 545 if ($('#search_term').length > 0) { 546 // autocomplete(document.getElementById("search_term")); 547 } 548 549 $('.home-header-slideshow').slick({ 550 slidesToShow: 1, 551 slidesToScroll: 1, 552 arrows: false, 553 dots: false, 554 autoplay: true, 555 autoplaySpeed: 10000, 556 fade: true, 557 pauseOnHover: false, 558 pauseOnFocus: false, 559 }); 560 561 $('.home-featured .featured-wrapper').slick({ 562 slidesToShow: 1, 563 slidesToScroll: 1, 564 arrows: true, 565 dots: false, 566 autoplay: true, 567 autoplaySpeed: 7000, 568 pauseOnHover: false, 569 pauseOnFocus: false, 570 fade: true 571 }); 572 573 $('#home-supporters .supporter-wrapper').slick({ 574 slidesToShow: 4, 575 slidesToScroll: 1, 576 arrows: false, 577 dots: false, 578 autoplay: true, 579 autoplaySpeed: 7000, 580 pauseOnHover: false, 581 pauseOnFocus: false, 582 responsive: [ 583 { 584 breakpoint: 1280, 585 settings: { 586 slidesToShow: 3, 587 } 588 }, 589 { 590 breakpoint: 1024, 591 settings: { 592 slidesToShow: 2, 593 } 594 }, 595 { 596 breakpoint: 800, 597 settings: { 598 slidesToShow: 3, 599 } 600 }, 601 { 602 breakpoint: 580, 603 settings: { 604 slidesToShow: 2, 605 } 606 }, 607 ] 608 }); 609 610 $('#primary-nav .menu-item-has-children > a').click(function(e) { 611 e.preventDefault(); 612 if ($(window).width() <= 700) { 613 if ($(this).parent().hasClass('active')) { 614 $(this).parent().find('.sub-menu').css('height', ''); 615 $(this).parent().removeClass('active'); 616 } else { 617 var navHeight = 0; 618 $('#primary-nav .menu-item-has-children.active').removeClass('active').find('.sub-menu').css('height', ''); 619 620 $(this).parent().find('.sub-menu li').each(function() { 621 navHeight = navHeight + $(this).outerHeight(); 622 }); 623 $(this).parent().addClass('active').find('.sub-menu').css('height', navHe
623ight); 624 } 625 } 626 }); 627 628 $('#primary-nav .menu-item-has-children').each(function() { 629 if ($(window).width() <= 700) { 630 631 if ($(this).hasClass('current-menu-parent') || $(this).hasClass('current-menu-ancestor')) { 632 var navHeight = 0; 633 $(this).find('.sub-menu li').each(function() { 634 navHeight = navHeight + $(this).outerHeight(); 635 }); 636 $(this).addClass('active').find('.sub-menu').css('height', navHeight); 637 } 638 } 639 }); 640 641 setLinkLang(readCookie('googtrans'), $('#search-chat a').data('original-url')); 642 643 setTimeout(function() { 644 setLinkLang(readCookie('googtrans'), $('#search-chat a').data('original-url')); 645 }, 2000); 646 647 $('.google-translate-icon').click(function() { 648 $('.google-translate-container').toggleClass('active'); 649 650 if ($(window).width() <= 700) { 651 if ($('.google-translate-container').hasClass('active')) { 652 $('.google-translate-dropdown').css('height', $('.google-translate-dropdown-content-wrapper').outerHeight()); 653 } else { 654 $('.google-translate-dropdown').css('height', ''); 655 } 656 } 657 }); 658 659 $('.google-translate-dropdown a').click(function() { 660 $('.google-translate-container').removeClass('active'); 661 $('.google-translate-dropdown').css('height', ''); 662 $('#primary-nav').removeClass('active'); 663 664 setTimeout(function() { 665 gtag('event', 'pageTranslated', { 666 'translationLanguage' : readCookie('googtrans') || document.getElementsByTagName('html')[0].getAttribute('lang'), 667 'translationService' : 'on-page google translate' 668 }); 669 670 setLinkLang(readCookie('googtrans'), $('#search-chat a').data('original-url')); 671 }, 1000); 672 }); 673 674 $(document).click(function(e) { 675 if (!$('.google-translate-container').is(e.target) && $('.google-translate-container').has(e.target).length === 0) { 676 $('.google-translate-container').removeClass('active'); 677 $('.google-translate-dropdown').css('height', ''); 678 } 679 }); 680 681 $('.accordion-title').click(function() { 682 if (!$(this).parent().hasClass('active')) { 683 684 $('.accordion.active').removeClass('active').find('.accordion-content-wrapper').animate({ 685 height: 0 686 }, 400); 687 688 $this = $(this); 689 $(this).parent().addClass('active').find('.accordion-content-wrapper').animate({ 690 height: $this.parent().find('.accordion-content').outerHeight() 691 }, 400, function() { 692 $('html, body').animate({ 693 scrollTop: $this.offset().top - $('#branding').outerHeight() - 50 694 }, 400); 695 }); 696 } else { 697 $('.accordion.active').removeClass('active').find('.accordion-content-wrapper').animate({ 698 height: 0 699 }, 400); 700 } 701 }); 702 703 $('.staff-resource-accordion-title').click(function() { 704 if (!$(this).parent().hasClass('active')) { 705 706 $(this).parent().parent().find('.staff-resource-accordion.active').each(function() { 707 $(this).children('.staff-resource-accordion-content-wrapper').height($(this).children('.staff-resource-accordion-content-wrapper').children('.staff-resource-accordion-content').outerHeight()); 708 $(this).removeClass('active').children('.staff-resource-accordion-content-wrapper').animate({ 709 height: 0 710 }, 400); 711 }); 712 713 $this = $(this); 714 $(this).parent().addClass('active'); 715 $(this).next().animate({ 716 height: $this.next().children('.staff-resource-accordion-content').outerHeight() 717 }, 400, function() { 718 $this.next().css('height', 'auto'); 719 }); 720 } else { 721 $(this).parent().find('.staff-resource-accordion.active').each(function() { 722 $(this).children('.staff-resource-accordion-content-wrapper').height($(this).children('.staff-resource-accordion-content-wrapper').children('.staff-resource-accordion-content').outerHeight()); 723 $(this).removeClass('active').children('.staff-resource-accordion-content-wrapper').animate({ 724 height: 0 725 }, 400); 726 }); 727 $(this).parent().removeClass('active'); 728 $(this).next().height($(this).next().children('.staff-resource-accordion-content').outerHeight()).animate({ 729 height: 0 730 }, 400); 731 } 732 }); 733 734 $('.collapsible-button').click(function() { 735 var buttonText = $(this).find('.collapsible-text').text(); 736 $this = $(this); 737 if ($(this).parent().hasClass('active')) { 738 buttonText = buttonText.replace("Hide", "Show"); 739 $(this).find('.collapsible-text').html(buttonText); 740 $(this).parent().removeClass('active').find('.collapsible-content-wrapper').height($(this).parent().find('.collapsible-content').outerHeight()).animate({ 741 height: 0 742 }, 400); 743 } else { 744 buttonText = buttonText.replace("Show", "Hide"); 745 $(this).find('.collapsible-text').html(buttonText); 746 $(this).parent().addClass('active').find('.collapsible-content-wrapper').animate({ 747 height: $this.parent().find('.collapsible-content').outerHeight() 748 }, 400, function() { 749 $this.parent().find('.collapsible-content-wrapper').css('height', 'auto'); 750 }); 751 } 752 }); 753 754 $('.acf-map').each(function(){ 755 var map = initMap( $(this) ); 756 }); 757 758 $('.help-subcategory-button').click(function() { 759 $(this).parent().find('.popup').addClass('active'); 760 }); 761 762 $('.help-subcategory > a').click(function(e) { 763 e.preventDefault(); 764 $(this).parent().find('.get-help-city-zip-popup').addClass('active'); 765 }); 766 767 $('.popup-close').click(function() { 768 $(this).closest('.popup.active').removeClass('active'); 769 }); 770 771 $('.print-share-email form').each(function() {
772 $(this).validate({ 773 rules: { 774 email: { 775 required: true, 776 email: true, 777 } 778 }, 779 messages: { 780 email: { 781 required: jQuery.validator.format("* This field is required."), 782 } 783 }, 784 success: "valid", 785 }); 786 }); 787 788 $('.search-form').each(function() { 789 $(this).validate({ 790 rules: { 791 search_term: { 792 required: true, 793 } 794 }, 795 messages: { 796 search_term: { 797 required: jQuery.validator.format("* Please select an option from the dropdown menu."), 798 } 799 }, 800 success: "valid", 801 }); 802 }); 803 804 $('.popup .city-zip-form').each(function() { 805 $(this).validate({ 806 rules: { 807 city_zip: { 808 required: true, 809 } 810 }, 811 messages: { 812 city_zip: { 813 required: jQuery.validator.format("* This field is required."), 814 } 815 }, 816 success: "valid" 817 }); 818 }); 819 820 $('.search-result-share-button').click(function() { 821 $(this).parent().find('.popup').addClass('active'); 822 }); 823 824 $('.print-share-tabs .tab').click(function() { 825 if (!$(this).hasClass('active')) { 826 var type = $(this).data('type'); 827 $(this).parent().find('.tab.active').removeClass('active'); 828 $(this).addClass('active'); 829 $(this).parent().parent().find('.print-share-content .active').removeClass('active'); 830 $(this).parent().parent().find('.print-share-content div[data-type="' + type + '"]').addClass('active'); 831 } 832 }); 833 834 $('.search-result-item-description a').each(function() { 835 $(this).attr('target', '_BLANK'); 836 }); 837 838 $('.search-result-item-eligibility a').each(function() { 839 $(this).attr('target', '_BLANK'); 840 }); 841 842 $('.donate-form .gf_left_three_quarters .gfield_radio input').each(function() { 843 if ($(this).prop('checked') == true) { 844 $(this).addClass('active'); 845 } 846 }); 847 848 $('.donate-form .gf_left_three_quarters .gfield_radio input').click(function() { 849 $('.donate-form .gf_right_one_quarter').find('input').val(''); 850 if ($(this).hasClass('active')) { 851 $(this).removeClass('active').prop('checked', false); 852 // $('.donate-form .gf_right_one_quarter').css('display', '').find('input').attr('disabled', false); 853 } else { 854 $('.donate-form .gf_left_three_quarters .gfield_radio input.active').removeClass('active'); 855 $(this).addClass('active'); 856 } 857 }); 858 859 $('.donate-form .gf_right_one_quarter input').on('keyup', function() { 860 $('.donate-form .gf_left_three_quarters .gfield_radio input.active').removeClass('active').prop('checked', false); 861 }); 862 863 printableTextOnChange('#choice_9_16_1', '#gform_submit_button_9'); 864 865 $(document).on('click', '.form-switch', function() { 866 var newSearchType = $(this).data('search-type'); 867 console.log(newSearchType); 868 869 if (newSearchType == 'provider-search') { 870 $(this).data('search-type', 'keyword-search'); 871 $('.search-form').attr('data-search-type', 'provider-search').prepend('<input id="provider_search" name="provider_search" type="hidden" value="true" />'); 872 $(this).html('Search by Service Type'); 873 $('.search-form #search_term').attr('placeholder', 'Search by Provider Name').val(''); 874 875 } else { 876 $(this).data('search-type', 'provider-search'); 877 $('.search-form #provider_search').remove(); 878 $('.search-form').attr('data-search-type', 'keyword-search'); 879 $(this).html('Search by Provider Name'); 880 $('.search-form #search_term').attr('placeholder', 'Search by Service Type').val(''); 881 } 882 }); 883 884 $('#home-form-button').click(function() { 885 $this = $(this); 886 if ($('#home-form').hasClass('hidden')) { 887 $this.addClass('active'); 888 $('#home-form').height(0).stop().animate({ 889 height: $('#home-form .form-content-wrapper').outerHeight() 890 }, 300, function() { 891 $('#home-form').css('height', '').css('overflow', 'visible').removeClass('hidden'); 892 }); 893 } else { 894 $this.removeClass('active'); 895 $('#home-form').css('overflow', 'hidden').height($('#home-form .form-content-wrapper').outerHeight()).stop().animate({ 896 height: 0 897 }, 300, function() { 898 $('#home-form').addClass('hidden'); 899 }); 900 } 901 }); 902 903 $('.housing-resources-select-wrapper select').val('*').trigger('select2.change'); 904 905 $('.housing-resources-select-wrapper select').change(function() { 906 var newCounty = $(this).val(); 907 908 $('.housing-resources-county-content.active').css('height', $('.housing-resources-county-content.active .housing-resources-county-inner-content').outerHeight()).animate({ 909 opacity: 0, 910 }, 300, function() { 911 $('.housing-resources-county-content.active').removeClass('active').css('opacity', '').css('height', ''); 912 }); 913 914 if (newCounty != '*') { 915 $this = $('.housing-resources-county-content[data-county="' + newCounty + '"]'); 916 917 $this.animate({ 918 opacity: 1, 919 }, 300, function() { 920 $this.addClass('active').css('opacity', '').css('height', ''); 921 }); 922 923 $('.housing-resources-county-content-wrapper').animate({ 924 height: $this.find('.housing-resources-county-inner-content').outerHeight() 925 }, 300); 926 927 $('html, body').animate({ 928 scrollTop: $this.offset().top - $('#branding').outerHeight() - 40 929 }, 300); 930 } else { 931 $('.housing-resources-county-content-wrapper').animate({ 932 height: 0 933 }, 300); 934 } 935 }); 936 937 repeatFunctions(); 938 }); 939 940 $(window).load(function() { 941 942 $('.article-wrapper .success-story.hidden').each(function() { 943 if (isScrolledIntoView($(this))) { 944 $(this).removeClass('hidden'); 945 } 946 }); 947 948 $('.secondary-content-block.hidden').each(function() { 949 if (isScrolledIntoView($(this))) { 950 $(this).removeClass('hidden'); 951 } 952 }); 953 954 $(".staff-wrapper .staff a").hover(function(e) { 955 var parentOffset = $(this).offset(); 956 var relX = e.pageX - parentOffset.left; 957 var relY = e.pageY - parentOffset.top; 958 959 var edge = closestEdge(relX, relY, $(this).width(), $(this).height()); 960 961 if (edge == "left") { 962 $(this).find('.staff-overlay').stop().css('top', 0).css('bottom', 0).css('left', '-100%').css('right', '100%').animate({ 963 right: 0, 964 left: 0 965 }, 300); 966 } 967 968 if (edge == "right") { 969 $(this).find('.staff-overlay').stop().css('top', 0).css('bottom', 0).css('right', '-100%').css('left', '100%').animate({ 970 left: 0, 971 right: 0 972 }, 300); 973 } 974 975 if (edge == "top") { 976 $(this).find('.staff-overlay').stop().css('left', 0).css('right', 0).css('top', "-100%").css('bottom', '100%').animate({ 977 bottom: 0, 978 top: 0 979 }, 300); 980 } 981 982 if (edge == "bottom") { 983 $(this).find('.staff-overlay').stop().css('left', 0).css('right', 0).css('bottom', "-100%").css('top', '100%').animate({ 984 top: 0, 985 bottom: 0 986 }, 300); 987 } 988 }, function(e) { 989 990 var parentOffset = $(this).offset(); 991 //or $(this).offset(); if you really just want the current element's offset 992 var relX = e.pageX - parentOffset.left; 993 var relY = e.pageY - parentOffset.top; 994 995 var edge = closestEdge(relX, relY, $(this).width(), $(this).height()); 996 997 if (edge == "left") { 998 $(this).find('.staff-overlay').stop().css('top', 0).css('bottom', 0).css('left', 0).css('right', 0).animate({ 999 right: '100%', 1000 left: '-100%' 1001 }, 300); 1002 } 1003 1004 if (edge == "right") { 1005 $(this).find('.staff-overlay').stop().css('top', 0).css('bottom', 0).css('right', 0).css('left', 0).animate({ 1006 left: '100%', 1007 right: '-100%' 1008 }, 300); 1009 } 1010 1011 if (edge == "top") { 1012 $(this).find('.staff-overlay').stop().css('left', 0).css('right', 0).css('top', 0).css('bottom', 0).animate({ 1013 bottom: '100%', 1014 top: '-100%' 1015 }, 300); 1016 } 1017 1018 if (edge == "bottom") { 1019 $(this).find('.staff-overlay').stop().css('left', 0).css('right', 0).css('bottom', 0).css('top', 0).animate({ 1020 top: '100%', 1021 bottom: '-100%' 1022 }, 300); 1023 } 1024 }); 1025 1026 repeatFunctions(); 1027 }); 1028 1029 $(window).resize(function() { 1030 1031 $('.article-wrapper .success-story.hidden').each(function() { 1032 if (isScrolledIntoView($(this))) { 1033 $(this).removeClass('hidden'); 1034 } 1035 }); 1036 1037 $('.secondary-content-block.hidden').each(function() { 1038 if (isScrolledIntoView($(this))) { 1039 $(this).removeClass('hidden'); 1040 } 1041 }); 1042 1043 $('#primary-nav .menu-item-has-children').each(function() { 1044 if ($(window).width() <= 700) { 1045 1046 if ($(this).hasClass('current-menu-parent') || $(this).hasClass('current-menu-ancestor')) { 1047 var navHeight = 0; 1048 $(this).find('.sub-menu li').each(function() { 1049 navHeight = navHeight + $(this).outerHeight(); 1050 }); 1051 $(this).addClass('active').find('.sub-menu').css('height', navHe
1051ight); 1052 } 1053 } 1054 }); 1055 1056 repeatFunctions(); 1057 }); 1058 1059 $(window).scroll(function() { 1060 1061 $('.article-wrapper .success-story.hidden').each(function() { 1062 if (isScrolledIntoView($(this))) { 1063 $(this).removeClass('hidden'); 1064 } 1065 }); 1066 1067 $('.secondary-content-block.hidden').each(function() { 1068 if (isScrolledIntoView($(this))) { 1069 $(this).removeClass('hidden'); 1070 } 1071 }); 1072 }); 1073});
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.