{ "version": 3, "sources": ["../../../Vettvangur.Frontend/src/scripts/components/languageSwitcher.ts"], "sourcesContent": ["const LanguageSwitcher = {\r\n\tel: {\r\n\t\troot: document.querySelectorAll(\".header__links--language\"),\r\n\t},\r\n\r\n\tinit(): void {\r\n\t\tlet storedLang =\r\n\t\t\tlocalStorage.getItem(\"preferredLang\") ||\r\n\t\t\tsessionStorage.getItem(\"preferredLang\");\r\n\t\tif (!storedLang) {\r\n\t\t\tif (!storedLang) {\r\n\t\t\t\tconst activeLangElement = document.querySelector(\r\n\t\t\t\t\t\".header__links--language\",\r\n\t\t\t\t);\r\n\t\t\t\tif (activeLangElement) {\r\n\t\t\t\t\tstoredLang = activeLangElement.getAttribute(\"title\") || \"IS\";\r\n\t\t\t\t\tlocalStorage.setItem(\"preferredLang\", storedLang);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tconsole.log(\"LanguageSwitcher.init()\");\r\n\t\tfor (const link of Array.from(\r\n\t\t\tdocument.querySelectorAll(\".header__links--language\"),\r\n\t\t)) {\r\n\t\t\tlink.addEventListener(\"click\", function (this: HTMLElement, event) {\r\n\t\t\t\tconst selectedLang = this.getAttribute(\"title\");\r\n\t\t\t\tlocalStorage.setItem(\"preferredLang\", selectedLang);\r\n\t\t\t\tsessionStorage.setItem(\"preferredLang\", selectedLang);\r\n\t\t\t});\r\n\t\t}\r\n\t},\r\n};\r\n\r\nexport default LanguageSwitcher;\r\n"], "mappings": "gCAAA,IAAMA,EAAmB,CACxB,GAAI,CACH,KAAM,SAAS,iBAA8B,0BAA0B,CACxE,EAEA,MAAa,CACZ,IAAIC,EACH,aAAa,QAAQ,eAAe,GACpC,eAAe,QAAQ,eAAe,EACvC,GAAI,CAACA,GACA,CAACA,EAAY,CAChB,IAAMC,EAAoB,SAAS,cAClC,0BACD,EACIA,IACHD,EAAaC,EAAkB,aAAa,OAAO,GAAK,KACxD,aAAa,QAAQ,gBAAiBD,CAAU,EAElD,CAED,QAAQ,IAAI,yBAAyB,EACrC,QAAWE,KAAQ,MAAM,KACxB,SAAS,iBAAiB,0BAA0B,CACrD,EACCA,EAAK,iBAAiB,QAAS,SAA6BC,EAAO,CAClE,IAAMC,EAAe,KAAK,aAAa,OAAO,EAC9C,aAAa,QAAQ,gBAAiBA,CAAY,EAClD,eAAe,QAAQ,gBAAiBA,CAAY,CACrD,CAAC,CAEH,CACD,EAEOC,EAAQN", "names": ["LanguageSwitcher", "storedLang", "activeLangElement", "link", "event", "selectedLang", "languageSwitcher_default"] }