微件:中立&怪物卡牌灵光一闪:修订间差异
来自卡厄思梦境WIKI
创建页面,内容为“<noinclude> 此Widget用于卡牌筛选功能。 </noinclude><includeonly><div id="card-filter-widget-<!--{$id|escape:'html'}-->"> <style> .filter-container { background-color: #f9f9f9; padding: 15px; margin-bottom: 20px; border: 1px solid #ddd; border-radius: 5px; } .filter-row { margin-bottom: 10px; display: flex; align-items: center;…” |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
<includeonly><div id="card-filter-widget"> | |||
<style> | <style> | ||
.filter-container { | .filter-container { | ||
| 第58行: | 第56行: | ||
<div class="filter-row"> | <div class="filter-row"> | ||
<span class="filter-label">类型:</span> | <span class="filter-label">类型:</span> | ||
<select class="filter-select" id="filter-type | <select class="filter-select" id="filter-type"> | ||
<option value="">全部</option> | <option value="">全部</option> | ||
<option value="攻击">攻击</option> | <option value="攻击">攻击</option> | ||
| 第68行: | 第66行: | ||
<div class="filter-row"> | <div class="filter-row"> | ||
<span class="filter-label">包含机制:</span> | <span class="filter-label">包含机制:</span> | ||
<select class="filter-select" id="filter-dict-include | <select class="filter-select" id="filter-dict-include"> | ||
<option value="">全部</option> | <option value="">全部</option> | ||
<option value="消耗">消耗</option> | <option value="消耗">消耗</option> | ||
| 第77行: | 第75行: | ||
<div class="filter-row"> | <div class="filter-row"> | ||
<span class="filter-label">排除机制:</span> | <span class="filter-label">排除机制:</span> | ||
<select class="filter-select" id="filter-dict-exclude | <select class="filter-select" id="filter-dict-exclude"> | ||
<option value="">全部</option> | <option value="">全部</option> | ||
<option value="无法使用">无法使用</option> | <option value="无法使用">无法使用</option> | ||
| 第87行: | 第85行: | ||
<div class="filter-row"> | <div class="filter-row"> | ||
<span class="filter-label">职业:</span> | <span class="filter-label">职业:</span> | ||
<select class="filter-select" id="filter-class | <select class="filter-select" id="filter-class"> | ||
<option value="">全部</option> | <option value="">全部</option> | ||
<option value="决斗家">决斗家</option> | <option value="决斗家">决斗家</option> | ||
| 第100行: | 第98行: | ||
<div class="filter-row"> | <div class="filter-row"> | ||
<span class="filter-label">最低费用:</span> | <span class="filter-label">最低费用:</span> | ||
<select class="filter-select" id="filter-cost-min | <select class="filter-select" id="filter-cost-min"> | ||
<option value="">全部</option> | <option value="">全部</option> | ||
<option value="-1">-1</option> | <option value="-1">-1</option> | ||
| 第113行: | 第111行: | ||
<div class="filter-row"> | <div class="filter-row"> | ||
<span class="filter-label">最高费用:</span> | <span class="filter-label">最高费用:</span> | ||
<select class="filter-select" id="filter-cost-max | <select class="filter-select" id="filter-cost-max"> | ||
<option value="">全部</option> | <option value="">全部</option> | ||
<option value="0">0</option> | <option value="0">0</option> | ||
| 第124行: | 第122行: | ||
<div class="filter-buttons"> | <div class="filter-buttons"> | ||
<div class="filter-btn filter-btn-submit" onclick=" | <div class="filter-btn filter-btn-submit" onclick="applyCardFilter()">筛选</div> | ||
<div class="filter-btn filter-btn-reset" onclick=" | <div class="filter-btn filter-btn-reset" onclick="resetCardFilter()">重置</div> | ||
</div> | </div> | ||
</div> | </div> | ||
| 第131行: | 第129行: | ||
<script> | <script> | ||
(function() { | (function() { | ||
// 获取当前URL参数 | // 获取当前URL参数 | ||
function getUrlParams() { | function getUrlParams() { | ||
| 第151行: | 第147行: | ||
var params = getUrlParams(); | var params = getUrlParams(); | ||
var typeElem = document.getElementById('filter-type'); | |||
var dictIncludeElem = document.getElementById('filter-dict-include'); | |||
var dictExcludeElem = document.getElementById('filter-dict-exclude'); | |||
var classElem = document.getElementById('filter-class'); | |||
var costMinElem = document.getElementById('filter-cost-min'); | |||
var costMaxElem = document.getElementById('filter-cost-max'); | |||
if (typeElem && params.type) { | |||
typeElem.value = params.type; | |||
} | } | ||
if (params.dict_include) { | if (dictIncludeElem && params.dict_include) { | ||
dictIncludeElem.value = params.dict_include; | |||
} | } | ||
if (params.dict_exclude) { | if (dictExcludeElem && params.dict_exclude) { | ||
dictExcludeElem.value = params.dict_exclude; | |||
} | } | ||
if (params['class']) { | if (classElem && params['class']) { | ||
classElem.value = params['class']; | |||
} | } | ||
if (params.cost_min) { | if (costMinElem && params.cost_min) { | ||
costMinElem.value = params.cost_min; | |||
} | } | ||
if (params.cost_max) { | if (costMaxElem && params.cost_max) { | ||
costMaxElem.value = params.cost_max; | |||
} | } | ||
} | } | ||
// 应用筛选 | // 应用筛选 | ||
window | window.applyCardFilter = function() { | ||
var params = []; | var params = []; | ||
var baseUrl = window.location.pathname; | var baseUrl = window.location.pathname; | ||
var type = document.getElementById('filter-type | var type = document.getElementById('filter-type').value; | ||
if (type) params.push('type=' + encodeURIComponent(type)); | if (type) params.push('type=' + encodeURIComponent(type)); | ||
var dictInclude = document.getElementById('filter-dict-include | var dictInclude = document.getElementById('filter-dict-include').value; | ||
if (dictInclude) params.push('dict_include=' + encodeURIComponent(dictInclude)); | if (dictInclude) params.push('dict_include=' + encodeURIComponent(dictInclude)); | ||
var dictExclude = document.getElementById('filter-dict-exclude | var dictExclude = document.getElementById('filter-dict-exclude').value; | ||
if (dictExclude) params.push('dict_exclude=' + encodeURIComponent(dictExclude)); | if (dictExclude) params.push('dict_exclude=' + encodeURIComponent(dictExclude)); | ||
var classValue = document.getElementById('filter-class | var classValue = document.getElementById('filter-class').value; | ||
if (classValue) params.push('class=' + encodeURIComponent(classValue)); | if (classValue) params.push('class=' + encodeURIComponent(classValue)); | ||
var costMin = document.getElementById('filter-cost-min | var costMin = document.getElementById('filter-cost-min').value; | ||
if (costMin) params.push('cost_min=' + encodeURIComponent(costMin)); | if (costMin) params.push('cost_min=' + encodeURIComponent(costMin)); | ||
var costMax = document.getElementById('filter-cost-max | var costMax = document.getElementById('filter-cost-max').value; | ||
if (costMax) params.push('cost_max=' + encodeURIComponent(costMax)); | if (costMax) params.push('cost_max=' + encodeURIComponent(costMax)); | ||
| 第203行: | 第206行: | ||
// 重置筛选 | // 重置筛选 | ||
window | window.resetCardFilter = function() { | ||
window.location.href = window.location.pathname; | window.location.href = window.location.pathname; | ||
}; | }; | ||