Skip to content

Commit

Permalink
稍微调整
Browse files Browse the repository at this point in the history
  • Loading branch information
Mapaler committed May 17, 2024
1 parent c7e3fc6 commit 7528542
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 24 deletions.
28 changes: 17 additions & 11 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("提前预载原来已经储存的数据");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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']");
Expand Down
25 changes: 14 additions & 11 deletions service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -26263,7 +26263,7 @@ const cachesMap = new Map([
],
[
"script.js",
"12467adb3aa2825e287a49ac89ddc1c9"
"8d7a86d95fabbf5de1883c3188449241"
],
[
"solo.html",
Expand All @@ -26275,7 +26275,7 @@ const cachesMap = new Map([
],
[
"style.css",
"c34c2e4307455d12036d8bb587a3d7d6"
"839c434cacaed4ba4866e59c617c913b"
],
[
"temp.js",
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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% {
Expand All @@ -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;
}

Expand Down

0 comments on commit 7528542

Please sign in to comment.