/// let idle_timer function reset_idle() { if (idle_timer) clearTimeout(idle_timer) idle_timer = setTimeout(() => { if (window.location.pathname != "/" || window.location.search != "") window.location.href = "/" idle_timer = undefined }, 30 * 1000) } document.addEventListener("DOMContentLoaded", () => { reset_idle() }) document.addEventListener("keydown", ev => { reset_idle() if (ev.ctrlKey || ev.altKey) return if (ev.code == "F5" || (ev.ctrlKey && ev.code == "KeyR")) return window.location.reload() // reimplement reload for electron usage if (!(document.activeElement instanceof HTMLInputElement)) { if (ev.code.startsWith("Digit")) { if (document.forms.buy_product) return document.forms.buy_product.pcode.value += ev.code.substring(5) } else if (ev.code == "Enter") { if (document.forms.buy_product) return document.forms.buy_product.submit() if (document.forms.user_creation) return document.forms.user_creation.submit() } else if (ev.code.startsWith("Key") || ev.code == "Space") { if (document.forms.user_creation) return document.forms.user_creation.create_user.value += ev.key } else if (ev.code == "Backspace") { if (document.forms.user_creation) return document.forms.user_creation.create_user.value = "" } else if (ev.code == "Escape") { window.location.href = "/" ev.preventDefault() } } }) document.addEventListener("mousemove", () => reset_idle()) document.addEventListener("mousedown", () => reset_idle())