Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加手机百度和夸克浏览器的规则 #113

Merged
merged 3 commits into from
Apr 28, 2017
Merged

Conversation

599316527
Copy link
Contributor

@599316527 599316527 commented Apr 26, 2017

fix #111 #112

Mozilla/5.0 (Linux; U; Android 6.0.1; zh-cn; OPPO R9s Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/38.0.0.0 Mobile Safari/537.36 OppoBrowser/4.2.8
Copy link
Owner

@hotoo hotoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 这些浏览器的占比数据提供下,占比小的建议放在 rules.js 而不是 web-rules.js 里。
  2. 添加测试用例。

lib/web-rules.js Outdated
@@ -87,7 +87,7 @@ const DEVICES = [
return /\bhtc[ _\-]?([a-z0-9 ]+)/;
}
}],
["oppo", /\boppo[_]([a-z0-9]+)/],
["oppo", /\boppo[_ ]([a-z0-9]+)/i],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ua 字符串会被转为小写,不用添加 i 标记。

lib/web-rules.js Outdated
}],
["quark", function (ua) {
if (ua.indexOf('quark/') >= 0) {
return (/\bquark\/([0-9.]+)/);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

["quark": /\bquark\/([0-9.]+)/],

lib/web-rules.js Outdated
}],
["oppo", function (ua) {
if (ua.indexOf('oppobrowser/') >= 0) {
return (/\boppobrowser\/([0-9.]+)/);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

["oppobrowser": /\boppobrowser\/([0-9.]+)/],

lib/web-rules.js Outdated
@@ -304,6 +304,21 @@ const BROWSER = [
return /\b(?:ucbrowser|uc)\b/;
}
}],
["baidubox", function (ua) {
if (ua.indexOf('baiduboxapp/') >= 0) {
return (/\bbaiduboxapp\/([0-9.]+)/);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

["baidubox", /\bbaiduboxapp\/([0-9.]+)/],

@599316527
Copy link
Contributor Author

我们这边手机百度和oppo占比略大。

我在实现一个无线端 <video> 相关的功能,Android 上乱七八糟的浏览器把 <video> 改得面目全非,我得为这些做退化又不想误伤到 Chrome,所以得辨别出这些浏览器

@hotoo hotoo merged commit cd92ccd into hotoo:master Apr 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

希望增加手机百度识别
2 participants