500 meter

HTML

<!DOCTYPE html>
<html>
  <head>
    <title>500 méter</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="custom.css">
    <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBIwzALxUPNbatRBj3Xi1Uhp0fFzwWNBkE&callback=initAutocomplete&libraries=places&v=weekly" defer></script>
    <script src="custom.js"></script>
  </head>
  <body>
    <input
      id="pac-input"
      class="controls"
      type="text"
      placeholder="Cím kereső"
    />
    <div id="map"></div>
  </body>
</html>

CSS

#map {
  height: 100%;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

#description {
  font-family: Roboto;
  font-size: 15px;
  font-weight: 300;
}

.pac-card {
  margin: 10px 10px 0 0;
  border-radius: 2px 0 0 2px;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  outline: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  background-color: #fff;
  font-family: Roboto;
}

#pac-container {
  padding-bottom: 12px;
  margin-right: 12px;
}

.pac-controls {
  display: inline-block;
  padding: 5px 11px;
}

.pac-controls label {
  font-family: Roboto;
  font-size: 13px;
  font-weight: 300;
}

#pac-input {
  background-color: #fff;
  font-family: Roboto;
  font-size: 15px;
  font-weight: 300;
  margin-top: 10px;
  margin-left: 12px;
  padding: 0 11px 0 13px;
  text-overflow: ellipsis;
  width: 400px;
  line-height: 2em;
}

#pac-input:focus {
  border-color: #4d90fe;
}

#title {
  color: #fff;
  background-color: #4d90fe;
  font-size: 25px;
  font-weight: 500;
  padding: 6px 12px;
}

#target {
  width: 345px;
}

JavaScript

let map;
let shape = {};

function initAutocomplete() {
  map = new google.maps.Map(document.getElementById("map"), {
    center: { lat: 47.516992, lng: 19.082046 },
    zoom: 15,
    mapTypeId: "roadmap",
  });
  
  map.addListener("click", (event) => {
    addShape(event.latLng, true);
  });
  
  const input = document.getElementById("pac-input");
  const searchBox = new google.maps.places.SearchBox(input);
  
  map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
  
  map.addListener("bounds_changed", () => {
    searchBox.setBounds(map.getBounds());
  });
  
  searchBox.addListener("places_changed", () => {
    const places = searchBox.getPlaces();

    if (places.length == 0) {
      return;
    };
    
    let place = places[0];
    if (!place.geometry) {
      return;
    };
    let center;
    if (place.geometry.viewport) {
      center = place.geometry.viewport.getCenter();
    } else {
      center = place.geometry.location;
    };
    
    addShape(center, false);
  });

  document.onfullscreenchange = function (event) {
    let target = event.target;
    let pacContainerElements = document.getElementsByClassName("pac-container");
    if (pacContainerElements.length > 0) {
      let pacContainer = pacContainerElements[0];
      if (pacContainer.parentElement === target) {
        document.getElementsByTagName("body")[0].appendChild(pacContainer);
      } else {
        target.appendChild(pacContainer);
      };
      pacContainer.style.marginTop = "10px";
    };
  };

  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(
      (position) => {
        map.panTo({ lat: position.coords.latitude, lng: position.coords.longitude });
      },
      null,
      {
        maximumAge: 0,
        timeout: 10000,
        enableHighAccuracy: true
      }
    );
  }
};

function removeShape() {
  if (shape) {
    if (shape.circle) shape.circle.setMap(null);
    if (shape.marker) shape.marker.setMap(null);
  }
}

function...