From e2e746e6ea60adcf94c445177864a5d5ebe4f531 Mon Sep 17 00:00:00 2001 From: woohoo Date: Sat, 2 Jul 2022 21:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E3=80=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=94=A8=E6=88=B7=E8=84=9A=E6=9C=AC=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- userscript_template.user.js | 22 +++ wuhu-torn-helper.js | 261 ++++++++++++++++++------------------ 2 files changed, 154 insertions(+), 129 deletions(-) diff --git a/userscript_template.user.js b/userscript_template.user.js index e69de29..00ddaa9 100644 --- a/userscript_template.user.js +++ b/userscript_template.user.js @@ -0,0 +1,22 @@ +// ==UserScript== +// @name Debug Userscript +// @namespace https://github.com/einverne/userscripts +// @version 0.1 +// @description This is a debug script to load userscripts from local file system. NOTICE, you need to turn on Allow access to file URLs to @require local file https://www.tampermonkey.net/documentation.php +// @author Ein Verne +// @match http*://* +// @include http://* +// @include https://* +// @include * +// @grant GM_xmlhttpRequest +// @grant GM_addStyle +// @grant GM_getResourceText +// @require {{file path}} +// ==/UserScript== + +(function () { + 'use strict'; + + console.log("debug script start here"); + // Your code here... +})(); \ No newline at end of file diff --git a/wuhu-torn-helper.js b/wuhu-torn-helper.js index d67b660..d1f1dde 100644 --- a/wuhu-torn-helper.js +++ b/wuhu-torn-helper.js @@ -2751,7 +2751,7 @@ } let clone = res.clone(); let text = await res.text(); - log({url, init, text}); + log({ url, init, text }); return clone; }; @@ -2832,56 +2832,56 @@ // 对新值应用「默认」设置 [ // 开启翻译 - {key: 'transEnable', val: false}, + { key: 'transEnable', val: false }, // 快速犯罪 - {key: 'quickCrime', val: true}, + { key: 'quickCrime', val: true }, // 任务助手 - {key: 'missionHint', val: true}, + { key: 'missionHint', val: true }, // 小镇攻略 - {key: 'xmasTownWT', val: true}, + { key: 'xmasTownWT', val: true }, // 小镇提醒 - {key: 'xmasTownNotify', val: true}, + { key: 'xmasTownNotify', val: true }, // 起飞爆e - {key: 'energyAlert', val: true}, + { key: 'energyAlert', val: true }, // 飞行闹钟 - {key: 'trvAlarm', val: true}, + { key: 'trvAlarm', val: true }, // 啤酒提醒 - {key: '_15Alarm', val: true}, + { key: '_15Alarm', val: true }, // 捡垃圾助手 - {key: 'cityFinder', val: false}, + { key: 'cityFinder', val: false }, // 叠E保护 - {key: 'SEProtect', val: false}, + { key: 'SEProtect', val: false }, // PT一键购买 - {key: 'ptQuickBuy', val: false}, + { key: 'ptQuickBuy', val: false }, // 光速拔刀 6-关闭 - {key: 'quickAttIndex', val: 2}, + { key: 'quickAttIndex', val: 2 }, // 光速跑路 0-leave 1-mug 2-hos 3-关闭 - {key: 'quickFinishAtt', val: 3}, + { key: 'quickFinishAtt', val: 3 }, // 自动开打和结束 - {key: 'autoStartFinish', val: false}, + { key: 'autoStartFinish', val: false }, // 废弃 - {key: 'attRelocate', val: true}, + { key: 'attRelocate', val: true }, // 攻击自刷新 0-无间隔 1-5s 6-关闭 - {key: 'attReload', val: 6}, + { key: 'attReload', val: 6 }, // 价格监视 - {key: 'priceWatcher', val: {xan: -1, pt: -1}}, + { key: 'priceWatcher', val: { xan: -1, pt: -1 } }, // 开发者模式 - {key: 'isDev', val: false}, + { key: 'isDev', val: false }, // 啤酒提醒时间 - {key: '_15AlarmTime', val: 50}, + { key: '_15AlarmTime', val: 50 }, // 4条转跳 - {key: 'barsRedirect', val: true}, + { key: 'barsRedirect', val: true }, // 浮动存钱框 - {key: 'floatDepo', val: true}, + { key: 'floatDepo', val: true }, // 公司转跳存钱 - {key: 'companyRedirect', val: true}, + { key: 'companyRedirect', val: true }, // 收起公司冰蛙效率表 - {key: 'companyBWCollapse', val: true}, + { key: 'companyBWCollapse', val: true }, // 清除多余的脚本 - {key: 'removeScripts', val: true}, + { key: 'removeScripts', val: true }, // 危险行为⚠️ - {key: 'dangerZone', val: false}, + { key: 'dangerZone', val: false }, ].forEach(df => { if (typeof getWhSettingObj()[df.key] !== typeof df.val) setWhSetting(df.key, df.val); }); @@ -3230,22 +3230,22 @@ let fest_date_html = ': '; { const fest_date_dict = { - '0105': {name: '周末自驾游', eff: '获得双倍的赛车点数与赛车技能等级增益'}, - '0114': {name: '情人节', eff: '使用爱情果汁(Love Juice)后获得降低攻击与复活的能量消耗的增益'}, - '0204': {name: '员工激励日', eff: '获得三倍的工作点数与火车增益'}, - '0217': {name: '圣帕特里克日', eff: '获得双倍的酒类效果增益,城市中可以捡到绿色世涛(Green Stout)'}, - '0320': {name: '420日', eff: '获得三倍的大麻(Cannabis)效果增益'}, - '0418': {name: '博物馆日', eff: '获得10%提高的博物馆PT兑换增益'}, - '0514': {name: '世界献血日', eff: '获得减半的抽血CD和扣血增益'}, - '0611': {name: '世界人口日', eff: '获得双倍的通过攻击获取的经验的增益'}, - '0629': {name: '世界老虎日', eff: '获得5倍的狩猎技能增益'}, - '0705': {name: '国际啤酒节', eff: '获得5倍的啤酒物品效果增益'}, - '0827': {name: '旅游节', eff: '获得双倍的起飞后物品携带容量增益'}, - '0915': {name: '饮料节', eff: '获得双倍的能量饮料效果增益'}, - '1014': {name: '世界糖尿病日', eff: '获得三倍的糖类效果增益'}, - '1015': {name: '周年庆', eff: '左上角的TORN图标可以食用'}, - '1025': {name: '黑色星期五', eff: '某些商家将提供1元购活动'}, - '1114': {name: '住院日', eff: '获得降低75%的住院时间增益'}, + '0105': { name: '周末自驾游', eff: '获得双倍的赛车点数与赛车技能等级增益' }, + '0114': { name: '情人节', eff: '使用爱情果汁(Love Juice)后获得降低攻击与复活的能量消耗的增益' }, + '0204': { name: '员工激励日', eff: '获得三倍的工作点数与火车增益' }, + '0217': { name: '圣帕特里克日', eff: '获得双倍的酒类效果增益,城市中可以捡到绿色世涛(Green Stout)' }, + '0320': { name: '420日', eff: '获得三倍的大麻(Cannabis)效果增益' }, + '0418': { name: '博物馆日', eff: '获得10%提高的博物馆PT兑换增益' }, + '0514': { name: '世界献血日', eff: '获得减半的抽血CD和扣血增益' }, + '0611': { name: '世界人口日', eff: '获得双倍的通过攻击获取的经验的增益' }, + '0629': { name: '世界老虎日', eff: '获得5倍的狩猎技能增益' }, + '0705': { name: '国际啤酒节', eff: '获得5倍的啤酒物品效果增益' }, + '0827': { name: '旅游节', eff: '获得双倍的起飞后物品携带容量增益' }, + '0915': { name: '饮料节', eff: '获得双倍的能量饮料效果增益' }, + '1014': { name: '世界糖尿病日', eff: '获得三倍的糖类效果增益' }, + '1015': { name: '周年庆', eff: '左上角的TORN图标可以食用' }, + '1025': { name: '黑色星期五', eff: '某些商家将提供1元购活动' }, + '1114': { name: '住院日', eff: '获得降低75%的住院时间增益' }, }; menu_list.fest_date_dict = fest_date_dict; menu_list.fest_date_list = Object.keys(fest_date_dict); @@ -3795,9 +3795,9 @@ background-size: 100% auto !important; new MutationObserver((m, o) => { o.disconnect(); if (!elem.querySelector('.wh-translate')) elem.prepend(mobile_prepend_node); - o.observe(elem, {childList: true, subtree: true}); + o.observe(elem, { childList: true, subtree: true }); }) - .observe(elem, {childList: true, subtree: true}); + .observe(elem, { childList: true, subtree: true }); }); // 隐藏返回顶部按钮 elementReady('#go-to-top-btn button', ifDocu).then(e => e.style.display = 'none'); @@ -3902,7 +3902,7 @@ background-size: 100% auto !important; URL${window.location.href} 页面尺寸${window.innerWidth}x${window.innerHeight} 设备类型${getDeviceType().toUpperCase()} - 脚本运行方式${{'gm': '油猴', 'raw': '直接运行', 'pda': 'TornPDA'}[getScriptEngine()]} + 脚本运行方式${{ 'gm': '油猴', 'raw': '直接运行', 'pda': 'TornPDA' }[getScriptEngine()]} 时间${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()} 插件版本${version} 操作系统${os} @@ -3928,7 +3928,7 @@ color:black; domId: '', domText: '📐️ 测试', clickFunc: function () { - WHNotify('芜湖助手', {sysNotify: true, timeout: 3}) + WHNotify('芜湖助手', { sysNotify: true, timeout: 3 }) }, }); } @@ -4149,7 +4149,7 @@ cursor:pointer; // 存钱CSS 不终止 let depo_channel; - const depo_selector = {CMPY: "div#funds div.deposit", FAC: "div#armoury-donate div.cash"}; + const depo_selector = { CMPY: "div#funds div.deposit", FAC: "div#armoury-donate div.cash" }; // 公司 if (href.includes('companies.php')) { depo_channel = "CMPY"; @@ -4218,7 +4218,7 @@ z-index: 999999;}`); const wh_trv_alarm = localStorage.getItem('wh_trv_alarm') ? JSON.parse(localStorage.getItem('wh_trv_alarm')) - : {'enable': true, 'alert_time': 30, 'node_pos': [240, 240]}; + : { 'enable': true, 'alert_time': 30, 'node_pos': [240, 240] }; const save_trv_settings = () => localStorage.setItem('wh_trv_alarm', JSON.stringify(wh_trv_alarm)); const wh_trv_alarm_node = document.createElement('div'); @@ -4487,7 +4487,7 @@ display:none; // 攻击页面 if (href.contains(/loader\.php\?sid=attack/)) { let stop_reload = false; - const {quickAttIndex, quickFinishAtt, attReload} = getWhSettingObj(); + const { quickAttIndex, quickFinishAtt, attReload } = getWhSettingObj(); // 光速刷新按钮 addActionBtn('光速刷新', doAttackReload, $zhongNode); @@ -4726,7 +4726,7 @@ display:none; } } }); - }).observe(wrap, {subtree: true, attributes: true, childList: true}); + }).observe(wrap, { subtree: true, attributes: true, childList: true }); } return; } @@ -4818,7 +4818,7 @@ display:inline-block; const finder_item = document.createElement('span'); finder_item.id = 'wh-city-finder-item' + item_id; finder_item.innerHTML = item_id; - founds.push({'id': item_id, 'node': finder_item, 'map_item': node}); + founds.push({ 'id': item_id, 'node': finder_item, 'map_item': node }); container.append(finder_item); }); // 未发现物品 返回 @@ -4897,7 +4897,7 @@ display:inline-block; 'LI' === e.tagName && rmv_cfm(e) } } - }).observe(points_sales, {childList: true}); + }).observe(points_sales, { childList: true }); } // 叠e助手 @@ -5148,7 +5148,7 @@ $1,000 // 圣诞小镇 if (href.contains(/christmas_town\.php/)) { let $root = document.querySelector('#christmastownroot'); - const {xmasTownWT, xmasTownNotify} = getWhSettingObj() + const { xmasTownWT, xmasTownNotify } = getWhSettingObj() // 解密攻略 if (xmasTownWT) { const insert_html = `
@@ -5185,7 +5185,7 @@ margin: 0 0 3px; } `; const wt_dict = { - "None": {title: '', wt: ``,}, + "None": { title: '', wt: ``, }, "Christmas Town": { title: '圣诞小镇', wt: `