【脚本】积分组成便捷显示
本帖最后由 reober3 于 2025-12-30 21:50 编辑之前忙着升级的时候经常喜欢看自己的积分看看旅程多少了,追随有没有偷偷涨,小数点后是什么数字了……虽然鼠标悬浮于右侧栏的“积分”两字时可以快速查看自己的一些属性但是少了主题和回帖,我想算的时候还得点进自己主页看所以就在ai帮助下做了一个脚本只需鼠标悬停于积分数字(1148)上,即可展示出具体的积分组成
复制后新建脚本即可~
@Name @match @Name@Match // ==UserScript==
// @name 积分组成便捷显示
// @version 2.3
// @description鼠标悬停积分数字时显示计算详情
// @author rober
// @match https://www.gamemale.com/*
// @match https://www.gamemale.com/forum.php
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
let cache;
const doc = document;
const iHTML = 'inner' + 'HTML';
const disp = 'dis' + 'play';
const cE = 'create' + 'Element';
const aC = 'append' + 'Child';
const tip = doc('div');
tip.style.cssText = 'posi'+'tion:fixed;dis'+'play:none;back'+'ground:rgba(0,0,0,0.9);color:#fff;pad'+'ding:12px;border-radius:6px;font-size:13px;line-height:1.6;z-index:99999;pointer-events:none;min-width:190px;border:1px solid #555;font-family:"Microsoft YaHei";box-shadow:0 4px 12px rgba(0,0,0,0.5)';
doc.body(tip);
const render = (d) => {
const s_fol = d.f / 5, s_act = (d.t + d.p) / 10;
const dv = '<' + 'div';
const dve = '<' + '/div>';
tip = `
${dv} style="font-weight:bold;color:#f0c14b;border-bottom:1px solid #555;margin-bottom:5px">积分计算详情${dve}
${dv} style="display:flex;justify-content:space-between"><span>旅程:</span><b>${d.j}</b>${dve}
${dv} style="display:flex;justify-content:space-between"><span>追随/5:</span><span style="color:#aeffc1">${s_fol.toFixed(2)}</span>${dve}
${dv} style="display:flex;justify-content:space-between"><span>(主题+回帖)/10:</span><span style="color:#ffb8a2">${s_act.toFixed(2)}</span>${dve}
${dv} style="border-top:1px dashed #666;margin-top:5px;padding-top:5px;display:flex;justify-content:space-between">
<span>总分:</span><strong style="color:#FFD700">${(d.j + s_fol + s_act).toFixed(2)}</strong>
${dve}
${dv} style="text-align:right;font-size:12px;color:#888;margin-top:4px">(原数据: 追随${d.f}/主题${d.t}/回帖${d.p})${dve}`;
};
const getData = () => {
if (cache) return render(cache);
tip = '读取中...';
GM_xmlhttpRequest({
method: "GET", url: "/home.php?mod=space&do=profile",
onload: r => {
const h = r.responseText;
const get = (re) => parseInt((h.match(re) || [])) || 0;
cache = {
j: get(/<em>旅程<\/em>\s*(\d+)/),
f: get(/<em>追随<\/em>\s*(\d+)/),
t: get(/>主题(?:数)?\s*(\d+)</),
p: get(/>回帖(?:数)?\s*(\d+)</)
};
render(cache);
}
});
};
const timer = setInterval(() => {
const target = doc.querySelector('#extcreditmenu + span a');
if (target) {
clearInterval(timer);
target.addEventListener('mouseenter', () => {
const rect = target.getBoundingClientRect();
tip.style.top = (rect.bottom + 8) + 'px';
tip.style.left = (rect.left - 120) + 'px';
tip.style = 'block';
getData();
});
target.addEventListener('mouseleave', () => { tip.style = 'none'; });
}
}, 500);
})();喜欢的话可以点点追随呀~(暂时不要堕落惹
本人基本上全是旅程贡献的积分了
PS:忘记把name和match这两个ID在最前面@出来了 这个显示挺好看的,感觉更美观了惹:loveliness: 能看出自己回了多少贴,有种努力具现化的感觉;P 本帖最后由 咸鱼鱼 于 2025-12-30 21:48 编辑
你这个是什么牌子的ai,变量名和语法稀奇古怪的
写法好抽象,setInterval注册点击事件
这个提示蛮有用的了 比较美观的能看到积分构成 有了这个的话,看自己回了多少贴就很方便了,不用专门去个人界面看了 https://img.gamemale.com/album/202508/27/154618wt52fzit25qb9aaf.jpg等于变相的看自己有多努力站街{:6_167:} 各项数据能更加直观的展示出来,有种自己的努(mai)力(pu)成果尽收眼底的感觉https://img.gamemale.com/album/202508/31/092111u1rzt6h6tzeezd11.jpg https://img.gamemale.com/album/202408/03/102121hz01mn3632og0c30.gif看起来非常方便和实用了,界面也很美观 很好看的UI,能直接显示旅程也是挺实用的的 很便捷的脚本呀,这样就知道自己积分到底都怎么来的:lol 0-0 更加直观了呢 不得不说现在咸鱼了好多 我们新人是这样的时刻要关注自己积分增长情况谢谢分享 可以很明显看出是旅程婆还是站街婆了;P 对于萌新其实有帮助的效果~当初完全不知道回帖也可以提升旅程;P 确实这样更直观许多~感谢楼主分享惹呢{:4_91:} 精确到小数点惹,原来真的能够显示出来 其实在帖子里移到自己头像上这些数据都是可以看见的吧,不过这个脚本也算是更加直观就是了{:6_200:} 这个可以看到自己详细得分挺方便的,实用小工具+1. 乍一看真不错,看到前面的评论笑哈哈了,确实点头像就有了,哈哈哈