From 95c46d824e24661682bc583929579752b747f3e8 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Wed, 19 Oct 2022 21:20:34 +0400 Subject: [PATCH] Converted spaces to tabs to reduce file sizes. --- homepage/static/assets/js/captcha_refresh.js | 34 ++++++++++---------- homepage/static/assets/js/mindflow.js | 14 ++++---- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/homepage/static/assets/js/captcha_refresh.js b/homepage/static/assets/js/captcha_refresh.js index 6f686af..54b0822 100644 --- a/homepage/static/assets/js/captcha_refresh.js +++ b/homepage/static/assets/js/captcha_refresh.js @@ -6,15 +6,15 @@ let g_captcha_timeout_remain = g_captcha_timeout_seconds; let g_current_captcha_id = captcha_hidden_field.value; function getColorScheme() { - return window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark"; + return window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark"; } async function getNewCaptcha() { - const id = await fetch("/captcha/").then(r => r.text()); - g_current_captcha_id = id; - captcha_hidden_field.value = id; - setTimeout(() => { captcha_img.src = `/captcha/${id}/image?style=${getColorScheme()}` }, 600); - g_captcha_timeout_remain = g_captcha_timeout_seconds; + const id = await fetch("/captcha/").then(r => r.text()); + g_current_captcha_id = id; + captcha_hidden_field.value = id; + setTimeout(() => { captcha_img.src = `/captcha/${id}/image?style=${getColorScheme()}` }, 600); + g_captcha_timeout_remain = g_captcha_timeout_seconds; } const captcha_span = document.getElementsByClassName("captcha")[0]; @@ -22,27 +22,27 @@ const captcha_img = captcha_span.children[1]; captcha_span.classList.toggle("refresh"); captcha_span.children[3].innerHTML = - `ed in 600 seconds.`; + `ed in 600 seconds.`; const captcha_refresh = document.getElementById("refresh"); const captcha_remain = document.getElementById("remain"); captcha_refresh.classList.toggle("refresh"); captcha_refresh.addEventListener("click", async e => { - e.preventDefault(); - captcha_refresh.disabled = true; - setTimeout(async () => { - captcha_refresh.disabled = false; - await fetch(`/captcha/${g_current_captcha_id}?remove`); }, 3000); - document.getElementsByName("captcha_answer")[0].value = ""; - await getNewCaptcha(); + e.preventDefault(); + captcha_refresh.disabled = true; + setTimeout(async () => { + captcha_refresh.disabled = false; + await fetch(`/captcha/${g_current_captcha_id}?remove`); }, 3000); + document.getElementsByName("captcha_answer")[0].value = ""; + await getNewCaptcha(); }); // Remove unused CAPTCHA on a server. window.addEventListener("unload", () => fetch(`/captcha/${g_current_captcha_id}?remove`)); setInterval(async () => { - captcha_remain.innerText = --g_captcha_timeout_remain; - if (g_captcha_timeout_remain == 0) - await getNewCaptcha(); + captcha_remain.innerText = --g_captcha_timeout_remain; + if (g_captcha_timeout_remain == 0) + await getNewCaptcha(); }, 1000); \ No newline at end of file diff --git a/homepage/static/assets/js/mindflow.js b/homepage/static/assets/js/mindflow.js index 7770fb5..37bbae9 100644 --- a/homepage/static/assets/js/mindflow.js +++ b/homepage/static/assets/js/mindflow.js @@ -4,10 +4,10 @@ const articles = document.getElementsByTagName("article"); document.getElementById("filter").classList.remove("hidden"); for (let i = 0; i < buttons.length; ++i) - if (buttons[i].name !== "") - buttons[i].addEventListener("click", e => { - for (let j = 0; j < articles.length; ++j) - if (articles[j].id.startsWith(e.target.name) || e.target.name === "all") - articles[j].classList.remove("hidden"); - else - articles[j].classList.add("hidden"); }); \ No newline at end of file + if (buttons[i].name !== "") + buttons[i].addEventListener("click", e => { + for (let j = 0; j < articles.length; ++j) + if (articles[j].id.startsWith(e.target.name) || e.target.name === "all") + articles[j].classList.remove("hidden"); + else + articles[j].classList.add("hidden"); }); \ No newline at end of file