From 75fc4e290d8375ad4418cd58bfe88afbdf42d802 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Tue, 1 Jul 2014 18:40:20 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BB=D1=83=D1=87=D0=B0=D0=B9=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=82=D0=BE=D1=87=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/views/indexTemplate.php | 2 ++ public/js/map.js | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ground/views/indexTemplate.php b/ground/views/indexTemplate.php index 54c736a..ca65481 100644 --- a/ground/views/indexTemplate.php +++ b/ground/views/indexTemplate.php @@ -27,6 +27,8 @@ Как пользоваться
Легенда
Список точек
+
+ Случайная точка

Карты

diff --git a/public/js/map.js b/public/js/map.js index 70847b7..9fe7a5f 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -121,7 +121,20 @@ function initPoints() if (getURLParameter('point') != 'null') { - showInfo(getURLParameter('point')); + if (getURLParameter('point') == 'random') + { + roundIndex = Math.floor(Math.random()*points.length); + runner = 0; + for(var key in points) + { + if(runner++ >= roundIndex) + return showInfo(key); + } + } + else + { + showInfo(getURLParameter('point')); + } } else if (getURLParameter('route') != 'null') { loadRouteJSON(getURLParameter('route'));