Files
weiyu/visitor/web/pc/js/bd_kfe_device.min.js
jack ning 8a84e6b738 update
2024-04-05 15:53:09 +08:00

1 line
12 KiB
JavaScript

"use strict"; var DeviceInfo = function () { var e = "undefined" != typeof self ? self : this, n = e || {}, r = { navigator: void 0 !== e.navigator ? e.navigator : {}, infoMap: { engine: ["WebKit", "Trident", "Gecko", "Presto"], browser: ["Safari", "Chrome", "Edge", "IE", "Firefox", "Firefox Focus", "Chromium", "Opera", "Vivaldi", "Yandex", "Arora", "Lunascape", "QupZilla", "Coc Coc", "Kindle", "Iceweasel", "Konqueror", "Iceape", "SeaMonkey", "Epiphany", "360", "360SE", "360EE", "UC", "QQBrowser", "QQ", "Baidu", "Maxthon", "Sogou", "LBBROWSER", "2345Explorer", "TheWorld", "XiaoMi", "Quark", "Qiyu", "Wechat", "Taobao", "Alipay", "Weibo", "Douban", "Suning", "iQiYi"], os: ["Windows", "Linux", "Mac OS", "Android", "Ubuntu", "FreeBSD", "Debian", "iOS", "Windows Phone", "BlackBerry", "MeeGo", "Symbian", "Chrome OS", "WebOS"], device: ["Mobile", "Tablet", "iPad"] } }, i = function () { return { getMatchMap: function (e) { return { Trident: e.indexOf("Trident") > -1 || e.indexOf("NET CLR") > -1, Presto: e.indexOf("Presto") > -1, WebKit: e.indexOf("AppleWebKit") > -1, Gecko: e.indexOf("Gecko/") > -1, Safari: e.indexOf("Safari") > -1, Chrome: e.indexOf("Chrome") > -1 || e.indexOf("CriOS") > -1, IE: e.indexOf("MSIE") > -1 || e.indexOf("Trident") > -1, Edge: e.indexOf("Edge") > -1, Firefox: e.indexOf("Firefox") > -1 || e.indexOf("FxiOS") > -1, "Firefox Focus": e.indexOf("Focus") > -1, Chromium: e.indexOf("Chromium") > -1, Opera: e.indexOf("Opera") > -1 || e.indexOf("OPR") > -1, Vivaldi: e.indexOf("Vivaldi") > -1, Yandex: e.indexOf("YaBrowser") > -1, Arora: e.indexOf("Arora") > -1, Lunascape: e.indexOf("Lunascape") > -1, QupZilla: e.indexOf("QupZilla") > -1, "Coc Coc": e.indexOf("coc_coc_browser") > -1, Kindle: e.indexOf("Kindle") > -1 || e.indexOf("Silk/") > -1, Iceweasel: e.indexOf("Iceweasel") > -1, Konqueror: e.indexOf("Konqueror") > -1, Iceape: e.indexOf("Iceape") > -1, SeaMonkey: e.indexOf("SeaMonkey") > -1, Epiphany: e.indexOf("Epiphany") > -1, 360: e.indexOf("QihooBrowser") > -1 || e.indexOf("QHBrowser") > -1, "360EE": e.indexOf("360EE") > -1, "360SE": e.indexOf("360SE") > -1, UC: e.indexOf("UC") > -1 || e.indexOf(" UBrowser") > -1, QQBrowser: e.indexOf("QQBrowser") > -1, QQ: e.indexOf("QQ/") > -1, Baidu: e.indexOf("Baidu") > -1 || e.indexOf("BIDUBrowser") > -1, Maxthon: e.indexOf("Maxthon") > -1, Sogou: e.indexOf("MetaSr") > -1 || e.indexOf("Sogou") > -1, LBBROWSER: e.indexOf("LBBROWSER") > -1, "2345Explorer": e.indexOf("2345Explorer") > -1, TheWorld: e.indexOf("TheWorld") > -1, XiaoMi: e.indexOf("MiuiBrowser") > -1, Quark: e.indexOf("Quark") > -1, Qiyu: e.indexOf("Qiyu") > -1, Wechat: e.indexOf("MicroMessenger") > -1, Taobao: e.indexOf("AliApp(TB") > -1, Alipay: e.indexOf("AliApp(AP") > -1, Weibo: e.indexOf("Weibo") > -1, Douban: e.indexOf("com.douban.frodo") > -1, Suning: e.indexOf("SNEBUY-APP") > -1, iQiYi: e.indexOf("IqiyiApp") > -1, Windows: e.indexOf("Windows") > -1, Linux: e.indexOf("Linux") > -1 || e.indexOf("X11") > -1, "Mac OS": e.indexOf("Macintosh") > -1, Android: e.indexOf("Android") > -1 || e.indexOf("Adr") > -1, Ubuntu: e.indexOf("Ubuntu") > -1, FreeBSD: e.indexOf("FreeBSD") > -1, Debian: e.indexOf("Debian") > -1, "Windows Phone": e.indexOf("IEMobile") > -1 || e.indexOf("Windows Phone") > -1, BlackBerry: e.indexOf("BlackBerry") > -1 || e.indexOf("RIM") > -1, MeeGo: e.indexOf("MeeGo") > -1, Symbian: e.indexOf("Symbian") > -1, iOS: e.indexOf("like Mac OS X") > -1, "Chrome OS": e.indexOf("CrOS") > -1, WebOS: e.indexOf("hpwOS") > -1, Mobile: e.indexOf("Mobi") > -1 || e.indexOf("iPh") > -1 || e.indexOf("480") > -1, Tablet: e.indexOf("Tablet") > -1 || e.indexOf("Nexus 7") > -1, iPad: e.indexOf("iPad") > -1 } }, matchInfoMap: function (e) { var n = r.navigator.userAgent || {}, o = i.getMatchMap(n); for (var a in r.infoMap) for (var t = 0; t < r.infoMap[a].length; t++) { var c = r.infoMap[a][t]; o[c] && (e[a] = c) } }, getOS: function () { var e = this; return i.matchInfoMap(e), e.os }, getOSVersion: function () { var e = this, n = r.navigator.userAgent || {}; e.osVersion = ""; var i = { Windows: function () { var e = n.replace(/^.*Windows NT ([\d.]+);.*$/, "$1"); return { 6.4: "10", 6.3: "8.1", 6.2: "8", 6.1: "7", "6.0": "Vista", 5.2: "XP", 5.1: "XP", "5.0": "2000" }[e] || e }, Android: function () { return n.replace(/^.*Android ([\d.]+);.*$/, "$1") }, iOS: function () { return n.replace(/^.*OS ([\d_]+) like.*$/, "$1").replace(/_/g, ".") }, Debian: function () { return n.replace(/^.*Debian\/([\d.]+).*$/, "$1") }, "Windows Phone": function () { return n.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/, "$2") }, "Mac OS": function () { return n.replace(/^.*Mac OS X ([\d_]+).*$/, "$1").replace(/_/g, ".") }, WebOS: function () { return n.replace(/^.*hpwOS\/([\d.]+);.*$/, "$1") } }; return i[e.os] && (e.osVersion = i[e.os](), e.osVersion == n && (e.osVersion = "")), e.osVersion }, getOrientationStatu: function () { return window.matchMedia("(orientation: portrait)").matches ? "竖屏" : "横屏" }, getDeviceType: function () { var e = this; return e.device = "PC", i.matchInfoMap(e), e.device }, getNetwork: function () { return navigator && navigator.connection && navigator.connection.effectiveType }, getLanguage: function () { var e = this; return e.language = function () { var e = r.navigator.browserLanguage || r.navigator.language, n = e.split("-"); return n[1] && (n[1] = n[1].toUpperCase()), n.join("_") }(), e.language }, createFingerprint: function (e) { var n = document.createElement("canvas"), r = n.getContext("2d"), i = e || window.location.host; r.textBaseline = "top", r.font = "14px 'Arial'", r.textBaseline = "tencent", r.fillStyle = "#f60", r.fillRect(125, 1, 62, 20), r.fillStyle = "#069", r.fillText(i, 2, 15), r.fillStyle = "rgba(102, 204, 0, 0.7)", r.fillText(i, 4, 17); var o = n.toDataURL().replace("data:image/png;base64,", ""), a = atob(o); return function (e) { var n, r, i, o = ""; for (e += "", n = 0, r = e.length; n < r; n++)i = e.charCodeAt(n).toString(16), o += i.length < 2 ? "0" + i : i; return o }(a.slice(-16, -12)) }, getBrowserInfo: function () { var e = this; i.matchInfoMap(e); var o = r.navigator.userAgent || {}, a = function (e, n) { var i = r.navigator.mimeTypes; for (var o in i) if (i[o][e] == n) return !0; return !1 }, t = i.getMatchMap(o), c = !1; if (n.chrome) { var d = o.replace(/^.*Chrome\/([\d]+).*$/, "$1"); d > 36 && n.showModalDialog ? c = !0 : d > 45 && (c = a("type", "application/vnd.chromium.remoting-viewer")) } if (t.Baidu && t.Opera && (t.Baidu = !1), t.Mobile && (t.Mobile = !(o.indexOf("iPad") > -1)), c && (a("type", "application/gameplugin") ? t["360SE"] = !0 : r.navigator && void 0 === r.navigator.connection.saveData ? t["360SE"] = !0 : t["360EE"] = !0), t.IE || t.Edge) { switch (window.screenTop - window.screenY) { case 71: case 74: case 99: break; case 102: t["360EE"] = !0; break; case 75: case 74: case 105: break; case 104: t["360SE"] = !0 } } var u = { Safari: function () { return o.replace(/^.*Version\/([\d.]+).*$/, "$1") }, Chrome: function () { return o.replace(/^.*Chrome\/([\d.]+).*$/, "$1").replace(/^.*CriOS\/([\d.]+).*$/, "$1") }, IE: function () { return o.replace(/^.*MSIE ([\d.]+).*$/, "$1").replace(/^.*rv:([\d.]+).*$/, "$1") }, Edge: function () { return o.replace(/^.*Edge\/([\d.]+).*$/, "$1") }, Firefox: function () { return o.replace(/^.*Firefox\/([\d.]+).*$/, "$1").replace(/^.*FxiOS\/([\d.]+).*$/, "$1") }, "Firefox Focus": function () { return o.replace(/^.*Focus\/([\d.]+).*$/, "$1") }, Chromium: function () { return o.replace(/^.*Chromium\/([\d.]+).*$/, "$1") }, Opera: function () { return o.replace(/^.*Opera\/([\d.]+).*$/, "$1").replace(/^.*OPR\/([\d.]+).*$/, "$1") }, Vivaldi: function () { return o.replace(/^.*Vivaldi\/([\d.]+).*$/, "$1") }, Yandex: function () { return o.replace(/^.*YaBrowser\/([\d.]+).*$/, "$1") }, Arora: function () { return o.replace(/^.*Arora\/([\d.]+).*$/, "$1") }, Lunascape: function () { return o.replace(/^.*Lunascape[\/\s]([\d.]+).*$/, "$1") }, QupZilla: function () { return o.replace(/^.*QupZilla[\/\s]([\d.]+).*$/, "$1") }, "Coc Coc": function () { return o.replace(/^.*coc_coc_browser\/([\d.]+).*$/, "$1") }, Kindle: function () { return o.replace(/^.*Version\/([\d.]+).*$/, "$1") }, Iceweasel: function () { return o.replace(/^.*Iceweasel\/([\d.]+).*$/, "$1") }, Konqueror: function () { return o.replace(/^.*Konqueror\/([\d.]+).*$/, "$1") }, Iceape: function () { return o.replace(/^.*Iceape\/([\d.]+).*$/, "$1") }, SeaMonkey: function () { return o.replace(/^.*SeaMonkey\/([\d.]+).*$/, "$1") }, Epiphany: function () { return o.replace(/^.*Epiphany\/([\d.]+).*$/, "$1") }, 360: function () { return o.replace(/^.*QihooBrowser\/([\d.]+).*$/, "$1") }, "360SE": function () { return { 63: "10.0", 55: "9.1", 45: "8.1", 42: "8.0", 31: "7.0", 21: "6.3" }[o.replace(/^.*Chrome\/([\d]+).*$/, "$1")] || "" }, "360EE": function () { return { 69: "11.0", 63: "9.5", 55: "9.0", 50: "8.7", 30: "7.5" }[o.replace(/^.*Chrome\/([\d]+).*$/, "$1")] || "" }, Maxthon: function () { return o.replace(/^.*Maxthon\/([\d.]+).*$/, "$1") }, QQBrowser: function () { return o.replace(/^.*QQBrowser\/([\d.]+).*$/, "$1") }, QQ: function () { return o.replace(/^.*QQ\/([\d.]+).*$/, "$1") }, Baidu: function () { return o.replace(/^.*BIDUBrowser[\s\/]([\d.]+).*$/, "$1") }, UC: function () { return o.replace(/^.*UC?Browser\/([\d.]+).*$/, "$1") }, Sogou: function () { return o.replace(/^.*SE ([\d.X]+).*$/, "$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/, "$1") }, LBBROWSER: function () { return { 57: "6.5", 49: "6.0", 46: "5.9", 42: "5.3", 39: "5.2", 34: "5.0", 29: "4.5", 21: "4.0" }[navigator.userAgent.replace(/^.*Chrome\/([\d]+).*$/, "$1")] || "" }, "2345Explorer": function () { return o.replace(/^.*2345Explorer\/([\d.]+).*$/, "$1") }, TheWorld: function () { return o.replace(/^.*TheWorld ([\d.]+).*$/, "$1") }, XiaoMi: function () { return o.replace(/^.*MiuiBrowser\/([\d.]+).*$/, "$1") }, Quark: function () { return o.replace(/^.*Quark\/([\d.]+).*$/, "$1") }, Qiyu: function () { return o.replace(/^.*Qiyu\/([\d.]+).*$/, "$1") }, Wechat: function () { return o.replace(/^.*MicroMessenger\/([\d.]+).*$/, "$1") }, Taobao: function () { return o.replace(/^.*AliApp\(TB\/([\d.]+).*$/, "$1") }, Alipay: function () { return o.replace(/^.*AliApp\(AP\/([\d.]+).*$/, "$1") }, Weibo: function () { return o.replace(/^.*weibo__([\d.]+).*$/, "$1") }, Douban: function () { return o.replace(/^.*com.douban.frodo\/([\d.]+).*$/, "$1") }, Suning: function () { return o.replace(/^.*SNEBUY-APP([\d.]+).*$/, "$1") }, iQiYi: function () { return o.replace(/^.*IqiyiVersion\/([\d.]+).*$/, "$1") } }; return e.browserVersion = "", u[e.browser] && (e.browserVersion = u[e.browser](), e.browserVersion == o && (e.browserVersion = "")), "Edge" == e.browser && (e.engine = "EdgeHTML"), "Chrome" == e.browser && parseInt(e.browserVersion) > 27 && (e.engine = "Blink"), "Opera" == e.browser && parseInt(e.browserVersion) > 12 && (e.engine = "Blink"), "Yandex" == e.browser && (e.engine = "Blink"), e.browser + "(版本:" + e.browserVersion + ";内核:" + e.engine + ")" } } }(), o = function () { return { DeviceInfoObj: function (e) { var o = { deviceType: i.getDeviceType(), os: i.getOS(), osVersion: i.getOSVersion(), screenHeight: n.screen.height, screenWidth: n.screen.width, wbHeight: n.innerHeight, wbWidth: n.innerWidth, language: i.getLanguage(), netWork: i.getNetwork(), orientation: i.getOrientationStatu(), browserInfo: i.getBrowserInfo(), fingerprint: i.createFingerprint(e.domain), userAgent: r.navigator.userAgent }; if (e.info && 0 != e.info.length) { var a = {}; for (var t in o) e.info.forEach(function (e) { e.toLowerCase() == t.toLowerCase() && (e = t, a[e] = o[e]) }); return a } return o } } }(); return { getDeviceInfo: function (e) { return o.DeviceInfoObj(e) } } }();