add isIOS13

This commit is contained in:
Harvey Zack committed 2023-05-05 13:08:07 +08:00
1 parent f6d6113423
commit cf6670bc53
3 files changed
+5 -2

No files matched your search

+1
View File
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- 使用 `switchUrl` 或者 `switchQuality` 方法切换地址后会保持原有的调整如:`aspectRatio`, `playbackRate`, `flip`, `autoSize`
- 删除 `switchUrl` 方法和 `switchQuality` 方法的第二个 `name` 参数
- 添加 `isIOS13` 工具,用于修复在 `IOS13` 以上版本的设备上的 `isMobile` 判断不准确的问题
## [5.0.6] - 2023-5-3
@@ -1,7 +1,8 @@
export const userAgent = typeof window !== 'undefined' ? window.navigator.userAgent : '';
export const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
export const userAgent = typeof navigator !== 'undefined' ? navigator.userAgent : '';
export const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);
export const isWechat = /MicroMessenger/i.test(userAgent);
export const isIE = /MSIE|Trident/i.test(userAgent);
export const isAndroid = /android/i.test(userAgent);
export const isIOS = /iPad|iPhone|iPod/i.test(userAgent) && !window.MSStream;
export const isIOS13 = isIOS || (userAgent.includes('Macintosh') && navigator.maxTouchPoints >= 1);
export const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) || isIOS13;
+1
View File
@@ -6,6 +6,7 @@ export type Utils = {
isIE: boolean;
isAndroid: boolean;
isIOS: boolean;
isIOS13: boolean;
query(selector: string, parent?: HTMLElement): HTMLElement;
queryAll(selector: string, parent?: HTMLElement): HTMLElement[];
addClass(target: HTMLElement, className: string): void;