【脚本】二手优化显示
本帖最后由 Makima 于 2025-12-23 16:28 编辑统计二手市场勋章数量,支持一键购买最低价
很早就写了,一直没发@Name @Match
// ==UserScript==
// @name 二手市场优化显示
// @version 0.2
// @description显示每类勋章的最低售价和数量
// @author MKM
// @match https://www.gamemale.com/wodexunzhang-showxunzhang.html?action=showjishou
// ==/UserScript==
(function() {
'use strict';
const container = document.querySelector('.myfldiv');
if (!container) return;
const items = Array.from(container.querySelectorAll('.myblok'));
const grouped = {};
items.forEach(item => {
const name = item.querySelector('p').title;
const priceText = item.querySelector('.mytip .jiage:last-child b').textContent;
const price = parseInt(priceText.match(/\d+/));
const id = item.querySelector('.mytip').id.replace('er', '');
if (!grouped) {
grouped = [];
}
grouped.push({
element: item,
price: price,
id: id
});
});
const result = [];
for (const name in grouped) {
const items = grouped;
const minPriceItem = items.reduce((min, item) => item.price < min.price ? item : min);
const count = items.length;
result.push({
name: name,
element: minPriceItem.element,
price: minPriceItem.price,
count: count,
id: minPriceItem.id
});
}
result.sort((a, b) => b.count - a.count);
container.innerHTML = '';
result.forEach(item => {
const countSpan = document.createElement('span');
countSpan.textContent = ` (${item.count})`;
countSpan.style.color = '#ff6b6b';
countSpan.style.fontWeight = 'bold';
countSpan.style.marginLeft = '5px';
const nameElement = item.element.querySelector('p');
nameElement.appendChild(countSpan);
container.appendChild(item.element);
});
})();
只要是徽章有关的插件那可是一定要有的呀
谢谢大佬 很好的优化 这下简洁多了 重复的勋章整合起来视觉上舒服很多惹{:6_169:} 这个优化之后商店简洁很多,不用被一堆东西糊脸了。 很棒,可以看到收益和升级要求,非常有用 0-0 确实 优化之后更加清晰了呢 抱住大佬大腿jpg 感觉很有用的样子呢 整个界面都整洁了很多 合并同类项确实更简洁明了呢 界面变得整洁了很多,看勋章更加容易了 很棒的插件,简洁了许多,更容易发现自己想要的勋章了 哈哈哈~一下子干净不少欸~一上新的二手也能快速找到~ 我在用一个差不多的插件,但这个比我用的好一点,还能显示升级的图标,等有空就更换一下 请问大佬这个该怎么使用啊 233二手里看了两个月的基蛋琴确实有点怪怪的,整合起来确实简洁了不少呢https://img.gamemale.com/album/202508/31/092111u1rzt6h6tzeezd11.jpg https://img.gamemale.com/album/202508/27/154618wt52fzit25qb9aaf.jpg能在二手市场看到升级的属性真的很方便诶 这个更能凸显哪个勋章没人要了哎 笑死,这下真的很明显看出谁在赔钱了;P 好东西哎,一目了然不用翻页了,太有必要装一个了~ 这个如何使用惹?!感觉也太好用了吧但不会用,求教程