.js files are now uglified

This commit is contained in:
Jonny Barnes 2016-09-26 13:19:52 +01:00
parent d73062f3cf
commit f0c8e8fbb9
11 changed files with 18 additions and 438 deletions

View file

@ -1,44 +1,2 @@
/* global L */
var button = document.querySelector('#locate');
if (button.addEventListener) {
button.addEventListener('click', getLocation);
} else {
button.attachEvent('onclick', getLocation);
}
function getLocation() {
if ('geolocation' in navigator) {
navigator.geolocation.getCurrentPosition(function(position) {
updateForm(position.coords.latitude, position.coords.longitude);
addMap(position.coords.latitude, position.coords.longitude);
});
}
}
function updateForm(latitude, longitude) {
var inputLatitude = document.querySelector('#latitude');
var inputLongitude = document.querySelector('#longitude');
inputLatitude.value = latitude;
inputLongitude.value = longitude;
}
function addMap(latitude, longitude) {
var form = document.querySelector('form');
var div = document.createElement('div');
div.setAttribute('id', 'map');
form.appendChild(div);
L.mapbox.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w';
var map = L.mapbox.map('map', 'jonnybarnes.gnoihnim')
.setView([latitude, longitude], 15)
.addLayer(L.mapbox.tileLayer('jonnybarnes.gnoihnim', {
detectRetina: true
}));
var marker = L.marker([latitude, longitude], {
draggable: true
}).addTo(map);
marker.on('dragend', function () {
var markerLocation = marker.getLatLng();
updateForm(markerLocation.lat, markerLocation.lng);
});
}
function getLocation(){"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(function(t){updateForm(t.coords.latitude,t.coords.longitude),addMap(t.coords.latitude,t.coords.longitude)})}function updateForm(t,e){var o=document.querySelector("#latitude"),n=document.querySelector("#longitude");o.value=t,n.value=e}function addMap(t,e){var o=document.querySelector("form"),n=document.createElement("div");n.setAttribute("id","map"),o.appendChild(n),L.mapbox.accessToken="pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiVlpndW1EYyJ9.aP9fxAqLKh7lj0LpFh5k1w";var a=L.mapbox.map("map","jonnybarnes.gnoihnim").setView([t,e],15).addLayer(L.mapbox.tileLayer("jonnybarnes.gnoihnim",{detectRetina:!0})),i=L.marker([t,e],{draggable:!0}).addTo(a);i.on("dragend",function(){var t=i.getLatLng();updateForm(t.lat,t.lng)})}var button=document.querySelector("#locate");button.addEventListener?button.addEventListener("click",getLocation):button.attachEvent("onclick",getLocation);
//# sourceMappingURL=maps/newplace.js.map