From 55faabb7095185540410a97e4359ee17bb7eb458 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sat, 26 Apr 2014 20:07:06 +0400 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D0=BE=D0=BB=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=D0=BA=20=D1=82=D0=BE=D1=87=D0=BA=D0=B8=20=D1=82=D0=B5?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D1=8C=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D1=8D=D1=82=D1=83=20=D1=82=D0=BE=D1=87=D0=BA?= =?UTF-8?q?=D1=83.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/main.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/public/js/main.js b/public/js/main.js index d233500..8315c1f 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -9,6 +9,16 @@ var points = Array(); var im; var search; +// -------------------------------- Libs --------------------------------------- + +function getURLParameter(name) { + return decodeURI( + (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] + ); +} + +// ----------------------------------------------------------------------------- + function init() { myMap = new ymaps.Map("map", { center: [ymaps.geolocation.latitude, ymaps.geolocation.longitude], @@ -85,6 +95,11 @@ function getPoints() for(var k in data) { myMap.geoObjects.add(constructPoint(data[k])); } + + if (getURLParameter('point') != null) + { + showInfo(getURLParameter('point')); + } } }); @@ -100,7 +115,9 @@ function showInfo(id) url: "/json/point/id/" + id, success: function(data) { description = '
' + + '' + '

' + data.name + '

' + + '
' + '' + '
' points[id].properties.set('balloonContent', description); + + point = getURLParameter('point'); + if (point != null && id == point) + { + myMap.setCenter(points[point].geometry.getCoordinates()); + points[point].balloon.open(); + } } }); }