|
|
| 第23行: |
第23行: |
| white-space: nowrap; | | white-space: nowrap; |
| } | | } |
| .pvzhe-rarity-btn:hover { | | .pvzhe-rarity-btn:hover { border-color: #ccc; } |
| border-color: #ccc;
| | .pvzhe-rarity-btn.active { font-weight: bold; } |
| } | |
| .pvzhe-rarity-btn.active { | |
| font-weight: bold;
| |
| } | |
| .pvzhe-rarity-btn.all { border-color: #4CAF50; color: #4CAF50; } | | .pvzhe-rarity-btn.all { border-color: #4CAF50; color: #4CAF50; } |
| .pvzhe-rarity-btn.all.active { background: #4CAF50; color: #fff; } | | .pvzhe-rarity-btn.all.active { background: #4CAF50; color: #fff; } |
| 第54行: |
第50行: |
| <button class="pvzhe-rarity-btn original" data-rarity="original">原卡</button> | | <button class="pvzhe-rarity-btn original" data-rarity="original">原卡</button> |
| </div> | | </div> |
|
| |
| <script>
| |
| (function() {
| |
| var raritySections = {
| |
| 'white': '白卡',
| |
| 'gold': '至尊金卡',
| |
| 'diamond': '臻享钻卡',
| |
| 'rainbow': '梦幻彩卡',
| |
| 'star': '星光闪卡',
| |
| 'original': '原卡'
| |
| };
| |
|
| |
| function countCards() {
| |
| var counts = { all: $('.pvzhe-card').length };
| |
|
| |
| $('.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;
| |
| });
| |
|
| |
| $('.pvzhe-rarity-btn').each(function() {
| |
| var rarity = $(this).data('rarity');
| |
| var count = counts[rarity] || 0;
| |
| var label = $(this).text().replace(/\s*\(\d+\)/, '');
| |
| $(this).text(label + ' (' + count + ')');
| |
| });
| |
| }
| |
|
| |
| function filterByRarity(rarity) {
| |
| if (rarity === 'all') {
| |
| $('.pvzhe-card').show();
| |
| $('.pvzhe-card-container').show();
| |
| $('.mw-heading, h2').show();
| |
| return;
| |
| }
| |
|
| |
| var targetTitle = raritySections[rarity];
| |
| if (!targetTitle) return;
| |
|
| |
| $('.pvzhe-card').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();
| |
| if ($next.length) {
| |
| $next.show();
| |
| $next.find('.pvzhe-card').show();
| |
| }
| |
| }
| |
| });
| |
| }
| |
|
| |
| $('.pvzhe-rarity-btn').click(function() {
| |
| $('.pvzhe-rarity-btn').removeClass('active');
| |
| $(this).addClass('active');
| |
| filterByRarity($(this).data('rarity'));
| |
| });
| |
|
| |
| countCards();
| |
| })();
| |
| </script>
| |
| </includeonly> | | </includeonly> |