diff options
Diffstat (limited to 'node_modules/ua-parser-js/readme.md')
-rw-r--r-- | node_modules/ua-parser-js/readme.md | 66 |
1 files changed, 40 insertions, 26 deletions
diff --git a/node_modules/ua-parser-js/readme.md b/node_modules/ua-parser-js/readme.md index 7951d0699..da7bc48ba 100644 --- a/node_modules/ua-parser-js/readme.md +++ b/node_modules/ua-parser-js/readme.md @@ -1,18 +1,26 @@ # UAParser.js -<img align="right" src="https://raw.githubusercontent.com/faisalman/ua-parser-js/gh-pages/images/logo.png"> A not-so-lightweight-anymore JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. +<img align="right" src="https://raw.githubusercontent.com/faisalman/ua-parser-js/gh-pages/images/logo.png"> A JavaScript-based User-Agent string parser. Can be used either in browser (client-side) or in node.js (server-side) environment. Also available as jQuery/Zepto plugin, Bower/Meteor package, & RequireJS/AMD module. This library aims to identify detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model, entirely from user-agent string with a relatively small footprint (~11KB when minified / ~4KB gzipped). Written in vanilla JavaScript, which means it doesn't require any other library and can be used independently. However, it's not recommended to use this library as browser detection since the result may not accurate than using feature detection. [](https://travis-ci.org/faisalman/ua-parser-js) +[](https://www.npmjs.com/package/ua-parser-js) [](https://www.npmjs.com/package/ua-parser-js) [](https://bower.io/) [](https://cdnjs.com/libraries/UAParser.js) [](https://gratipay.com/UAParser.js) [](http://flattr.com/thing/3867907/faisalmanua-parser-js-on-GitHub) -* Author : Faisal Salman <<fyzlman@gmail.com>> +* Author : Faisal Salman <<f@faisalman.com>> * Demo : http://faisalman.github.io/ua-parser-js * Source : https://github.com/faisalman/ua-parser-js +# Constructor + +* `new UAParser([uastring][,extensions])` + * returns new instance + +* `UAParser([uastring][,extensions])` + * returns result object `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }` # Methods @@ -21,14 +29,14 @@ ``` # Possible 'browser.name': -Amaya, Android Browser, Arora, Avant, Baidu, Blazer, Bolt, Camino, Chimera, Chrome, -Chromium, Comodo Dragon, Conkeror, Dillo, Dolphin, Doris, Edge, Epiphany, Fennec, -Firebird, Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, IceCat, IceDragon, -Iceweasel, IE [Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, Links, -Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, +Amaya, Android Browser, Arora, Avant, Baidu, Blazer, Bolt, Bowser, Camino, Chimera, +Chrome [WebView], Chromium, Comodo Dragon, Conkeror, Dillo, Dolphin, Doris, Edge, +Epiphany, Fennec, Firebird, Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, +IceCat, IceDragon, Iceweasel, IE[Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, +Links, Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, MIUI Browser, [Mobile] Safari, Mosaic, Mozilla, Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], -PhantomJS, Phoenix, Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, SlimBrowser, -Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, WeChat, Yandex +PhantomJS, Phoenix, Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, Sleipnir, +SlimBrowser, Swiftfox, Tizen, UCBrowser, Vivaldi, w3m, WeChat, Yandex # 'browser.version' determined dynamically ``` @@ -43,8 +51,8 @@ console, mobile, tablet, smarttv, wearable, embedded # Possible 'device.vendor': Acer, Alcatel, Amazon, Apple, Archos, Asus, BenQ, BlackBerry, Dell, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu, Microsoft, Motorola, Nexian, -Nintendo, Nokia, Nvidia, Ouya, Palm, Panasonic, Polytron, RIM, Samsung, Sharp, -Siemens, Sony-Ericsson, Sprint, Xbox, ZTE +Nintendo, Nokia, Nvidia, OnePlus, Ouya, Palm, Panasonic, Pebble, Polytron, RIM, +Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, ZTE # 'device.model' determined dynamically ``` @@ -68,7 +76,7 @@ Tasman, Trident, w3m, WebKit AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS, Contiki, Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Gentoo, GNU, Haiku, Hurd, iOS, Joli, Linpus, Linux, Mac OS, Mageia, Mandriva, MeeGo, Minix, Mint, Morph OS, NetBSD, -Nintendo, OpenBSD, OpenVMS, OS/2, Palm, PCLinuxOS, Plan9, Playstation, QNX, RedHat, +Nintendo, OpenBSD, OpenVMS, OS/2, Palm, PC-BSD, PCLinuxOS, Plan9, Playstation, QNX, RedHat, RIM Tablet OS, RISC OS, Sailfish, Series40, Slackware, Solaris, SUSE, Symbian, Tizen, Ubuntu, UNIX, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk @@ -80,8 +88,7 @@ Ubuntu, UNIX, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk ``` # Possible 'cpu.architecture' -68k, amd64, arm, arm64, avr, ia32, ia64, irix, irix64, mips, mips64, pa-risc, -ppc, sparc, sparc64 +68k, amd64, arm[64], avr, ia[32/64], irix[64], mips[64], pa-risc, ppc, sparc[64] ``` * `getResult()` @@ -91,7 +98,8 @@ ppc, sparc, sparc64 * returns UA string of current instance * `setUA(uastring)` - * set & parse UA string + * set UA string to parse + * returns current instance # Example @@ -237,20 +245,24 @@ console.log($.ua.browser.name); // "Safari" console.log($.ua.engine.name); // "Webkit" console.log($.ua.device); // {vendor: "Motorola", model: "Xoom", type: "tablet"} console.log(parseInt($.ua.browser.version.split('.')[0], 10)); // 4 + +// Add class to <body> tag +// <body class="ua-browser-safari ua-devicetype-tablet"> +$('body').addClass('ua-browser-' + $.ua.browser.name + ' ua-devicetype-' + $.ua.device.type); ``` ## Extending regex patterns -* `UAParser(uastring[, extensions])` +* `UAParser([uastring,] extensions)` Pass your own regexes to extend the limited matching rules. ```js // Example: -var uaString = 'MyOwnBrowser/1.3'; var myOwnRegex = [[/(myownbrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]]; -var parser = new UAParser(uaString, { browser: myOwnRegex }); -console.log(parser.getBrowser()); // {name: "MyOwnBrowser", version: "1.3"} +var myParser = new UAParser({ browser: myOwnRegex }); +var uaString = 'Mozilla/5.0 MyOwnBrowser/1.3'; +console.log(myParser.setUA(uaString).getBrowser()); // {name: "MyOwnBrowser", version: "1.3"} ``` @@ -261,15 +273,10 @@ console.log(parser.getBrowser()); // {name: "MyOwnBrowser", version: "1.3"} * Fork and clone this repository * Make some changes as required * Write a unit test to showcase your feature -* Run the test suites to make sure the changes you made didn't break anything - -```sh -$ npm run test -``` - +* Run the test suites to make sure the changes you made didn't break anything `$ npm run test` * Commit and push to your own repository * Submit a pull request to this repository under `develop` branch -* Profit? +* Profit? $$$ ## Build @@ -280,6 +287,13 @@ $ npm run build ``` +# Donate + +Do you use & like UAParser.js but you don’t find a way to show some love? If yes, please consider donating to support this project. Otherwise, no worries, regardless of whether there is support or not, I will keep maintaining this project. Still, if you buy me a cup of coffee I would be more than happy though :) + +[](https://pledgie.com/campaigns/34252) + + # License Dual licensed under GPLv2 & MIT |