diff --git a/zsite/static/js/snippets.js b/zsite/static/js/snippets.js index 1c9d7cd..7cb3285 100644 --- a/zsite/static/js/snippets.js +++ b/zsite/static/js/snippets.js @@ -1,4 +1,4 @@ -GetNoun = function(number, one, two, five) { + GetNoun = function(number, one, two, five) { number = Math.abs(number); number %= 100; if (number >= 5 && number <= 20) { @@ -37,7 +37,7 @@ getCookie = function(name) { } detectRegion = function() { - function renderRegionData(current_region) { + function renderRegionData(region_name, country_code) { var regions = { 'Moscow': { 'city': 'В Москве', @@ -45,7 +45,7 @@ detectRegion = function() { }, 'St.-Petersburg': { 'city': 'В Санкт Петербурге', - 'phone': '+7 800 700-16-37' + 'phone': '+7 812 449-03-54.' }, 'Rostov': { 'city': 'В Ростове-на-Дону', @@ -61,19 +61,46 @@ detectRegion = function() { }, 'Voronezhskaya Oblast': { 'city': 'В Воронеже', - 'phone': '+7 800 700-16-37' + 'phone': '8 800 700-16-37' }, 'Volgogradskaya Oblast': { 'city': 'В Волгограде', - 'phone': '+7 800 700-16-37' + 'phone': '8 800 700-16-37' + }, + 'US': { + 'city': 'В США', + 'phone': '+7 495 775-16-37' + }, + 'UA': { + 'city': 'В Украине', + 'phone': '+7 495 775-16-37' + }, + 'KZ': { + 'city': 'В Казахстане', + 'phone': '+7 495 775-16-37' + }, + 'BY': { + 'city': 'В Беларуси', + 'phone': '+7 495 775-16-37' + }, + 'DE': { + 'city': 'В Германии', + 'phone': '+7 495 775-16-37' + }, + 'UZ': { + 'city': 'В Узбекистане', + 'phone': '+7 495 775-16-37' } + }; + var current_region = regions[region_name] || regions[country_code] + console.log(current_region); if(typeof current_region !== "undefined") { - $('.city').text(regions[current_region]['city']); - $('.header-contacts .consultation h3').text(regions[current_region]['phone']); + $('.city').text(current_region['city']); + $('.header-contacts .consultation h3').text(current_region['phone']); } } @@ -85,7 +112,7 @@ detectRegion = function() { request.done(function(data) { setCookie('region', data.regionName); - renderRegionData(data.regionName); + renderRegionData(data.regionName, data.countryCode); }); } else { renderRegionData(getCookie('region'));