PageSourceSearch

https://xn--80abjcbjpll9bmq.xn--p1ai/ru/simai.data/grid/block/head…/yatranslate.js?17715056993730

js xn--80abjcbjpll9bmq.xn--p1ai collected 2026-10-08 11:41:57 UTC 3,730 bytes, 95 lines download raw bytes

1if (typeof yatranslate === 'undefined') {
2    // Если переменная не объявлена, объявляем её
3    var yatranslate = {
4        /* Оригинальный язык */
5        lang: "ru",
6    };
7} else {
8    // Если переменная уже объявлена, перезаписываем её
9    yatranslate = {
10        /* Оригинальный язык */
11        lang: "ru",
12    };
13}
14
15langCodeDescription = {
16    ru : 'Russian',
17    en: 'English',
18    de: 'German',
19    zh: 'China',
20    fr: 'French',
21	kk: 'Kazakh',
22	ba: 'Bashkir',
23	es: 'Spanish',
24	tr: 'Turkish',
25	ja: 'Japanese',
26}
27
28document.addEventListener('DOMContentLoaded', function () {
29    // Start
30    yaTranslateInit();
31})
32
33function yaTranslateInit() {
34
35    if (yatranslate.langFirstVisit && !localStorage.getItem('yt-widget')) {
36        /* Если установлен язык перевода для первого посещения и в localStorage нет yt-widget */
37        /* If the translation language is installed for the first visit and in localStorage no yt-widget */
38        yaTranslateSetLang(yatranslate.langFirstVisit);
39    }
40
41    // Подключаем виджет yandex translate
42    // Connecting the yandex translate widget
43    let script = document.createElement('script');
44    script.src = `https://translate.yandex.net/website-widget/v1/widget.js?widgetId=ytWidget&pageLang=${yatranslate.lang}&widgetTheme=light&autoMode=false`;
45    document.getElementsByTagName('head')[0].appendChild(script);
46
47    // Получаем и записываем язык на который переводим
48    // We get and write down the language into which we translate
49    let code = yaTranslateGetCode();
50
51    // Показываем текущий язык в меню
52    // Show the current language in the menu
53    yaTranslateHtmlHandler(code);
54
55    // Вешаем событие клик на флаги
56    // We hang the event click on the flags
57    yaTranslateEventHandler('click', '[data-ya-lang]', function (el) {
58        yaTranslateSetLang(el.getAttribute('data-ya-lang'));
59        // Перезагружаем страницу
60        // Reloading the page
61        window.location.reload();
62    })
63}
64
65function yaTranslateSetLang(lang) {
66    // Записываем выбранный язык в localStorage объект yt-widget 
67    // Writing the selected language to localStorage 
68    localStorage.setItem('yt-widget', JSON.stringify({
69        "lang": lang,
70        "active": true
71    }));
72}
73
74function yaTranslateGetCode() {
75    // Возвращаем язык на который переводим
76    // Returning the language to which we are translating
77    return (localStorage["yt-widget"] != undefined && JSON.parse(localStorage["yt-widget"]).lang != undefined) ? JSON.parse(localStorage["yt-widget"]).lang : yatranslate.lang;
78}
79
80function yaTranslateHtmlHandler(code) {
81    // Получаем язык на который переводим и производим необходимые манипуляции с DOM
82    // We get the language to which we translate and produce the necessary manipulations with DOM 
83    document.querySelector('[data-lang-active]').innerHTML = `<span translate="no">${langCodeDescription[code]}</span>`;
84    elementToRemove = document.querySelector(`[data-ya-lang="${code}"]`);
85    if(elementToRemove) {
86        elementToRemove.remove();
87    }
88}
89
90function yaTranslateEventHandler(event, selector, handler) {
91    document.addEventListener(event, function (e) {
92        let el = e.target.closest(selector);
93        if (el) handler(el);
94    });
95}

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.