diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index ed090e5..9641719 100644 --- a/torn-trans-zhcn.user.js +++ b/torn-trans-zhcn.user.js @@ -1,8 +1,8 @@ // ==UserScript== -// @lastmodified 202204050419 +// @lastmodified 202205271439 // @name 芜湖助手 // @namespace WOOH -// @version 0.3.31 +// @version 0.3.32 // @description 托恩,起飞! // @author Woohoo[2687093] Sabrina_Devil[2696209] // @match https://www.torn.com/* @@ -23,13 +23,19 @@ if (window.WHTRANS) return; window.WHTRANS = true; // 版本 - const version = '0.3.31'; + const version = '0.3.32'; // 修改历史 const changelist = [ { todo: true, cont: `翻译:baza npc商店、imarket、imarket搜索结果`, }, + { + ver: '0.3.32', + date: '20220527', + cont: `添加:修改了点击4条的行为:分别对应锻炼、犯罪、物品(加成物品)、物品(医疗) +修复:光速跑路无法关闭的错误现已修复`, + }, { ver: '0.3.31', date: '20220405', @@ -3128,7 +3134,6 @@ return keywords.test(this); } }; - console.log('href') // 原始fetch const ori_fetch = window.fetch; @@ -4496,6 +4501,18 @@ cursor:pointer; // 开启翻译 transToZhCN(href, getWhSettingObj()['transEnable']); + // 4条转跳 + { + const eb = document.getElementById('barEnergy'); + const nb = document.getElementById('barNerve'); + const hb = document.getElementById('barHappy'); + const lb = document.getElementById('barLife'); + (eb) && (eb.addEventListener('click', () => location.href = '/gym.php')); + (nb) && (nb.addEventListener('click', () => location.href = '/crimes.php')); + (hb) && (hb.addEventListener('click', () => location.href = '/item.php#boosters-items')); + (lb) && (lb.addEventListener('click', () => location.href = '/item.php#medical-items')); + } + // 飞行闹钟 if (href.includes('index.php') && !!document.querySelector('div.travelling h4') && device === Device.PC && getWhSettingObj()['trvAlarm']) { @@ -4812,6 +4829,7 @@ display:none; if (href.contains(/loader\.php\?sid=attack/)) { let stop_reload = false; const {quickAttIndex, quickFinishAtt, attReload} = getWhSettingObj(); + let cssRules = null; // 光速拔刀 if (quickAttIndex !== 6) { // const selectedId = ['weapon_main', 'weapon_second', 'weapon_melee', 'weapon_temp', 'weapon_fists', 'weapon_boots'] @@ -4831,7 +4849,7 @@ display:none; modal.style.display = 'none'; // 根据选择的武器调整css let css_top = '0'; - switch (getWhSettingObj().quickAttIndex) { + switch (getWhSettingObj()['quickAttIndex']) { case 1: { // weapon_second css_top = '97px'; break; @@ -4861,7 +4879,7 @@ display:none; document.body.classList.toggle('wh-move-btn'); // 绑定点击事件 btn.onclick = () => { - if (getWhSettingObj().quickFinishAtt !== 3) { + if (quickFinishAtt !== 3) { btn.remove(); // 停止自动刷新 stop_reload = true; @@ -4971,25 +4989,25 @@ display:none; } } }); - const CUR_DISABLED = true; - if (!CUR_DISABLED) { - const original_fetch = window.fetch; - window.fetch = async (url, init) => { - let response = await original_fetch(url, init) - let res = response.clone(); - res.json().then((data) => { - if (isDev()) { - log('[url]', url) - log('[返回数据]', data) - } - }); - return response; - } - } + // const CUR_DISABLED = true; + // if (!CUR_DISABLED) { + // const original_fetch = window.fetch; + // window.fetch = async (url, init) => { + // let response = await original_fetch(url, init) + // let res = response.clone(); + // res.json().then((data) => { + // if (isDev()) { + // log('[url]', url) + // log('[返回数据]', data) + // } + // }); + // return response; + // } + // } } // 光速跑路 if (quickFinishAtt !== 3) { - const user_btn_select = ['leave', 'mug', 'hosp'][getWhSettingObj().quickFinishAtt]; + const user_btn_select = ['leave', 'mug', 'hosp'][getWhSettingObj()['quickFinishAtt']]; const wrap = document.querySelector('#react-root'); log('光速跑路选项选中:', user_btn_select); new MutationObserver(() => { @@ -4999,7 +5017,7 @@ display:none; log('按钮内容:', btn.innerText, ',是否包含选中:', flag); if (!flag) btn.style.display = 'none'; // 自动结束 - else if (getWhSettingObj().autoStartFinish === true) { + else if (getWhSettingObj()['autoStartFinish'] === true) { try { btn.click(); } catch { @@ -5007,6 +5025,8 @@ display:none; } }); }).observe(wrap, {subtree: true, attributes: true, childList: true}); + } else { + document.body.classList.remove('wh-move-btn'); } // 自刷新 let audio_played_flag;