X Tutup
Skip to content

Commit cb0c3f7

Browse files
committed
update
1 parent 6022d0b commit cb0c3f7

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

base/base.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,35 @@
2929
return theRequest;
3030
};
3131

32-
var base = new Base();
32+
Base.prototype.checkPlatforms = function() {
33+
var u = navigator.userAgent, app = navigator.appVersion;
34+
        return {
35+
            tridentu.indexOf('Trident') > -1, //IE内核
36+
            prestou.indexOf('Presto') > -1, //opera内核
37+
            webKitu.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
38+
            geckou.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核
39+
            mobile!!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
40+
            ios!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
41+
            androidu.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
42+
            iPhoneu.indexOf('iPhone') > -1 , //是否为iPhone或者QQHD浏览器
43+
            iPadu.indexOf('iPad') > -1, //是否iPad
44+
            webAppu.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部
45+
            weixinu.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增)
46+
            qqu.match(/\sQQ/i) == " qq" //是否QQ
47+
        };
48+
};
49+
50+
var basefn = new Base();
3351

34-
window.base = base;
52+
window.basefn = basefn;
3553

3654
})(window, document);
3755

3856
if (typeof module !== 'undefined') {
39-
module.exports = window.base;
57+
module.exports = window.basefn;
4058
} else if (typeof define === 'function' && define.amd) {
4159
define([], function () {
4260
'use strict';
43-
return window.base;
61+
return window.basefn;
4462
});
4563
}

0 commit comments

Comments
 (0)
X Tutup