From e66ce3569080b93d86ff67b3a0a80f22deace433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Mon, 16 Nov 2020 17:39:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=B8=BA=E7=82=B9=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E4=B8=AA=E7=82=B9=E7=9A=84=E6=97=B6=E5=80=99=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E5=89=8D=E4=B8=A4=E4=B8=AA=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- multi.html | 24 ++++++++++++------------ script-universal_function.js | 4 ++-- script.js | 30 +++++++++++++++++++++--------- style.css | 5 +++++ triple.html | 24 ++++++++++++------------ 5 files changed, 52 insertions(+), 35 deletions(-) diff --git a/multi.html b/multi.html index aaf13077..5c5a377f 100644 --- a/multi.html +++ b/multi.html @@ -499,18 +499,18 @@ var formation = new Formation(teamsCount,5);
- +
+
+
+
+
+
+
+
+
+
+
+
diff --git a/script-universal_function.js b/script-universal_function.js index 1cfe1467..776a85a5 100644 --- a/script-universal_function.js +++ b/script-universal_function.js @@ -426,9 +426,9 @@ function searchCards(cards,attr1,attr2,fixMainColor,types,typeAndOr,rares,awoken ); } //稀有度 - if (rares.length>0) + if (rares.length>1) { - cardsRange = cardsRange.filter(c=>rares.includes(c.rarity)); + cardsRange = cardsRange.filter(c=>c.rarity >= rares[0] && c.rarity <= rares[1]); } //觉醒 //等效觉醒时,事先去除大觉醒 diff --git a/script.js b/script.js index bea3a9f8..0e1b6ca7 100644 --- a/script.js +++ b/script.js @@ -1131,16 +1131,25 @@ function initialize() { //稀有度筛选 const s_rareDiv = searchBox.querySelector(".rare-div"); const s_rareLst = s_rareDiv.querySelector(".rare-list"); - const s_rareIcons = Array.from(s_rareLst.querySelectorAll("rare-icon")); + const s_rareIcons = Array.from(s_rareLst.querySelectorAll(".rare-icon")); + const s_rareLows = Array.from(s_rareLst.querySelectorAll("input[name='rare-low']")); + const s_rareHighs = Array.from(s_rareLst.querySelectorAll("input[name='rare-high']")); function s_rareIcons_onclick() { const thisValue = parseInt(this.getAttribute("data-rare-icon"),10); - const radioLow = s_rareLst.querySelector("input[name='rare-low']:checked"); - const radioHigh = s_rareLst.querySelector("input[name='rare-high']:checked"); - const range = [ - radioLow ? parseInt(radioLow.value,10) : 1, - radioHigh ? parseInt(radioHigh.value,10) : 10 - ]; + const radioLow = s_rareLows.find(radio=>radio.checked); + const radioHigh = s_rareHighs.find(radio=>radio.checked); + const rangeLow = radioLow ? parseInt(radioLow.value,10) : 1; + const rangeHigh = radioHigh ? parseInt(radioHigh.value,10) : 10; + if (rangeLow == rangeHigh) + { + s_rareLows.find(radio=>parseInt(radio.value,10) == Math.min(thisValue,rangeLow)).checked = true; + s_rareHighs.find(radio=>parseInt(radio.value,10) == Math.max(thisValue,rangeLow)).checked = true; + }else + { + s_rareLows.find(radio=>parseInt(radio.value,10) == thisValue).checked = true; + s_rareHighs.find(radio=>parseInt(radio.value,10) == thisValue).checked = true; + } } s_rareIcons.forEach(icon=>icon.onclick = s_rareIcons_onclick); @@ -1301,7 +1310,10 @@ function initialize() { } } const typesFilter = s_types.filter(returnCheckedInput).map(returnInputValue).map(Str2Int); - //const rareFilter = s_rare.filter(returnCheckedInput).map(returnInputValue).map(Str2Int); + const rareFilter = [ + s_rareLows.filter(returnCheckedInput).map(returnInputValue).map(Str2Int)[0], + s_rareHighs.filter(returnCheckedInput).map(returnInputValue).map(Str2Int)[0], + ]; const sawokensFilter = s_sawokens.filter(returnCheckedInput).map(returnInputValue).map(Str2Int); const awokensFilter = s_awokensCounts.filter(btn => parseInt(btn.value, 10) > 0).map(btn => { const awokenIndex = parseInt(btn.parentNode.parentNode.querySelector(".awoken-icon").getAttribute("data-awoken-icon"), 10); @@ -1312,7 +1324,7 @@ function initialize() { s_fixMainColor.checked, typesFilter, s_typeAndOr.checked, - [],//rareFilter, + rareFilter, awokensFilter, sawokensFilter, s_awokensEquivalent.checked, diff --git a/style.css b/style.css index 754889c4..cc361d38 100644 --- a/style.css +++ b/style.css @@ -1076,6 +1076,11 @@ ul{ position: relative; text-align: center; display: inline-block; + cursor: pointer; +} +.rare-radio +{ + display: none; } .rare-radio[name="rare-low"]+.rare-icon { diff --git a/triple.html b/triple.html index 10a63dd2..3fdd400d 100644 --- a/triple.html +++ b/triple.html @@ -1144,18 +1144,18 @@ var formation = new Formation(teamsCount,6);
- +
+
+
+
+
+
+
+
+
+
+
+