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

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