Skip to content

Commit

Permalink
fixed #76 for SAMSUNG mobile device.
Browse files Browse the repository at this point in the history
  • Loading branch information
hotoo committed Apr 22, 2015
1 parent c1e1d1a commit e7ec09e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ sea-modules
dist/
npm-debug.log
spm_modules/
coverage/
4 changes: 2 additions & 2 deletions detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ var DEVICES = [
// 三星有 Android 和 WP 设备。
["samsung", function(ua){
if(ua.indexOf("samsung") !== -1){
return /\bsamsung(?:\-gt)?[ \-]([a-z0-9\-]+)/;
return /\bsamsung(?:[ \-](?:sgh|gt|sm))?-([a-z0-9]+)/;
}else{
return /\b(?:gt|sch)[ \-]([a-z0-9\-]+)/;
return /\b(?:sgh|sch|gt|sm)-([a-z0-9]+)/;
}
}],
["wp", function(ua){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "detector",
"version": "2.2.1",
"version": "2.2.2",
"description": "客户端信息识别模块",
"homepage": "http://spmjs.io/docs/detector/",
"author": "冒顿 <[email protected]>",
Expand Down
32 changes: 25 additions & 7 deletions tests/detector-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ var UAs = [
engine: "trident/6.0;6.0;o"
}],
["Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; SAMSUNG SGH-i917)", {
device: "samsung/sgh-i917",
device: "samsung/i917",
os: "wp/7.5",
browser: "ie/9.0;9.0;o",
engine: "trident/5.0;5.0;o"
Expand Down Expand Up @@ -747,12 +747,6 @@ var UAs = [
browser: "uc/-1;-1;o",
engine: (isBlinkEngine() ? "blink" : "webkit") + "/534.31;534.31;o"
}],
["Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; LG-P500 Build/GRI40) UC AppleWebKit/534.31 (KHTML%2C like Gecko) Mobile Safari/534.31", {
device: "lg/p500",
os: "android/2.3.7",
browser: "uc/-1;-1;o",
engine: (isBlinkEngine() ? "blink" : "webkit") + "/534.31;534.31;o"
}],
[{
"userAgent": "Mozilla/5.0 (Linux; U; Android 3.2; zh-cn; GT-P6800 Build/HTJ85B) UC AppleWebKit/534.31 (KHTML, like Gecko) Mobile Safari/534.31",
"appVersion": "5.0 (Linux; U; Android 3.2; zh-cn; GT-P6800 Build/HTJ85B) UC AppleWebKit/534.31 (KHTML, like Gecko) Mobile Safari/534.31 UC/8.7.4.225",
Expand All @@ -763,6 +757,30 @@ var UAs = [
browser: "uc/8.7.4.225;8.7.4.225;o",
engine: (isBlinkEngine() ? "blink" : "webkit") + "/534.31;534.31;o"
}],
["Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; SM-T311 Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30", {
device: "samsung/t311",
os: "android/4.2.2",
browser: "android/4.0;4.0;o",
engine: (isBlinkEngine() ? "blink" : "webkit") + "/534.30;534.30;o"
}],
["Mozilla/5.0 (Linux; Android 4.4.2; zh-cn; SAMSUNG-SM-N9009 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36", {
device: "samsung/n9009",
os: "android/4.4.2",
browser: "chrome/28.0.1500.94;28.0.1500.94;o",
engine: (isBlinkEngine() ? "blink" : "webkit") + "/537.36;537.36;o"
}],
["(Linux; Android 4.3; zh-cn; SAMSUNG SM-N9002 Build/JSS15J) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36", {
device: "samsung/n9002",
os: "android/4.3",
browser: "chrome/28.0.1500.94;28.0.1500.94;o",
engine: (isBlinkEngine() ? "blink" : "webkit") + "/537.36;537.36;o"
}],
["Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; LG-P500 Build/GRI40) UC AppleWebKit/534.31 (KHTML%2C like Gecko) Mobile Safari/534.31", {
device: "lg/p500",
os: "android/2.3.7",
browser: "uc/-1;-1;o",
engine: (isBlinkEngine() ? "blink" : "webkit") + "/534.31;534.31;o"
}],
[{
"userAgent": "Mozilla/4.0 (compatible;Android;320x480)",
"appVersion": "4.0 (compatible;Android;320x480) UC/9.1.1.309",
Expand Down

0 comments on commit e7ec09e

Please sign in to comment.