1function getDeviceType() {
2 const ua = navigator.userAgent;
3
4 if (/mobile/i.test(ua)) {
5 return "Mobile";
6 } else if (/tablet/i.test(ua)) {
7 return "Tablet";
8 } else {
9 return "Desktop";
10 }
11}
12
13if (getDeviceType() !== "Desktop") {
14 if (location.pathname !== "/") {
15 location.href = "/";
16 }
17}
18
19document.addEventListener("DOMContentLoaded", () => {
20 if (getDeviceType() !== "Desktop") {
21 const warning = document.getElementById("warning");
22 if (warning) {
23 warning.checked = true;
24 }
25 }
26});