Отформатировал JS с пробелов на табы

This commit is contained in:
Krivchikov Dmitry 2014-05-03 22:44:05 +04:00
parent 4b4514d559
commit 202a2ffb47
1 changed files with 207 additions and 208 deletions

View File

@ -12,9 +12,7 @@ var route = false;
// -------------------------------- Libs ---------------------------------------
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
);
return decodeURI((RegExp(name + '=' + '(.+?)(&|$)').exec(location.search) || [, null])[1]);
}
// -----------------------------------------------------------------------------
@ -34,9 +32,9 @@ function init() {
initCategories()
getPoints();
myMap.events.add('click', function (e) {
myMap.events.add('click', function(e) {
if (!myMap.balloon.isOpen()) {
if ( $('#addPointButton').hasClass('btn-success') )
if ($('#addPointButton').hasClass('btn-success'))
{
coords = e.get('coordPosition');
$('#addPointLat').val(coords[0].toPrecision(11));
@ -49,9 +47,9 @@ function init() {
}
});
myMap.events.add('boundschange', function(e){
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'));
history.pushState({}, document.title, "/?lat=" + e.get('newCenter')[0] + "&lng=" + e.get('newCenter')[1] + "&zoom=" + e.get('newZoom'));
}
});
@ -93,7 +91,7 @@ function constructPoint(data)
balloonCloseButton: true
});
points[id].events.add('click', function (e) {
points[id].events.add('click', function(e) {
showInfo(e.get('target').properties.get('id'));
});
@ -104,15 +102,15 @@ function getPoints()
{
$.ajax({
url: "/json/points/",
success: function(data){
for(var k in data) {
success: function(data) {
for (var k in data) {
myMap.geoObjects.add(constructPoint(data[k]));
}
if (getURLParameter('point') != 'null')
{
showInfo(getURLParameter('point'));
} else if ( (getURLParameter('lat') != 'null')&&(getURLParameter('lng') != 'null')&&(getURLParameter('zoom') != 'null') )
} else if ((getURLParameter('lat') != 'null') && (getURLParameter('lng') != 'null') && (getURLParameter('zoom') != 'null'))
{
myMap.setCenter([getURLParameter('lat'), getURLParameter('lng')], getURLParameter('zoom'));
}
@ -131,7 +129,7 @@ function showInfo(id)
url: "/json/point/id/" + id,
success: function(data) {
description = '<div class="infoCard">' +
'<a href="/?point='+id+'">' +
'<a href="/?point=' + id + '">' +
'<h3>' + data.name + '</h3>' +
'</a>' +
'<img src="' + data.img + '" />' +
@ -151,7 +149,7 @@ function showInfo(id)
});
}
history.pushState({}, document.title, "/?point="+id);
history.pushState({}, document.title, "/?point=" + id);
return true;
}
@ -159,7 +157,7 @@ function initCategories()
{
$.ajax({
url: "/json/categories/",
success: function(data){
success: function(data) {
categories = data;
}
});
@ -171,12 +169,13 @@ function searchAdderess()
{
var myGeocoder = ymaps.geocode($('#addressField').val());
myGeocoder.then(
function (res) {
function(res) {
search = new ymaps.Placemark(res.geoObjects.get(0).geometry.getCoordinates());
myMap.geoObjects.add(search);
myMap.setCenter(res.geoObjects.get(0).geometry.getCoordinates(), 10);
},
function (err) {}
function(err) {
}
);
}
@ -193,7 +192,7 @@ function showMeOnTheMap()
function activateAddPoint()
{
$('#addPointButton').toggleClass('btn-success').toggleClass('btn-default');
if ( $('#addPointButton').hasClass('btn-success') )
if ($('#addPointButton').hasClass('btn-success'))
myMap.cursors.push('crosshair');
else
myMap.cursors.push('arrow');
@ -227,7 +226,7 @@ function addPoint()
obj.lng = $('#addPointLng').val();
obj.categoryIcon = categories[$('#addPointCategoryId').val()].icon;
setTimeout(function(){
setTimeout(function() {
myMap.geoObjects.add(constructPoint(obj));
}, 3000);
@ -294,7 +293,7 @@ function buildRoute()
function addToRoute(id)
{
$('#wayPoints').append('<div pointid="'+id+'" class="wayPoint"><span onclick="$(this).parent().remove()">&times;</span> ' + points[id].properties.get('hintContent') + '</div>');
$('#wayPoints').append('<div pointid="' + id + '" class="wayPoint"><span onclick="$(this).parent().remove()">&times;</span> ' + points[id].properties.get('hintContent') + '</div>');
myMap.balloon.close();
$('#routeWindow').show(200);
return true;