From 7cf08c5eeb485819b5f3c4b666148097e63b79d7 Mon Sep 17 00:00:00 2001 From: wukko Date: Fri, 10 May 2024 19:11:57 +0600 Subject: [PATCH] web/cobalt.js: enable ios adaptations for ipados & clean up user agent matching --- src/front/cobalt.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/front/cobalt.js b/src/front/cobalt.js index d121b3a2..be79ea27 100644 --- a/src/front/cobalt.js +++ b/src/front/cobalt.js @@ -1,9 +1,9 @@ const ua = navigator.userAgent.toLowerCase(); -const isIOS = ua.match("iphone os"); -const isMobile = ua.match("android") || ua.match("iphone os"); -const isSafari = ua.match("safari/"); -const isFirefox = ua.match("firefox/"); -const isOldFirefox = ua.match("firefox/") && ua.split("firefox/")[1].split('.')[0] < 103; +const isIOS = ua.includes("iphone os") || (ua.includes("mac os") && navigator.maxTouchPoints > 0); +const isMobile = ua.includes("android") || ua.includes("iphone os"); +const isSafari = ua.includes("safari/"); +const isFirefox = ua.includes("firefox/"); +const isOldFirefox = ua.includes("firefox/") && ua.split("firefox/")[1].split('.')[0] < 103; const switchers = { "theme": ["auto", "light", "dark"],