Comparing version 1.1.0 to 1.2.0
@@ -35,2 +35,3 @@ /* HEADER BEGIN */ | ||
var edgePattern = /Edge\/([.0-9]+)/; | ||
var chromePattern = /(?:Chrome|CrMo|CriOS)\/([.0-9]+)/; | ||
@@ -46,2 +47,9 @@ var operaBlinkPattern = /OPR\/([.0-9]+)/; | ||
var match; | ||
if ((match = edgePattern.exec(ua))) { | ||
version = match[1]; | ||
updateMap(result, dataset.get('Edge')); | ||
updateVersion(result, version); | ||
return true; | ||
} | ||
if ((match = chromePattern.exec(ua))) { | ||
@@ -107,2 +115,24 @@ var matchOpera; | ||
var webviewPattern = /iP(hone;|ad;|od) .*like Mac OS X/; | ||
var webviewVersionPattern = /Version\/([.0-9]+)/; | ||
var challengeWebview = exports.challengeWebview = function(ua, result) { | ||
var version = dataset.VALUE_UNKNOWN; | ||
var match = webviewPattern.exec(ua); | ||
if (match) { | ||
if (ua.indexOf('Safari/') > -1) | ||
return false; | ||
var vmatch = webviewVersionPattern.exec(ua); | ||
if (vmatch) | ||
version = vmatch[1]; | ||
updateMap(result, dataset.get('Webview')); | ||
updateVersion(result, version); | ||
return true; | ||
} | ||
return false; | ||
}; | ||
var sleipnirPattern = /Sleipnir\/([.0-9]+)/; | ||
@@ -109,0 +139,0 @@ var challengeSleipnir = exports.challengeSleipnir = function(ua, result) { |
@@ -108,2 +108,6 @@ /* HEADER BEGIN */ | ||
} | ||
if (ua.indexOf('Twitterbot/') >= 0) { | ||
updateMap(result, dataset.get('twitter')); | ||
return true; | ||
} | ||
if (ua.indexOf('ichiro') >= 0) { | ||
@@ -110,0 +114,0 @@ if (ua.indexOf('http://help.goo.ne.jp/door/crawler.html') >= 0 || |
@@ -37,3 +37,3 @@ var KEY_LABEL = exports.KEY_LABEL = 'label', | ||
var DATASET = {}; | ||
// GENERATED from dataset.yaml at Thu Mar 26 11:58:49 JST 2015 by tagomoris | ||
// GENERATED from dataset.yaml at Thu Aug 13 14:22:27 JST 2015 by tagomoris | ||
var obj; | ||
@@ -43,2 +43,5 @@ obj = {label:'MSIE', name:'Internet Explorer', type:'browser'}; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Edge', name:'Edge', type:'browser'}; | ||
obj['vendor'] = 'Microsoft'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Chrome', name:'Chrome', type:'browser'}; | ||
@@ -59,5 +62,11 @@ obj['vendor'] = 'Google'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Webview', name:'Webview', type:'browser'}; | ||
obj['vendor'] = 'OS vendor'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Win', name:'Windows UNKNOWN Ver', type:'os'}; | ||
obj['category'] = 'pc'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Win10', name:'Windows 10', type:'os'}; | ||
obj['category'] = 'pc'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Win8.1', name:'Windows 8.1', type:'os'}; | ||
@@ -135,2 +144,5 @@ obj['category'] = 'pc'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'BlackBerry10', name:'BlackBerry 10', type:'os'}; | ||
obj['category'] = 'smartphone'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'docomo', name:'docomo', type:'full'}; | ||
@@ -311,2 +323,6 @@ obj['vendor'] = 'docomo'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'twitter', name:'twitter', type:'full'}; | ||
obj['vendor'] = ''; | ||
obj['category'] = 'crawler'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'mixi', name:'mixi', type:'full'}; | ||
@@ -313,0 +329,0 @@ obj['vendor'] = ''; |
@@ -39,3 +39,4 @@ /* HEADER BEGIN */ | ||
var version = match[1]; | ||
if (version === 'NT 6.3') data = dataset.get('Win8.1'); | ||
if (version === 'NT 10.0') data = dataset.get('Win10'); | ||
else if (version === 'NT 6.3') data = dataset.get('Win8.1'); | ||
else if (version === 'NT 6.2') data = dataset.get('Win8'); // "NT 6.2; ARM;" means Windows RT, oh.... | ||
@@ -119,2 +120,7 @@ else if (version === 'NT 6.1') data = dataset.get('Win7'); | ||
else if (ua.indexOf('CFNetwork') >= 0) data = dataset.get('iOS'); | ||
else if (ua.indexOf('BB10') >= 0) { | ||
data = dataset.get('BlackBerry10'); | ||
if ((match = /BB10(?:.+)Version\/([.0-9]+)/.exec(ua))) | ||
os_version = match[1]; | ||
} | ||
else if (ua.indexOf('BlackBerry') >= 0) { | ||
@@ -121,0 +127,0 @@ data = dataset.get('BlackBerry'); |
@@ -80,2 +80,5 @@ /* HEADER BEGIN */ | ||
if (browser.challengeWebview(userAgent, result)) | ||
return true; | ||
return false; | ||
@@ -82,0 +85,0 @@ } |
{ | ||
"name": "woothee", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "User-Agent string parser (js implementation)", | ||
@@ -5,0 +5,0 @@ "main": "./release/woothee", |
@@ -5,6 +5,6 @@ (function (){ | ||
// GENERATED from dataset.yaml at Thu Mar 26 11:58:49 JST 2015 by tagomoris | ||
// GENERATED from dataset.yaml at Thu Aug 13 14:22:28 JST 2015 by tagomoris | ||
// Snapshot from package.json | ||
var package_info = {"name":"woothee","version":"1.0.2","description":"User-Agent string parser (js implementation)","main":"./release/woothee","devDependencies":{"mocha":">= 1.7.0","chai":">= 1.3.0","js-yaml":">= 1.0.3","should":"~1.2.2"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"https://github.com/woothee/woothee-js"},"author":"tagomoris","license":"Apache v2"}; | ||
var package_info = {"name":"woothee","version":"1.2.0","description":"User-Agent string parser (js implementation)","main":"./release/woothee","devDependencies":{"mocha":">= 1.7.0","chai":">= 1.3.0","js-yaml":">= 1.0.3","should":"~1.2.2"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"https://github.com/woothee/woothee-js"},"author":"tagomoris","license":"Apache v2"}; | ||
@@ -45,3 +45,3 @@ var dataset = {}; | ||
var DATASET = {}; | ||
// GENERATED from dataset.yaml at Thu Mar 26 11:58:49 JST 2015 by tagomoris | ||
// GENERATED from dataset.yaml at Thu Aug 13 14:22:27 JST 2015 by tagomoris | ||
var obj; | ||
@@ -51,2 +51,5 @@ obj = {label:'MSIE', name:'Internet Explorer', type:'browser'}; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Edge', name:'Edge', type:'browser'}; | ||
obj['vendor'] = 'Microsoft'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Chrome', name:'Chrome', type:'browser'}; | ||
@@ -67,5 +70,11 @@ obj['vendor'] = 'Google'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Webview', name:'Webview', type:'browser'}; | ||
obj['vendor'] = 'OS vendor'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Win', name:'Windows UNKNOWN Ver', type:'os'}; | ||
obj['category'] = 'pc'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Win10', name:'Windows 10', type:'os'}; | ||
obj['category'] = 'pc'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Win8.1', name:'Windows 8.1', type:'os'}; | ||
@@ -143,2 +152,5 @@ obj['category'] = 'pc'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'BlackBerry10', name:'BlackBerry 10', type:'os'}; | ||
obj['category'] = 'smartphone'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'docomo', name:'docomo', type:'full'}; | ||
@@ -319,2 +331,6 @@ obj['vendor'] = 'docomo'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'twitter', name:'twitter', type:'full'}; | ||
obj['vendor'] = ''; | ||
obj['category'] = 'crawler'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'mixi', name:'mixi', type:'full'}; | ||
@@ -425,2 +441,3 @@ obj['vendor'] = ''; | ||
}; | ||
var edgePattern = /Edge\/([.0-9]+)/; | ||
var chromePattern = /(?:Chrome|CrMo|CriOS)\/([.0-9]+)/; | ||
@@ -434,2 +451,8 @@ var operaBlinkPattern = /OPR\/([.0-9]+)/; | ||
var match; | ||
if ((match = edgePattern.exec(ua))) { | ||
version = match[1]; | ||
updateMap(result, dataset.get('Edge')); | ||
updateVersion(result, version); | ||
return true; | ||
} | ||
if ((match = chromePattern.exec(ua))) { | ||
@@ -487,2 +510,19 @@ var matchOpera; | ||
}; | ||
var webviewPattern = /iP(hone;|ad;|od) .*like Mac OS X/; | ||
var webviewVersionPattern = /Version\/([.0-9]+)/; | ||
var challengeWebview = exports.challengeWebview = function(ua, result) { | ||
var version = dataset.VALUE_UNKNOWN; | ||
var match = webviewPattern.exec(ua); | ||
if (match) { | ||
if (ua.indexOf('Safari/') > -1) | ||
return false; | ||
var vmatch = webviewVersionPattern.exec(ua); | ||
if (vmatch) | ||
version = vmatch[1]; | ||
updateMap(result, dataset.get('Webview')); | ||
updateVersion(result, version); | ||
return true; | ||
} | ||
return false; | ||
}; | ||
var sleipnirPattern = /Sleipnir\/([.0-9]+)/; | ||
@@ -538,3 +578,4 @@ var challengeSleipnir = exports.challengeSleipnir = function(ua, result) { | ||
var version = match[1]; | ||
if (version === 'NT 6.3') data = dataset.get('Win8.1'); | ||
if (version === 'NT 10.0') data = dataset.get('Win10'); | ||
else if (version === 'NT 6.3') data = dataset.get('Win8.1'); | ||
else if (version === 'NT 6.2') data = dataset.get('Win8'); // "NT 6.2; ARM;" means Windows RT, oh.... | ||
@@ -612,2 +653,7 @@ else if (version === 'NT 6.1') data = dataset.get('Win7'); | ||
else if (ua.indexOf('CFNetwork') >= 0) data = dataset.get('iOS'); | ||
else if (ua.indexOf('BB10') >= 0) { | ||
data = dataset.get('BlackBerry10'); | ||
if ((match = /BB10(?:.+)Version\/([.0-9]+)/.exec(ua))) | ||
os_version = match[1]; | ||
} | ||
else if (ua.indexOf('BlackBerry') >= 0) { | ||
@@ -911,2 +957,6 @@ data = dataset.get('BlackBerry'); | ||
} | ||
if (ua.indexOf('Twitterbot/') >= 0) { | ||
updateMap(result, dataset.get('twitter')); | ||
return true; | ||
} | ||
if (ua.indexOf('ichiro') >= 0) { | ||
@@ -1165,2 +1215,4 @@ if (ua.indexOf('http://help.goo.ne.jp/door/crawler.html') >= 0 || | ||
return true; | ||
if (browser.challengeWebview(userAgent, result)) | ||
return true; | ||
return false; | ||
@@ -1167,0 +1219,0 @@ } |
@@ -23,2 +23,6 @@ # Project Woothee | ||
* v1.2.0 | ||
* Add Microsoft Edge, Webview of mobile phones | ||
* Add Windows 10, BlackBerry 10 | ||
* Add Twitterbot | ||
* v1.1.0 | ||
@@ -25,0 +29,0 @@ * Add specs for blank input data |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
162935
2888