diff --git a/.gitignore b/.gitignore index ac56411..6f18eba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ npm-debug.log +<<<<<<< HEAD ### vim ### .*.s[a-w][a-z] *.un~ @@ -20,3 +21,6 @@ Icon # Files that might appear on external disk .Spotlight-V100 .Trashes +======= +.idea +>>>>>>> baf4bb99b4ef92c71419931e8fd334e34c051e52 diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..5df1992 --- /dev/null +++ b/bower.json @@ -0,0 +1,26 @@ +{ + "name": "ua-parser-js", + "version": "0.6.3-ktb", + "authors": [ + "Faisal Salman " + ], + "private": false, + "main": "src/ua-parser.js", + "ignore": [ + "build", + "node_modules", + "bower_components", + "test", + "tests" + ], + "contributors": [ + "Faisal Salman ", + "Christopher De Cairos ", + "John Tantalo ", + "Jon Buckley ", + "Lee Treveil " + ], + "dependencies": { + + } +} diff --git a/src/ua-parser.js b/src/ua-parser.js index bfc4f92..7d8aaca 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -205,6 +205,9 @@ browser : [[ + /APP-([\w\s-\d]+)\/((\d+)?[\w\.]+)/i // KTA App + ], [NAME, VERSION, MAJOR], [ + // Presto based /(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini /(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet @@ -507,6 +510,8 @@ ], engine : [[ + /APP-([\w\s-\d]+)\/((\d+)?[\w\.]+)/i // KTA App + ], [[NAME, 'Mobile-App'], VERSION], [ /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m diff --git a/test/browser-test.json b/test/browser-test.json index 15cb6db..968e7ec 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -14,7 +14,7 @@ "ua" : "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB5; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)", "expect" : { - "name" : "Avant Browser", + "name" : "Avant ", "version" : "undefined", "major" : "undefined" } @@ -24,7 +24,7 @@ "ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)", "expect" : { - "name" : "baidubrowser", + "name" : "baidu", "version" : "1.x", "major" : "1" } @@ -594,7 +594,7 @@ "ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SlimBrowser)", "expect" : { - "name" : "SlimBrowser", + "name" : "Slim", "version" : "undefined", "major" : "undefined" } @@ -1218,5 +1218,15 @@ "version" : "1.18.1", "major" : "1" } + }, + { + "desc" : "BE-Test", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "name" : "BE Test", + "version" : "1.0", + "major" : "1" + } } ] diff --git a/test/cpu-test.json b/test/cpu-test.json index 8e9befc..657d21b 100644 --- a/test/cpu-test.json +++ b/test/cpu-test.json @@ -102,5 +102,21 @@ { "architecture" : "amd64" } + }, + { + "desc" : "KTB iPad", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "architecture" : "undefined" + } + }, + { + "desc" : "KTB-Nexus 5", + "ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)", + "expect" : + { + "architecture" : "undefined" + } } ] diff --git a/test/device-test.json b/test/device-test.json index ea737ff..41d7c8d 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -169,6 +169,16 @@ "type" : "mobile" } }, + { + "desc" : "KTB-iPhone", + "ua" : "APP-BE/1.0 (iPhone; Apple; CPU iPhone OS 7_0 like Mac OS X)", + "expect" : + { + "vendor" : "Apple", + "model" : "iPhone", + "type" : "mobile" + } + }, { "desc" : "stagefright", "ua" : "Samsung GT-I9070 stagefright/1.1 (Linux;Android 2.3.6)", @@ -179,6 +189,16 @@ "type" : "mobile" } }, + { + "desc" : "KTB-iPod Touch", + "ua" : "APP-BE/1.0 (iPod touch; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "vendor" : "Apple", + "model" : "iPod touch", + "type" : "mobile" + } + }, { "desc" : "rad.io", "ua" : "rad.io 1.18.1 rv:593 (iPhone 4S; iPhone OS 7.0.4; it_IT)", @@ -198,5 +218,25 @@ "model" : "KFTT", "type" : "tablet" } + }, + { + "desc" : "KTB-iPad", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "vendor" : "Apple", + "model" : "iPad", + "type" : "tablet" + } + }, + { + "desc" : "KTB-Nexus 5", + "ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)", + "expect" : + { + "vendor" : "LG", + "model" : "Nexus 5", + "type" : "mobile" + } } ] diff --git a/test/engine-test.json b/test/engine-test.json index 9f6944c..23987eb 100644 --- a/test/engine-test.json +++ b/test/engine-test.json @@ -61,4 +61,24 @@ "name" : "WebKit", "version" : "533.19.4" } -}] + }, + { + "desc" : "KTA Mobile App", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "name" : "Mobile-App", + "version" : "1.0" + } + }, + { + "desc" : "KTB-Nexus 5", + "ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)", + "expect" : + { + "name" : "Mobile-App", + "version" : "1.0" + } + } + +] diff --git a/test/os-test.json b/test/os-test.json index 2e4c0c4..b792ec9 100644 --- a/test/os-test.json +++ b/test/os-test.json @@ -574,5 +574,23 @@ "name" : "", "version" : "" } + }, + { + "desc" : "iOS BE App", + "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)", + "expect" : + { + "name" : "iOS", + "version" : "7.0.2" + } + }, + { + "desc" : "KTB-Nexus 5", + "ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)", + "expect" : + { + "name" : "Android", + "version" : "4.2.1" + } } ]