From 75285422ac8d47e4f82e4ae1f2c313bd50129ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Sat, 18 May 2024 00:15:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A8=8D=E5=BE=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script.js | 28 +++++++++++++++++----------- service-worker.js | 25 ++++++++++++++----------- style.css | 4 ++-- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/script.js b/script.js index 77f4ac1a..6c3a5116 100644 --- a/script.js +++ b/script.js @@ -2069,7 +2069,7 @@ function loadData(force = false) let currentCkey; //获取当前语言的ckey let lastCurrentCkey; //以前的当前语言的ckey - if (responseText === undefined) { + if (!force && responseText === undefined) { try { newCkeys = JSON.parse(lastKeyString); console.info("提前预载原来已经储存的数据"); @@ -2873,7 +2873,10 @@ function initialize() { statusLine = controlBox.querySelector(".status"); //显示当前状态的 statusLine.writeText = function(text) { this.innerHTML = ''; - if (text) this.textContent = text; + if (text) { + console.debug(text); + this.textContent = text; + } }; formationBox = document.body.querySelector(".formation-box"); editBox = document.body.querySelector(".edit-box"); @@ -4536,7 +4539,7 @@ function initialize() { function clickHeadToNewMon(event) { event.preventDefault(); //取消链接的默认操作 monstersID.value = this.card.id; - formIdSearch.onsubmit(); + formIdSearch.onchange(); } const cli = document.createElement("li"); const cdom = cli.head = createCardA(options); @@ -5332,11 +5335,7 @@ function initialize() { //id搜索 editBox.changeMonId = editBoxChangeMonId; - function idChange(event) { - event?.preventDefault(); - const formData = new FormData(this); - const searchString = formData.get("card-id"); - const newId = parseInt(searchString, 10); + function idChange(newId) { if (editBox.mid != newId) { //避免多次运行oninput、onchange editBox.mid = newId; @@ -5369,8 +5368,15 @@ function initialize() { } const formIdSearch = document.getElementById("form-id-search"); - formIdSearch.onsubmit = idChange; - formIdSearch.onchange = idChange; //让数字快速变化时也改变当前卡片 + formIdSearch.onchange = function(event){ + const formData = new FormData(this); + const searchString = formData.get("card-id"); + const newId = parseInt(searchString, 10); + idChange(newId); + };//idChange; //让数字快速变化时也改变当前卡片 + formIdSearch.onsubmit = function(event){ + event?.preventDefault(); + }; const formStringSearch = document.getElementById("form-string-search"); formStringSearch.onsubmit = search; const monstersID = document.getElementById("card-id"); @@ -6144,7 +6150,7 @@ function editMember(teamNum, isAssist, indexInTeam) { const formIdSearch = document.getElementById("form-id-search"); const monstersID = document.getElementById("card-id"); monstersID.value = mon.id > 0 ? mon.id : 0; - formIdSearch.onsubmit(); + formIdSearch.onchange(); //觉醒 const monEditOuterAwokensRow = editBox.querySelector(".row-awoken-sawoken"); const monEditAwokens = monEditOuterAwokensRow.querySelectorAll(".row-mon-awoken .awoken-ul input[name='awoken-number']"); diff --git a/service-worker.js b/service-worker.js index 05968df3..bd43652f 100644 --- a/service-worker.js +++ b/service-worker.js @@ -26263,7 +26263,7 @@ const cachesMap = new Map([ ], [ "script.js", - "12467adb3aa2825e287a49ac89ddc1c9" + "8d7a86d95fabbf5de1883c3188449241" ], [ "solo.html", @@ -26275,7 +26275,7 @@ const cachesMap = new Map([ ], [ "style.css", - "c34c2e4307455d12036d8bb587a3d7d6" + "839c434cacaed4ba4866e59c617c913b" ], [ "temp.js", @@ -26993,11 +26993,12 @@ self.addEventListener('fetch', async function(event) { // If we didn't find a match in the cache, use the network. try { const newResponse = fetch(event.request); - console.debug("%c无相同 md5 缓存,重新在线获取结果:%s,%s", "color: lightblue;", relativePath, md5); - const response = await newResponse; - const cache = await caches.open(cacheName); - await cache.put(url, response.clone()); - return response; + newResponse.then(async response=>{ + console.debug("%c无相同 md5 缓存,重新在线获取结果:%s,%s", "color: lightblue;", relativePath, md5); + const cache = await caches.open(cacheName); + cache.put(url, response.clone()); + }); + return newResponse; //console.debug("%c储存新的Cache", "color: blue;", url, cache); } catch (error) { console.error("%c数据在线获取失败-有hash,尝试使用忽略 search 的离线数据:%s,%s", "color: red;", relativePath, md5, error); @@ -27012,10 +27013,12 @@ self.addEventListener('fetch', async function(event) { const responseSync = (async () => { try { const newResponse = fetch(event.request); - const response = await newResponse; - const cache = await caches.open(cacheName); - await cache.put(url, response.clone()); - return response; + newResponse.then(async response=>{ + console.debug("%c无相同 md5 缓存,重新在线获取结果:%s,%s", "color: lightblue;", relativePath, md5); + const cache = await caches.open(cacheName); + cache.put(url, response.clone()); + }); + return newResponse; //console.debug("%c储存新的Cache", "color: blue;", url, cache); } catch (error) { console.error("%c数据在线获取失败-无hash,尝试使用忽略 search 的离线数据:%s", "color: red;", relativePath, error); diff --git a/style.css b/style.css index 5cd5e774..ad1bdbd8 100644 --- a/style.css +++ b/style.css @@ -1193,7 +1193,7 @@ body:not(.solo) .awoken-icon[data-awoken-icon="64"]::after .team-assist-awoken .member-awoken, .team-ability .abilitys { - transition: transform 1s cubic-bezier(0.35, 2, 0.65, -1); + transition: transform 0.5s cubic-bezier(0.35, 2, 0.65, -1); } @keyframes changing-leader { 0% { @@ -1210,7 +1210,7 @@ body:not(.solo) .awoken-icon[data-awoken-icon="64"]::after } } .changing-leader { - animation: changing-leader 1s cubic-bezier(0.45, 0.25, 0.75, 0.25); + animation: changing-leader 0.5s cubic-bezier(0.45, 0.25, 0.75, 0.25); animation-iteration-count: 1; }