File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed
Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -31,22 +31,22 @@ import Article from "../layouts/templates/Article.astro";
3131 </section >
3232 </Article >
3333 </div >
34+ </Shell >
3435
35- <script >
36- function register() {
37- const localeElements = document.querySelectorAll("[data-translation]");
38- const pathname = window.location.pathname;
39- const activeElement =
40- Array.from(localeElements).find(
41- (el) => el instanceof HTMLElement && pathname.startsWith(`/${el.dataset.translation}/`),
42- ) || document.querySelector('[data-translation="de"]');
36+ <script >
37+ function register() {
38+ const localeElements = document.querySelectorAll("[data-translation]");
39+ const pathname = window.location.pathname;
40+ const activeElement =
41+ Array.from(localeElements).find(
42+ (el) => el instanceof HTMLElement && pathname.startsWith(`/${el.dataset.translation}/`),
43+ ) || document.querySelector('[data-translation="de"]');
4344
44- if (activeElement instanceof HTMLElement) {
45- activeElement.classList.add("active");
46- }
45+ if (activeElement instanceof HTMLElement) {
46+ activeElement.classList.add("active");
4747 }
48+ }
4849
49- register();
50- document.addEventListener("astro:after-swap", register);
51- </script >
52- </Shell >
50+ register();
51+ document.addEventListener("astro:after-swap", register);
52+ </script >
You can’t perform that action at this time.
0 commit comments