removed old cookierequests

This commit is contained in:
Zan
2025-09-23 20:40:37 +02:00
parent 636a325470
commit 4180fe823b
5 changed files with 9 additions and 110 deletions

View File

@@ -226,11 +226,10 @@
</div>
<footer class="popup-footer">
<div class="version-info" id="version">v1.1.0</div>
<div class="version-info" id="version">v1.3.0</div>
</footer>
</div>
<script src="../tools/storageManager.js"></script>
<script src="../tools/cookieManager.js"></script>
<script src="../global/language.js"></script>
<script src="index.js"></script>
</body>

View File

@@ -3,38 +3,9 @@ document.addEventListener("DOMContentLoaded", async () => {
await new Promise((resolve) => setTimeout(resolve, 10));
}
function getCookie(name) {
const cookieName = `${name}=`;
const decodedCookie = decodeURIComponent(document.cookie);
const cookieArray = decodedCookie.split(";");
for (let i = 0; i < cookieArray.length; i++) {
let cookie = cookieArray[i];
while (cookie.charAt(0) === " ") {
cookie = cookie.substring(1);
}
if (cookie.indexOf(cookieName) === 0) {
return cookie.substring(cookieName.length, cookie.length);
}
}
return null;
}
function setCookie(name, value, days = 365) {
const date = new Date();
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
const expires = `expires=${date.toUTCString()}`;
document.cookie = `${name}=${value}; ${expires}; path=/; domain=.e-kreta.hu`;
}
function getCurrentTheme() {
return (
localStorage.getItem("themePreference") ||
getCookie("themePreference") ||
"light-green"
);
}
@@ -50,7 +21,6 @@ document.addEventListener("DOMContentLoaded", async () => {
function getCurrentLanguage() {
return (
localStorage.getItem("languagePreference") ||
getCookie("languagePreference") ||
"hu"
);
}
@@ -63,7 +33,6 @@ document.addEventListener("DOMContentLoaded", async () => {
}
async function applyLanguage(language) {
setCookie("languagePreference", language);
localStorage.setItem("languagePreference", language);
updateLanguageButtons(language);
@@ -80,7 +49,6 @@ document.addEventListener("DOMContentLoaded", async () => {
}
async function applyTheme(theme) {
setCookie("themePreference", theme);
localStorage.setItem("themePreference", theme);
document.documentElement.setAttribute("data-theme", theme);
@@ -142,8 +110,6 @@ document.addEventListener("DOMContentLoaded", async () => {
const versionElement = document.getElementById("version");
versionElement.textContent = `v${manifest.version}`;
themeButtons.forEach((button) => {
button.addEventListener("mouseover", () => {
if (!button.hasAttribute("disabled")) {
@@ -233,12 +199,10 @@ document.addEventListener("DOMContentLoaded", async () => {
const theme = this.customThemes.find(t => t.id === themeId);
if (theme) {
this.applyCustomThemeColors(theme.colors);
setCookie("themePreference", themeId);
localStorage.setItem("themePreference", themeId);
}
} else {
document.documentElement.setAttribute('data-theme', themeId);
setCookie("themePreference", themeId);
localStorage.setItem("themePreference", themeId);
}
updateThemeButtons(themeId);