-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Showing
17 changed files
with
150 additions
and
81 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"title": "UAParser.js", | ||
"name": "ua-parser-js", | ||
"version": "2.0.0-rc.1", | ||
"version": "2.0.0-rc.2", | ||
"author": "Faisal Salman <[email protected]> (http://faisalman.com)", | ||
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client Hints data. Supports browser & node.js environment", | ||
"keywords": [ | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/////////////////////////////////////////////// | ||
/* Enums for UAParser.js v2.0.0-rc.1 | ||
/* Enums for UAParser.js v2.0.0-rc.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
|
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
// Source: /src/enums/ua-parser-enums.js | ||
|
||
/////////////////////////////////////////////// | ||
/* Enums for UAParser.js v2.0.0-rc.1 | ||
/* Enums for UAParser.js v2.0.0-rc.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
|
@@ -12,8 +12,9 @@ | |
/*jshint esversion: 6 */ | ||
|
||
const Browser = Object.freeze({ | ||
'2345_EXPLORER': '2345Explorer', | ||
'360': '360 Browser', | ||
'115': '115', | ||
'2345': '2345', | ||
'360': '360', | ||
ALIPAY: 'Alipay', | ||
AMAYA: 'Amaya', | ||
ANDROID: 'Android Browser', | ||
|
@@ -36,11 +37,11 @@ const Browser = Object.freeze({ | |
CHROMIUM: 'Chromium', | ||
COBALT: 'Cobalt', | ||
COC_COC: 'Coc Coc', | ||
COMODO_DRAGON: 'Comodo Dragon', | ||
CONKEROR: 'Conkeror', | ||
DILLO: 'Dillo', | ||
DOLPHIN: 'Dolphin', | ||
DORIS: 'Doris', | ||
DRAGON: 'Dragon', | ||
DUCKDUCKGO: 'DuckDuckGo', | ||
EDGE: 'Edge', | ||
EPIPHANY: 'Epiphany', | ||
|
@@ -78,6 +79,7 @@ const Browser = Object.freeze({ | |
KLARNA: 'Klarna', | ||
KINDLE: 'Kindle', | ||
LENOVO: 'Smart Lenovo Browser', | ||
LIBREWOLF: 'LibreWolf', | ||
LIEBAO: 'LBBROWSER', | ||
LINE: 'Line', | ||
LINKEDIN: 'LinkedIn', | ||
|
@@ -126,7 +128,9 @@ const Browser = Object.freeze({ | |
SILK: 'Silk', | ||
SKYFIRE: 'Skyfire', | ||
SLEIPNIR: 'Sleipnir', | ||
SLIMBOAT: 'SlimBoat', | ||
SLIMBROWSER: 'SlimBrowser', | ||
SLIMJET: 'Slimjet', | ||
SNAPCHAT: 'Snapchat', | ||
SOGOU_EXPLORER: 'Sogou Explorer', | ||
SOGOU_MOBILE: 'Sogou Mobile', | ||
|
@@ -291,6 +295,10 @@ const OS = Object.freeze({ | |
CENTOS: 'CentOS', | ||
CHROME_OS: 'Chrome OS', | ||
CHROMECAST: 'Chromecast', | ||
CHROMECAST_ANDROID: 'Chromecast Android', | ||
CHROMECAST_FUCHSIA: 'Chromecast Fuchsia', | ||
CHROMECAST_LINUX: 'Chromecast Linux', | ||
CHROMECAST_SMARTSPEAKER: 'Chromecast SmartSpeaker', | ||
CONTIKI: 'Contiki', | ||
DEBIAN: 'Debian', | ||
DEEPIN: 'Deepin', | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/////////////////////////////////////////////// | ||
/* Extensions for UAParser.js v2.0.0-rc.1 | ||
/* Extensions for UAParser.js v2.0.0-rc.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
|
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
// Source: /src/extensions/ua-parser-extensions.js | ||
|
||
/////////////////////////////////////////////// | ||
/* Extensions for UAParser.js v2.0.0-rc.1 | ||
/* Extensions for UAParser.js v2.0.0-rc.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/////////////////////////////////////////////// | ||
/* Helpers for UAParser.js v2.0.0-rc.1 | ||
/* Helpers for UAParser.js v2.0.0-rc.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
|
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 |
---|---|---|
|
@@ -3,17 +3,19 @@ | |
// Source: /src/helpers/ua-parser-helpers.js | ||
|
||
/////////////////////////////////////////////// | ||
/* Helpers for UAParser.js v2.0.0-rc.1 | ||
/* Helpers for UAParser.js v2.0.0-rc.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
////////////////////////////////////////////// | ||
|
||
/*jshint esversion: 6 */ | ||
|
||
import { CPU, OS, Engine } from './enums/ua-parser-enums.mjs'; | ||
import { UAParser } from './main/ua-parser.mjs'; | ||
import { UAParser } from '../main/ua-parser.mjs'; | ||
import { CPU, OS, Engine } from '../enums/ua-parser-enums.mjs'; | ||
import { isFromEU } from 'detect-europe-js'; | ||
import { isFrozenUA } from 'ua-is-frozen'; | ||
import { isStandalonePWA } from 'is-standalone-pwa'; | ||
|
||
const getDeviceVendor = (model) => UAParser(`Mozilla/5.0 (Linux; Android 10; ${model}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36`).device.vendor; | ||
|
||
|
@@ -37,26 +39,17 @@ const isAppleSilicon = (res) => { | |
return false; | ||
} | ||
|
||
const isBot = (res) => ['cli', 'crawler', 'fetcher', 'module'].includes(res.browser.type); | ||
|
||
const isChromeFamily = (res) => res.engine.is(Engine.BLINK); | ||
|
||
const isElectron = () => !!(process?.versions?.hasOwnProperty('electron') || // node.js | ||
/ electron\//i.test(navigator?.userAgent)); // browser | ||
|
||
const isFrozenUA = (ua) => /^Mozilla\/5\.0 \((Windows NT 10\.0; Win64; x64|Macintosh; Intel Mac OS X 10_15_7|X11; Linux x86_64|X11; CrOS x86_64 14541\.0\.0|Fuchsia|Linux; Android 10; K)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/\d+\.0\.0\.0 (Mobile )?Safari\/537\.36/.test(ua); | ||
|
||
const isStandalonePWA = () => window && (window.matchMedia('(display-mode: standalone)').matches || | ||
// iOS | ||
navigator.standalone || | ||
// Android | ||
document.referrer.startsWith('android-app://') || | ||
// Windows | ||
window.Windows || | ||
/trident.+(msapphost|webview)\//i.test(navigator.userAgent) || | ||
document.referrer.startsWith('app-info://platform/microsoft-store')); | ||
|
||
export { | ||
getDeviceVendor, | ||
isAppleSilicon, | ||
isBot, | ||
isChromeFamily, | ||
isElectron, | ||
isFromEU, | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
///////////////////////////////////////////////////////////////////////////////// | ||
/* UAParser.js v2.0.0-rc.1 | ||
/* UAParser.js v2.0.0-rc.2 | ||
Copyright © 2012-2024 Faisal Salman <[email protected]> | ||
AGPLv3 License *//* | ||
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. | ||
|
@@ -19,7 +19,7 @@ | |
// Constants | ||
///////////// | ||
|
||
var LIBVERSION = '2.0.0-rc.1', | ||
var LIBVERSION = '2.0.0-rc.2', | ||
EMPTY = '', | ||
UNKNOWN = '?', | ||
FUNC_TYPE = 'function', | ||
|
Oops, something went wrong.