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