增加了“攻击界面自刷新”

This commit is contained in:
woohoo 2022-01-05 00:52:35 +08:00
parent 9a5b727054
commit 048cac1ef2

View File

@ -1,5 +1,5 @@
// ==UserScript==
// @lastmodified 202201041738
// @lastmodified 202201050051
// @name Torn翻译
// @namespace WOOH
// @version 0.2.0104a
@ -21,6 +21,11 @@
todo: true,
cont: `baza npc商店 imarket及imarket搜索结果`,
},
{
ver: '0.2.0105a',
date: '20220105',
cont: `增加了“攻击界面自刷新”`,
},
{
ver: '0.2.0104a',
date: '20220104',
@ -2882,7 +2887,6 @@
// transDict.calDict = calDict;
// if (!localStorage.getItem('wh_trans_transDict')) localStorage.setItem('wh_trans_transDict', JSON.stringify(transDict))
// const mobile = window.innerWidth <= 600;
let device;
if (window.innerWidth > 1000) device = 'pc';
else if (window.innerWidth <= 600) device = 'mobile';
@ -2967,6 +2971,12 @@
domText: ' 真·攻击界面转跳',
dictName: 'attRelocate',
},
{
domType: 'checkbox',
domId: 'wh-attack-reload',
domText: ' 攻击界面自刷新',
dictName: 'attReload',
},
{
domType: 'select',
domId: 'wh-quick-attack-index',
@ -2974,31 +2984,31 @@
domSelectOpt: [
{
domVal: 'pri',
domText: '--主手--',
domText: '主手',
},
{
domVal: 'sec',
domText: '--副手--',
domText: '副手',
},
{
domVal: 'wea',
domText: '--近战--',
domText: '近战',
},
{
domVal: 'gre',
domText: '--手雷--',
domText: '手雷',
},
{
domVal: 'fis',
domText: '--拳头--',
domText: '拳头',
},
{
domVal: 'kic',
domText: '--脚踢--',
domText: '脚踢',
},
{
domVal: 'none',
domText: '--关闭--',
domText: '关闭',
},
],
dictName: 'quickAttIndex',
@ -3047,17 +3057,17 @@
xmasTownWT: true,
xmasTownNotify: true,
energyAlert: true,
// quickAtt: false,
quickAttIndex: 2,
quickFinishAtt: 4,
attRelocate: true,
attReload: false,
isDev: false,
};
initIcon();
addStyle(`#wh-trans-icon{
display: inline-block;
position: fixed;
top: calc(50% - 123px);
top: calc(50% - 133px);
left: 0;
z-index: 20000;
border: solid 1px #b5b5b5;
@ -3624,7 +3634,7 @@ padding:16px !important;
btn.onclick = () => {
if (wh_trans_settings.quickFinishAtt !== 3) {
addStyle(`.wh-move-btn #defender button{display:none;}`);
addStyle(`.wh-move-btn #defender button:nth-of-type(${wh_trans_settings.quickFinishAtt+1}){display:inline-block !important;}`);
addStyle(`.wh-move-btn #defender button:nth-of-type(${wh_trans_settings.quickFinishAtt + 1}){display:inline-block !important;}`);
}
};
break;
@ -3698,7 +3708,7 @@ padding:16px !important;
document.body.classList.toggle('wh-move-btn');
btn.onclick = () => {
addStyle(`.wh-move-btn #attacker button{display:none;}`);
addStyle(`.wh-move-btn #attacker button:nth-of-type(${wh_trans_settings.quickFinishAtt+1}){display:inline-block !important;}`);
addStyle(`.wh-move-btn #attacker button:nth-of-type(${wh_trans_settings.quickFinishAtt + 1}){display:inline-block !important;}`);
};
break;
}
@ -3723,6 +3733,29 @@ padding:16px !important;
}
}
}
if (wh_trans_settings.attReload) {
switch (device) {
case 'pc': {
elementReady('#defender div[class^="modal___"]').then(elem => {
if (!elem.innerHTML.includes('<button')) {
window.location.reload();
}
});
break;
}
case 'mobile': {
elementReady('#attacker div[class^="modal___"]').then(elem => {
if (!elem.innerHTML.includes('<button')) {
window.location.reload();
}
});
break;
}
case 'tablet': {
break;
}
}
}
return;
}