diff --git a/public/js/main.js b/public/js/main.js index 0cbe297..6cfe031 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -50,6 +50,12 @@ function init() { } }); + myMap.events.add('boundschange', function(e){ + if (!myMap.balloon.isOpen()) { + history.pushState({}, document.title, "/?lat="+e.get('newCenter')[0]+"&lng="+e.get('newCenter')[1]+"&zoom="+e.get('newZoom')); + } + }); + im = new ymaps.Placemark( [ymaps.geolocation.latitude, ymaps.geolocation.longitude], { @@ -103,7 +109,10 @@ function getPoints() if (getURLParameter('point') != 'null') { showInfo(getURLParameter('point')); - } + } else if ( (getURLParameter('lat') != 'null')&&(getURLParameter('lng') != 'null')&&(getURLParameter('zoom') != 'null') ) + { + myMap.setCenter([getURLParameter('lat'), getURLParameter('lng')], getURLParameter('zoom')); + } } });