fix region detection

master
fefa4ka 10 years ago
parent fbadbee338
commit 0747520df3
  1. 13
      zsite/static/js/snippets.js

@ -55,20 +55,23 @@ detectRegion = function() {
'city': 'В Ростове-на-Дону', 'city': 'В Ростове-на-Дону',
'phone': '+7 863 209-85-65' 'phone': '+7 863 209-85-65'
}, },
'Volgogradskaya Oblast': { 'Stavropol\'skiy Kray': {
'city': 'В Ростове-на-Дону', 'city': 'В Ростове-на-Дону',
'phone': '+7 863 209-85-65' 'phone': '+7 863 209-85-65'
}, },
'Voronezhskaya Oblast': { 'Voronezhskaya Oblast': {
'city': 'В Ростове-на-Дону', 'city': 'В Воронеже',
'phone': '+7 863 209-85-65' 'phone': '+7 800 700-16-37'
},
'Volgogradskaya Oblast': {
'city': 'В Волгограде',
'phone': '+7 800 700-16-37'
} }
}; };
console.log(current_region); console.log(current_region);
if(typeof current_region !== "undefined") { if(typeof current_region !== "undefined") {
$('.city').text(regions[current_region]['city']); $('.city').text(regions[current_region]['city']);
$('.header-contacts .consultation h3').text(regions[current_region]['phone']); $('.header-contacts .consultation h3').text(regions[current_region]['phone']);
} }
@ -76,7 +79,7 @@ detectRegion = function() {
} }
if(typeof getCookie('region') === undefined || getCookie('region') == "") { if(typeof getCookie('region') === "undefined" || getCookie('region') == "") {
var request = $.get('http://ip-api.com/json') var request = $.get('http://ip-api.com/json')
request.done(function(data) { request.done(function(data) {

Loading…
Cancel
Save