const SPANISH_MESSAGE = "Versión en español" const SPANISH_BUTTON = "No mostrar esto de nuevo" const ENGLISH_MESSAGE = "English page" const ENGLISH_BUTTON = "Do not show me this again" if (redirect_notice_enabled()) { let language = (navigator.language || navigator.userLanguage).split("-")[0] if (location.pathname.startsWith("/en")) { if (language === "es") { add_redirect_notice(location.pathname.replace("/en", "").slice(0, -1), SPANISH_MESSAGE, SPANISH_BUTTON) } } else if (!["recommendations", "projects", "links"].includes(location.pathname.split("/")[1])) { if (language !== "es") { add_redirect_notice("/en" + location.pathname.slice(0, -1), ENGLISH_MESSAGE, ENGLISH_BUTTON) } } } function add_redirect_notice(redirect, message, btn_message) { let main = document.getElementsByTagName("main").item(0) let div = document.createElement("div") div.classList.add("redirect-notice") div.innerHTML = `