HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/topswtwmobile.komma.pro/wwwroot/js/temp/googleAutocomplete.js
(function($)
{
    /*
    // This example displays an address form, using the autocomplete feature
    // of the Google Places API to help users fill in the information.

    var placeSearch, autocomplete, geolocation, bounds;

    var componentForm = {
        //street_number: 'short_name',
        //route: 'long_name',
        locality: 'long_name',
        //administrative_area_level_1: 'short_name',
        country: 'long_name',
        postal_code: 'short_name'
    };

    function initializeAutocomplete() {
        // Create the autocomplete object, restricting the search
        // to geographical location types.

        autocomplete = new google.maps.places.Autocomplete(
            (document.getElementById('route')),
            {
                types: ['address'],
                componentRestrictions: {country: 'nl'}
            });

        // When the user selects an address from the dropdown,
        // populate the address fields in the form.
        google.maps.event.addListener(autocomplete, 'place_changed', function() {
            fillInAddress();
        });

    }

    function fillInAddress() {
        // Get the place details from the autocomplete object.
        var place = autocomplete.getPlace();
        console.log(autocomplete.bounds);
        for (var component in componentForm) {
            document.getElementById(component).value = '';
            document.getElementById(component).disabled = false;
        }

        // Get each component of the address from the place details
        // and fill the corresponding field on the form.
        for (var i = 0; i < place.address_components.length; i++) {
            var addressType = place.address_components[i].types[0];
            if (componentForm[addressType]) {
                var val = place.address_components[i][componentForm[addressType]];
                document.getElementById(addressType).value = val;
            }
        }
    }


    //================================================================================


    function codeAddress(address) {
        //var address = document.getElementById('locality').value;

        geocoder = new google.maps.Geocoder();
        geocoder.geocode( { 'address': address}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {

                console.log(results);
                geolocation = results[0].geometry.location;
                autocomplete.setBounds(results[0].geometry.bounds);

                //map.setCenter(results[0].geometry.location);
            } else {
                alert('Geocode was not successful for the following reason: ' + status);
            }
        });
    }


    //================================================================================


    codeAddress('5591 DD, NL');

    $('#locality').blur(function(){
       codeAddress($('#locality').val());
    });

    initializeAutocomplete();
     */
}
)(jQuery);