From bf8efce348fa70cdc88aab0ae3eba2e35691b6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Wed, 7 Oct 2020 00:45:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E7=95=8C=E9=9D=A2=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=88=B0=E6=95=B0=E6=8D=AE=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E4=B9=8B=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script.js | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/script.js b/script.js index acc1754e..d39e6b5e 100644 --- a/script.js +++ b/script.js @@ -375,7 +375,11 @@ window.onload = function() { document.body.classList.add("ds-" + currentDataSource.code); const dataSourceOptionArray = Array.from(dataSelectDom.options); dataSourceOptionArray.find(dataOpt => dataOpt.value == currentDataSource.code).selected = true; + //▼添加数据来源列表结束 + initialize(); //界面初始化 + + //开始读取解析怪物数据 const sourceDataFolder = "monsters-info"; var newCkeys; //当前的Ckey @@ -479,6 +483,24 @@ window.onload = function() { return; } statusLine.classList.remove("loading-mon-info"); + + const monstersList = editBox.querySelector("#monsters-name-list"); + let fragment = document.createDocumentFragment(); + Cards.forEach(function(m) { //添加下拉框候选 + const opt = fragment.appendChild(document.createElement("option")); + opt.value = m.id; + opt.label = m.id + " - " + returnMonsterNameArr(m, currentLanguage.searchlist, currentDataSource.code).join(" | "); + + const linkRes = new RegExp("link:(\\d+)", "ig").exec(m.specialAttribute); + if (linkRes) { //每个有链接的符卡,把它们被链接的符卡的进化根修改到链接前的 + const _m = Cards[parseInt(linkRes[1], 10)]; + _m.evoRootId = m.evoRootId; + m.henshinFrom = true; + _m.henshinTo = true; + } + }); + monstersList.appendChild(fragment); + statusLine.classList.add("loading-skill-info"); const currentCkey = newCkeys.find(ckey => ckey.code == currentDataSource.code); //获取当前语言的ckey @@ -538,7 +560,7 @@ window.onload = function() { const updateTime = controlBox.querySelector(".datasource-updatetime"); updateTime.innerHTML = new Date(currentCkey.updateTime).toLocaleString(undefined, { hour12: false }); - initialize(); //初始化 + //initialize(); //初始化 statusLine.classList.remove("loading-skill-info"); //如果通过的话就载入URL中的怪物数据 reloadFormationData(); @@ -612,22 +634,6 @@ function capture() { } //初始化 function initialize() { - const monstersList = editBox.querySelector("#monsters-name-list"); - let fragment = document.createDocumentFragment(); - Cards.forEach(function(m) { //添加下拉框候选 - const opt = fragment.appendChild(document.createElement("option")); - opt.value = m.id; - opt.label = m.id + " - " + returnMonsterNameArr(m, currentLanguage.searchlist, currentDataSource.code).join(" | "); - - const linkRes = new RegExp("link:(\\d+)", "ig").exec(m.specialAttribute); - if (linkRes) { //每个有链接的符卡,把它们被链接的符卡的进化根修改到链接前的 - const _m = Cards[parseInt(linkRes[1], 10)]; - _m.evoRootId = m.evoRootId; - m.henshinFrom = true; - _m.henshinTo = true; - } - }); - monstersList.appendChild(fragment); //标题和介绍文本框 const titleBox = formationBox.querySelector(".title-box"); @@ -1476,7 +1482,7 @@ function initialize() { if (isGuideMod) //图鉴模式直接打开搜索框 { showSearch([]); - if (monstersID.value.length == 0) editBoxChangeMonId(0); + //if (monstersID.value.length == 0) editBoxChangeMonId(0); } } //编辑界面点击每个怪物的头像的处理