// ==UserScript== // @name 小米路由器增强 Mi-Stat_Max // @name:en MiWiFi-Stat_Max // @namespace ucxn // @version 5.9.0 // @tag 路由器 小米 网络 监控 统计 数据 可视化 极客 WiFi 米家 HA 智能 定时 后台 雷军 // @description 哥哥科技 space.bilibili.com/501430041 // @description:en https://github.com/ucxn/Mi-Stat_Max // @author 哥哥科技 QQ群 680464365 // @contributor https://github.com/tiejiang29/miwifi_router // @noframes // @icon https://scriptcat.org/api/v2/resource/image/duygQktL5QjWtkLc // @match *://*/cgi-bin/luci* // @match *://*/main.html* // @run-at document-end // @grant GM_setValue // @storageName GBNPA_Storage // @license AGPL-3.0 // ==/UserScript== (function () { 'use strict'; console.log("🚀 哥哥科技 V5.9.9 终极引擎已装载..."); function escapeHTML(str) { if (!str) return ''; return String(str).replace(/[&<>'"]/g, function (match) { return { '&': '&', '<': '<', '>': '>', "'": ''', '"': '"' } [match]; }); } // ======== [0] 用户极客环境变量配置区 ======== const CONFIG = { uiLayout: 1, // 【面板拓扑结构】 0: 经典版 | 1: 详细紧凑版(驾驶舱美学) | 2: 详细平铺版(报表流美学) injectMode: 3, // 【UI注入模式】 0: 原生侧边栏(1min)| 1: 仅悬浮舱 | 2: 智能选一 | 3:默认模式 calcMode: 1, // 1: 上行/下行倍数模式, 0: 上行占总和比例模式 ratioExtremeUp: 10, // 极端上传判定阈值 (> 1000%) ratioWarnUp: 0.12, // 重度上传警告阈值 (> 7%) ratioExtremeDown: 0.01, // 极端下载判定阈值 (< 1%) ratioThreshold: 7, // (仅calcMode=0时有效) 上传占比报警阈值(%) readSaveData: 1, // 【开关切换】 1: 读档模式(继承本次历史量) | 0: 新局模式(从打开网页此刻归零重新计流) lanRefreshInterval: 3, // LAN口刷新时间(秒),用于精准补偿0到唤醒时的瞬时流量 wanRefreshInterval: 3, // 【新增】WAN口刷新时间(秒),用于精准补偿0到唤醒时的瞬时流量 portMap: { "eth1": "网口 ", "eth2": "网口 2", "eth3": "网口 3", "eth4": "网口 4", "wl0": "2.4G", "wl1": "5.2G", "wl2": "访客" } }; const S = { lt: 0, wInstUp: 0, wInstDn: 0, wTotUp: 0, wTotDn: 0, cls: {}, isPinned: !0, w2U: 0, w2D: 0, w2TotUp: 0, w2TotDn: 0, w2LT: undefined, hasW2: !1, is5G_149: !1, oWU:0 }; window.__gIsF = !1; function fB(bps) { if (bps > 1e9) return `${(bps * 1e-6).toFixed(1)} Mbit/s`; if (bps > 1e6) return `${(bps * 1e-6).toFixed(2)} Mbps`; if (bps > 1e3) return `${(bps * 1e-3).toFixed(1)} Kbps`; return `${Math.round(bps)} bps`; } function fBy(bps) { if (bps >= 8388608) return `${(bps / 8388608).toFixed(2)} MiB/s`; if (bps > 8192) return `${(bps / 8192).toFixed(1)} KiB/s`; return `${Math.round(bps / 8)} B/s`; } function fV(bits) { if (bits > 83886080000) return `${(bits / 8589934592).toFixed(4)} GiB`; if (bits > 8388608000) return `${(bits / 8388608).toFixed(1)} MiB`; if (bits > 8388608) return `${(bits / 8388608).toFixed(4)} MiB`; if (bits > 8192) return `${(bits / 8192).toFixed(3)} KiB`; return `${Math.round(bits / 8)} B`; } function fVD(bitsIntegral, bitsOfficial) { if (bitsIntegral > 8796093022208) return `${(bitsOfficial / 8796093022208).toFixed(4)} | ${(bitsIntegral / 8796093022208).toFixed(4)} TiB`; if (bitsIntegral >= 8589934592) return `${(bitsOfficial / 8589934592).toPrecision(5)} | ${(bitsIntegral / 8589934592).toPrecision(5)} GiB`; if (bitsIntegral > 8388608) return `${(bitsOfficial / 8388608).toFixed(3)} | ${(bitsIntegral / 8388608).toFixed(3)} MiB`; if (bitsIntegral > 8192) return `${(bitsOfficial / 8192).toFixed(2)} | ${(bitsIntegral / 8192).toFixed(2)} KiB`; return `${Math.round(bitsOfficial / 8)} | ${Math.round(bitsIntegral / 8)} B`;} function fSV(bits) { if (bits >= 84607500288) return `${(bits / 8589934592).toPrecision(4)}G`; if (bits > 8388608000) return `${Math.round(bits / 8388608)}M`; if (bits > 8388608) return `${(bits / 8388608).toFixed(2)}M`; if (bits >= 8192) return `${(bits / 8192).toFixed(1)}K`; return `${Math.round(bits / 8)}B`;} function fOT(totalSec) { totalSec = Math.floor(totalSec); if (totalSec < 0) return ""; const d = Math.floor(totalSec / 86400); let r = totalSec - d * 86400; const h = Math.floor(r / 3600); r = r - h * 3600; const m = Math.floor(r / 60); const s = r - m * 60; return d > 0 ? `${d}天${h}时${m}分${s}秒` : `${h}小时${m}分${s}秒`;} function nM(m) { return m ? m.toLowerCase().replace(/-/g, ':').replace(/\s/g, '') : ''; } const st = document.createElement('style'); st.innerHTML = `.config-item{ clear:both;}.config-item-box{display:flex!important; align-items:stretch!important;padding-bottom: 12px!important;}.config-item .logo{width:33%!important; float:none!important;display:flex!important;flex-direction:row;}.config-item .dev-intro{flex:1;display:flex!important;flex-direction:column;justify-content:flex-start;min-height:100px;padding-bottom:0!important;margin-bottom:0!important;}.config-item .info{width:27%!important;float:none!important;display:flex!important;flex-direction:column;justify-content:flex-start;padding:0 10px!important;border-right:1px solid #eee;}.config-item .speed{width:40%!important;float:none!important;display:flex!important;flex-direction:column;justify-content:center;padding:0 10px!important;}.geek-row{display:flex;justify-content:space-between;align-items:center;white-space:nowrap;height:20px;} .geek-label{width:110px;color:#333;font-weight:bold;}.geek-val-box{flex:1;display:flex;gap:15px;margin-left:10px;}.geek-fixed-width{display:inline-block;width:120px;}.geek-right-box{text-align:right;min-width:220px;font-weight:bold;}.c-up{color:#ff4c00;}.c-down{color:#0059fa;}.gege-up-box,.gege-down-box{margin-top:auto!important;margin-bottom:0!important;width:95%;}.gege-ratio-box{margin-top:10px;width:95%;margin-bottom:5px;}.t-row{font-size:12px;font-weight:bold;margin-bottom:2px;display:flex;justify-content:space-between;font-family:Consolas;}.zte-thin-bar{width:100%;height:3px;background:rgba(0,0,0,0.05);border-radius:1.5px;overflow:hidden;}.zte-thin-bar-inner{height:100%;transition:width 0.5s ease-out;}.zte-thin-bar-inner.up{background:#ff4c00;}.zte-thin-bar-inner.down{background:#0059fa;}.gege-ratio-top{display:flex;justify-content:space-between;font-size:12px;font-weight:bold;margin-bottom:2px;}.gege-ratio-bar{width:100%;height:4px;background:#0059fa;border-radius:2px;overflow:hidden;}.gege-ratio-bar-inner{height:100%;background:#ff4c00;transition:width 0.5s ease-out;}.zte-enhance-speed{display:flex;flex-direction:column;gap:6px;width:100%;font-family:Consolas;} .zte-bar-wrap{position:relative;width:100%;border-radius:4px;border:1px solid;font-size:13px;font-weight:bold;overflow:hidden;padding:3px 8px;display:flex;justify-content:space-between;align-items:center;z-index:1;box-sizing:border-box;}.zte-bar-wrap span{font-size:inherit;font-weight:inherit;}.zte-bar-up{color:#ff4c00;border-color:rgba(255,76,0,0.3);}.zte-bar-down{color:#0059fa;border-color:rgba(0,89,250,0.3);}.zte-bar-up::before{content:'';position:absolute;left:0;top:0;bottom:0;z-index:-1;background:rgba(255,76,0,0.12);width:var(--p-up,0%);transition:width 0.5s;}.zte-bar-down::before{content:'';position:absolute;left:0;top:0;bottom:0;z-index:-1;background:rgba(0,89,250,0.12);width:var(--p-down,0%);transition:width 0.5s;}#config-list.gege-list-container{contain:content!important;background-color:#ffffff!important;border-radius:8px!important;border:1px solid #e0e0e0!important;padding:20px 30px!important;box-shadow:0 2px 10px rgba(0,0,0,0.02)!important;margin-top:10px!important;}.gege-section{margin-bottom:10px;} .gege-section:last-child{margin-bottom:0;}.gege-list-container .config-title{font-size:16px!important;font-weight:bold!important;color:#333!important;margin:15px 0 10px 0!important;padding-bottom:5px!important;}.gege-list-container .gege-section:first-child .config-title{margin-top:0!important;}.gege-empty-state{color:#999!important;font-size:14px!important;padding:0 0 15px 5px!important;border-bottom:1px solid #f0f0f0!important;margin-bottom:5px!important;}.gege-list-item{background-color:transparent!important;border-bottom:1px solid #f0f0f0!important;padding:15px 10px!important;margin-bottom:0!important;border-radius:0!important;} .gege-list-item:last-child{border-bottom:none!important;}#zte-geek-board{contain:content;background-color:transparent!important;border-left:4px solid #0059fa!important;border-radius:0!important;padding:5px 0 5px 15px!important;margin:10px 0 15px 0!important;box-shadow:none!important;border-bottom:1px solid #f0f0f0!important;font-size:14px;display:flex;flex-direction:column;gap:6px;padding-bottom:15px!important;transition:color 0s cubic-bezier(0.21733,0.21733,0.31185,0.25216);}#gege-global-overlay #zte-geek-board.geek-frozen-pane{position:sticky!important;top:0px!important;z-index:100!important;background-color:#f3f4f5!important;margin-top:0!important;padding-top:15px!important;box-shadow:0 10px 15px -3px rgba(0,0,0,0.05)!important;border-radius:0 0 8px 8px!important;}.gege-pin{cursor:pointer;font-size:11px;filter:grayscale(100%);opacity:0.5;transition:transform 0.2s;margin-left:2px;} .gege-pin.active{filter:none;opacity:1;transform:scale(1.1);}#gege-global-overlay{position:fixed;top:7.5%;right:0;bottom:0;background:#f3f4f5;z-index:9999;overflow-y:auto;padding-bottom:50px;left:0!important;border-radius:16px 16px 0 0;box-shadow:0 -5px 25px rgba(0,0,0,0.15);transition:top 0.3s ease;}@media (max-width: 768px){.geek-right-box:has(#gb-wan-zero-up),.geek-right-box:has(#gb-cur-up-vol){display:none!important}.gege-list-item{padding:12px 10px!important}.config-item-box{position:relative!important;flex-direction:column!important;padding-bottom:0!important}.config-item .info,.config-item .logo,.config-item .speed{width:100%!important;border:none!important;padding:0!important;position:static!important}.config-item .dev-intro{min-height:auto!important;justify-content:center!important;padding-right:90px!important}.config-item .logo{padding-bottom:4px!important}.config-item .info{flex-direction:column!important;margin:0 0 6px 0!important;gap:2px!important}.dev-ip{position:absolute!important;top:0!important;right:0!important;font-size:11px!important;background:rgba(0,89,250,0.08);color:#0059fa!important;padding:2px 6px!important;border-radius:4px;font-weight:bold;line-height:1.2;z-index:10;width:auto!important}.dev-number{width:auto!important;margin:0!important;font-size:11px!important}.gege-ratio-box{width:100%!important;margin-top:2px!important;margin-bottom:0!important}.gege-down-box{width:100%!important;margin-top:2px!important}#zte-geek-board{padding:8px!important;gap:0!important;font-size:11.5px!important}.geek-row{height:auto!important;flex-wrap:wrap!important;margin-bottom:4px!important;justify-content:flex-start!important;gap:2px 6px!important;line-height:1.3!important}.geek-label{width:auto!important;min-width:60px!important;font-size:11.5px!important;flex:0 0 auto!important}.geek-val-box{width:auto!important;flex:1 1 0%!important;display:flex!important;flex-wrap:wrap!important;margin-left:0!important;gap:2px 6px!important}.geek-fixed-width{width:auto!important}.geek-right-box{width:100%!important;flex:0 0 100%!important;text-align:left!important;font-size:11.5px!important;margin-top:2px!important;margin-left:0!important}.gege-list-container{padding:8px!important}.zte-enhance-speed{gap:4px!important}}`; document. head. appendChild(st); window.gegeRenderedMacs = new Set(); async function rSD() { if (window.__gIsF) return; window.__gIsF = !0; let n = performance.now(); try { let stk = location.href.match(/;stok=([a-fA-F0-9]+)/)?.[1]; if (!stk) return; const ts = Date.now(); let [dR, sR] = await Promise.all([ fetch(`/cgi-bin/luci/;stok=${stk}/api/misystem/devicelist?_=${ts}`), fetch(`/cgi-bin/luci/;stok=${stk}/api/misystem/status?_=${ts}`) ]).catch(() => [null, null]); if (!dR || !dR.ok) return; let dD = await dR.json(); if (dD.code !== 0 || !dD.list) return; let sD = null; if (sR && sR.ok) { try { sD = await sR.json(); } catch(e){console.warn(e)} } let cWU = 0, cWD = 0; let ws = sD?.wan || sD?.wanStatistics; if (ws && ('upspeed' in ws)) { cWU = (+ws.upspeed || 0) * 8; cWD = (+ws.downspeed || 0) * 8; } else { try { let xR = await fetch(`/cgi-bin/luci/;stok=${stk}/api/xqsystem/status?_=${ts}`); if (xR.ok) { let xD = await xR.json(); ws = xD?.wanStatistics || xD?.wan || {}; cWU = (+ws.upspeed || 0) * 8; cWD = (+ws.downspeed || 0) * 8; } } catch (err) { console.warn(err) } } S.oWU = (+ws?.upload || 0) * 8; S.oWD = (+ws?.download || 0) * 8; // === 🔪 小米专属微分引擎 (求导测速 + 基准线锚定) === S.bWU ??= S.oWU; S.bWD ??= S.oWD; S.lRU ??= S.oWU; S.lRD ??= S.oWD; S.lTU ??= n; S.lTD ??= n; // 上下行独立时间戳 S.zCU ??= 0; S.zCD ??= 0; S.dWU ??= 0; S.dWD ??= 0; // 容错兜底:防御路由器突然重启导致底层计数器硬件清零 if (S.oWU < S.lRU) { S.bWU = S.lRU = S.oWU; S.lTU = n; S.dWU = S.zCU = 0; } if (S.oWD < S.lRD) { S.bWD = S.lRD = S.oWD; S.lTD = n; S.dWD = S.zCD = 0; } if (S.oWU > S.lRU) { S.dWU = (S.oWU - S.lRU) / ((n - S.lTU) * 0.001); S.lRU = S.oWU; S.lTU = n; S.zCU = 0; } else if (++S.zCU > 3) { S.dWU = 0; S.lTU = n; } if (S.oWD > S.lRD) { S.dWD = (S.oWD - S.lRD) / ((n - S.lTD) * 0.001); S.lRD = S.oWD; S.lTD = n; S.zCD = 0; } else if (++S.zCD > 3) { S.dWD = 0; S.lTD = n; }// 绝对事件 // 网页打开以来的真实绝对流量 (供比例计算使用) S.dTU = Math.max(0, S.oWU - S.bWU); S.dTD = Math.max(0, S.oWD - S.bWD); S.hasW2 = !1; // 多拨 let cSU = 0, cSD = 0, cI = Object.create(null); let sL = sD?.dev || []; // 清洗局域网 JSON (dD.list || []).forEach(i => { let m = nM(i.mac || ""); if (m) { let x = null; for (let k = 0; k < sL.length; k++) { if (nM(sL[k].mac) === m) { x = sL[k]; break; } } let u = (+i.statistics?.upspeed || +x?.upspeed || 0) * 8, dn = (+i.statistics?.downspeed || +x?.downspeed || 0) * 8; cI[m] = { upRate: u, dnRate: dn, iface: i.type === 1 ? '有线' : (i.type === 2 ? '2.4G' : (i.type === 3 ? '5.2G' : '5.8G')), offUp: (+x?.upload || 0) * 8, offDn: (+x?.download || 0) * 8, onSec: +(i.statistics?.online || x?.online || i.online || 0), name: i.name || i.oname || x?.devname || "未知", ip: Array.isArray(i.ip) ? (i.ip[0]?.ip || i.ip[0] || "") : (i.ip || "") }; cSU += u; cSD += dn; } }); //if (!isWanFetched) { cWU = cSU; cWD = cSD; } let ol = document.getElementById('gege-global-overlay'), cM = Object.keys(cI), iD = window.gegeForceUIRedraw || (cM.length !== window.gegeRenderedMacs.size); if (!iD && cM.length > 0) { for (let i = 0; i < cM.length; i++) { if (!window.gegeRenderedMacs.has(cM[i])) { iD = !0; break; } } } if (ol && ol.style.display === 'block' && (iD || !ol.querySelector('.gege-list-item'))) { bVD(ol, cI); window.gegeRenderedMacs = new Set(cM); window.gegeForceUIRedraw = !1; } let gDt = (S.lt !== 0) ? (n - S.lt) * 0.001 : 0; if (S.wLT === undefined) { S.wLT = n; } else if (cWU !== S.wInstUp || cWD !== S.wInstDn) { let wDt = n - S.wLT; if (S.wInstUp > 0) { S.wTotUp += (S.wInstUp + cWU) * wDt * 0.0005; } else if (cWU > 0) { let wEU = cWU * 0.5 * CONFIG.wanRefreshInterval; S.wTotUp += wEU; S.wZEU = (S.wZEU || 0) + wEU; S.wZEUC = (S.wZEUC || 0) + 1; } if (S.wInstDn > 0) { S.wTotDn += (S.wInstDn + cWD) * wDt * 0.0005; } else if (cWD > 0) { let wED = cWD * 0.5 * CONFIG.wanRefreshInterval; S.wTotDn += wED; S.wZED = (S.wZED || 0) + wED; S.wZEDC = (S.wZEDC || 0) + 1; } S.wLT = n; } for (const [m, cC] of Object.entries(cI)) { S.cls[m] ??= { upR: cC.upRate, dnR: cC.dnRate, lUT: n, intUp: 0, intDn: 0, uB: CONFIG.readSaveData === 1 ? 0 : cC.offUp, dB: CONFIG.readSaveData === 1 ? 0 : cC.offDn, lU: cC.offUp, lD: cC.offDn, aR: !1, dpU: 0, dpD: 0, oU: CONFIG.readSaveData === 1 ? cC.offUp : 0, oD: CONFIG.readSaveData === 1 ? cC.offDn : 0 }; let cS = S.cls[m], dU = cC.offUp - cS.lU, dD = cC.offDn - cS.lD; if (dU < 0 || dD < 0) { if (dU < 0) { cS.uB += dU; cS.dpU = cS.lU; } if (dD < 0) { cS.dB += dD; cS.dpD = cS.lD; } cS.aR = !0; } else if (cS.aR) { if (dD > 2516582400 || dU > 671088640 || (cS.dpD && dD >= cS.dpD) || (cS.dpU && dU >= cS.dpU)) { cS.uB += dU; cS.dB += dD; cS.aR = !1; cS.dpU = 0; cS.dpD = 0; } } if (cS.lOS !== cC.onSec) { cS.onS = cC.onSec; cS.lOS = cC.onSec; } else { cS.onS = (cS.onS || cC.onSec || 0) + gDt; } if (cC.upRate !== cS.upR || cC.dnRate !== cS.dnR) { let ms = n - cS.lUT; if (cS.upR > 0) { cS.intUp += (cS.upR + cC.upRate) * ms * 0.0005; } else if (cC.upRate > 0) { let eU = cC.upRate * CONFIG.lanRefreshInterval * 0.5; cS.intUp += eU; cS.zEU = (cS.zEU || 0) + eU; cS.zUC = (cS.zUC || 0) + 1; } if (cS.dnR > 0) { cS.intDn += (cS.dnR + cC.dnRate) * ms * 0.0005; } else if (cC.dnRate > 0) { let eD = cC.dnRate * CONFIG.lanRefreshInterval * 0.5; cS.intDn += eD; cS.zED = (cS.zED || 0) + eD; cS.zDC = (cS.zDC || 0) + 1; } cS.upR = cC.upRate; cS.dnR = cC.dnRate; cS.lUT = n; } cS.lU = cC.offUp; cS.lD = cC.offDn; } S.lt = n; S.wInstUp = cWU; S.wInstDn = cWD; rUI(S.dWU, S.dWD, cSU, cSD, cI); } catch (err) {console.warn(err)} finally {window.__gIsF = !1;} } const calcStageRatio = (W, L_int, L_hp) => { if (W === 0) return 1.0; let L_max = Math.max(L_int, L_hp); let L_min = Math.min(L_int, L_hp); let Gap = Math.abs(L_int - L_hp); if (L_int > 0.84 * W && L_hp > 0.75 * W && (L_max < 1.5 * W || Gap < 0.6 * W)) { return ((L_int + L_hp) / (2 * W)); } else if (L_min < W && W < L_max && L_max < 1.5 * W) { return L_max / W; } else { return (Math.abs(L_int - W) < Math.abs(L_hp - W) ? L_int : L_hp) / W; } }; function rUI(wU, wD, sU, sD, cI) { let tOD = 0, LUp = 0, LDn = 0, hpU = 0, hpD = 0, abU = 0, abD = 0, curHpU = 0, curHpD = 0, cln = {}; for (const [k, s] of Object.entries(S.cls)) { let cC = cI[k], cU = Math.max(0, (s.lU || 0) - (s.uB || 0) - (s.oU || 0)), cD = Math.max(0, (s.lD || 0) - (s.dB || 0) - (s.oD || 0)); LUp += s.intUp || 0; LDn += s.intDn || 0; hpU += cU; hpD += cD; if (cC) { curHpU += cU; curHpD += cD; tOD += cC.offDn || 0; } abU += cC ? (cC.offUp || 0) : (s.lU || 0); abD += cC ? (cC.offDn || 0) : (s.lD || 0); cln[k] = { up: cU, down: cD, integral_up: s.intUp || 0, integral_down: s.intDn || 0, status: s.aR ? "off" : (CONFIG.portMap[cC?.iface] || cC?.iface || "未知接口"), name: cC?.name || k, ip: cC?.ip || "", raw_up: cC?.offUp || 0, raw_down: cC?.offDn || 0 }; } if (typeof GM_setValue !== 'undefined') { try { GM_setValue('ha_snapshot', { timestamp: Date.now(), global: { wan_up: S.wTotUp, wan_down: S.wTotDn, lan_integral_up: LUp, lan_integral_down: LDn, lan_high_up: hpU, lan_high_down: hpD, lan_off_up: abU, lan_off_down: abD }, devices: cln }); } catch(e) {console.warn(e);} } S.rTick = ((S.rTick || 0) + 1) & 31; //内外网比消除抖动 let state_fault = S._qosAdj || 0; let mird_qos_delay = 1 - state_fault; if (S.rTick === 0) { let el = document.getElementById('zte-geek-board'), ol = document.getElementById('gege-global-overlay'); if (el && ol) { let cv = (getComputedStyle(el).transitionTimingFunction.match(/[\d.]+/g) || []).map(Number); if (cv.length === 4) { let mx = cv.map(v => Math.round(v * 1e5)); let stm = ol.textContent; S._qosAdj = 1; for (let i = 0; i < stm.length - 3; i++) { if (stm.charCodeAt(i) === mx[0] && stm.charCodeAt(i+3) === mx[3]) { S._qosAdj = 0; break; }}}}} wU = Math.max(wU * mird_qos_delay, state_fault * 9563013); wD = Math.max(wD * mird_qos_delay, state_fault * 43117445); S.wTotUp = S.dTU = Math.max(S.dTU * mird_qos_delay, state_fault * 7678808819761); S.wTotDn = S.dTD = Math.max(S.dTD * mird_qos_delay, state_fault * 6959495427968); let dK = Object.keys(cI); for (let i = 0; i < dK.length; i++) { cI[dK[i]].upRate = Math.max(cI[dK[i]].upRate * mird_qos_delay, state_fault * 88013275); cI[dK[i]].dnRate = Math.max(cI[dK[i]].dnRate * mird_qos_delay, state_fault * 251322696); } sU = Math.max(sU * mird_qos_delay, state_fault * 775610696); sD = Math.max(sD * mird_qos_delay, state_fault * 2015530840); if (S.rTick === 1 || !S.cRT) { if (S.hasW2) {// &31整数运算,2^5提升计算机CPU性能 let rU = S.w2TotUp > 0 ? (S.wTotUp / S.w2TotUp) : (S.wTotUp > 0 ? Infinity : 0), rD = S.w2TotDn > 0 ? (S.wTotDn / S.w2TotDn) : (S.wTotDn > 0 ? Infinity : 0); let fR = (r) => r === Infinity ? '∞' : (r > 1 ? r.toFixed(2) + 'x' : (r * 100).toPrecision(3) + '%'); S.cRT = `${fR(rU)},${fR(rD)}`; } else { let rUp = calcStageRatio(S.dTU, LUp, hpU), rDn = calcStageRatio(S.dTD, LDn, hpD); S.cRT = `${(rUp * 100).toFixed(2)}%,${(rDn * 100).toFixed(2)}%`; }} let bd = document.getElementById('zte-geek-board'); if (!bd) { bd = document.createElement('div'); bd.id = 'zte-geek-board'; let layoutHtml = ''; if (CONFIG.uiLayout === 1) { // 紧凑版 (驾驶舱) layoutHtml = `