// ==UserScript==
// @name 来看看您水多吗
// @namespace 泥潭含水量计算
// @version
// @description 快点干燥起来吧
// @author nulluser
// @match https://www.uscardforum.com/*
// @icon
// @grant none
// @license MIT
// ==/UserScript==
(function () {
'use strict';
// 创建一个显示牌的HTML元素
var displayPanel = document.createElement('div');
displayPanel.id = 'percentageDisplay';
displayPanel.style.cssText = `
position: fixed;
bottom: 10px;
right: 10px;
width: 150px;
height: 100px;
background-color: rgba(0, 0, 0, 0.7);
color: white;
border-radius: 10px;
text-align: center;
line-height: 100px;
font-size: 24px;
font-weight: bold;
z-index: 9999;
`;
// 创建一个更新按钮的HTML元素
var updateButton = document.createElement('button');
updateButton.id = 'updateButton';
updateButton.textContent = '更新泥潭含水量';
updateButton.style.cssText = `
position: fixed;
bottom: 120px;
right: 10px;
width: 150px;
height: 30px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
font-size: 15px;
cursor: pointer;
`;
// 更新百分比值
function updatePercentage() {
let bad_ids = [11, 16, 34, 17, 18, 19, 29, 36, 35, 22, 26, 25];
const bad_score = [];
const good_score = [];
// 定义要获取的URL数组
const urls = [
'https://www.uscardforum.com/latest.json?order=created',
'https://www.uscardforum.com/new.json',
'https://www.uscardforum.com/top.json?period=daily'
];
// 使用Promise.all并发获取所有URL的数据
Promise.all(urls.map(url => fetch(url).then(response => response.json())))
.then(dataArray => {
// 所有请求都成功后,这里将会收到一个包含所有JSON数据的数组
// 数组中的元素顺序与urls数组中的URL顺序相同
// 将数据合并或处理
const combinedData = {
latest: dataArray[0].topic_list.topics, // 假设第一个URL返回的是最新的数据
new: dataArray[1].topic_list.topics, // 假设第二个URL返回的是新的数据
top: dataArray[2].topic_list.topics // 假设第三个URL返回的是每日热门数据
};
// 定义一个函数来处理每个主题的分数
const processTopic = (topic) => {
const score = topic.posts_count + topic.like_count + topic.reply_count;
if (bad_ids.includes(topic.category_id)) {
bad_score.push(score);
} else {
good_score.push(score);
}
};
// 遍历每个主题列表并处理
combinedData.latest.forEach(processTopic);
combinedData.new.forEach(processTopic);
combinedData.top.forEach(processTopic);
// 计算bad_score和good_score的总和
const bad_total = bad_score.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
const good_total = good_score.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
// 打印结果
const percentage = (bad_total / (bad_total + good_total)) * 100;
console.log(`当前论坛含水量: ${percentage.toFixed(2)}%`);
displayPanel.textContent = `${percentage.toFixed(2)}%`;
})
.catch(error => {
// 处理任何在请求过程中发生的错误
console.error('Error fetching data:', error);
});
}
// 初始化显示牌和按钮
function initializeDisplay() {
document.body.appendChild(displayPanel);
document.body.appendChild(updateButton);
updatePercentage();
updateButton.addEventListener('click', updatePercentage);
}
// 等待页面加载完成后再初始化显示牌
window.addEventListener('load', initializeDisplay);
})();
)
【说明】
含水量10%以下,说明论坛近期干货满满;
含水量10%-20%,说明论坛近期干湿较为平衡;
含水量20%-30%,说明论坛近期稍微有点潮湿;
含水量30%-35%,说明论坛近期水分过于充足,需要注意了;
含水量数据超过35%,需要控制大水漫灌了。
【效果图】
【安装】
在浏览器拓展市场安装 篡改猴 插件(我是用的Violentmonkey ) 点
新建
把代码复制粘贴到插件里 保存
刷新 页面就可以看到右下方多了一个小框子
全谭参与 看看谁是泥潭水王!
备注:代码转自友站,感谢原作者




