Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,16 @@ $(function() {
var hash = window.location.hash;
var type = null;
var url_location = null;

var startloc = berlin;
var startzoom = 13;
var startloc;
var startzoom;

if (localStorage.getItem("latlng") !== null && localStorage.getItem("zoom") !== null) {
startloc = JSON.parse(localStorage.latlng);
startzoom = localStorage.zoom;
} else {
startloc = berlin;
startzoom = 13;
}

if (hash.length > 0) {
hash = hash.replace('#', '');
Expand Down Expand Up @@ -335,6 +342,9 @@ $(function() {
mapDragged = true;
}

window.addEventListener('unload', function(event) {
cacheLocation();
});

initMap(startloc, startzoom);

Expand Down Expand Up @@ -388,6 +398,11 @@ function locateMe() {
mapDragged = false;
}

function cacheLocation() {
localStorage.setItem('zoom', map.getZoom());
localStorage.setItem('latlng', JSON.stringify(map.getCenter()));
}

function showInfo() {
$("#info_overlay").css("visibility", "visible");
}
Expand Down