server/aspnetapp/wwwroot/lib/swiper/src/utils/device.js
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
import { window } from 'ssr-window';
import Support from './support';
const Device = (function Device() {
const platform = window.navigator.platform;
const ua = window.navigator.userAgent;
const device = {
ios: false,
android: false,
androidChrome: false,
desktop: false,
iphone: false,
ipod: false,
ipad: false,
edge: false,
ie: false,
firefox: false,
macos: false,
windows: false,
cordova: !!(window.cordova || window.phonegap),
phonegap: !!(window.cordova || window.phonegap),
electron: false,
};
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const ie = ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
const edge = ua.indexOf('Edge/') >= 0;
const firefox = ua.indexOf('Gecko/') >= 0 && ua.indexOf('Firefox/') >= 0;
const windows = platform === 'Win32';
const electron = ua.toLowerCase().indexOf('electron') >= 0;
let macos = platform === 'MacIntel';
// iPadOs 13 fix
if (!ipad
&& macos
&& Support.touch
&& (
(screenWidth === 1024 && screenHeight === 1366) // Pro 12.9
|| (screenWidth === 834 && screenHeight === 1194) // Pro 11
|| (screenWidth === 834 && screenHeight === 1112) // Pro 10.5
|| (screenWidth === 768 && screenHeight === 1024) // other
)
) {
ipad = ua.match(/(Version)\/([\d.]+)/);
macos = false;
}
device.ie = ie;
device.edge = edge;
device.firefox = firefox;
// Android
if (android && !windows) {
后面还有 57 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。