bettergi-scripts-list/repo/js/背包扫描/lib/cursor.js
AYAPNZ 2a916442c6
新增js脚本:背包扫描 (#3845)
* 新增脚本:背包扫描

* 更新 settings.json
2026-11-16 10:11:34 +08:00

16 lines
724 B
JavaScript

const SCREEN_MIN_MEAN_SCORE = 0.85;
export function screenIsPlausible(scores, opts) {
const o = opts || {};
const thr = (typeof o.minMean === "number") ? o.minMean : SCREEN_MIN_MEAN_SCORE;
const arr = Array.isArray(scores) ? scores.filter(function (v) { return typeof v === "number"; }) : [];
if (!arr.length) return { plausible: false, meanScore: null, reason: "没有有效得分" };
let s = 0;
for (const v of arr) s += v;
const mean = s / arr.length;
return {
plausible: mean >= thr,
meanScore: Math.round(mean * 10000) / 10000,
reason: (mean >= thr) ? "" : ("整屏平均得分 " + mean.toFixed(3) + " < " + thr + " —— 疑似非本页签内容屏")
};
}