From 040905ab1a4e62947586cd88c203b578749b19e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Fri, 9 Oct 2020 17:08:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E9=89=B4=E6=A8=A1=E5=BC=8F=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E6=80=AA=E7=89=A9id=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script.js | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/script.js b/script.js index 0f85b2e7..b1a7b292 100644 --- a/script.js +++ b/script.js @@ -288,7 +288,6 @@ function swapABCteam() { } //在单人和多人之间转移数据 function turnPage(toPage, e = null) { - console.log(e) let pagename = null; switch (toPage) { case 1: @@ -613,7 +612,7 @@ function loadData(force = false) try { Skills = JSON.parse(response.response); } catch (e) { - console.log("Cards数据JSON解码出错", e); + console.log("Skills数据JSON解码出错", e); return; } if (db) @@ -667,6 +666,15 @@ function reloadFormationData() { formation.loadObj(formationData); refreshAll(formation); } + if (isGuideMod) + { + const mid = parseInt(getQueryString("id")); + if (!isNaN(mid)) + { + editBox.mid = mid; + editBoxChangeMonId(mid); + } + } } window.onpopstate = reloadFormationData; //前进后退时修改页面 //创建新的分享地址 @@ -972,25 +980,7 @@ function initialize() { }); }; }); -/* const s_typesCheckBoxIcon = s_typesLi.map(li=>li.querySelector(".type-icon")); - s_typesCheckBoxIcon.forEach(icon=> - { - icon.onclick = function(e){ - console.log(e,s_typeAndOr.checked); - if (!s_typeAndOr.checked) //or的时候才生效 - { - const type = parseInt(this.getAttribute("data-type-icon")); - const killerTypes = typekiller_for_type.filter(o=>o.typeKiller.includes(type)).map(o=>o.type); - console.log(killerTypes); - s_typesCheckBox.forEach(checkbox=>{ - const type = parseInt(checkbox.value); - checkbox.checked = killerTypes.includes(type); - }); - } - } - } - ); -*/ + s_typeAndOr.onchange = function(){ s_typesCheckBox.forEach(checkBox=>checkBox.onchange()); if (this.checked) @@ -1134,7 +1124,7 @@ function initialize() { s_awokensEquivalent.checked, s_includeSuperAwoken.checked ); - console.log("搜索结果", searchResult); + //console.log("搜索结果", searchResult); showSearch(searchResult); }; searchBox.startSearch = startSearch; @@ -1215,7 +1205,21 @@ function initialize() { if (editBox.mid != newId) //避免多次运行oninput、onchange { editBox.mid = newId; - editBoxChangeMonId(editBox.mid); + + if (isGuideMod) + { + const locationURL = new URL(location); + if (newId === 0) { + locationURL.searchParams.delete('id'); + history.pushState(null, null, locationURL); + }else + { + locationURL.searchParams.set('id', newId); + history.pushState(null, null, locationURL); + } + } + + editBoxChangeMonId(newId); } } };