Skip to content

best way to save what you love

web/cobalt.js: enable ios adaptations for ipados

wukko7cf08c5eeb48
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"],