From d6ceb356e5a0592997a5ac66dc13affb1353e99e Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Sun, 24 Sep 2023 21:36:18 +0200 Subject: [PATCH] mobile warning --- bin/web/js/main.js | 4 ++++ bin/web/js/utils.js | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/bin/web/js/main.js b/bin/web/js/main.js index b3f09cc..413d4a1 100644 --- a/bin/web/js/main.js +++ b/bin/web/js/main.js @@ -37,6 +37,7 @@ import { downloadFile, hashFromString, clone, + isMobile, } from './utils.js'; import { @@ -171,6 +172,9 @@ const findInjectPanel = () => { }; window.onload = () => { + if (isMobile()) { + alert('Variable Time is a tool currently designed to be used on desktop.'); + } window.addEventListener('panelEvent', (e) => { clearTimeout(window.panelFinderTimeout); let target = false; diff --git a/bin/web/js/utils.js b/bin/web/js/utils.js index fb54ae8..4896b28 100644 --- a/bin/web/js/utils.js +++ b/bin/web/js/utils.js @@ -386,6 +386,15 @@ const mapValue = (value, low1, high1, low2, high2, clamp=false) => { return clamp ? Math.min(high2 > low2 ? high2 : low2, Math.max(low2 < high2 ? low2 : high2, mapped)) : mapped; } +const isMobile = () => { + if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { + return true; + } else if (navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform)) { + return true; + } + return false; +}; + ///////////////////////////////////// export {