Случайна точка

This commit is contained in:
Krivchikov Dmitry 2014-07-01 18:40:20 +04:00
parent d9134fae03
commit 75fc4e290d
2 changed files with 16 additions and 1 deletions

View File

@ -27,6 +27,8 @@
<a onclick="$('#howToUseModal').modal('show');" href="#">Как пользоваться</a><br/> <a onclick="$('#howToUseModal').modal('show');" href="#">Как пользоваться</a><br/>
<a onclick="$('#categoriesModal').modal('show');" href="#">Легенда</a><br/> <a onclick="$('#categoriesModal').modal('show');" href="#">Легенда</a><br/>
<a href="/page/points">Список точек</a><br/> <a href="/page/points">Список точек</a><br/>
<br/>
<a href="/?point=random">Случайная точка</a>
</div> </div>
<div id="boxLayers"> <div id="boxLayers">
<h3>Карты</h3> <h3>Карты</h3>

View File

@ -120,8 +120,21 @@ function initPoints()
} }
if (getURLParameter('point') != 'null') if (getURLParameter('point') != 'null')
{
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')); showInfo(getURLParameter('point'));
}
} else if (getURLParameter('route') != 'null') } else if (getURLParameter('route') != 'null')
{ {
loadRouteJSON(getURLParameter('route')); loadRouteJSON(getURLParameter('route'));