打开/关闭菜单
933
1525
112
1.4万
植物大战僵尸杂交版Wiki
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

微件: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 {
    color: #fff;
     font-weight: bold;
     font-weight: bold;
}
}
.pvzhe-rarity-btn.all { border-color: #888; }
.pvzhe-rarity-btn.all { border-color: #4CAF50; color: #4CAF50; }
.pvzhe-rarity-btn.all.active { background: #888; }
.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.purple { border-color: #7B1FA2; color: #7B1FA2; }
.pvzhe-rarity-btn.original { border-color: #7B1FA2; color: #7B1FA2; }
.pvzhe-rarity-btn.purple.active { background: linear-gradient(135deg, #CE93D8, #AB47BC); color: #fff; }
.pvzhe-rarity-btn.original.active { background: linear-gradient(135deg, #CE93D8, #AB47BC); color: #fff; }
.pvzhe-rarity-btn.original { border-color: #A5D6A7; color: #388E3C; }
.pvzhe-rarity-btn.original.active { background: #A5D6A7; color: #1B5E20; }
</style>
</style>


第70行: 第67行:


     function countCards() {
     function countCards() {
         var counts = { all: 0 };
         var counts = { all: $('.pvzhe-card').length };


         $('.pvzhe-card').each(function() {
         $('.pvzhe-card-container').each(function() {
             counts.all++;
             var $container = $(this);
        });
            var $prev = $container.prevAll('h2, .mw-heading').first();
            if (!$prev.length) return;
            var title = $prev.text().trim();


        var $container = $('.pvzhe-card-container');
            if (title === '白卡') counts.white = $container.find('.pvzhe-card').length;
        $container.each(function() {
            else if (title === '至尊金卡') counts.gold = $container.find('.pvzhe-card').length;
             var $prev = $(this).prevAll('.mw-heading, h2, h3').first();
             else if (title === '臻享钻卡') counts.diamond = $container.find('.pvzhe-card').length;
             var title = $prev.text().trim();
             else if (title === '梦幻彩卡') counts.rainbow = $container.find('.pvzhe-card').length;
             for (var key in raritySections) {
             else if (title === '星光闪卡') counts.star = $container.find('.pvzhe-card').length;
                if (title.indexOf(raritySections[key]) !== -1) {
            else if (title === '原卡') counts.original = $container.find('.pvzhe-card').length;
                    if (!counts[key]) counts[key] = 0;
                    counts[key] += $(this).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;
             $(this).text($(this).text().replace(/\(\d+\)/, '') + ' (' + count + ')');
             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, h3').show();
             $('.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();


         var $headings = $('.mw-heading, h2, h3');
         $('.mw-heading, h2').each(function() {
        var found = false;
             if ($(this).text().trim() === targetTitle) {
        $headings.each(function() {
                 $(this).show();
             var $heading = $(this);
                 var $next = $(this).nextAll('.pvzhe-card-container').first();
            if ($heading.text().trim().indexOf(targetTitle) !== -1) {
                found = true;
                 $heading.show();
                 var $next = $heading.nextAll('.pvzhe-card-container').first();
                 if ($next.length) {
                 if ($next.length) {
                     $next.show();
                     $next.show();
                     $next.find('.pvzhe-card').show();
                     $next.find('.pvzhe-card').show();
                 }
                 }
            } else if (found && $heading.is('h2, h3, .mw-heading')) {
                return false;
             }
             }
         });
         });

2026年6月21日 (日) 07:40的版本