Skip to content

Commit

Permalink
Merge pull request #2 from LiuXiangyu/master
Browse files Browse the repository at this point in the history
+ get white list from crayfish
  • Loading branch information
LiuXiangyu authored Jul 7, 2017
2 parents ac8168d + 24ad787 commit b0d9540
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
11 changes: 7 additions & 4 deletions build/flexible.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@
var isIPhone = win.navigator.appVersion.match(/iphone/gi);
var devicePixelRatio = win.devicePixelRatio;
var isX5 = /TBS\/\d+/.test(win.navigator.userAgent)
var notInBlackList = blackUAList.every(function(ua) {
return !new RegExp(ua).test(navigator.userAgent)
})
if (isIPhone || isChrome || (isX5 && flexibleInX5) && notInBlackList) {
var isInWhiteList = false
try {
isInWhiteList = localStorage.getItem('IN_FLEXIBLE_WHITE_LIST') === 'true'
} catch (e) {
isInWhiteList = false
}
if (isIPhone || isChrome || (isX5 && flexibleInX5 && isInWhiteList)) {
// iOS下,对于2和3的屏,用2倍的方案,其余的用1倍方案
if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) {
dpr = 3;
Expand Down
2 changes: 1 addition & 1 deletion build/flexible.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lib.flexible",
"description": "移动端自适应方案",
"version": "1.2.0",
"version": "1.2.2",
"homepage": "http://gitlab.alibaba-inc.com/mtb/lib-flexible",
"author": [
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lib.flexible",
"description": "移动端自适应方案",
"version": "1.2.1",
"version": "1.2.2",
"homepage": "http://gitlab.alibaba-inc.com/mtb/lib-flexible",
"author": [
{
Expand Down
11 changes: 7 additions & 4 deletions src/flexible.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@
var isIPhone = win.navigator.appVersion.match(/iphone/gi);
var devicePixelRatio = win.devicePixelRatio;
var isX5 = /TBS\/\d+/.test(win.navigator.userAgent)
var notInBlackList = blackUAList.every(function(ua) {
return !new RegExp(ua).test(navigator.userAgent)
})
if (isIPhone || isChrome || (isX5 && flexibleInX5) && notInBlackList) {
var isInWhiteList = false
try {
isInWhiteList = localStorage.getItem('IN_FLEXIBLE_WHITE_LIST') === 'true'
} catch (e) {
isInWhiteList = false
}
if (isIPhone || isChrome || (isX5 && flexibleInX5 && isInWhiteList)) {
// iOS下,对于2和3的屏,用2倍的方案,其余的用1倍方案
if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) {
dpr = 3;
Expand Down

0 comments on commit b0d9540

Please sign in to comment.