Gay contractors
"; $('body').append(cssHideLogo); } else { var cssHideLogo = ""; $('body').append(cssHideLogo); } } function showPhone(elemente) { $(elemente).addClass("hide").siblings().removeClass("hide"); } function initGMap() { // Check if the map object is available. const mapIconView = document.querySelector('.mapView'); if (mapIconView) { mapIconView.removeEventListener('click', initGMap); mapIconView.addEventListener('click', initGMap); } const mapDivID = document.getElementById('map-canvas'); if (typeof google?.maps === 'object') { // Retrieve the map source. setJsMapSR(mapDivID); } else { // If the map isn't loaded, wait. googleMapOnFormClick().then(() => setJsMapSR(mapDivID)); } } window.addEventListener('load', () => { // Acquire the lazy map div, either by data-id or ID. const lazyMapDiv = document.querySelector('div[data-id]'); const mapDivID = document.getElementById('map-canvas'); // Allow time for map loading before initialization. setTimeout(() => { // Ensure the map div exists. if (lazyMapDiv) { lazyMapDiv.id = lazyMapDiv.dataset.id; let mapIconView = document.querySelector('.mapView'); if (mapIconView) { mapIconView.addEventListener('click', initGMap); } } else if (mapDivID) { // Initialize the map. initGMap(); } }, 500); }); "; $('body').append(cssHideLogo); } else { var cssHideLogo = ""; $('body').append(cssHideLogo); } if (geocodeVisitorsSetting === 1 && geocodingMethod === "IP") { populateSearchFields(); } if ($('.googleSuggest').val() === "") { populateSearchFields(); } const geocodeVisitorsSetting = '1'; const geocodingMethod = 'HTML5'; //Advanced setting "geocode_visitor_default" (set to 1) may override location values with formatted Google address data. let vlon = ''; let vlat = ''; } function switchPlaceID(placeId, urlGET, formActionUrl) { const request = { placeId, fields: ['address_components', 'adr_address', 'formatted_address', 'geometry', 'icon', 'name', 'place_id', 'plus_code', 'type'], }; const service = new google.maps.places.PlacesService(document.createElement('div')); service.getDetails(request, (place, status) => { if (status === google.maps.places.PlacesServiceStatus.OK) { const dataArray = [place]; parseInfoToSearch(dataArray, urlGET, formActionUrl); } else { console.error('Place details retrieval failed:', status); } }); } function parseInfoToSearch(results, urlGET, formActionUrl) { const urlSearchParams = new URLSearchParams(urlGET); const parameters = {}; const addressComponentsArray = []; if (results.length > 1 && urlSearchParams.get("location_value")?.toLowerCase() === "nebraska") { //Swap results if there are two results and location value is Nebraska. let tempResult = results[0]; results[0] = results[1]; results[1] = tempResult; } //Filter out results that aren't addresses or significant locations. results.forEach((result, index) => { if (['natural_feature', 'airport', 'point_of_interest', 'establishment', 'park'].includes(result.types[0])) { results.splice(index, 1); } }); const adComLength = results[0]?.address_components?.length; if (results[0]?.place_id === 'ChIJmQrivHKsQjQR4MIK3c41aj8') { switchPlaceID('ChIJi73bYWusQjQRgqQGXK260bw', urlGET, formActionUrl); return; } sessionStorage.setItem("google_result", JSON.stringify(results)); //Find postal code and city types. const foundPostalType = results[0]?.types?.find(type => postalTypes.includes(type)); const foundCityType = results[0]?.types?.find(type => cityTypes.includes(type)); //Collect address components. results[0]?.address_components?.forEach(component => { if (component.types[0] === "country") { parameters.country_sn = component.short_name; } if (component.types[0] === "administrative_area_level_1") { parameters.adm_lvl_1_sn = component.short_name; parameters.stateSearchLN = component.long_name; } //Get additional relevant address components. if (component.types[0] === "administrative_area_level_2") { parameters.county_sn = component.short_name; } if (cityTypes.includes(component.types[0]) && (foundCityType || foundPostalType)) { parameters.city = component.long_name; } if (['postal_code', 'postal_code_prefix'].includes(component.types[0])) { parameters.postal_code = component.long_name; } }); parameters.location_type = results[0]?.types[0]; if (parameters.adm_lvl_1_sn) { parameters.stateSearch = parameters.adm_lvl_1_sn; } if (parameters.country_sn === "GB") { delete parameters.adm_lvl_1_sn; } //Handle bounds or viewport data. if (results[0]?.geometry?.bounds || results[0]?.geometry?.viewport) { const bounds = results[0]?.geometry?.bounds || results[0]?.geometry?.viewport; parameters.swlat = bounds.getSouthWest().lat(); parameters.nelat = bounds.getNorthEast().lat(); parameters.swlng = bounds.getSouthWest().lng(); parameters.nelng = bounds.getNorthEast().lng(); } else { parameters.fsearch = "radius"; } //Set location coordinates and formatted address. const locationCenter = results[0]?.geometry?.location; parameters.lat = locationCenter?.lat(); parameters.lng = locationCenter?.lng(); parameters.faddress = results[0]?.formatted_address; parameters.place_id = results[0]?.place_id; urlGET += "&" + $.param(parameters); // Construct the redirection URL. const urlPath = formActionUrl; window.location.href = `${urlPath}?${urlGET}`; } // Function to populate search fields using geolocation. function populateSearchFields() { const prePopulateLocationSetting = '1'; const geolocationMethod = 'HTML5'; // Use pre-populated location data. if (prePopulateLocationSetting === 1 && (geolocationMethod === "HTML5" || geolocationMethod === "IP") && vlat !== '' && vlon !== '' && vlat !== undefined && vlon !== undefined && vlat !== 0 && vlon !== 0) { const visitorLatLng = new google.maps.LatLng(parseFloat(vlat), parseFloat(vlon)); const visitorGeocoder = new google.maps.Geocoder(); const formattedAddress = []; // Format specific address components. const preFormattedStructure = { "locality": "long_name", "administrative_area_level_2": "long_name", "administrative_area_level_1": "long_name", "country": "long_name" }; visitorGeocoder.geocode({'latLng': visitorLatLng}, (results, status) => { if (status == google.maps.GeocoderStatus.OK) { $.each(preFormattedStructure, function (findex, fvalue) { $.each(results[0].address_components, function (rindex, rvalue) { if (rvalue.types[0] == findex) { formattedAddress.push(rvalue.long_name); } }); }); $('.googleSuggest').each(function () { if ($(this).val() === '') { if (formattedAddress.length > 0) { $(this).val(formattedAddress.join(', ')); clearContent($(this)); } } }); } else { $('.googleSuggest').each(function () { $(this).val(''); }); } }); } } function showError(error) { switch (error.code) { case error.PERMISSION_DENIED: $('.fill_location.clicked').popover({ content: 'Location access denied by browser settings.', container: 'body' }); $('.fill_location.clicked').popover('toggle'); setTimeout(() => { $('.fill_location.clicked').popover('hide'); $('.fill_location.clicked').removeClass('clicked'); }, 2000); break; case error.POSITION_UNAVAILABLE: break; case error.TIMEOUT: break; case error.UNKNOWN_ERROR: break; } } if (navigator.geolocation) { if ($(".googleSuggest")[0]) { $(document).on('click', '.fill_location', function getCXPosition() { $(this).addClass('clicked'); let startPos; navigator.geolocation.getCurrentPosition((position) => { startPos = position; vlat = startPos.coords.latitude; vlon = startPos.coords.longitude; $.get("/api/data/html/get/data_widgets/widget_name", { "vlat": vlat, "vlon": vlon, "name": "Website - Save Coordinates Session" }).done((data) => {}); populateSearchFields(); }, showError); }); } } else { console.log('Geolocation unavailable.'); } function getUrlParameter(sParam) { const sPageURL = window.location.search.substring(1); const sURLVariables = sPageURL.split('&'); for (let i = 0; i < sURLVariables.length; i++) { const sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return decodeURIComponent(sParameterName[1]); } } }