From 6bcab9fb4c9c37c96e6339c58a4c188ae427a6f9 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sat, 9 Aug 2014 19:45:57 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BA=D0=B0=D0=B7=20=D1=81=D0=BB?= =?UTF-8?q?=D1=83=D1=87=D0=B0=D0=B9=D0=BD=D0=BE=D0=B9=20=D1=82=D0=BE=D1=87?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=B1=D0=B5=D0=B7=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/views/indexTemplate.php | 2 +- public/js/map.js | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ground/views/indexTemplate.php b/ground/views/indexTemplate.php index 71f5ebe..5a34d3f 100644 --- a/ground/views/indexTemplate.php +++ b/ground/views/indexTemplate.php @@ -28,7 +28,7 @@ Легенда
Список точек

- Случайная точка + Случайная точка


Группа ВКонтакте diff --git a/public/js/map.js b/public/js/map.js index 3b355ff..b80e63f 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -133,13 +133,7 @@ function initPoints() { if (getURLParameter('point') == 'random') { - roundIndex = Math.floor(Math.random()*points.length); - runner = 0; - for(var key in points) - { - if(runner++ >= roundIndex) - return showInfo(key); - } + showRandomPoint(); } else { @@ -230,6 +224,17 @@ function showInfo(id) } } +function showRandomPoint() +{ + roundIndex = Math.floor(Math.random()*points.length); + runner = 0; + for(var key in points) + { + if(runner++ >= roundIndex) + return showInfo(key); + } +} + /** * Загружает с сервера список категорий точек. * @returns {Boolean}