1/* 2* СкÑÐ¸Ð¿Ñ Ð³ÐµÐ¾Ð»Ð¾ÐºÐ°Ñии ÑеÑез ÐÐРбÑаÑзеÑа \ ÑÐ½Ð´ÐµÐºÑ 3* 4* ÐодÑÑавлÑÐµÑ Ð² ÑÐ°Ð¿ÐºÑ Ð½Ð°Ð·Ð²Ð°Ð½Ð¸Ðµ гоÑода поÑле оÑÑабоÑки геоопÑÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ 5* 6* Ð ÑлÑÑае полÑÑение гоÑода не из оÑновнÑÑ (Ñм www/local/php_interface/include/classes/Geolocation.php), ÑÑавиÑÑÑÑ ÐоÑква 7* */ 8$(function () { 9 ymaps.ready(initGeolocation); 10 11 function initGeolocation() { 12 if (getCookie('geolocation_city_name')) { 13 console.log('geolocation_city_name'); 14 console.log(getCookie('geolocation_city_name')); 15 // do nothing 16 } else if (getCookie('geolocation_change_city')) { 17 console.log('geolocation_change_city'); 18 console.log(getCookie('geolocation_change_city')); 19 // do nothing 20 } else { 21 let Geolocation = ymaps.geolocation; 22 23 Geolocation.get({ 24 provider: 'auto', 25 mapStateAutoApply: true 26 }).then(function (result) { 27 result.geoObjects.each(function(el) { 28 let areas = el.getAdministrativeAreas(); 29console.log(areas); 30 setCity(areas[0] + ', ' + areas[1]); 31 }); 32 }); 33 } 34 } 35}); 36 37function setCity(cityName) { 38 var year = 1000 * 60 * 60 * 24; 39 var expires = new Date((new Date()).valueOf() + year); 40 41 console.log('ÐÑÐ´ÐµÑ ÑÑÑановлен гоÑод: ' + cityName); 42 document.cookie = 'geolocation_city_name=' + encodeURIComponent(cityName) + '; expires=' + expires.toUTCString() + '; path=/'; 43 44 if (!getCookie('region') && cityName.length > 0) { 45 $.ajax(location.protocol + '//' + location.hostname + '/local/api/geolocation.php?region=' + cityName) 46 .done(function () { 47 $.ajax(location.protocol + '//' + location.hostname + '/local/api/getLocatedCityData.php') 48 .done(function (result) { 49 result = JSON.parse(result); 50 console.log('УÑпеÑно ÑÑÑановлен гоÑод: ' + result[0] + ', Ñ Ð½Ð¾Ð¼ÐµÑом: ' + result[1]); 51 $('.c-city-name').html(result[0]); 52 $('.c-city-phone').html(result[1]); 53 }); 54 }); 55 } 56} 57 58function getCookie(name) { 59 let matches = document.cookie.match(new RegExp( 60 "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" 61 )); 62 return matches ? decodeURIComponent(matches[1]) : undefined; 63}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.