1 2const googleTranslateConfig = { 3 /* Original language */ 4 lang: "ru", 5 6 /* The language we translate into on the first visit*/ 7 /* ЯзÑк, на коÑоÑÑй пеÑеводим пÑи пеÑвом поÑеÑении */ 8 /* langFirstVisit: 'en', */ 9 10 /* ÐÑли ÑкÑÐ¸Ð¿Ñ Ð½Ðµ ÑабоÑÐ°ÐµÑ Ð¸Ð»Ð¸ ÑабоÑÐ°ÐµÑ Ð½ÐµÐ¿ÑавилÑно, ÑаÑкомменÑиÑÑйÑе и ÑкажиÑе оÑновной домен в ÑвойÑÑве domain */ 11 /* If the script does not work or does not work correctly, uncomment and specify the main domain in the domain property */ 12 /* domain: "Get-Web.Site" */ 13}; 14 15$(function () { 16 /* ÐодклÑÑаем Ð²Ð¸Ð´Ð¶ÐµÑ google translate */ 17 /* Connecting the google translate widget */ 18 let script = document.createElement("script"); 19 script.src = `//translate.google.com/translate_a/element.js?cb=TranslateWidgetIsLoaded`; 20 document.getElementsByTagName("head")[0].appendChild(script); 21}); 22 23function TranslateWidgetIsLoaded() { 24 TranslateInit(googleTranslateConfig); 25} 26 27function TranslateInit(config) { 28 if (config.langFirstVisit && !$.cookie("googtrans")) { 29 /* ÐÑли ÑÑÑановлен ÑзÑк пеÑевода Ð´Ð»Ñ Ð¿ÐµÑвого поÑеÑÐµÐ½Ð¸Ñ Ð¸ кÑки не назнаÑÐµÐ½Ñ */ 30 /* If the translation language is installed for the first visit and cookies are not assigned */ 31 TranslateCookieHandler("/auto/" + config.langFirstVisit); 32 } 33 34 let code = TranslateGetCode(config); 35 36 TranslateHtmlHandler(code); 37 38 if (code == config.lang) { 39 /* ÐÑли ÑзÑк по ÑмолÑаниÑ, ÑÐ¾Ð²Ð¿Ð°Ð´Ð°ÐµÑ Ñ ÑзÑком на коÑоÑÑй пеÑеводим, Ñо оÑиÑаем кÑки */ 40 /* If the default language is the same as the language we are translating into, then we clear the cookies */ 41 TranslateCookieHandler(null, config.domain); 42 } 43 44 /* ÐниÑиализиÑÑем Ð²Ð¸Ð´Ð¶ÐµÑ Ñ ÑзÑком по ÑмолÑÐ°Ð½Ð¸Ñ */ 45 /* Initialize the widget with the default language */ 46 new google.translate.TranslateElement({ 47 pageLanguage: config.lang, 48 }); 49 50 /* ÐеÑаем ÑобÑÑие клик на Ñлаги */ 51 /* Assigning a handler to the flags */ 52 $("[data-google-lang]").click(function () { 53 TranslateCookieHandler( 54 "/auto/" + $(this).attr("data-google-lang"), 55 config.domain 56 ); 57 /* ÐеÑезагÑÑжаем ÑÑÑаниÑÑ */ 58 /* Reloading the page */ 59 window.location.reload(); 60 }); 61} 62 63function TranslateGetCode(config) { 64 /* ÐÑли кÑки неÑ, Ñо пеÑедаем деÑолÑнÑй ÑзÑк */ 65 /* If there are no cookies, then we pass the default language */ 66 let lang = 67 $.cookie("googtrans") != undefined && $.cookie("googtrans") != "null" 68 ? $.cookie("googtrans") 69 : config.lang; 70 return lang.match(/(?!^\/)[^\/]*$/gm)[0]; 71} 72 73function TranslateCookieHandler(val, domain) { 74 /* ÐапиÑÑваем кÑки /ÑзÑк_коÑоÑÑй_пеÑеводим/ÑзÑк_на_коÑоÑÑй_пеÑеводим */ 75 /* Writing down cookies /language_for_translation/the_language_we_are_translating_into */
76 $.cookie("googtrans", val); 77 $.cookie("googtrans", val, { 78 domain: "." + document.domain, 79 }); 80 81 if (domain == "undefined") return; 82 /* запиÑÑваем кÑки Ð´Ð»Ñ Ð´Ð¾Ð¼ÐµÐ½Ð°, еÑли он назнаÑен в конÑиге */ 83 /* Writing down cookies for the domain, if it is assigned in the config */ 84 $.cookie("googtrans", val, { 85 domain: domain, 86 }); 87 88 $.cookie("googtrans", val, { 89 domain: "." + domain, 90 }); 91} 92 93function TranslateHtmlHandler(code) { 94 /* ÐолÑÑаем ÑзÑк на коÑоÑÑй пеÑеводим и пÑоизводим Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ñе манипÑлÑÑии Ñ DOM */ 95 /* We get the language to which we translate and produce the necessary manipulations with DOM */ 96 $('[data-google-lang="' + code + '"]').addClass("language__img_active"); 97}
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.