@polyv/utils
Version:
Utility functions of Polyv frontend development.
1 lines • 954 B
JavaScript
export function isMobile(){const t=navigator.userAgent;return!/\(X11[;)]/i.test(t)&&!/\b(Windows\sNT|Macintosh)\b/.test(t)&&/mobile|tablet|android/i.test(t)}export function hasMobileFeature(){const t=navigator.platform;return"onorientationchange"in window&&"number"==typeof window.orientation||(!!/^(iPhone|iPod|iPad)/.test(t)||"Win32"!==t&&!/^Linux\s*(x86|i686)/.test(t)&&("MacIntel"===t||"Macintosh"===t?navigator.maxTouchPoints>0:"function"==typeof matchMedia&&(matchMedia("(hover: none)").matches&&matchMedia("(pointer: coarse)").matches&&!matchMedia("(pointer: fine)").matches)))}export function isMaxthon(){const t=navigator.userAgent;if(/\bMaxthon\b/i.test(t))return!0;if("maxthon"in window){const t=window.maxthon;return"function"==typeof t.IsMaxthon&&t.IsMaxthon()}return!1}export function supportMSEH264(){const t=window.MediaSource;return t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}