web/cobalt.js: enable ios adaptations for ipados

& clean up user agent matching
This commit is contained in:
wukko 2024-05-10 19:11:57 +06:00
parent 94b8d647f5
commit 7cf08c5eeb
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -1,9 +1,9 @@
const ua = navigator.userAgent.toLowerCase(); const ua = navigator.userAgent.toLowerCase();
const isIOS = ua.match("iphone os"); const isIOS = ua.includes("iphone os") || (ua.includes("mac os") && navigator.maxTouchPoints > 0);
const isMobile = ua.match("android") || ua.match("iphone os"); const isMobile = ua.includes("android") || ua.includes("iphone os");
const isSafari = ua.match("safari/"); const isSafari = ua.includes("safari/");
const isFirefox = ua.match("firefox/"); const isFirefox = ua.includes("firefox/");
const isOldFirefox = ua.match("firefox/") && ua.split("firefox/")[1].split('.')[0] < 103; const isOldFirefox = ua.includes("firefox/") && ua.split("firefox/")[1].split('.')[0] < 103;
const switchers = { const switchers = {
"theme": ["auto", "light", "dark"], "theme": ["auto", "light", "dark"],