mirror of
https://github.com/thepaperpilot/Super-Auto-Coots.git
synced 2024-12-11 08:31:33 +00:00
1 line
1.7 KiB
JavaScript
1 line
1.7 KiB
JavaScript
var p=/iPhone/i,b=/iPod/i,h=/iPad/i,v=/\biOS-universal(?:.+)Mac\b/i,s=/\bAndroid(?:.+)Mobile\b/i,f=/Android/i,r=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,d=/Silk/i,t=/Windows Phone/i,u=/\bWindows(?:.+)ARM\b/i,c=/BlackBerry/i,m=/BB10/i,w=/Opera Mini/i,y=/\b(CriOS|Chrome)(?:.+)Mobile/i,A=/Mobile(?:.+)Firefox\b/i,P=function(i){return typeof i!="undefined"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream=="undefined"};function T(i){return function(n){return n.test(i)}}function g(i){var n={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator!="undefined"?n={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?n.userAgent=i:i&&i.userAgent&&(n={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var a=n.userAgent,l=a.split("[FBAN");typeof l[1]!="undefined"&&(a=l[0]),l=a.split("Twitter"),typeof l[1]!="undefined"&&(a=l[0]);var e=T(a),o={apple:{phone:e(p)&&!e(t),ipod:e(b),tablet:!e(p)&&(e(h)||P(n))&&!e(t),universal:e(v),device:(e(p)||e(b)||e(h)||e(v)||P(n))&&!e(t)},amazon:{phone:e(r),tablet:!e(r)&&e(d),device:e(r)||e(d)},android:{phone:!e(t)&&e(r)||!e(t)&&e(s),tablet:!e(t)&&!e(r)&&!e(s)&&(e(d)||e(f)),device:!e(t)&&(e(r)||e(d)||e(s)||e(f))||e(/\bokhttp\b/i)},windows:{phone:e(t),tablet:e(u),device:e(t)||e(u)},other:{blackberry:e(c),blackberry10:e(m),opera:e(w),firefox:e(A),chrome:e(y),device:e(c)||e(m)||e(w)||e(A)||e(y)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}export{g as i};
|