修复“光速跑路”无法关闭的bug

This commit is contained in:
woohoo 2022-01-05 22:45:44 +08:00
parent c8016a930d
commit 4fbac7495a

View File

@ -1,8 +1,8 @@
// ==UserScript== // ==UserScript==
// @lastmodified 202201051815 // @lastmodified 202201052245
// @name Torn翻译 // @name Torn翻译
// @namespace WOOH // @namespace WOOH
// @version 0.2.0105b // @version 0.2.0105c
// @description Torn UI翻译 // @description Torn UI翻译
// @author Woohoo-[2687093] sabrina_devil[2696209] // @author Woohoo-[2687093] sabrina_devil[2696209]
// @match https://www.torn.com/* // @match https://www.torn.com/*
@ -22,6 +22,11 @@
todo: true, todo: true,
cont: `baza npc商店 imarket及imarket搜索结果`, cont: `baza npc商店 imarket及imarket搜索结果`,
}, },
{
ver: '0.2.0105c',
date: '20220105',
cont: `修复“光速跑路”无法关闭的bug`,
},
{ {
ver: '0.2.0105b', ver: '0.2.0105b',
date: '20220105', date: '20220105',
@ -3080,7 +3085,7 @@
xmasTownNotify: true, xmasTownNotify: true,
energyAlert: true, energyAlert: true,
quickAttIndex: 2, quickAttIndex: 2,
quickFinishAtt: 4, quickFinishAtt: 3,
attRelocate: true, attRelocate: true,
attReload: false, attReload: false,
isDev: false, isDev: false,
@ -3694,9 +3699,18 @@ width: 66px;}
document.body.classList.toggle('wh-move-btn'); document.body.classList.toggle('wh-move-btn');
// 绑定点击事件 // 绑定点击事件
btn.onclick = () => { btn.onclick = () => {
if (wh_trans_settings.quickFinishAtt !== 3) { if (undefined !== wh_trans_settings.quickFinishAtt && wh_trans_settings.quickFinishAtt !== 3) {
addStyle(`.wh-move-btn #defender button{display:none;}`); btn.remove();
addStyle(`.wh-move-btn #defender button:nth-of-type(${wh_trans_settings.quickFinishAtt + 1}){display:inline-block !important;}`); elementReady('div[class^="modal___"] button')
.then(() => document.querySelectorAll('div[class^="modal___"] button').forEach((e, i) => {
if (i !== wh_trans_settings.quickFinishAtt) {
e.style.display = 'none';
} else {
e.style.display = 'inline-block';
}
}));
} else {
document.body.classList.toggle('wh-move-btn');
} }
}; };
break; break;
@ -3769,8 +3783,19 @@ width: 66px;}
addStyle(css_rule); addStyle(css_rule);
document.body.classList.toggle('wh-move-btn'); document.body.classList.toggle('wh-move-btn');
btn.onclick = () => { btn.onclick = () => {
addStyle(`.wh-move-btn #attacker button{display:none;}`); if (undefined !== wh_trans_settings.quickFinishAtt && wh_trans_settings.quickFinishAtt !== 3) {
addStyle(`.wh-move-btn #attacker button:nth-of-type(${wh_trans_settings.quickFinishAtt + 1}){display:inline-block !important;}`); btn.remove();
elementReady('div[class^="modal___"] button')
.then(()=>document.querySelectorAll('div[class^="modal___"] button').forEach((e,i)=>{
if (i !== wh_trans_settings.quickFinishAtt) {
e.style.display = 'none';
} else {
e.style.display = 'inline-block';
}
}));
} else {
document.body.classList.toggle('wh-move-btn');
}
}; };
break; break;
} }
@ -7289,7 +7314,7 @@ margin: 0 0 3px;
<div class="wh-main"> <div class="wh-main">
<div><b>芜湖的翻译助手</b></div> <div><b>芜湖的翻译助手</b></div>
<div id="wh-gSettings"></div> <div id="wh-gSettings"></div>
<div><p>当前版本: ${version}</p></div> <div><p>当前版本: ${version} <button id="wh-update-btn">更新</button></p></div>
<div><p>最新版本: <span id="wh-latest-version"></span></p></div> <div><p>最新版本: <span id="wh-latest-version"></span></p></div>
</div> </div>
</div>`; </div>`;
@ -7332,6 +7357,10 @@ margin: 0 0 3px;
e.target.blur(); e.target.blur();
e.target.parentElement.parentElement.classList.toggle('wh-icon-expanded'); e.target.parentElement.parentElement.classList.toggle('wh-icon-expanded');
}; };
zhongNode.querySelector('#wh-update-btn').onclick = (e) => {
e.target.blur();
popupMsg(``,'如何更新');
};
document.body.prepend(zhongNode); document.body.prepend(zhongNode);
} }