-
Notifications
You must be signed in to change notification settings - Fork 25
/
device.min.js
1 lines (1 loc) · 925 Bytes
/
device.min.js
1
(function(){function e(e){return e.test(s)}var i=window,o=i.location,n=i.navigator,s=n.userAgent.toLowerCase(),d="ontouchend"in i,t=e(/android|htc/)||/linux/i.test(n.platform+""),a=!t&&e(/ipad/),r=!t&&e(/ipod|iphone/),u=a||r,c=e(/windows phone/),l=!!n.standalone,p=t&&e(/mi\s+/),f=e(/ucbrowser/),m=e(/micromessenger/),w=e(/baidubrowser/),h=!!i.chrome,b=e(/baiduboxapp/),x=!t&&!u&&!c,C=t&&e(/htc\s+/),B=e(/baiduwallet/),g=!!~(""+o.port).indexOf("0"),v={isTouch:d,isAndroid:t,isIPad:a,isIPhone:r,isIOS:u,isWinPhone:c,isWebapp:l,isXiaoMi:p,isUC:f,isWeixin:m,isBaiduBox:b,isBaiduBrowser:w,isChrome:h,isPC:x,isHTC:C,isBaiduWallet:B,isDebug:g},I=i.document.documentElement;for(var P in v)v[P]&&(I.className+=" "+P.replace("Is","").toLowerCase());"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return v}):"undefined"!=typeof module&&module.exports?module.exports=v:window.device=v}).call(this);