2019-04-01 22:35:46 +03:00
|
|
|
const mobileQuery = getComputedStyle(document.body).getPropertyValue("--phoneWidth");
|
|
|
|
const isMobile = () => window.matchMedia(mobileQuery).matches;
|
|
|
|
|
2020-09-27 16:49:58 +03:00
|
|
|
const languageSelector = document.querySelector(".language-selector-current");
|
|
|
|
const moreLanguagesContainer = document.querySelector(".language-selector__more");
|
2019-04-01 22:35:46 +03:00
|
|
|
|
2020-09-27 16:49:58 +03:00
|
|
|
document.body.addEventListener("click", () => {
|
|
|
|
if (
|
|
|
|
!isMobile() &&
|
|
|
|
moreLanguagesContainer &&
|
|
|
|
!moreLanguagesContainer.classList.contains("hidden")
|
|
|
|
) {
|
|
|
|
moreLanguagesContainer.classList.add("hidden");
|
|
|
|
}
|
|
|
|
});
|
2019-08-13 09:44:06 +03:00
|
|
|
|
2020-09-27 16:49:58 +03:00
|
|
|
languageSelector &&
|
|
|
|
languageSelector.addEventListener("click", (e) => {
|
|
|
|
if (!isMobile()) {
|
|
|
|
e.stopPropagation();
|
|
|
|
moreLanguagesContainer.classList.toggle("hidden");
|
|
|
|
}
|
2019-04-01 22:35:46 +03:00
|
|
|
});
|