diff --git a/src/UI/RemoveOtherLanguages.js b/src/UI/RemoveOtherLanguages.js deleted file mode 100644 index 7486047ca..000000000 --- a/src/UI/RemoveOtherLanguages.js +++ /dev/null @@ -1,31 +0,0 @@ -let lang = ( - (navigator.languages && navigator.languages[0]) || - navigator.language || - navigator["userLanguage"] || - "en" -).substr(0, 2) - -function filterLangs(maindiv) { - let foundLangs = 0 - for (const child of Array.from(maindiv.children)) { - if (child.attributes.getNamedItem("lang")?.value === lang) { - foundLangs++ - } - } - if (foundLangs === 0) { - lang = "en" - } - for (const child of Array.from(maindiv.children)) { - const childLang = child.attributes.getNamedItem("lang") - if (childLang === undefined) { - continue - } - if (childLang.value === lang) { - continue - } - child.parentElement.removeChild(child) - } -} - -filterLangs(document.getElementById("descriptions-while-loading")) -filterLangs(document.getElementById("default-title")) diff --git a/src/UI/RemoveOtherLanguages.ts b/src/UI/RemoveOtherLanguages.ts new file mode 100644 index 000000000..207a64098 --- /dev/null +++ b/src/UI/RemoveOtherLanguages.ts @@ -0,0 +1,32 @@ +export {} +let lang = ( + (navigator.languages && navigator.languages[0]) || + navigator.language || + navigator["userLanguage"] || + "en" +).substr(0, 2) + +function filterLangs(maindiv) { + let foundLangs = 0 + for (const child of Array.from(maindiv.children)) { + if (child.attributes.getNamedItem("lang")?.value === lang) { + foundLangs++ + } + } + if (foundLangs === 0) { + lang = "en" + } + for (const child of Array.from(maindiv.children)) { + const childLang = child.attributes.getNamedItem("lang") + if (childLang === undefined) { + continue + } + if (childLang.value === lang) { + continue + } + child.parentElement.removeChild(child) + } +} + +filterLangs(document.getElementById("descriptions-while-loading")) +filterLangs(document.getElementById("default-title")) diff --git a/theme.html b/theme.html index e8674e27e..239c52c56 100644 --- a/theme.html +++ b/theme.html @@ -73,7 +73,7 @@ - +