{"version":3,"sources":["volgte2.min.js"],"names":["regexClassSelector","selector","expression","all","arguments","length","undefined","elements","document","querySelectorAll","regex","RegExp","filter","element","className","match","find","_VOLGTETranslateLinkSet","constructor","defaultLanguage","languages","container","select","frame","resetOptionText","this","iframe","links","isDefaultLanguagePrepended","languageContainer","linkList","createElement","currentLanguage","appendChild","setGoogleTranslateLinks","selectLanguage","language","forEach","link","classList","dataset","setTimeout","contentDocument","getElementsByTagName","prependDefaultLanguageLink","t","value","includes","cl","href","textContent","querySelector","push","referenceToElm","addEventListener","li","item","add","GTIframeDocument","getElementById","contentWindow","click","savedLink","remove","insertAdjacentElement","VOLGTE","elementID","options","defaultLangOptionPrepended","checkInterval","linkFrame","linkSet","bannerFrame","banner","callback","defaults","optionDisplayLanguageCode","resetOptionValue","selectWidgetLabel","languageSwitchCallback","selectedLanguage","documentElement","createBanner","languageSelectEvent","MutationObserver","mutationList","observer","mutation","oldLang","target","observe","attributes","childList","subtree","init","let","_initElement","registerEvent","type","console","attrLink","style","head","body","createSelect","setAttribute","resetOption","currentLink","toUpperCase","option","restoreButton","el","hr","heading","config","createTextNode","pageLanguage","layout","google","translate","TranslateElement","InlineLayout","id","setInterval","clearInterval","gadget","display","insertTranslateLinks"],"mappings":"aAAA,MAAMA,mBAAAA,SACLC,EACAC,GACAC,IAAAA,EAAG,EAAAC,UAAAC,QAAAC,KAAAA,IAAAF,UAAA,IAAAA,UAAA,GAGHG,EAAc,CAAG,IAFX,EAAAH,UAAAC,QAAAC,KAAAA,IAAAF,UAAA,GAAAA,UAAA,GAAGI,UAEkBC,iBAAiBR,CAACA,GAC7C,MAAAS,EAAW,IAAGC,OAAUT,CAACA,EAEzB,OAAAC,EACCI,EAAOA,OAASK,GAAeC,EAAKA,UAAQC,MAAUC,CAAML,CAAAA,EAE5DH,EAAOA,KAASS,GAAaH,EAAKA,UAAQC,MAAUC,CAAML,CAAAA,CAE5D,QAEMO,wBACLC,YACCC,EACAC,EACAC,EACAC,EACAC,EACAC,G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BxE,SAAGA,gBAASyE,KAGjCxD,KAAA4C,cAAkBsD,YAAGA,KAEpB,IAMChG,EANDD,EAAY1B,mBACX,uBACA,+DAAA,EAGD0B,GAKWrB,GAJVsB,EAAMA,CACL,GAAAD,EAAGA,gBAAOgB,iBAAgBjC,YAAiB,IAGxCkB,SACHF,KAAA6C,UAAKA,EACL7C,KAAAE,MAAKA,EACLiG,cAAAA,KAAcvD,aAAKA,EACnB5C,KAAA+E,aAAKA,GACLqB,EAAMA,KAAShH,QAAKA,cACnB,wBAAA,KAIAgH,EAAAA,MAAOxB,QAAMyB,QAGdrG,KAAAZ,QAAKA,YAAQoB,CAAAA,EAGhB,EAAC,GAAE,CACJ,CAEA8F,qBAAoB3G,EAAUC,GAC7BI,KAAA8C,QAAY,IAAGtD,wBACdQ,KAAIW,SACJhB,EACAC,EACAI,KAAIH,OACJG,KAAI6C,UACJ7C,KAAI0C,QAAQU,gBAACA,CAEf,CACD","file":"volgte2.min.js","sourcesContent":["const regexClassSelector = (\n\tselector,\n\texpression,\n\tall = false,\n\tparent = document\n) => {\n\tconst elements = [...parent.querySelectorAll(selector)];\n\tconst regex = new RegExp(expression);\n\n\tif (all) {\n\t\treturn elements.filter((element) => element.className.match(regex));\n\t} else {\n\t\treturn elements.find((element) => element.className.match(regex));\n\t}\n};\n\nclass _VOLGTETranslateLinkSet {\n\tconstructor(\n\t\tdefaultLanguage,\n\t\tlanguages,\n\t\tcontainer,\n\t\tselect,\n\t\tframe,\n\t\tresetOptionText\n\t) {\n\t\tif (!container) return;\n\n\t\tthis.iframe = frame;\n\t\tthis.select = select;\n\t\tthis.languages = languages;\n\t\tthis.defaultLanguage = defaultLanguage;\n\t\tthis.links = [];\n\t\tthis.isDefaultLanguagePrepended = false;\n\t\tthis.languageContainer = container;\n\t\tthis.linkList = document.createElement(\"ul\");\n\t\tthis.currentLanguage = this.defaultLanguage;\n\t\tthis.resetOptionText = resetOptionText;\n\n\t\tthis.languageContainer.appendChild(this.linkList);\n\t\tthis.setGoogleTranslateLinks();\n\n\t\t/* const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (\n mutation.type === 'attributes' &&\n mutation.target.classList.contains('goog-te-menu2-item-selected') &&\n mutation.target.value.length > 0\n ) {\n this.selectLanguage(mutation.target.value);\n }\n }\n });\n\n observer.observe(this.iframe.contentDocument, {\n attributes: true,\n childList: false,\n subtree: true,\n }); */\n\t}\n\n\tselectLanguage(language) {\n\t\tthis.links.forEach((link) => {\n\t\t\tlink.classList.toggle(\n\t\t\t\t\"googleTranslateActiveLanguage\",\n\t\t\t\tlink.dataset.value === language\n\t\t\t);\n\t\t});\n\n\t\tthis.currentLanguage = language;\n\t}\n\n\tsetGoogleTranslateLinks() {\n\t\tsetTimeout(() => {\n\t\t\tlet t = null;\n\n\t\t\tif (\n\t\t\t\ttypeof this.iframe.contentDocument != \"undefined\" &&\n\t\t\t\tthis.iframe.contentDocument.getElementsByTagName(\"table\")[0]\n\t\t\t) {\n\t\t\t\tthis.prependDefaultLanguageLink();\n\n\t\t\t\tt = [...this.iframe.contentDocument.querySelectorAll(\"table td a\")];\n\n\t\t\t\tt.forEach((link) => {\n\t\t\t\t\tconst value = link.value;\n\n\t\t\t\t\tif (this.languages.includes(value)) {\n\t\t\t\t\t\tconst cl = document.createElement(\"a\");\n\t\t\t\t\t\tcl.href = \"javascript:void(0)\";\n\t\t\t\t\t\tcl.className = \"language-\" + value;\n\t\t\t\t\t\tcl.textContent = link.querySelector(\".text\").textContent;\n\t\t\t\t\t\tthis.links.push(cl);\n\n\t\t\t\t\t\tcl.referenceToElm = link;\n\t\t\t\t\t\tcl.dataset.value = link.value;\n\t\t\t\t\t\tcl.addEventListener(\"click\", () => {\n\t\t\t\t\t\t\tcl.referenceToElm.click();\n\t\t\t\t\t\t\t//this.selectLanguage(cl.dataset.value);\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (this.currentLanguage === value) {\n\t\t\t\t\t\t\tthis.selectLanguage(value);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst li = document.createElement(\"li\");\n\t\t\t\t\t\tli.appendChild(cl);\n\t\t\t\t\t\tthis.linkList.appendChild(li);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}, 1000);\n\t}\n\n\tprependDefaultLanguageLink() {\n\t\tif (this.isDefaultLanguagePrepended) return;\n\n\t\tconst item = document.createElement(\"li\");\n\t\tconst link = document.createElement(\"a\");\n\n\t\tlink.className = \"language-\" + this.defaultLanguage;\n\t\tlink.dataset.value = this.defaultLanguage;\n\t\tlink.textContent = this.resetOptionText;\n\t\tlink.href = \"javascript:void(0)\";\n\n\t\tif (this.currentLanguage === this.defaultLanguage) {\n\t\t\tlink.classList.add(\"googleTranslateActiveLanguage\");\n\t\t}\n\n\t\tlink.addEventListener(\"click\", () => {\n\t\t\tconst GTIframeDocument = document.getElementById(\":2.container\");\n\n\t\t\tif (GTIframeDocument) {\n\t\t\t\tGTIframeDocument.contentWindow.document\n\t\t\t\t\t.getElementById(\":2.restore\")\n\t\t\t\t\t.click();\n\n\t\t\t\tthis.links.forEach((savedLink) => {\n\t\t\t\t\tsavedLink.classList.remove(\"googleTranslateActiveLanguage\");\n\t\t\t\t});\n\n\t\t\t\tlink.classList.add(\"googleTranslateActiveLanguage\");\n\t\t\t}\n\t\t});\n\n\t\tthis.links.push(link);\n\t\titem.appendChild(link);\n\t\tthis.linkList.insertAdjacentElement(\"afterbegin\", item);\n\t\tthis.isDefaultLanguagePrepended = true;\n\t}\n}\n\nclass VOLGTE {\n\tconstructor(elementID, options) {\n\t\tthis.element = document.getElementById(elementID);\n\n\t\tif (!this.element) return;\n\n\t\tthis.defaultLangOptionPrepended = false;\n\t\tthis.checkInterval;\n\t\tthis.linkFrame = null;\n\t\tthis.linkSet = null;\n\t\tthis.bannerFrame = null;\n\t\tthis.select = null;\n\t\tthis.banner = null;\n\t\tthis.callback;\n\t\tthis.defaults = {\n\t\t\tlanguage: \"cs\",\n\t\t\tlanguages: null,\n\t\t\toptionDisplayLanguageCode: false,\n\t\t\tresetOptionValue: \"původní jazyk\",\n\t\t\tselectWidgetLabel: \"Widget překladu jazyků\",\n\t\t\tlanguageSwitchCallback: null,\n\t\t};\n\n\t\tthis.options = { ...this.defaults, ...options };\n\n\t\tthis.language = this.options.language;\n\t\tthis.languages = this.options.languages;\n\t\tthis.selectedLanguage = document.documentElement.lang;\n\t\tthis.element.dataset.selectedLanguage = this.selectedLanguage;\n\t\tthis.createBanner();\n\n\t\tthis.languageSelectEvent = null;\n\n\t\tconst observer = new MutationObserver((mutationList, observer) => {\n\t\t\tfor (const mutation of mutationList) {\n\t\t\t\tif (\n\t\t\t\t\tmutation.type === \"attributes\" &&\n\t\t\t\t\tmutation.attributeName === \"lang\"\n\t\t\t\t) {\n\t\t\t\t\tconst oldLang = this.selectedLanguage;\n\t\t\t\t\tthis.selectedLanguage = mutation.target.lang;\n\n\t\t\t\t\tif (this.selectedLanguage === this.language) {\n\t\t\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t\t\t\"gte-attr-banner-visible\"\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t\t\t\t\"gte-attr-banner-visible\"\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t//console.log('this.linkSet', this.linkSet);\n\t\t\t\t\tif (this.linkSet) {\n\t\t\t\t\t\tthis.linkSet.selectLanguage(this.selectedLanguage);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.languageSelectEvent) {\n\t\t\t\t\t\tthis.languageSelectEvent(oldLang, this.selectedLanguage);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.select) {\n\t\t\t\t\t\tthis.select.value = this.selectedLanguage;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tobserver.observe(document.documentElement, {\n\t\t\tattributes: true,\n\t\t\tchildList: false,\n\t\t\tsubtree: false,\n\t\t});\n\t}\n\n\tinit(callback = null) {\n\t\tif (callback) {\n\t\t\tthis.callback = callback;\n\t\t}\n\t\treturn () => {\n\t\t\tthis._initElement();\n\t\t};\n\t}\n\n\tregisterEvent(type, callback) {\n\t\tif (type === \"languageselect\") {\n\t\t\tthis.languageSelectEvent = callback;\n\t\t} else {\n\t\t\tconsole.warn(`Event type ${type} is not supported.`);\n\t\t}\n\t}\n\n\tcreateBanner() {\n\t\tconst banner = document.createElement(\"div\");\n\t\tconst attrLink = document.createElement(\"a\");\n\t\tthis.banner = banner;\n\t\tattrLink.href = \"https://translate.google.com/\";\n\t\tattrLink.title = \"Powered by Google Translate\";\n\t\tattrLink.target = \"_blank\";\n\n\t\tconst style = document.createElement(\"style\");\n\t\tbanner.className = \"gte-attribution-banner skiptranslate\";\n\t\tbanner.appendChild(attrLink);\n\n\t\tstyle.textContent = `\n #goog-gt-tt,\n #goog-gt-tt + div > object,\n iframe.goog-te-menu-frame,\n iframe[id^=\":\"],\n iframe.goog-te-banner-frame {\n display: none !important;\n }\n\n .gte-attribution-banner {\n position: absolute;\n left: 0;\n top: -40px;\n right: 0;\n z-index: 90;\n box-sizing: border-box;\n background: white url(/ASPINCLUDE/vismoWeb5/html/images/gte-attr-color-regular.svg) no-repeat 50% 50%;\n box-shadow: 0 2px 10px rgba(0,0,0,0.12);\n height: 40px;\n display: none;\n }\n\n .gte-attribution-banner a,\n .gte-attribution-banner a:link,\n .gte-attribution-banner a:visited,\n .gte-attribution-banner a:hover,\n .gte-attribution-banner a:focus,\n .gte-attribution-banner a:active {\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n height: 40px;\n text-decoration: none;\n color: inherit;\n }\n\n .gte-attr-banner-visible body {\n position: relative;\n top: 40px !important;\n }\n\n .gte-attr-banner-visible .gte-attribution-banner {\n display: flex;\n }\n `;\n\n\t\tdocument.head.appendChild(style);\n\t\tdocument.body.insertAdjacentElement(\"afterbegin\", banner);\n\t}\n\n\tcreateSelect() {\n\t\tconst select = document.createElement(\"select\");\n\t\tthis.select = select;\n\t\tselect.className = \"goog-te-select skiptranslate\";\n\t\tselect.id = \"google_translate_element_volgte_select\";\n\t\tselect.setAttribute(\"aria-label\", this.options.selectWidgetLabel);\n\t\tconst resetOption = document.createElement(\"option\");\n\n\t\tresetOption.className = \"skiptranslate\";\n\t\tresetOption.value = this.language;\n\t\tresetOption.textContent = this.options.optionDisplayLanguageCode\n\t\t\t? this.language.toUpperCase()\n\t\t\t: this.options.resetOptionValue;\n\t\tselect.appendChild(resetOption);\n\n\t\tthis.links.forEach((link) => {\n\t\t\tconst option = document.createElement(\"option\");\n\n\t\t\tif (link.value.length > 0) {\n\t\t\t\toption.value = link.value;\n\t\t\t\toption.textContent = this.options.optionDisplayLanguageCode\n\t\t\t\t\t? link.value.toUpperCase()\n\t\t\t\t\t: link.querySelector(\".text\").textContent;\n\t\t\t\tselect.appendChild(option);\n\t\t\t}\n\t\t});\n\n\t\tselect.addEventListener(\"change\", (event) => {\n\t\t\t//console.log(event);\n\t\t\t//console.log('selected', select.value);\n\t\t\tif (select.value === this.language) {\n\t\t\t\tconst GTIframeDocument = regexClassSelector(\n\t\t\t\t\t\"iframe.skiptranslate\",\n\t\t\t\t\t\"([a-zA-Z0-9]{4,6}-[a-zA-Z0-9]{4,6}-[a-zA-Z0-9]{4,6}-[a-zA-Z0-9]{4,6})\"\n\t\t\t\t);\n\t\t\t\t//console.log(`GTIframeDocument`, GTIframeDocument);\n\t\t\t\tif (GTIframeDocument) {\n\t\t\t\t\tconst restoreButton =\n\t\t\t\t\t\tGTIframeDocument.contentWindow.document.querySelector(\n\t\t\t\t\t\t\t'button[id*=\"restore\"]'\n\t\t\t\t\t\t);\n\n\t\t\t\t\tif (restoreButton && select.value === this.language) {\n\t\t\t\t\t\trestoreButton.click();\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof this.options.languageSwitchCallback === \"function\"\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthis.options.languageSwitchCallback(this.language);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.warn(\"Restore button not found\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//console.log(this.linkFrame);\n\t\t\tif (this.linkFrame) {\n\t\t\t\tconst links = [\n\t\t\t\t\t...this.linkFrame.contentDocument.querySelectorAll(\"table td a\"),\n\t\t\t\t];\n\t\t\t\t//console.log(links);\n\t\t\t\tconst link = links.find((el) => el.value === select.value);\n\n\t\t\t\tif (link) {\n\t\t\t\t\tlink.click();\n\t\t\t\t\tif (typeof this.options.languageSwitchCallback === \"function\") {\n\t\t\t\t\t\tthis.options.languageSwitchCallback(link.value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//const oldLang = this.selectedLanguage;\n\t\t\t//select.value = this.selectedLanguage;\n\t\t\t//\n\t\t\t//if (this.languageSelectEvent) {\n\t\t\t// this.languageSelectEvent(oldLang, this.selectedLanguage);\n\t\t\t//}\n\n\t\t\t//this.element.dataset.selectedLanguage = select.value;\n\t\t});\n\n\t\t//const currentLink = this.linkFrame.contentDocument.querySelector('table a.goog-te-menu2-item-selected');\n\t\tconst currentLink = regexClassSelector(\n\t\t\t\"table a\",\n\t\t\t\"([a-zA-Z0-9]{6}-[a-zA-Z0-9]{6}-[a-zA-Z0-9]{6}-[a-zA-Z0-9]{6}-[a-zA-Z0-9]{6})\",\n\t\t\tfalse,\n\t\t\tthis.linkFrame.contentDocument\n\t\t);\n\n\t\tif (currentLink && currentLink.value.length > 0) {\n\t\t\tselect.value = currentLink.value;\n\t\t} else {\n\t\t\tselect.value = this.selectedLanguage;\n\t\t}\n\n\t\tthis.element.appendChild(select);\n\n\t\tif (this.callback) {\n\t\t\tthis.callback();\n\t\t}\n\n\t\tthis.element.classList.add(\"ready\");\n\t}\n\n\t_initElement() {\n\t\tconst hr = document.createElement(\"hr\");\n\t\tconst heading = document.createElement(\"h2\");\n\n\t\thr.className = \"cist\";\n\t\theading.className = \"cist\";\n\t\theading.appendChild(document.createTextNode(\"Google Translator\"));\n\t\tthis.element.appendChild(heading);\n\t\tthis.links = [];\n\n\t\tconst config = {\n\t\t\tpageLanguage: this.language,\n\t\t\tlayout: google.translate.TranslateElement.InlineLayout.SIMPLE,\n\t\t};\n\n\t\tif (this.languages) {\n\t\t\tconfig.includedLanguages = this.languages;\n\t\t}\n\n\t\tnew google.translate.TranslateElement(config, this.element.id);\n\t\tthis.selectedLanguage = document.documentElement.lang;\n\n\t\t//console.log(this.selectedLanguage);\n\t\tthis.checkInterval = setInterval(() => {\n\t\t\t//const iframe = document.querySelector('iframe.skiptranslate');\n\t\t\tconst iframe = regexClassSelector(\n\t\t\t\t\"iframe.skiptranslate\",\n\t\t\t\t\"([a-zA-Z0-9]{6}-[a-zA-Z0-9]{6}-[a-zA-Z0-9]{6}-[a-zA-Z0-9]{6})\"\n\t\t\t);\n\t\t\t//console.log(iframe);\n\t\t\tif (iframe) {\n\t\t\t\tconst links = [\n\t\t\t\t\t...iframe.contentDocument.querySelectorAll(\"table td a\"),\n\t\t\t\t];\n\n\t\t\t\tif (links.length > 0) {\n\t\t\t\t\tthis.linkFrame = iframe;\n\t\t\t\t\tthis.links = links;\n\t\t\t\t\tclearInterval(this.checkInterval);\n\t\t\t\t\tthis.createSelect();\n\t\t\t\t\tconst gadget = this.element.querySelector(\n\t\t\t\t\t\t\".goog-te-gadget-simple\"\n\t\t\t\t\t);\n\n\t\t\t\t\tif (gadget) {\n\t\t\t\t\t\tgadget.style.display = \"none\";\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.element.appendChild(hr);\n\t\t\t\t}\n\t\t\t}\n\t\t}, 1000);\n\t}\n\n\tinsertTranslateLinks(languages, container) {\n\t\tthis.linkSet = new _VOLGTETranslateLinkSet(\n\t\t\tthis.language,\n\t\t\tlanguages,\n\t\t\tcontainer,\n\t\t\tthis.select,\n\t\t\tthis.linkFrame,\n\t\t\tthis.options.resetOptionValue\n\t\t);\n\t}\n}\n"]}