1jQuery(document).ready(function ($) { 2 3 $(document).on('click', '.cspm_search_in_ext_data', function () { 4 5 var address = $('.pac-target-input').val(); 6 var geocoder = new google.maps.Geocoder(); 7 8 var search_latitude = ''; 9 var search_longitude = ''; 10 geocoder.geocode({'address': address}, function(results, status) { 11 12 search_latitude = ''; 13 search_longitude = ''; 14 if (status === 'OK') { 15 search_latitude = results[0].geometry.location.lat(); 16 search_longitude = results[0].geometry.location.lng(); 17 $.cookie('search_location', search_latitude+'_'+search_longitude, { expires: 7, path: '/' }); 18 19 } else { 20 console.log('Geocode was not successful for the following reason: ' + status); 21 } 22 }); 23 24 $.cookie('search_address', address, { expires: 7, path: '/' }); 25 26 }); 27 28 jQuery('#search-address').on('input', function() { 29 initAutocomplete(); 30 }); 31 32 33 34 function initAutocomplete() { 35 var country = 'au'; 36 37 if( CareparkMapObj.current_site_id == 6 ) { 38 country = 'nz'; 39 } 40 41 const input = document.getElementById('search-address'); 42 43 44 const autocomplete = new google.maps.places.Autocomplete(input,{ 45 componentRestrictions: { 46 country: country 47 }, // Limit suggestions to Australia 48 }); 49 50 google.maps.event.addListener(autocomplete, 'place_changed', function() { 51 // $.each(autocomplete.gm_bindings_.manualSessions, function(index, element) { 52 // selectedAddress = element.js.formattedPrediction || element.js.formattedSuggestion; 53 // }); 54 55 var selectedAddress = $('#search-address').val(); 56 57 localStorage.setItem('searched_address', selectedAddress); 58 59 const redirectURL = `find-a-care-park`; 60 window.location.href = redirectURL; 61 }); 62 } 63}); 64 65 66 67 68// /* Below code is for home page search location trigger to find car park page */ 69document.addEventListener("DOMContentLoaded", function() { 70 71 72 // Parse parameters from the URL 73 //const params = new URLSearchParams(window.location.search); 74 const label = localStorage.getItem('searched_address'); 75 console.log(label); 76 77 // Check if the 'label' parameter is set 78 if (label) { 79 80 jQuery(".cspm_search_input_text_container").css("width","100%"); 81 jQuery(".cspm_geotarget_search_btn").remove(); 82 83 // Set values in the search bar 84 jQuery('.cspm_search_input_text_container input').val(label).promise().done(function() { 85 setTimeout(function() { 86 if( CareparkMapObj.current_site_id == 6 ) { 87 jQuery(".cspm_submit_search_form_map2976").click(); 88 } 89 else{ 90 jQuery(".cspm_submit_search_form_map4706").click(); 91 } 92 }, 3000); 93 94 setTimeout(function() { 95 localStorage.removeItem('searched_address'); 96 }, 3000); 97 }); 98 } 99});
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.