|
|
|
|
@ -28,9 +28,72 @@ setCookie = function(key, value) { |
|
|
|
|
document.cookie = key + '=' + value + ';expires=' + expires.toUTCString() + ';path=/'; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
getCookie = function(name) { |
|
|
|
|
var matches = document.cookie.match(new RegExp( |
|
|
|
|
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" |
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
return matches ? decodeURIComponent(matches[1]) : undefined; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
detectRegion = function() { |
|
|
|
|
function renderRegionData(current_region) { |
|
|
|
|
var regions = { |
|
|
|
|
'Moscow': { |
|
|
|
|
'city': 'В Москве', |
|
|
|
|
'phone': '+7 495 775-16-37' |
|
|
|
|
}, |
|
|
|
|
'St.-Petersburg': { |
|
|
|
|
'city': 'В Санкт Петербурге', |
|
|
|
|
'phone': '+7 800 700-16-37' |
|
|
|
|
}, |
|
|
|
|
'Rostov': { |
|
|
|
|
'city': 'В Ростове-на-Дону', |
|
|
|
|
'phone': '+7 863 209-85-65' |
|
|
|
|
}, |
|
|
|
|
'Krasnodarskiy Kray': { |
|
|
|
|
'city': 'В Ростове-на-Дону', |
|
|
|
|
'phone': '+7 863 209-85-65' |
|
|
|
|
}, |
|
|
|
|
'Volgogradskaya Oblast': { |
|
|
|
|
'city': 'В Ростове-на-Дону', |
|
|
|
|
'phone': '+7 863 209-85-65' |
|
|
|
|
}, |
|
|
|
|
'Voronezhskaya Oblast': { |
|
|
|
|
'city': 'В Ростове-на-Дону', |
|
|
|
|
'phone': '+7 863 209-85-65' |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
console.log(current_region); |
|
|
|
|
|
|
|
|
|
if(typeof current_region !== "undefined") { |
|
|
|
|
|
|
|
|
|
$('.city').text(regions[current_region]['city']); |
|
|
|
|
$('.header-contacts .consultation h3').text(regions[current_region]['phone']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(typeof getCookie('region') === undefined || getCookie('region') == "") { |
|
|
|
|
var request = $.get('http://ip-api.com/json') |
|
|
|
|
|
|
|
|
|
request.done(function(data) { |
|
|
|
|
setCookie('region', data.regionName); |
|
|
|
|
|
|
|
|
|
renderRegionData(data.regionName); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
renderRegionData(getCookie('region')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
$(function() { |
|
|
|
|
$( "[href^=mailto]" ).click(function() { |
|
|
|
|
yaCounter950321.reachGoal('EmailClick');
|
|
|
|
|
ga('send', 'event', 'Communication', 'email'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$( "[href^='#service-form-submit']" ).click(function(e) { |
|
|
|
|
|