1(function (_, $) { 2 var commercial_api_url = 'https://enterprise.api-maps.yandex.ru/', 3 free_api_url = 'https://api-maps.yandex.ru/', 4 default_language = 'en', 5 api_version = '2.1', 6 locales = { 7 'ru': 'ru_RU', 8 'en': 'en_US', 9 'uk': 'uk_UA', 10 'tr': 'tr_TR' 11 }; 12 function fn_get_yandex_api_loader() { 13 var d = $.Deferred(), 14 yandex_api_initialized = false, 15 loading_failed = false, 16 loading_started = false; 17 return function (options) { 18 if (yandex_api_initialized || loading_started || loading_failed) { 19 return d.promise(); 20 } 21 loading_started = true; 22 options = $.extend(options || {}, _.geo_maps); 23 if (!options.suggest_api_key && options.controls) { 24 options.controls.enable_search = false; 25 } 26 var url = fn_generate_api_url(options || {}); 27 $.getScript(url).then(function () { 28 geo_maps_yandex.ready(function () { 29 yandex_api_initialized = true; 30 clearTimeout(await_timeout); 31 d.resolve(); 32 }); 33 }).fail(function () { 34 loading_failed = true; 35 d.reject(); 36 }); 37 38 // .fail() does not work for cross domain requests 39 var await_timeout = setTimeout(function () { 40 if (d.state() === 'pending') { 41 loading_failed = true; 42 d.reject(); 43 } 44 }, 7000); 45 return d.promise(); 46 }; 47 } 48 function fn_generate_api_url(options) { 49 var data = ['ns=geo_maps_yandex', 'lang=' + fn_get_locale(options.language || ''), 'onload=$.ceGeoMapOnLoadYandexIndex']; 50 var url = free_api_url; 51 if (options.yandex_commercial) { 52 url = commercial_api_url; 53 } 54 if (options.api_key) { 55 data.push('apikey=' + options.api_key); 56 } 57 if (options.suggest_api_key) { 58 data.push('suggest_apikey=' + options.suggest_api_key); 59 } 60 url += api_version + '?' + data.join('&'); 61 return url; 62 } 63 function fn_get_locale(lang_code) { 64 return locales[lang_code.toLowerCase()] || locales[default_language]; 65 } 66 $.ceGeoMapOnLoadYandexIndex = function () { 67 $.ceEvent('trigger', 'ce:geomap:onload', ['yandex', 'index']); 68 }; 69 $.geoMapInitYandexApi = fn_get_yandex_api_loader(); 70})(Tygh, Tygh.$);
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.