打开/关闭搜索
搜索
打开/关闭菜单
933
1525
112
1.4万
植物大战僵尸杂交版Wiki
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
上传文件
打开/关闭外观设置菜单
notifications
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
创建账号
登录
查看“︁微件:RarityFilter”︁的源代码
来自植物大战僵尸杂交版Wiki
查看
阅读
查看源代码
查看历史
associated-pages
微件
讨论
更多操作
←
微件:RarityFilter
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您没有权限编辑
微件
命名空间内的页面。
您可以查看和复制此页面的源代码。
<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; white-space: nowrap; } .pvzhe-rarity-btn:hover { border-color: #ccc; } .pvzhe-rarity-btn.active { color: #fff; font-weight: bold; } .pvzhe-rarity-btn.all { border-color: #888; } .pvzhe-rarity-btn.all.active { background: #888; } .pvzhe-rarity-btn.white { border-color: #4CAF50; color: #4CAF50; } .pvzhe-rarity-btn.white.active { background: #A5D6A7; color: #1B5E20; } .pvzhe-rarity-btn.gold { border-color: #FFC107; color: #C79100; } .pvzhe-rarity-btn.gold.active { background: linear-gradient(135deg, #FFD700, #FFA000); color: #fff; } .pvzhe-rarity-btn.diamond { border-color: #42A5F5; color: #42A5F5; } .pvzhe-rarity-btn.diamond.active { background: linear-gradient(135deg, #42A5F5, #1E88E5); color: #fff; } .pvzhe-rarity-btn.rainbow { border-color: #e91e63; color: #e91e63; } .pvzhe-rarity-btn.rainbow.active { background: linear-gradient(135deg, #FF6B6B, #FFD93D, #6BCB77, #4D96FF, #9B59B6); color: #fff; } .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.purple { border-color: #7B1FA2; color: #7B1FA2; } .pvzhe-rarity-btn.purple.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> <div class="pvzhe-rarity-filter" id="pvzhe-rarity-filter"> <button class="pvzhe-rarity-btn all active" data-rarity="all">全部</button> <button class="pvzhe-rarity-btn white" data-rarity="white">白卡</button> <button class="pvzhe-rarity-btn gold" data-rarity="gold">至尊金卡</button> <button class="pvzhe-rarity-btn diamond" data-rarity="diamond">臻享钻卡</button> <button class="pvzhe-rarity-btn rainbow" data-rarity="rainbow">梦幻彩卡</button> <button class="pvzhe-rarity-btn star" data-rarity="star">星光闪卡</button> <button class="pvzhe-rarity-btn original" data-rarity="original">原卡</button> </div> <script> (function() { var raritySections = { 'white': '白卡', 'gold': '至尊金卡', 'diamond': '臻享钻卡', 'rainbow': '梦幻彩卡', 'star': '星光闪卡', 'original': '原卡' }; function countCards() { var counts = { all: 0 }; $('.pvzhe-card').each(function() { counts.all++; }); var $container = $('.pvzhe-card-container'); $container.each(function() { var $prev = $(this).prevAll('.mw-heading, h2, h3').first(); var title = $prev.text().trim(); for (var key in raritySections) { if (title.indexOf(raritySections[key]) !== -1) { if (!counts[key]) counts[key] = 0; counts[key] += $(this).find('.pvzhe-card').length; } } }); $('.pvzhe-rarity-btn').each(function() { var rarity = $(this).data('rarity'); var count = counts[rarity] || 0; $(this).text($(this).text().replace(/\(\d+\)/, '') + ' (' + count + ')'); }); } function filterByRarity(rarity) { if (rarity === 'all') { $('.pvzhe-card').show(); $('.pvzhe-card-container').show(); $('.mw-heading, h2, h3').show(); return; } var targetTitle = raritySections[rarity]; if (!targetTitle) return; $('.pvzhe-card').hide(); $('.pvzhe-card-container').hide(); var $headings = $('.mw-heading, h2, h3'); var found = false; $headings.each(function() { var $heading = $(this); if ($heading.text().trim().indexOf(targetTitle) !== -1) { found = true; $heading.show(); var $next = $heading.nextAll('.pvzhe-card-container').first(); if ($next.length) { $next.show(); $next.find('.pvzhe-card').show(); } } else if (found && $heading.is('h2, h3, .mw-heading')) { return false; } }); } $('.pvzhe-rarity-btn').click(function() { $('.pvzhe-rarity-btn').removeClass('active'); $(this).addClass('active'); filterByRarity($(this).data('rarity')); }); countCards(); })(); </script> </includeonly>
返回
微件:RarityFilter
。
查看“︁微件:RarityFilter”︁的源代码
来自植物大战僵尸杂交版Wiki