From 4c570889bf21430112d0dd3c2145248208a8144b Mon Sep 17 00:00:00 2001 From: PGSCOM <69808296+PGSCOM@users.noreply.github.com> Date: Tue, 1 Apr 2025 22:47:44 +0200 Subject: [PATCH] Fix: Language reorder by time zone --- main.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 6136e51..fc090f6 100644 --- a/main.js +++ b/main.js @@ -7805,11 +7805,23 @@ async function main() { }); var currentTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone; - + if (timezones.includes(currentTimezone)) { - var el = getById("languagesList").querySelector("li a[data-tz*='" + currentTimezone + "']"); // select language li - el.parentElement.removeChild(el); // remove it - getById("languagesList").insertBefore(el, getById("languagesList").querySelector("li:nth-child(2)")); // insert it after English + var list = getById("languagesList"); + // Find the link element matching the timezone + var el = list.querySelector("li a[data-tz*='" + currentTimezone + "']"); + + if (el) { + var targetLi = el.parentElement; // Get the parent