2023-01-13 05:40:33 +01:00
|
|
|
import { defaultStore } from "@/store";
|
2022-02-08 10:46:39 +01:00
|
|
|
|
|
|
|
const ua = navigator.userAgent.toLowerCase();
|
2023-01-13 05:40:33 +01:00
|
|
|
const isTablet =
|
|
|
|
/ipad/.test(ua) ||
|
|
|
|
(/mobile|iphone|android/.test(ua) && window.innerWidth > 700);
|
2022-02-08 10:46:39 +01:00
|
|
|
const isSmartphone = !isTablet && /mobile|iphone|android/.test(ua);
|
|
|
|
|
2023-01-13 05:40:33 +01:00
|
|
|
export const deviceKind = defaultStore.state.overridedDeviceKind
|
|
|
|
? defaultStore.state.overridedDeviceKind
|
|
|
|
: isSmartphone
|
2024-02-11 18:50:57 +01:00
|
|
|
? "smartphone"
|
|
|
|
: isTablet
|
|
|
|
? "tablet"
|
|
|
|
: "desktop";
|