-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af77f6a
commit b449ca0
Showing
191 changed files
with
17,473 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "browser", { | ||
enumerable: true, | ||
get: ()=>browser | ||
}); | ||
const nav = typeof navigator != "undefined" ? navigator : null; | ||
const doc = typeof document != "undefined" ? document : null; | ||
const agent = nav && nav.userAgent || ""; | ||
const ie_edge = /Edge\/(\d+)/.exec(agent); | ||
const ie_upto10 = /MSIE \d/.exec(agent); | ||
const ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent); | ||
const ie = !!(ie_upto10 || ie_11up || ie_edge); | ||
const ie_version = ie_upto10 ? document.documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0; | ||
const gecko = !ie && /gecko\/(\d+)/i.test(agent); | ||
const gecko_version = gecko && +(/Firefox\/(\d+)/.exec(agent) || [ | ||
0, | ||
0 | ||
])[1]; | ||
const _chrome = !ie && /Chrome\/(\d+)/.exec(agent); | ||
const chrome = !!_chrome; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const chrome_version = _chrome ? +_chrome[1] : 0; | ||
const safari = !ie && !!nav && /Apple Computer/.test(nav.vendor); | ||
// Is true for both iOS and iPadOS for convenience | ||
const ios = safari && (/Mobile\/\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2); | ||
const mac = ios || (nav ? /Mac/.test(nav.platform) : false); | ||
const windows = nav ? /Win/.test(nav.platform) : false; | ||
const android = /Android \d/.test(agent); | ||
const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style; | ||
const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [ | ||
0, | ||
0 | ||
])[1] : 0; | ||
const browser = { | ||
ie, | ||
ie_version, | ||
gecko, | ||
gecko_version, | ||
chrome, | ||
chrome_version, | ||
safari, | ||
ios, | ||
mac, | ||
windows, | ||
android, | ||
webkit, | ||
webkit_version | ||
}; |
Oops, something went wrong.