微件:RarityFilter:修订间差异
来自植物大战僵尸杂交版Wiki
更多操作
创建页面,内容为“<includeonly> <style> .pvzhe-rarity-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 15px 0; padding: 12px 16px; background: #f9f9f9; border-radius: 12px; border: 1px solid #e0e0e0; align-items: center; } .pvzhe-rarity-btn { padding: 6px 14px; border-radius: 20px; font-size: 13px; cursor: pointer; border: 2px solid transparent; background: #fff; color: #555; transition: all 0.2s;…” |
无编辑摘要 |
||
| 第27行: | 第27行: | ||
} | } | ||
.pvzhe-rarity-btn.active { | .pvzhe-rarity-btn.active { | ||
font-weight: bold; | font-weight: bold; | ||
} | } | ||
.pvzhe-rarity-btn.all { border-color: # | .pvzhe-rarity-btn.all { border-color: #4CAF50; color: #4CAF50; } | ||
.pvzhe-rarity-btn.all.active { background: # | .pvzhe-rarity-btn.all.active { background: #4CAF50; color: #fff; } | ||
.pvzhe-rarity-btn.white { border-color: #4CAF50; color: #4CAF50; } | .pvzhe-rarity-btn.white { border-color: #4CAF50; color: #4CAF50; } | ||
.pvzhe-rarity-btn.white.active { background: #A5D6A7; color: #1B5E20; } | .pvzhe-rarity-btn.white.active { background: #A5D6A7; color: #1B5E20; } | ||
| 第42行: | 第41行: | ||
.pvzhe-rarity-btn.star { border-color: #FFC107; color: #C79100; } | .pvzhe-rarity-btn.star { border-color: #FFC107; color: #C79100; } | ||
.pvzhe-rarity-btn.star.active { background: linear-gradient(135deg, #FFF9C4, #FFE082, #FFD54F); color: #333; } | .pvzhe-rarity-btn.star.active { background: linear-gradient(135deg, #FFF9C4, #FFE082, #FFD54F); color: #333; } | ||
.pvzhe-rarity-btn. | .pvzhe-rarity-btn.original { border-color: #7B1FA2; color: #7B1FA2; } | ||
.pvzhe-rarity-btn. | .pvzhe-rarity-btn.original.active { background: linear-gradient(135deg, #CE93D8, #AB47BC); color: #fff; } | ||
</style> | </style> | ||
| 第70行: | 第67行: | ||
function countCards() { | function countCards() { | ||
var counts = { all: | var counts = { all: $('.pvzhe-card').length }; | ||
$('.pvzhe-card').each(function() { | $('.pvzhe-card-container').each(function() { | ||
var $container = $(this); | |||
var $prev = $container.prevAll('h2, .mw-heading').first(); | |||
if (!$prev.length) return; | |||
var title = $prev.text().trim(); | |||
if (title === '白卡') counts.white = $container.find('.pvzhe-card').length; | |||
else if (title === '至尊金卡') counts.gold = $container.find('.pvzhe-card').length; | |||
else if (title === '臻享钻卡') counts.diamond = $container.find('.pvzhe-card').length; | |||
else if (title === '梦幻彩卡') counts.rainbow = $container.find('.pvzhe-card').length; | |||
else if (title === '星光闪卡') counts.star = $container.find('.pvzhe-card').length; | |||
else if (title === '原卡') counts.original = $container.find('.pvzhe-card').length; | |||
}); | }); | ||
| 第91行: | 第86行: | ||
var rarity = $(this).data('rarity'); | var rarity = $(this).data('rarity'); | ||
var count = counts[rarity] || 0; | var count = counts[rarity] || 0; | ||
var label = $(this).text().replace(/\s*\(\d+\)/, ''); | |||
$(this).text(label + ' (' + count + ')'); | |||
}); | }); | ||
} | } | ||
| 第99行: | 第95行: | ||
$('.pvzhe-card').show(); | $('.pvzhe-card').show(); | ||
$('.pvzhe-card-container').show(); | $('.pvzhe-card-container').show(); | ||
$('.mw-heading, h2 | $('.mw-heading, h2').show(); | ||
return; | return; | ||
} | } | ||
| 第108行: | 第104行: | ||
$('.pvzhe-card').hide(); | $('.pvzhe-card').hide(); | ||
$('.pvzhe-card-container').hide(); | $('.pvzhe-card-container').hide(); | ||
$('.mw-heading, h2').hide(); | |||
$('.mw-heading, h2').each(function() { | |||
if ($(this).text().trim() === targetTitle) { | |||
$(this).show(); | |||
var $next = $(this).nextAll('.pvzhe-card-container').first(); | |||
$ | |||
var $next = $ | |||
if ($next.length) { | if ($next.length) { | ||
$next.show(); | $next.show(); | ||
$next.find('.pvzhe-card').show(); | $next.find('.pvzhe-card').show(); | ||
} | } | ||
} | } | ||
}); | }); | ||