feat: update with 1.0
This commit is contained in:
+42
-37
@@ -381,40 +381,40 @@ handlers[1] = (tabNode, containerNode) => {
|
|||||||
const list = containerNode.querySelectorAll(`button.btn`);
|
const list = containerNode.querySelectorAll(`button.btn`);
|
||||||
for (const node of list) {
|
for (const node of list) {
|
||||||
if (node.id === id) continue;
|
if (node.id === id) continue;
|
||||||
|
if (node.querySelector("button.theresmore-helper")) continue;
|
||||||
const name = node.firstChild.textContent;
|
const name = node.firstChild.textContent;
|
||||||
if (!node.querySelector("button.btn")) {
|
const button = document.createElement("button");
|
||||||
const button = document.createElement("button");
|
button.classList.add(
|
||||||
button.classList.add(
|
"-bottom-0",
|
||||||
"-bottom-0",
|
"right-0",
|
||||||
"right-0",
|
"inline-block",
|
||||||
"inline-block",
|
"py-px",
|
||||||
"py-px",
|
"px-2",
|
||||||
"px-2",
|
"rounded-full",
|
||||||
"rounded-full",
|
"font-bold",
|
||||||
"font-bold",
|
"text-xs",
|
||||||
"text-xs",
|
"theresmore-helper",
|
||||||
);
|
);
|
||||||
button.textContent = "A";
|
button.textContent = "A";
|
||||||
if (blackList.has(name)) {
|
if (blackList.has(name)) {
|
||||||
button.classList.add("text-gray-600");
|
button.classList.add("text-gray-600");
|
||||||
} else {
|
} else {
|
||||||
button.classList.add("text-green-600");
|
button.classList.add("text-green-600");
|
||||||
}
|
|
||||||
button.onclick = (ev) => {
|
|
||||||
ev.stopPropagation();
|
|
||||||
if (blackList.has(name)) {
|
|
||||||
blackList.delete(name);
|
|
||||||
button.classList.remove("text-gray-600");
|
|
||||||
button.classList.add("text-green-600");
|
|
||||||
} else {
|
|
||||||
blackList.add(name);
|
|
||||||
button.classList.remove("text-green-600");
|
|
||||||
button.classList.add("text-gray-600");
|
|
||||||
}
|
|
||||||
saveBlackList(blackList);
|
|
||||||
};
|
|
||||||
node.appendChild(button);
|
|
||||||
}
|
}
|
||||||
|
button.onclick = (ev) => {
|
||||||
|
ev.stopPropagation();
|
||||||
|
if (blackList.has(name)) {
|
||||||
|
blackList.delete(name);
|
||||||
|
button.classList.remove("text-gray-600");
|
||||||
|
button.classList.add("text-green-600");
|
||||||
|
} else {
|
||||||
|
blackList.add(name);
|
||||||
|
button.classList.remove("text-green-600");
|
||||||
|
button.classList.add("text-gray-600");
|
||||||
|
}
|
||||||
|
saveBlackList(blackList);
|
||||||
|
};
|
||||||
|
node.appendChild(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (containerNode.firstChild.textContent === "ALL") return;
|
if (containerNode.firstChild.textContent === "ALL") return;
|
||||||
@@ -569,7 +569,7 @@ handlers[4] = async (tabNode, containerNode) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (currentSubTab.firstChild.textContent === "攻击") {
|
} else if (currentSubTab.firstChild.textContent === "攻击") {
|
||||||
const chooseBtn = containerNode.querySelector(`button.btn.btn-dark`);
|
const chooseBtn = containerNode.querySelector(`button.btn:nth-child(2)`);
|
||||||
if (chooseBtn && chooseBtn.firstChild.textContent !== "没有敌人可供攻击") {
|
if (chooseBtn && chooseBtn.firstChild.textContent !== "没有敌人可供攻击") {
|
||||||
if (chooseBtn.lastChild.id !== "auto-attack") {
|
if (chooseBtn.lastChild.id !== "auto-attack") {
|
||||||
const btn = document.createElement("button");
|
const btn = document.createElement("button");
|
||||||
@@ -729,8 +729,13 @@ function customFunction(MainStore) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sleep(time) {
|
async function sleep(time) {
|
||||||
return new Promise((resolve) => {
|
let timer;
|
||||||
setTimeout(resolve, time);
|
try {
|
||||||
});
|
return await new Promise((resolve) => {
|
||||||
|
timer = setTimeout(resolve, time);
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
return clearTimeout(timer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user