From d4e1908fb30c0a66e30398072667ff0358a90e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Sieroci=C5=84ski?= Date: Mon, 26 Oct 2020 21:43:37 +0100 Subject: [PATCH] Added SamsungInternet browser --- dist/smartbear-browser-info.embed.min.js | 4 ++-- dist/smartbear-browser-info.embed.min.js.map | 2 +- dist/smartbear-browser-info.js | 4 ++-- dist/smartbear-browser-info.js.map | 2 +- dist/smartbear-browser-info.min.js | 4 ++-- dist/smartbear-browser-info.min.js.map | 2 +- package-lock.json | 2 +- package.json | 2 +- src/known-browsers.js | 3 ++- 9 files changed, 13 insertions(+), 12 deletions(-) diff --git a/dist/smartbear-browser-info.embed.min.js b/dist/smartbear-browser-info.embed.min.js index 3484152..fe52e94 100644 --- a/dist/smartbear-browser-info.embed.min.js +++ b/dist/smartbear-browser-info.embed.min.js @@ -1,3 +1,3 @@ -/* @smartbear/browser-info v1.1.1 | Copyright 2020 (c) SmartBear Software and contributors | https://github.com/SmartBear/browser-info/blob/master/LICENSE */ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self)["@smartbear/browser-info"]=n()}(this,(function(){"use strict";const e=/^\d+/;class n{constructor(e,n){this.name=e,this.pattern=n}match(n){const r=n.match(this.pattern);if(null===r)return null;const t={name:this.name,version:null,release:null};return void 0!==r[1]&&(t.version=r[1].replace("_","."),t.release=parseInt(t.version.match(e)[0],10)),t}}const r=[new n("Firefox",/Firefox\/([0-9.]+)/),new n("Opera",/OPR\/([0-9.]+)/),new n("Edge",/Edge\/([0-9.]+)/),new n("Maxthon",/Maxthon\/([0-9.]+)/),new n("Chrome",/Chrome\/([0-9.]+)/),new n("Safari",/Version\/([0-9.]+) Safari\//),new n("InternetExplorer",/MSIE ([0-9.]+)/)],t=[new n("Windows",/Windows NT ([0-9.]+)/),new n("Windows Phone",/Windows Phone ([0-9.]+)/),new n("MacOS",/OS X ([0-9._]+)/),new n("iOS",/iPhone OS ([0-9_.]+)/),new n("iPadOS",/iPad.+?OS ([0-9_,]+)/),new n("ChromeOS",/CrOS [^ ]+ ([0-9.]+)/),new n("Android",/(?:Android|Adr) ([0-9.]+)/),new n("BlackBerry",/BlackBerry|BB10/),new n("webOS",/webOS\/([0-9.]+)/),new n("Linux",/Linux/)],o={os:"?",name:"?",release:"?",version:"?",detect(e=null){const n="string"==typeof e?e:window.navigator.userAgent;let o=!1;for(const e of r){let r=e.match(n);if(null!==r){this.name=r.name,this.release=r.release,this.version=r.version,o=!0;break}}for(const e of t){let r=e.match(n);if(null!==r){this.os=r.name;break}}return o},toString(){return`${this.name} ${this.version}`},get versionAsNumber(){return parseInt(this.version.replace(/\./g,""))}};return window.navigator.browserInfo=o,o.detect(),o})); +/* @smartbear/browser-info v1.2.0 | Copyright 2020 (c) SmartBear Software and contributors | https://github.com/SmartBear/browser-info/blob/master/LICENSE */ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self)["@smartbear/browser-info"]=n()}(this,(function(){"use strict";const e=/^\d+/;class n{constructor(e,n){this.name=e,this.pattern=n}match(n){const r=n.match(this.pattern);if(null===r)return null;const t={name:this.name,version:null,release:null};return void 0!==r[1]&&(t.version=r[1].replace("_","."),t.release=parseInt(t.version.match(e)[0],10)),t}}const r=[new n("Firefox",/Firefox\/([0-9.]+)/),new n("Edge",/Edge\/([0-9.]+)/),new n("Opera",/OPR\/([0-9.]+)/),new n("SamsungInternet",/SamsungBrowser\/([0-9.]+)/),new n("Maxthon",/Maxthon\/([0-9.]+)/),new n("Chrome",/Chrome\/([0-9.]+)/),new n("Safari",/Version\/([0-9.]+) Safari\//),new n("InternetExplorer",/MSIE ([0-9.]+)/)],t=[new n("Windows",/Windows NT ([0-9.]+)/),new n("Windows Phone",/Windows Phone ([0-9.]+)/),new n("MacOS",/OS X ([0-9._]+)/),new n("iOS",/iPhone OS ([0-9_.]+)/),new n("iPadOS",/iPad.+?OS ([0-9_,]+)/),new n("ChromeOS",/CrOS [^ ]+ ([0-9.]+)/),new n("Android",/(?:Android|Adr) ([0-9.]+)/),new n("BlackBerry",/BlackBerry|BB10/),new n("webOS",/webOS\/([0-9.]+)/),new n("Linux",/Linux/)],o={os:"?",name:"?",release:"?",version:"?",detect(e=null){const n="string"==typeof e?e:window.navigator.userAgent;let o=!1;for(const e of r){let r=e.match(n);if(null!==r){this.name=r.name,this.release=r.release,this.version=r.version,o=!0;break}}for(const e of t){let r=e.match(n);if(null!==r){this.os=r.name;break}}return o},toString(){return`${this.name} ${this.version}`},get versionAsNumber(){return parseInt(this.version.replace(/\./g,""))}};return window.navigator.browserInfo=o,o.detect(),o})); //# sourceMappingURL=smartbear-browser-info.embed.min.js.map diff --git a/dist/smartbear-browser-info.embed.min.js.map b/dist/smartbear-browser-info.embed.min.js.map index 6524bb2..8811fdf 100644 --- a/dist/smartbear-browser-info.embed.min.js.map +++ b/dist/smartbear-browser-info.embed.min.js.map @@ -1 +1 @@ -{"version":3,"file":"smartbear-browser-info.embed.min.js","sources":["../src/Entity.js","../src/known-browsers.js","../src/known-platforms.js","../src/BrowserInfo.js","../src/embed.js"],"sourcesContent":["const MAJOR_VERSION = /^\\d+/;\n\nclass Entity {\n constructor (name, pattern) {\n this.name = name;\n this.pattern = pattern;\n }\n\n match (str) {\n const m = str.match(this.pattern);\n if (m === null) {\n return null;\n }\n\n const info = {\n name: this.name,\n version: null,\n release: null\n };\n\n if (typeof m[1] !== 'undefined') {\n info.version = m[1].replace('_', '.');\n info.release = parseInt(info.version.match(MAJOR_VERSION)[0], 10);\n }\n\n return info;\n }\n}\n\nexport { Entity };\n","import { Entity } from './Entity';\n\nconst browsers = [\n new Entity('Firefox', /Firefox\\/([0-9.]+)/),\n new Entity('Opera', /OPR\\/([0-9.]+)/),\n new Entity('Edge', /Edge\\/([0-9.]+)/),\n new Entity('Maxthon', /Maxthon\\/([0-9.]+)/),\n new Entity('Chrome', /Chrome\\/([0-9.]+)/),\n new Entity('Safari', /Version\\/([0-9.]+) Safari\\//),\n new Entity('InternetExplorer', /MSIE ([0-9.]+)/)\n];\n\nexport { browsers };\n","import { Entity } from './Entity';\n\nconst platforms = [\n new Entity('Windows', /Windows NT ([0-9.]+)/),\n new Entity('Windows Phone', /Windows Phone ([0-9.]+)/),\n new Entity('MacOS', /OS X ([0-9._]+)/),\n new Entity('iOS', /iPhone OS ([0-9_.]+)/),\n new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/),\n new Entity('ChromeOS', /CrOS [^ ]+ ([0-9.]+)/),\n new Entity('Android', /(?:Android|Adr) ([0-9.]+)/),\n new Entity('BlackBerry', /BlackBerry|BB10/),\n new Entity('webOS', /webOS\\/([0-9.]+)/),\n new Entity('Linux', /Linux/)\n];\n\nexport { platforms };\n","import { browsers } from './known-browsers';\nimport { platforms } from './known-platforms';\n\nconst BrowserInfo = {\n os: '?',\n name: '?',\n release: '?',\n version: '?',\n\n detect (userAgent = null) {\n const ua = typeof userAgent === 'string' ? userAgent : window.navigator.userAgent;\n\n let found = false;\n for(const browser of browsers) {\n let match = browser.match(ua);\n\n if (match !== null) {\n this.name = match.name;\n this.release = match.release;\n this.version = match.version;\n found = true;\n break;\n }\n }\n\n for(const platform of platforms) {\n let match = platform.match(ua);\n\n if (match !== null) {\n this.os = match.name;\n break;\n }\n }\n\n return found;\n },\n\n toString () {\n return `${this.name} ${this.version}`;\n },\n\n get versionAsNumber() {\n return parseInt(this.version.replace(/\\./g, ''));\n }\n};\n\nexport { BrowserInfo };\n","import BrowserInfo from './index';\nwindow.navigator.browserInfo = BrowserInfo;\nBrowserInfo.detect();\nexport default BrowserInfo;\n"],"names":["MAJOR_VERSION","Entity","constructor","name","pattern","match","str","m","this","info","version","release","replace","parseInt","browsers","platforms","BrowserInfo","os","detect","userAgent","ua","window","navigator","found","browser","platform","toString","browserInfo"],"mappings":";2PAAA,MAAMA,EAAgB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G,iBACU,GAAElB,KAAKL,QAAQK,KAAKE,wCAIrBG,SAASL,KAAKE,QAAQE,QAAQ,MAAO,cCzChDS,OAAOC,UAAUK,YAAcX,EAC/BA,EAAYE"} \ No newline at end of file +{"version":3,"file":"smartbear-browser-info.embed.min.js","sources":["../src/Entity.js","../src/known-browsers.js","../src/known-platforms.js","../src/BrowserInfo.js","../src/embed.js"],"sourcesContent":["const MAJOR_VERSION = /^\\d+/;\n\nclass Entity {\n constructor (name, pattern) {\n this.name = name;\n this.pattern = pattern;\n }\n\n match (str) {\n const m = str.match(this.pattern);\n if (m === null) {\n return null;\n }\n\n const info = {\n name: this.name,\n version: null,\n release: null\n };\n\n if (typeof m[1] !== 'undefined') {\n info.version = m[1].replace('_', '.');\n info.release = parseInt(info.version.match(MAJOR_VERSION)[0], 10);\n }\n\n return info;\n }\n}\n\nexport { Entity };\n","import { Entity } from './Entity';\n\nconst browsers = [\n new Entity('Firefox', /Firefox\\/([0-9.]+)/),\n new Entity('Edge', /Edge\\/([0-9.]+)/),\n new Entity('Opera', /OPR\\/([0-9.]+)/),\n new Entity('SamsungInternet', /SamsungBrowser\\/([0-9.]+)/),\n new Entity('Maxthon', /Maxthon\\/([0-9.]+)/),\n new Entity('Chrome', /Chrome\\/([0-9.]+)/),\n new Entity('Safari', /Version\\/([0-9.]+) Safari\\//),\n new Entity('InternetExplorer', /MSIE ([0-9.]+)/)\n];\n\nexport { browsers };\n","import { Entity } from './Entity';\n\nconst platforms = [\n new Entity('Windows', /Windows NT ([0-9.]+)/),\n new Entity('Windows Phone', /Windows Phone ([0-9.]+)/),\n new Entity('MacOS', /OS X ([0-9._]+)/),\n new Entity('iOS', /iPhone OS ([0-9_.]+)/),\n new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/),\n new Entity('ChromeOS', /CrOS [^ ]+ ([0-9.]+)/),\n new Entity('Android', /(?:Android|Adr) ([0-9.]+)/),\n new Entity('BlackBerry', /BlackBerry|BB10/),\n new Entity('webOS', /webOS\\/([0-9.]+)/),\n new Entity('Linux', /Linux/)\n];\n\nexport { platforms };\n","import { browsers } from './known-browsers';\nimport { platforms } from './known-platforms';\n\nconst BrowserInfo = {\n os: '?',\n name: '?',\n release: '?',\n version: '?',\n\n detect (userAgent = null) {\n const ua = typeof userAgent === 'string' ? userAgent : window.navigator.userAgent;\n\n let found = false;\n for(const browser of browsers) {\n let match = browser.match(ua);\n\n if (match !== null) {\n this.name = match.name;\n this.release = match.release;\n this.version = match.version;\n found = true;\n break;\n }\n }\n\n for(const platform of platforms) {\n let match = platform.match(ua);\n\n if (match !== null) {\n this.os = match.name;\n break;\n }\n }\n\n return found;\n },\n\n toString () {\n return `${this.name} ${this.version}`;\n },\n\n get versionAsNumber() {\n return parseInt(this.version.replace(/\\./g, ''));\n }\n};\n\nexport { BrowserInfo };\n","import BrowserInfo from './index';\nwindow.navigator.browserInfo = BrowserInfo;\nBrowserInfo.detect();\nexport default BrowserInfo;\n"],"names":["MAJOR_VERSION","Entity","constructor","name","pattern","match","str","m","this","info","version","release","replace","parseInt","browsers","platforms","BrowserInfo","os","detect","userAgent","ua","window","navigator","found","browser","platform","toString","browserInfo"],"mappings":";2PAAA,MAAMA,EAAgB,OAEtB,MAAMC,EACJC,YAAaC,EAAMC,QACZD,KAAOA,OACPC,QAAUA,EAGjBC,MAAOC,SACCC,EAAID,EAAID,MAAMG,KAAKJ,YACf,OAANG,SACK,WAGHE,EAAO,CACXN,KAAMK,KAAKL,KACXO,QAAS,KACTC,QAAS,kBAGS,IAATJ,EAAE,KACXE,EAAKC,QAAUH,EAAE,GAAGK,QAAQ,IAAK,KACjCH,EAAKE,QAAUE,SAASJ,EAAKC,QAAQL,MAAML,GAAe,GAAI,KAGzDS,GCvBX,MAAMK,EAAW,CACf,IAAIb,EAAO,UAAW,sBACtB,IAAIA,EAAO,OAAQ,mBACnB,IAAIA,EAAO,QAAS,kBACpB,IAAIA,EAAO,kBAAmB,6BAC9B,IAAIA,EAAO,UAAW,sBACtB,IAAIA,EAAO,SAAU,qBACrB,IAAIA,EAAO,SAAU,+BACrB,IAAIA,EAAO,mBAAoB,mBCR3Bc,EAAY,CAChB,IAAId,EAAO,UAAW,wBACtB,IAAIA,EAAO,gBAAiB,2BAC5B,IAAIA,EAAO,QAAS,mBACpB,IAAIA,EAAO,MAAO,wBAClB,IAAIA,EAAO,SAAU,wBACrB,IAAIA,EAAO,WAAY,wBACvB,IAAIA,EAAO,UAAW,6BACtB,IAAIA,EAAO,aAAc,mBACzB,IAAIA,EAAO,QAAS,oBACpB,IAAIA,EAAO,QAAS,UCThBe,EAAc,CAClBC,GAAI,IACJd,KAAM,IACNQ,QAAS,IACTD,QAAS,IAETQ,OAAQC,EAAY,YACZC,EAA0B,iBAAdD,EAAyBA,EAAYE,OAAOC,UAAUH,cAEpEI,GAAQ,MACR,MAAMC,KAAWV,EAAU,KACzBT,EAAQmB,EAAQnB,MAAMe,MAEZ,OAAVf,EAAgB,MACbF,KAAOE,EAAMF,UACbQ,QAAUN,EAAMM,aAChBD,QAAUL,EAAMK,QACrBa,GAAQ,aAKR,MAAME,KAAYV,EAAW,KAC3BV,EAAQoB,EAASpB,MAAMe,MAEb,OAAVf,EAAgB,MACbY,GAAKZ,EAAMF,mBAKboB,GAGTG,iBACU,GAAElB,KAAKL,QAAQK,KAAKE,wCAIrBG,SAASL,KAAKE,QAAQE,QAAQ,MAAO,cCzChDS,OAAOC,UAAUK,YAAcX,EAC/BA,EAAYE"} \ No newline at end of file diff --git a/dist/smartbear-browser-info.js b/dist/smartbear-browser-info.js index 04a79a3..010f7c3 100644 --- a/dist/smartbear-browser-info.js +++ b/dist/smartbear-browser-info.js @@ -1,4 +1,4 @@ -/* @smartbear/browser-info v1.1.1 | Copyright 2020 (c) SmartBear Software and contributors | https://github.com/SmartBear/browser-info/blob/master/LICENSE */ +/* @smartbear/browser-info v1.2.0 | Copyright 2020 (c) SmartBear Software and contributors | https://github.com/SmartBear/browser-info/blob/master/LICENSE */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -36,7 +36,7 @@ } - const browsers = [new Entity('Firefox', /Firefox\/([0-9.]+)/), new Entity('Opera', /OPR\/([0-9.]+)/), new Entity('Edge', /Edge\/([0-9.]+)/), new Entity('Maxthon', /Maxthon\/([0-9.]+)/), new Entity('Chrome', /Chrome\/([0-9.]+)/), new Entity('Safari', /Version\/([0-9.]+) Safari\//), new Entity('InternetExplorer', /MSIE ([0-9.]+)/)]; + const browsers = [new Entity('Firefox', /Firefox\/([0-9.]+)/), new Entity('Edge', /Edge\/([0-9.]+)/), new Entity('Opera', /OPR\/([0-9.]+)/), new Entity('SamsungInternet', /SamsungBrowser\/([0-9.]+)/), new Entity('Maxthon', /Maxthon\/([0-9.]+)/), new Entity('Chrome', /Chrome\/([0-9.]+)/), new Entity('Safari', /Version\/([0-9.]+) Safari\//), new Entity('InternetExplorer', /MSIE ([0-9.]+)/)]; const platforms = [new Entity('Windows', /Windows NT ([0-9.]+)/), new Entity('Windows Phone', /Windows Phone ([0-9.]+)/), new Entity('MacOS', /OS X ([0-9._]+)/), new Entity('iOS', /iPhone OS ([0-9_.]+)/), new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/), new Entity('ChromeOS', /CrOS [^ ]+ ([0-9.]+)/), new Entity('Android', /(?:Android|Adr) ([0-9.]+)/), new Entity('BlackBerry', /BlackBerry|BB10/), new Entity('webOS', /webOS\/([0-9.]+)/), new Entity('Linux', /Linux/)]; diff --git a/dist/smartbear-browser-info.js.map b/dist/smartbear-browser-info.js.map index 6dcbb83..b061ab0 100644 --- a/dist/smartbear-browser-info.js.map +++ b/dist/smartbear-browser-info.js.map @@ -1 +1 @@ -{"version":3,"file":"smartbear-browser-info.js","sources":["../src/Entity.js","../src/known-browsers.js","../src/known-platforms.js","../src/BrowserInfo.js"],"sourcesContent":["const MAJOR_VERSION = /^\\d+/;\n\nclass Entity {\n constructor (name, pattern) {\n this.name = name;\n this.pattern = pattern;\n }\n\n match (str) {\n const m = str.match(this.pattern);\n if (m === null) {\n return null;\n }\n\n const info = {\n name: this.name,\n version: null,\n release: null\n };\n\n if (typeof m[1] !== 'undefined') {\n info.version = m[1].replace('_', '.');\n info.release = parseInt(info.version.match(MAJOR_VERSION)[0], 10);\n }\n\n return info;\n }\n}\n\nexport { Entity };\n","import { Entity } from './Entity';\n\nconst browsers = [\n new Entity('Firefox', /Firefox\\/([0-9.]+)/),\n new Entity('Opera', /OPR\\/([0-9.]+)/),\n new Entity('Edge', /Edge\\/([0-9.]+)/),\n new Entity('Maxthon', /Maxthon\\/([0-9.]+)/),\n new Entity('Chrome', /Chrome\\/([0-9.]+)/),\n new Entity('Safari', /Version\\/([0-9.]+) Safari\\//),\n new Entity('InternetExplorer', /MSIE ([0-9.]+)/)\n];\n\nexport { browsers };\n","import { Entity } from './Entity';\n\nconst platforms = [\n new Entity('Windows', /Windows NT ([0-9.]+)/),\n new Entity('Windows Phone', /Windows Phone ([0-9.]+)/),\n new Entity('MacOS', /OS X ([0-9._]+)/),\n new Entity('iOS', /iPhone OS ([0-9_.]+)/),\n new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/),\n new Entity('ChromeOS', /CrOS [^ ]+ ([0-9.]+)/),\n new Entity('Android', /(?:Android|Adr) ([0-9.]+)/),\n new Entity('BlackBerry', /BlackBerry|BB10/),\n new Entity('webOS', /webOS\\/([0-9.]+)/),\n new Entity('Linux', /Linux/)\n];\n\nexport { platforms };\n","import { browsers } from './known-browsers';\nimport { platforms } from './known-platforms';\n\nconst BrowserInfo = {\n os: '?',\n name: '?',\n release: '?',\n version: '?',\n\n detect (userAgent = null) {\n const ua = typeof userAgent === 'string' ? userAgent : window.navigator.userAgent;\n\n let found = false;\n for(const browser of browsers) {\n let match = browser.match(ua);\n\n if (match !== null) {\n this.name = match.name;\n this.release = match.release;\n this.version = match.version;\n found = true;\n break;\n }\n }\n\n for(const platform of platforms) {\n let match = platform.match(ua);\n\n if (match !== null) {\n this.os = match.name;\n break;\n }\n }\n\n return found;\n },\n\n toString () {\n return `${this.name} ${this.version}`;\n },\n\n get versionAsNumber() {\n return parseInt(this.version.replace(/\\./g, ''));\n }\n};\n\nexport { BrowserInfo };\n"],"names":["MAJOR_VERSION","Entity","constructor","name","pattern","match","str","m","info","version","release","replace","parseInt","browsers","platforms","BrowserInfo","os","detect","userAgent","ua","window","navigator","found","browser","platform","toString","versionAsNumber"],"mappings":";;;;;;;EAAA,MAAMA,aAAa,GAAG,MAAtB;;EAEA,MAAMC,MAAN,CAAa;EACXC,EAAAA,WAAW,CAAEC,IAAF,EAAQC,OAAR,EAAiB;EAC1B,SAAKD,IAAL,GAAYA,IAAZ;EACA,SAAKC,OAAL,GAAeA,OAAf;EACD;;EAEDC,EAAAA,KAAK,CAAEC,GAAF,EAAO;EACV,UAAMC,CAAC,GAAGD,GAAG,CAACD,KAAJ,CAAU,KAAKD,OAAf,CAAV;;EACA,QAAIG,CAAC,KAAK,IAAV,EAAgB;EACd,aAAO,IAAP;EACD;;EAED,UAAMC,IAAI,GAAG;EACXL,MAAAA,IAAI,EAAE,KAAKA,IADA;EAEXM,MAAAA,OAAO,EAAE,IAFE;EAGXC,MAAAA,OAAO,EAAE;EAHE,KAAb;;EAMA,QAAI,OAAOH,CAAC,CAAC,CAAD,CAAR,KAAgB,WAApB,EAAiC;EAC/BC,MAAAA,IAAI,CAACC,OAAL,GAAeF,CAAC,CAAC,CAAD,CAAD,CAAKI,OAAL,CAAa,GAAb,EAAkB,GAAlB,CAAf;EACAH,MAAAA,IAAI,CAACE,OAAL,GAAeE,QAAQ,CAACJ,IAAI,CAACC,OAAL,CAAaJ,KAAb,CAAmBL,aAAnB,EAAkC,CAAlC,CAAD,EAAuC,EAAvC,CAAvB;EACD;;EAED,WAAOQ,IAAP;EACD;;EAxBU;;ECAb,MAAMK,QAAQ,GAAG,CACf,IAAIZ,MAAJ,CAAW,SAAX,EAAsB,oBAAtB,CADe,EAEf,IAAIA,MAA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AAG,KAAZ;;EACA,SAAI,MAAMC,OAAV,IAAqBV,QAArB,EAA+B;EAC7B,UAAIR,KAAK,GAAGkB,OAAO,CAAClB,KAAR,CAAcc,EAAd,CAAZ;;EAEA,UAAId,KAAK,KAAK,IAAd,EAAoB;EAClB,aAAKF,IAAL,GAAYE,KAAK,CAACF,IAAlB;EACA,aAAKO,OAAL,GAAeL,KAAK,CAACK,OAArB;EACA,aAAKD,OAAL,GAAeJ,KAAK,CAACI,OAArB;EACAa,QAAAA,KAAK,GAAG,IAAR;EACA;EACD;EACF;;EAED,SAAI,MAAME,QAAV,IAAsBV,SAAtB,EAAiC;EAC/B,UAAIT,KAAK,GAAGmB,QAAQ,CAACnB,KAAT,CAAec,EAAf,CAAZ;;EAEA,UAAId,KAAK,KAAK,IAAd,EAAoB;EAClB,aAAKW,EAAL,GAAUX,KAAK,CAACF,IAAhB;EACA;EACD;EACF;;EAED,WAAOmB,KAAP;EACD,GAhCiB;;EAkClBG,EAAAA,QAAQ,GAAI;EACV,WAAQ,GAAE,KAAKtB,IAAK,IAAG,KAAKM,OAAQ,EAApC;EACD,GApCiB;;EAsClB,MAAIiB,eAAJ,GAAsB;EACpB,WAAOd,QAAQ,CAAC,KAAKH,OAAL,CAAaE,OAAb,CAAqB,KAArB,EAA4B,EAA5B,CAAD,CAAf;EACD;;EAxCiB;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"smartbear-browser-info.js","sources":["../src/Entity.js","../src/known-browsers.js","../src/known-platforms.js","../src/BrowserInfo.js"],"sourcesContent":["const MAJOR_VERSION = /^\\d+/;\n\nclass Entity {\n constructor (name, pattern) {\n this.name = name;\n this.pattern = pattern;\n }\n\n match (str) {\n const m = str.match(this.pattern);\n if (m === null) {\n return null;\n }\n\n const info = {\n name: this.name,\n version: null,\n release: null\n };\n\n if (typeof m[1] !== 'undefined') {\n info.version = m[1].replace('_', '.');\n info.release = parseInt(info.version.match(MAJOR_VERSION)[0], 10);\n }\n\n return info;\n }\n}\n\nexport { Entity };\n","import { Entity } from './Entity';\n\nconst browsers = [\n new Entity('Firefox', /Firefox\\/([0-9.]+)/),\n new Entity('Edge', /Edge\\/([0-9.]+)/),\n new Entity('Opera', /OPR\\/([0-9.]+)/),\n new Entity('SamsungInternet', /SamsungBrowser\\/([0-9.]+)/),\n new Entity('Maxthon', /Maxthon\\/([0-9.]+)/),\n new Entity('Chrome', /Chrome\\/([0-9.]+)/),\n new Entity('Safari', /Version\\/([0-9.]+) Safari\\//),\n new Entity('InternetExplorer', /MSIE ([0-9.]+)/)\n];\n\nexport { browsers };\n","import { Entity } from './Entity';\n\nconst platforms = [\n new Entity('Windows', /Windows NT ([0-9.]+)/),\n new Entity('Windows Phone', /Windows Phone ([0-9.]+)/),\n new Entity('MacOS', /OS X ([0-9._]+)/),\n new Entity('iOS', /iPhone OS ([0-9_.]+)/),\n new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/),\n new Entity('ChromeOS', /CrOS [^ ]+ ([0-9.]+)/),\n new Entity('Android', /(?:Android|Adr) ([0-9.]+)/),\n new Entity('BlackBerry', /BlackBerry|BB10/),\n new Entity('webOS', /webOS\\/([0-9.]+)/),\n new Entity('Linux', /Linux/)\n];\n\nexport { platforms };\n","import { browsers } from './known-browsers';\nimport { platforms } from './known-platforms';\n\nconst BrowserInfo = {\n os: '?',\n name: '?',\n release: '?',\n version: '?',\n\n detect (userAgent = null) {\n const ua = typeof userAgent === 'string' ? userAgent : window.navigator.userAgent;\n\n let found = false;\n for(const browser of browsers) {\n let match = browser.match(ua);\n\n if (match !== null) {\n this.name = match.name;\n this.release = match.release;\n this.version = match.version;\n found = true;\n break;\n }\n }\n\n for(const platform of platforms) {\n let match = platform.match(ua);\n\n if (match !== null) {\n this.os = match.name;\n break;\n }\n }\n\n return found;\n },\n\n toString () {\n return `${this.name} ${this.version}`;\n },\n\n get versionAsNumber() {\n return parseInt(this.version.replace(/\\./g, ''));\n }\n};\n\nexport { BrowserInfo };\n"],"names":["MAJOR_VERSION","Entity","constructor","name","pattern","match","str","m","info","version","release","replace","parseInt","browsers","platforms","BrowserInfo","os","detect","userAgent","ua","window","navigator","found","browser","platform","toString","versionAsNumber"],"mappings":";;;;;;;EAAA,MAAMA,aAAa,GAAG,MAAtB;;EAEA,MAAMC,MAAN,CAAa;EACXC,EAAAA,WAAW,CAAEC,IAAF,EAAQC,OAAR,EAAiB;EAC1B,SAAKD,IAAL,GAAYA,IAAZ;EACA,SAAKC,OAAL,GAAeA,OAAf;EACD;;EAEDC,EAAAA,KAAK,CAAEC,GAAF,EAAO;EACV,UAAMC,CAAC,GAAGD,GAAG,CAACD,KAAJ,CAAU,KAAKD,OAAf,CAAV;;EACA,QAAIG,CAAC,KAAK,IAAV,EAAgB;EACd,aAAO,IAAP;EACD;;EAED,UAAMC,IAAI,GAAG;EACXL,MAAAA,IAAI,EAAE,KAAKA,IADA;EAEXM,MAAAA,OAAO,EAAE,IAFE;EAGXC,MAAAA,OAAO,EAAE;EAHE,KAAb;;EAMA,QAAI,OAAOH,CAAC,CAAC,CAAD,CAAR,KAAgB,WAApB,EAAiC;EAC/BC,MAAAA,IAAI,CAACC,OAAL,GAAeF,CAAC,CAAC,CAAD,CAAD,CAAKI,OAAL,CAAa,GAAb,EAAkB,GAAlB,CAAf;EACAH,MAAAA,IAAI,CAACE,OAAL,GAAeE,QAAQ,CAACJ,IAAI,CAACC,OAAL,CAAaJ,KAAb,CAAmBL,aAAnB,EAAkC,CAAlC,CAAD,EAAuC,EAAvC,CAAvB;EACD;;EAED,WAAOQ,IAAP;EACD;;EAxBU;;ECAb,MAAMK,QAAQ,GAAG,CACf,IAAIZ,MAAJ,CAAW,SAAX,EAAsB,oBAAtB,CADe,EAEf,IAAIA,MAAJ,CAAW,MAAX,EAAmB,iBAAnB,CAFe,EAGf,IAAIA,MAAJ,CAAW,OAAX,EAAoB,gBAApB,CAHe,EAIf,IAAIA,MAAJ,CAAW,iBAAX,EAA8B,2BAA9B,CAJe,EAKf,IAAIA,MAAJ,CAAW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Ad,CAAZ;;EAEA,UAAId,KAAK,KAAK,IAAd,EAAoB;EAClB,aAAKF,IAAL,GAAYE,KAAK,CAACF,IAAlB;EACA,aAAKO,OAAL,GAAeL,KAAK,CAACK,OAArB;EACA,aAAKD,OAAL,GAAeJ,KAAK,CAACI,OAArB;EACAa,QAAAA,KAAK,GAAG,IAAR;EACA;EACD;EACF;;EAED,SAAI,MAAME,QAAV,IAAsBV,SAAtB,EAAiC;EAC/B,UAAIT,KAAK,GAAGmB,QAAQ,CAACnB,KAAT,CAAec,EAAf,CAAZ;;EAEA,UAAId,KAAK,KAAK,IAAd,EAAoB;EAClB,aAAKW,EAAL,GAAUX,KAAK,CAACF,IAAhB;EACA;EACD;EACF;;EAED,WAAOmB,KAAP;EACD,GAhCiB;;EAkClBG,EAAAA,QAAQ,GAAI;EACV,WAAQ,GAAE,KAAKtB,IAAK,IAAG,KAAKM,OAAQ,EAApC;EACD,GApCiB;;EAsClB,MAAIiB,eAAJ,GAAsB;EACpB,WAAOd,QAAQ,CAAC,KAAKH,OAAL,CAAaE,OAAb,CAAqB,KAArB,EAA4B,EAA5B,CAAD,CAAf;EACD;;EAxCiB;;;;;;;;"} \ No newline at end of file diff --git a/dist/smartbear-browser-info.min.js b/dist/smartbear-browser-info.min.js index 338850b..12a91e6 100644 --- a/dist/smartbear-browser-info.min.js +++ b/dist/smartbear-browser-info.min.js @@ -1,3 +1,3 @@ -/* @smartbear/browser-info v1.1.1 | Copyright 2020 (c) SmartBear Software and contributors | https://github.com/SmartBear/browser-info/blob/master/LICENSE */ -!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self)["@smartbear/browser-info"]=n()}(this,(function(){"use strict";const e=/^\d+/;class n{constructor(e,n){this.name=e,this.pattern=n}match(n){const r=n.match(this.pattern);if(null===r)return null;const t={name:this.name,version:null,release:null};return void 0!==r[1]&&(t.version=r[1].replace("_","."),t.release=parseInt(t.version.match(e)[0],10)),t}}const r=[new n("Firefox",/Firefox\/([0-9.]+)/),new n("Opera",/OPR\/([0-9.]+)/),new n("Edge",/Edge\/([0-9.]+)/),new n("Maxthon",/Maxthon\/([0-9.]+)/),new n("Chrome",/Chrome\/([0-9.]+)/),new n("Safari",/Version\/([0-9.]+) Safari\//),new n("InternetExplorer",/MSIE ([0-9.]+)/)],t=[new n("Windows",/Windows NT ([0-9.]+)/),new n("Windows Phone",/Windows Phone ([0-9.]+)/),new n("MacOS",/OS X ([0-9._]+)/),new n("iOS",/iPhone OS ([0-9_.]+)/),new n("iPadOS",/iPad.+?OS ([0-9_,]+)/),new n("ChromeOS",/CrOS [^ ]+ ([0-9.]+)/),new n("Android",/(?:Android|Adr) ([0-9.]+)/),new n("BlackBerry",/BlackBerry|BB10/),new n("webOS",/webOS\/([0-9.]+)/),new n("Linux",/Linux/)];return{os:"?",name:"?",release:"?",version:"?",detect(e=null){const n="string"==typeof e?e:window.navigator.userAgent;let o=!1;for(const e of r){let r=e.match(n);if(null!==r){this.name=r.name,this.release=r.release,this.version=r.version,o=!0;break}}for(const e of t){let r=e.match(n);if(null!==r){this.os=r.name;break}}return o},toString(){return`${this.name} ${this.version}`},get versionAsNumber(){return parseInt(this.version.replace(/\./g,""))}}})); +/* @smartbear/browser-info v1.2.0 | Copyright 2020 (c) SmartBear Software and contributors | https://github.com/SmartBear/browser-info/blob/master/LICENSE */ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self)["@smartbear/browser-info"]=n()}(this,(function(){"use strict";const e=/^\d+/;class n{constructor(e,n){this.name=e,this.pattern=n}match(n){const r=n.match(this.pattern);if(null===r)return null;const t={name:this.name,version:null,release:null};return void 0!==r[1]&&(t.version=r[1].replace("_","."),t.release=parseInt(t.version.match(e)[0],10)),t}}const r=[new n("Firefox",/Firefox\/([0-9.]+)/),new n("Edge",/Edge\/([0-9.]+)/),new n("Opera",/OPR\/([0-9.]+)/),new n("SamsungInternet",/SamsungBrowser\/([0-9.]+)/),new n("Maxthon",/Maxthon\/([0-9.]+)/),new n("Chrome",/Chrome\/([0-9.]+)/),new n("Safari",/Version\/([0-9.]+) Safari\//),new n("InternetExplorer",/MSIE ([0-9.]+)/)],t=[new n("Windows",/Windows NT ([0-9.]+)/),new n("Windows Phone",/Windows Phone ([0-9.]+)/),new n("MacOS",/OS X ([0-9._]+)/),new n("iOS",/iPhone OS ([0-9_.]+)/),new n("iPadOS",/iPad.+?OS ([0-9_,]+)/),new n("ChromeOS",/CrOS [^ ]+ ([0-9.]+)/),new n("Android",/(?:Android|Adr) ([0-9.]+)/),new n("BlackBerry",/BlackBerry|BB10/),new n("webOS",/webOS\/([0-9.]+)/),new n("Linux",/Linux/)];return{os:"?",name:"?",release:"?",version:"?",detect(e=null){const n="string"==typeof e?e:window.navigator.userAgent;let o=!1;for(const e of r){let r=e.match(n);if(null!==r){this.name=r.name,this.release=r.release,this.version=r.version,o=!0;break}}for(const e of t){let r=e.match(n);if(null!==r){this.os=r.name;break}}return o},toString(){return`${this.name} ${this.version}`},get versionAsNumber(){return parseInt(this.version.replace(/\./g,""))}}})); //# sourceMappingURL=smartbear-browser-info.min.js.map diff --git a/dist/smartbear-browser-info.min.js.map b/dist/smartbear-browser-info.min.js.map index b8fc0cc..f705ac2 100644 --- a/dist/smartbear-browser-info.min.js.map +++ b/dist/smartbear-browser-info.min.js.map @@ -1 +1 @@ -{"version":3,"file":"smartbear-browser-info.min.js","sources":["../src/Entity.js","../src/known-browsers.js","../src/known-platforms.js","../src/BrowserInfo.js"],"sourcesContent":["const MAJOR_VERSION = /^\\d+/;\n\nclass Entity {\n constructor (name, pattern) {\n this.name = name;\n this.pattern = pattern;\n }\n\n match (str) {\n const m = str.match(this.pattern);\n if (m === null) {\n return null;\n }\n\n const info = {\n name: this.name,\n version: null,\n release: null\n };\n\n if (typeof m[1] !== 'undefined') {\n info.version = m[1].replace('_', '.');\n info.release = parseInt(info.version.match(MAJOR_VERSION)[0], 10);\n }\n\n return info;\n }\n}\n\nexport { Entity };\n","import { Entity } from './Entity';\n\nconst browsers = [\n new Entity('Firefox', /Firefox\\/([0-9.]+)/),\n new Entity('Opera', /OPR\\/([0-9.]+)/),\n new Entity('Edge', /Edge\\/([0-9.]+)/),\n new Entity('Maxthon', /Maxthon\\/([0-9.]+)/),\n new Entity('Chrome', /Chrome\\/([0-9.]+)/),\n new Entity('Safari', /Version\\/([0-9.]+) Safari\\//),\n new Entity('InternetExplorer', /MSIE ([0-9.]+)/)\n];\n\nexport { browsers };\n","import { Entity } from './Entity';\n\nconst platforms = [\n new Entity('Windows', /Windows NT ([0-9.]+)/),\n new Entity('Windows Phone', /Windows Phone ([0-9.]+)/),\n new Entity('MacOS', /OS X ([0-9._]+)/),\n new Entity('iOS', /iPhone OS ([0-9_.]+)/),\n new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/),\n new Entity('ChromeOS', /CrOS [^ ]+ ([0-9.]+)/),\n new Entity('Android', /(?:Android|Adr) ([0-9.]+)/),\n new Entity('BlackBerry', /BlackBerry|BB10/),\n new Entity('webOS', /webOS\\/([0-9.]+)/),\n new Entity('Linux', /Linux/)\n];\n\nexport { platforms };\n","import { browsers } from './known-browsers';\nimport { platforms } from './known-platforms';\n\nconst BrowserInfo = {\n os: '?',\n name: '?',\n release: '?',\n version: '?',\n\n detect (userAgent = null) {\n const ua = typeof userAgent === 'string' ? userAgent : window.navigator.userAgent;\n\n let found = false;\n for(const browser of browsers) {\n let match = browser.match(ua);\n\n if (match !== null) {\n this.name = match.name;\n this.release = match.release;\n this.version = match.version;\n found = true;\n break;\n }\n }\n\n for(const platform of platforms) {\n let match = platform.match(ua);\n\n if (match !== null) {\n this.os = match.name;\n break;\n }\n }\n\n return found;\n },\n\n toString () {\n return `${this.name} ${this.version}`;\n },\n\n get versionAsNumber() {\n return parseInt(this.version.replace(/\\./g, ''));\n }\n};\n\nexport { BrowserInfo };\n"],"names":["MAJOR_VERSION","Entity","constructor","name","pattern","match","str","m","this","info","version","release","replace","parseInt","browsers","platforms","os","detect","userAgent","ua","window","navigator","found","browser","platform","toString"],"mappings":";2PAAA,MAAMA,EAAgB,OAEtB,MAAMC,EACJC,YAAaC,EAAMC,QACZD,KAAOA,OACPC,QAAUA,EAGjBC,MAAOC,SACCC,EAAID,EAAID,MAAMG,KAAKJ,YACf,OAANG,SACK,WAGHE,EAAO,CACXN,KAAMK,KAAKL,KACXO,QAAS,KACTC,QAAS,kBAGS,IAATJ,EAAE,KACXE,EAAKC,QAAUH,EAAE,GAAGK,QAAQ,IAAK,KACjCH,EAAKE,QAAUE,SAASJ,EAAKC,QAAQL,MAAML,GAAe,GAAI,KAGzDS,GCvBX,MAAMK,EAAW,CACf,IAAIb,EAAO,UAAW,sBACtB,IAAIA,EAAO,QAAS,kBACpB,IAAIA,EAAO,OAAQ,mBACnB,IAAIA,EAAO,UAAW,sBACtB,IAAIA,EAAO,SAAU,qBACrB,IAAIA,EAAO,SAAU,+BACrB,IAAIA,EAAO,mBAAoB,mBCP3Bc,EAAY,CAChB,IAAId,EAAO,UAAW,wBACtB,IAAIA,EAAO,gBAAiB,2BAC5B,IAAIA,EAAO,QAAS,mBACpB,IAAIA,EAAO,MAAO,wBAClB,IAAIA,EAAO,SAAU,wBACrB,IAAIA,EAAO,WAAY,wBACvB,IAAIA,EAAO,UAAW,6BACtB,IAAIA,EAAO,aAAc,mBACzB,IAAIA,EAAO,QAAS,oBACpB,IAAIA,EAAO,QAAS,gBCTF,CAClBe,GAAI,IACJb,KAAM,IACNQ,QAAS,IACTD,QAAS,IAETO,OAAQC,EAAY,YACZC,EAA0B,iBAAdD,EAAyBA,EAAYE,OAAOC,UAAUH,cAEpEI,GAAQ,MACR,MAAMC,KAAWT,EAAU,KACzBT,EAAQkB,EAAQlB,MAAMc,MAEZ,OAAVd,EAAgB,MACbF,KAAOE,EAAMF,UACbQ,QAAUN,EAAMM,aAChBD,QAAUL,EAAMK,QACrBY,GAAQ,aAKR,MAAME,KAAYT,EAAW,KAC3BV,EAAQmB,EAASnB,MAAMc,MAEb,OAAVd,EAAgB,MACbW,GAAKX,EAAMF,mBAKbmB,GAGTG,iBACU,GAAEjB,KAAKL,QAAQK,KAAKE,wCAIrBG,SAASL,KAAKE,QAAQE,QAAQ,MAAO"} \ No newline at end of file +{"version":3,"file":"smartbear-browser-info.min.js","sources":["../src/Entity.js","../src/known-browsers.js","../src/known-platforms.js","../src/BrowserInfo.js"],"sourcesContent":["const MAJOR_VERSION = /^\\d+/;\n\nclass Entity {\n constructor (name, pattern) {\n this.name = name;\n this.pattern = pattern;\n }\n\n match (str) {\n const m = str.match(this.pattern);\n if (m === null) {\n return null;\n }\n\n const info = {\n name: this.name,\n version: null,\n release: null\n };\n\n if (typeof m[1] !== 'undefined') {\n info.version = m[1].replace('_', '.');\n info.release = parseInt(info.version.match(MAJOR_VERSION)[0], 10);\n }\n\n return info;\n }\n}\n\nexport { Entity };\n","import { Entity } from './Entity';\n\nconst browsers = [\n new Entity('Firefox', /Firefox\\/([0-9.]+)/),\n new Entity('Edge', /Edge\\/([0-9.]+)/),\n new Entity('Opera', /OPR\\/([0-9.]+)/),\n new Entity('SamsungInternet', /SamsungBrowser\\/([0-9.]+)/),\n new Entity('Maxthon', /Maxthon\\/([0-9.]+)/),\n new Entity('Chrome', /Chrome\\/([0-9.]+)/),\n new Entity('Safari', /Version\\/([0-9.]+) Safari\\//),\n new Entity('InternetExplorer', /MSIE ([0-9.]+)/)\n];\n\nexport { browsers };\n","import { Entity } from './Entity';\n\nconst platforms = [\n new Entity('Windows', /Windows NT ([0-9.]+)/),\n new Entity('Windows Phone', /Windows Phone ([0-9.]+)/),\n new Entity('MacOS', /OS X ([0-9._]+)/),\n new Entity('iOS', /iPhone OS ([0-9_.]+)/),\n new Entity('iPadOS', /iPad.+?OS ([0-9_,]+)/),\n new Entity('ChromeOS', /CrOS [^ ]+ ([0-9.]+)/),\n new Entity('Android', /(?:Android|Adr) ([0-9.]+)/),\n new Entity('BlackBerry', /BlackBerry|BB10/),\n new Entity('webOS', /webOS\\/([0-9.]+)/),\n new Entity('Linux', /Linux/)\n];\n\nexport { platforms };\n","import { browsers } from './known-browsers';\nimport { platforms } from './known-platforms';\n\nconst BrowserInfo = {\n os: '?',\n name: '?',\n release: '?',\n version: '?',\n\n detect (userAgent = null) {\n const ua = typeof userAgent === 'string' ? userAgent : window.navigator.userAgent;\n\n let found = false;\n for(const browser of browsers) {\n let match = browser.match(ua);\n\n if (match !== null) {\n this.name = match.name;\n this.release = match.release;\n this.version = match.version;\n found = true;\n break;\n }\n }\n\n for(const platform of platforms) {\n let match = platform.match(ua);\n\n if (match !== null) {\n this.os = match.name;\n break;\n }\n }\n\n return found;\n },\n\n toString () {\n return `${this.name} ${this.version}`;\n },\n\n get versionAsNumber() {\n return parseInt(this.version.replace(/\\./g, ''));\n }\n};\n\nexport { BrowserInfo };\n"],"names":["MAJOR_VERSION","Entity","constructor","name","pattern","match","str","m","this","info","version","release","replace","parseInt","browsers","platforms","os","detect","userAgent","ua","window","navigator","found","browser","platform","toString"],"mappings":";2PAAA,MAAMA,EAAgB,OAEtB,MAAMC,EACJC,YAAaC,EAAMC,QACZD,KAAOA,OACPC,QAAUA,EAGjBC,MAAOC,SACCC,EAAID,EAAID,MAAMG,KAAKJ,YACf,OAANG,SACK,WAGHE,EAAO,CACXN,KAAMK,KAAKL,KACXO,QAAS,KACTC,QAAS,kBAGS,IAATJ,EAAE,KACXE,EAAKC,QAAUH,EAAE,GAAGK,QAAQ,IAAK,KACjCH,EAAKE,QAAUE,SAASJ,EAAKC,QAAQL,MAAML,GAAe,GAAI,KAGzDS,GCvBX,MAAMK,EAAW,CACf,IAAIb,EAAO,UAAW,sBACtB,IAAIA,EAAO,OAAQ,mBACnB,IAAIA,EAAO,QAAS,kBACpB,IAAIA,EAAO,kBAAmB,6BAC9B,IAAIA,EAAO,UAAW,sBACtB,IAAIA,EAAO,SAAU,qBACrB,IAAIA,EAAO,SAAU,+BACrB,IAAIA,EAAO,mBAAoB,mBCR3Bc,EAAY,CAChB,IAAId,EAAO,UAAW,wBACtB,IAAIA,EAAO,gBAAiB,2BAC5B,IAAIA,EAAO,QAAS,mBACpB,IAAIA,EAAO,MAAO,wBAClB,IAAIA,EAAO,SAAU,wBACrB,IAAIA,EAAO,WAAY,wBACvB,IAAIA,EAAO,UAAW,6BACtB,IAAIA,EAAO,aAAc,mBACzB,IAAIA,EAAO,QAAS,oBACpB,IAAIA,EAAO,QAAS,gBCTF,CAClBe,GAAI,IACJb,KAAM,IACNQ,QAAS,IACTD,QAAS,IAETO,OAAQC,EAAY,YACZC,EAA0B,iBAAdD,EAAyBA,EAAYE,OAAOC,UAAUH,cAEpEI,GAAQ,MACR,MAAMC,KAAWT,EAAU,KACzBT,EAAQkB,EAAQlB,MAAMc,MAEZ,OAAVd,EAAgB,MACbF,KAAOE,EAAMF,UACbQ,QAAUN,EAAMM,aAChBD,QAAUL,EAAMK,QACrBY,GAAQ,aAKR,MAAME,KAAYT,EAAW,KAC3BV,EAAQmB,EAASnB,MAAMc,MAEb,OAAVd,EAAgB,MACbW,GAAKX,EAAMF,mBAKbmB,GAGTG,iBACU,GAAEjB,KAAKL,QAAQK,KAAKE,wCAIrBG,SAASL,KAAKE,QAAQE,QAAQ,MAAO"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d8a959c..032cd45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@smartbear/browser-info", - "version": "1.1.1", + "version": "1.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f6f7fb6..6684b74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@smartbear/browser-info", - "version": "1.1.1", + "version": "1.2.0", "description": "Tiny developer-friendly JS library that provides information about host browser", "main": "dist/smartbear-browser-info.min.js", "scripts": { diff --git a/src/known-browsers.js b/src/known-browsers.js index f6d90e9..68fee8b 100644 --- a/src/known-browsers.js +++ b/src/known-browsers.js @@ -2,8 +2,9 @@ import { Entity } from './Entity'; const browsers = [ new Entity('Firefox', /Firefox\/([0-9.]+)/), - new Entity('Opera', /OPR\/([0-9.]+)/), new Entity('Edge', /Edge\/([0-9.]+)/), + new Entity('Opera', /OPR\/([0-9.]+)/), + new Entity('SamsungInternet', /SamsungBrowser\/([0-9.]+)/), new Entity('Maxthon', /Maxthon\/([0-9.]+)/), new Entity('Chrome', /Chrome\/([0-9.]+)/), new Entity('Safari', /Version\/([0-9.]+) Safari\//),