From 57a93f1c1f0b7ec6e110450a775e8d9d4d09b49c Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sat, 3 May 2014 18:57:03 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BE=D1=80=D0=B4=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=D1=82=20=D0=B2=20=D1=83=D1=80=D0=BB=D0=B5,=20=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B0=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=D1=88=D0=B5=D0=B4=D1=88=D0=B8=D1=85=20=D0=BA=D0=BE=D0=BE=D1=80?= =?UTF-8?q?=D0=B4=D0=B8=D0=BD=D0=B0=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/main.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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')); + } } });