diff --git a/CHANGELOG.md b/CHANGELOG.md
index a48897e..59ca734 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,14 @@
# CHANGE
+## 0.7.0
+
+2022年11月10日
+
+### 添加
+
+- 官方引入Google登陆方式及相关脚本后引起的无限加载中的问题的不完美解决办法
+
## 0.6.9
2022年11月8日
diff --git a/package.json b/package.json
index 64d951e..e34c969 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "wuhu-torn-helper",
- "version": "0.6.9",
+ "version": "0.7.0",
"description": "芜湖助手",
"dependencies": {},
"scripts": {
diff --git a/release.min.user.js b/release.min.user.js
index 53eef1b..c5dd51e 100644
--- a/release.min.user.js
+++ b/release.min.user.js
@@ -1,8 +1,8 @@
// ==UserScript==
-// @lastmodified 202211081539
+// @lastmodified 202211101804
// @name 芜湖助手
// @namespace WOOH
-// @version 0.6.9
+// @version 0.7.0
// @description 托恩,起飞!
// @author Woohoo[2687093] Sabrina_Devil[2696209]
// @match https://www.torn.com/*
@@ -16,14 +16,14 @@
// @connect staticfile.org
// @connect gitee.com
// ==/UserScript==
-!function(){"use strict";class re{static info(...e){re.counter.info++;var t=this.getTime(),n="[WH] IFO";this.debug()&&console.log(n,t,...e),this.saveLogs(n,t,...e)}static error(...e){re.counter.error++;var t=this.getTime(),n="[WH] ERR";console.error(n,t,...e),this.saveLogs(n,t,...e)}static warn(...e){re.counter.warning++;var t=this.getTime(),n="[WH] WRN";this.debug()&&console.warn(n,t,...e),this.saveLogs(n,t,...e)}static debug(){let e=!0;try{var t=JSON.parse(localStorage.getItem("wh_trans_settings"));t&&(e=t.isDev)}catch(e){}return e}static getTime(){let e=new Date;return`[${e.getFullYear()}-${("0"+(e.getMonth()+1)).slice(-2)}-${("0"+e.getDate()).slice(-2)} ${("0"+e.getHours()).slice(-2)}:${("0"+e.getMinutes()).slice(-2)}:${("0"+e.getSeconds()).slice(-2)}.${("00"+e.getMilliseconds()).slice(-3)}]`}static getLogs(){return this.logs}static saveLogs(...e){e.forEach(n=>{if("string"==typeof n)this.logs+=n;else if(null!=n){let e="{}",t=n.toString?n.toString():"UNKNOWN_OBJECT";try{e=JSON.stringify(n),t=Object.getPrototypeOf(n).constructor.name}catch(e){}this.logs+=` [${t}] [${e}] `}}),this.logs+="\r\n"}static getCounter(){return{info:re.counter.info,error:re.counter.error,warning:re.counter.warning}}}function y(e,r,s,l){return new(s=s||Promise)(function(n,t){function i(e){try{a(l.next(e))}catch(e){t(e)}}function o(e){try{a(l.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(i,o)}a((l=l.apply(e,r||[])).next())})}re.logs="",re.counter={info:0,error:0,warning:0};class n{constructor(){this.className="Provider"}static getInstance(){var e,t;return this.instance||(e=performance.now(),this.instance=new this,t=this.instance.getClassName()||this.name,re.info("实例已创建,",t,this.instance,"耗时"+(performance.now()-e|0)+"ms"),n.pool[t]=this.instance),this.instance}static getPool(){return{pool:n.pool}}}n.pool={};class s extends n{constructor(){super(...arguments),this.className="WuhuBase"}static getLocal(){let e;var t=localStorage.getItem("wh_trans_settings")||"{}";try{e=JSON.parse(t)}catch(e){re.error("解析localStorage对象出错",e),localStorage.setItem("wh_trans_settings","{}")}return e||{}}static conditionInterrupt(){let e=document.querySelector("#skip-to-content")||document.querySelector('[href*="#skip-to-content"]')||{innerText:""};if(document.title.toLowerCase().includes("just a moment")||e.innerText.toLowerCase().includes("please validate")||null!==document.querySelector("div.container div.cf .iAmUnderAttack"))throw"芜湖"}getClassName(){return this.className}}s.glob=null;class u extends s{constructor(e,t="芜湖助手"){super(),this.className="Popup",this.container=null,this.node=null,u.glob.popup_node&&(re.info("关闭前一个弹窗"),u.glob.popup_node.close()),re.info("新建弹窗",{innerHTML:e,title:t});const n=document.createElement("div");n.id="wh-popup",n.innerHTML='\n
'.replace("{{}}",t).replace("{{}}",e),document.body.append(n),n.addEventListener("click",e=>{e.stopImmediatePropagation(),e.target===n&&this.close()}),this.container=n,this.node=n.querySelector("#wh-popup-cont"),this.hideChat(),u.glob.popup_node=this}close(){this.container.remove(),this.showChat()}getElement(){return this.node}hideChat(){document.querySelector("#chatRoot").classList.add("wh-hide")}showChat(){document.querySelector("#chatRoot").classList.remove("wh-hide")}getInstance(){}}function d(){let e=new u("","传单助手").getElement(),t=(document.querySelector("#chatRoot").classList.remove("wh-hide"),document.createElement("p")),n=document.createElement("textarea"),i=document.createElement("button"),o=document.createElement("button"),a=document.createElement("button"),r=document.createElement("style");t.innerHTML="打开多个聊天框后,点击{if(e!==r.value&&!l.obj[e]){l.obj[e]=!0;{let t="进攻者:
";Object.keys(l.obj).forEach(e=>t+=`[${e}]
`),l.innerHTML=t}}}),(e.currentFightHistory||[]).forEach(e=>{var t,n,i,o,a,r;c.list.includes(e.ID)||({ID:e,TimeCreated:t,attackID:n,attackerID:i,attackerItemID:o,result:a,text:r}=e,c.list.push(e),c.details[e]={TimeCreated:t,attackID:n,attackerID:i,attackerItemID:o,result:a,text:r},s())}),n&&n[r.value]&&n[r.value].forEach(e=>{var t,n,i,o;c.list.includes(e.ID)||({ID:e,TimeCreated:t,attackID:n,attackResult:i,userID:o}=e,c.list.push(e),c.details[e]={TimeCreated:t,attackID:n,attackerID:o,attackerItemID:0,result:i,text:""},s())})}}),900)}}),i.addEventListener("click",()=>{null!==d&&(n.disabled=!1,i.disabled=!0,r.readOnly=!1,window.clearInterval(d),d=null,t.innerHTML="状态:已关 ❎")}),o.addEventListener("click",()=>r.value=w.getInstance().getPlayerInfo().userID+"")}var v=[{start:[0,17,8],end:[0,24,8],name:"捡垃圾周",eff:"获得捡垃圾概率提升的增益"},{start:[3,5,20],end:[3,25,20],name:"复活节狩猎",eff:"复活节彩蛋会随机出现,集齐10个可兑换金蛋和一个独特的头像框(章)。"},{start:[5,20,20],end:[5,29,20],name:"狗牌",eff:"击败其他玩家以获得狗牌,小心保护你的狗牌。"},{start:[6,5,20],end:[6,25,20],name:"托恩先生和托恩女士",eff:"上传你的真实图片,然后拿章"},{start:[8,5,20],end:[8,23,20],name:"大逃杀",eff:"加入特定队伍后,攻击其他队伍玩家,存活下来的3个队伍可以拿章"},{start:[9,25,20],end:[10,1,20],name:"不给糖就捣蛋",eff:"买篮子之后攻击其他玩家后会随机掉落糖果,可用于兑换许多高价值物品"},{start:[11,14,20],end:[11,31,20],name:"圣诞小镇",eff:"在小镇中闲逛来获取随机掉落的物品"}],x={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:"获得双倍的能量饮料效果增益"}},T=[{name:"mex",show:"墨西哥",stocks:{Dahlia:"花","Jaguar Plushie":"偶"}},{name:"cay",show:"开曼",stocks:{"Banana Orchid":"花","Stingray Plushie":"偶"}},{name:"can",show:"加拿大",stocks:{Crocus:"花","Wolverine Plushie":"偶"}},{name:"haw",show:"夏威夷",stocks:{Orchid:"花","Large Suitcase":"大箱"}},{name:"uni",show:"嘤国",stocks:{Heather:"花","Red Fox Plushie":"赤狐","Nessie Plushie":"水怪"}},{name:"arg",show:"阿根廷",stocks:{"Ceibo Flower":"花","Monkey Plushie":"偶","Tear Gas":"催泪弹"}},{name:"swi",show:"瑞士",stocks:{Edelweiss:"花","Chamois Plushie":"偶"}},{name:"jap",show:"日本",stocks:{"Cherry Blossom":"花"}},{name:"chi",show:"祖国",stocks:{Peony:"花","Panda Plushie":"偶"}},{name:"uae",show:"迪拜",stocks:{"Tribulus Omanense":"花","Camel Plushie":"偶"}},{name:"sou",show:"南非",stocks:{"African Violet":"花","Lion Plushie":"偶",Xanax:"XAN"}}];class M extends s{constructor(){super(),this.className="TravelItem",this.apiUrl="https://yata.yt/api/v1/travel/export/",this.foreignStockInfo=null,window.setInterval(()=>y(this,void 0,void 0,function*(){m.getInstance().get()&&(re.info("fetching ",this.apiUrl),this.foreignStockInfo=JSON.parse(yield E.COFetch(this.apiUrl)),re.info({"fetch returned":this.foreignStockInfo}))}),3e4)}clickHandler(){return y(this,void 0,void 0,function*(){if(E.getScriptEngine()===c.RAW)new u('

'.replace("{{}}",performance.now().toString()),"飞花库存");else{const e=new u("请稍后 "+E.loading_gif_html(),"飞花库存");let i='
| 目的地 - 更新时间 | 库存 |
';const t=T,o=new Date,a=yield this.get();re.info({res:a}),a&&a.stocks&&(t.forEach(t=>{var e=(o.getTime()-new Date(1e3*a.stocks[t.name].update).getTime())/1e3|0;i+=`| ${t.show} | ${e/60|0}分${e%60|0}秒前 | `;let n=0;for(a.stocks[t.name].stocks.forEach(e=>{t.stocks[e.name]&&(i+=`${t.stocks[e.name]} (${e.quantity}) | `,n++)});n<3;)n++,i+=" | ";i+="
"}),i+="
",e.getElement().innerHTML=i)}})}get(){return y(this,void 0,void 0,function*(){return this.foreignStockInfo||(this.foreignStockInfo=JSON.parse(yield E.COFetch(this.apiUrl)))})}}class V extends s{constructor(){super(...arguments),this.className="Test"}test(){let e=new u(E.getInstance().getTravelStage().toString());e.getElement().__POOL__=V.getPool(),this.case3().then()}case1(){const e=document.createElement("DIV"),t=document.createElement("DIV");e.append(...document.body.childNodes),t.append(...document.head.childNodes),t.querySelectorAll('script[src*="google"]').forEach(e=>e.remove()),t.querySelectorAll("#gtm_tag").forEach(e=>e.remove()),t.querySelectorAll('script[src*="chat/gonline"]').forEach(e=>e.remove()),t.querySelectorAll("script[nonce]").forEach(e=>e.remove()),window.stop(),re.info(document.body.outerHTML),document.body.innerHTML="",document.head.innerHTML="",document.body.append(...e.childNodes),document.body.insertAdjacentHTML("afterbegin",t.innerHTML)}case2(){document.head.insertAdjacentHTML("afterbegin",`
`)}case3(){return y(this,void 0,void 0,function*(){})}}class A extends s{constructor(){super(),this.className="BuyBeerHelper",this.isNotifying=!1,this.loopId=null,this.notifyHtml='
啤酒小助手\n
提醒您:还有不到 50 秒 NPC 的商品就要刷新了,啤酒血包要抢的可以准备咯。\n
\n
【啤酒店】\n
【血包店】'.replace("{{}}",p.getInstance().getRandomInt(0,99).toString()),this.time=I.get("_15AlarmTime")||30}start(){this.loopId?re.info("啤酒助手已在运行"):this.loopId=window.setInterval(()=>y(this,void 0,void 0,function*(){var{isTravelling:t,isAbroad:n}=yield w.getInstance().getUserState();if(t||n)this.stop();else{let e=new Date;t=[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()],n=I.get("_15_alarm_ignore")||"{}";if(JSON.stringify(t)!==JSON.stringify(n)){t=14-e.getMinutes()%15,n=60-e.getSeconds();if(0==t&&n
this.skip_today()),i.getElement().addEventListener("click",e=>{"a"===e.target.tagName.toLowerCase()&&i.close()});t=E.getInstance().audioPlay;window.setTimeout(t,800),window.setTimeout(t,1600),window.setTimeout(t,2400)}}else this.isNotifying=!1}}}),1e3)}stop(){this.loopId&&(window.clearInterval(this.loopId),this.loopId=null)}set_time(e){this.time=e}status(){return this.loopId?"已启动":"未启动"}is_running(){return null!==this.loopId}skip_today(){const e=new Date,t=(I.set("_15_alarm_ignore",[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()],!1),new C(`明早8点前将不再提醒 `));t.getElement().querySelector(".wh-notify-msg button").addEventListener("click",()=>I.set("_15_alarm_ignore",void 0,!0))}setTimeHandler(){let n=new u(`区间为 1 ~ 60,默认 50
`,"啤酒提醒时间设定"),e=document.createElement("button");e.innerHTML="确定",e.style.float="right",e.addEventListener("click",()=>{let e=n.getElement().querySelector("input"),t=0|e.value;t!==I.get("_15AlarmTime")&&((t<1||60{if(0!==this.notifies.count)for(let e=0;e\n主要用途:出院秒飞
\n点起飞,页面加载完成后会马上飞走
\n
\n\n
\n
\n
查看花偶库存
\n
注:需要验证时无法起飞
\n
\n
\n
',n.querySelectorAll("select")),o=(n.querySelector("button").addEventListener("click",()=>{sessionStorage["wh-quick-fly"]=`${t.selectedIndex} ${i.selectedIndex} `+(new Date).getTime(),window.location.href.contains("travelagency.php")?N.doQuickFly():(new C("正在转跳"),location.href="https://www.torn.com/travelagency.php")}),n.querySelector("a").addEventListener("click",e=>{e.preventDefault(),M.getInstance().clickHandler()}),n.querySelector("input").addEventListener("click",e=>{n.classList.toggle("wh-quick-fly-opt-hide");const t=e.target;t.value=" - "===t.value?" + ":" - "}),n.querySelector("info")),a=document.createElement("p"),r=document.createElement("p"),s=(o.append(a),o.append(r),[["~54分","~36分","~26分","~16分"],["~1时10分","~50分","~36分","~22分"],["~1时22分","~58分","~40分","~24分"],["~4时28分","~3时8分","~2时14分","~1时20分"],["~5时18分","~3时42分","~2时40分","~1时36分"],["~5时34分","~3时54分","~2时46分","~1时40分"],["~5时50分","~4时6分","~2时56分","~1时46分"],["~7时30分","~5时16分","~3时46分","~2时16分"],["~8时4分","~5时38分","~4时2分","~2时24分"],["~9时2分","~6时20分","~4时30分","~2时42分"],["~9时54分","~6时56分","~4时58分","~2时58分"]]);var e=function(){a.innerHTML="往返时间:"+s[t.selectedIndex][i.selectedIndex]};t.addEventListener("change",e),i.addEventListener("change",e),document.body.append(n),e(),r.innerHTML="药CD剩余:"+E.getYaoCD()}}}class D extends s{constructor(){super(...arguments),this.className="NNB"}handle(){let{isPDA:t,PDA_APIKey:n}=l.getInstance();var e='\n\nNNB(Natural Nerve Bar)意思是:扣除所有加成后,玩家本身的犯罪条上限,可用于衡量大佬隐藏的犯罪技能等级\n
\n一般来说,左侧红色的犯罪条(Nerve Bar/NB)的上限都是包含加成的,如来自帮派、天赋的加成等。额外的加成不会影响玩家的犯罪技能\n
\n查看NNB的方法很简单,在Torn主页面的最下方有一栏Perks,NB-Perks=NNB
\n\n'.replace("{{}}",localStorage.getItem("APIKey")||"不可用").replace("{{}}",t?n:"不可用");const i=new u(e,"查看NNB").getElement(),o=i.querySelector("input"),a=i.querySelector("p");i.querySelector("button").addEventListener("click",e=>{let i=e.target;if(i.style.display="none",a.innerHTML="加载中",o.checked){e=t?n:window.localStorage.getItem("APIKey");window.fetch("https://api.torn.com/user/?selections=bars,perks&key="+e).then(e=>e.json()).then(e=>{if(e.error)return a.innerHTML="出错了 "+JSON.stringify(e.error),void(i.style.display=null);var t=e.nerve.maximum;let n=0;Object.values(e).forEach(e=>{e instanceof Array&&e.forEach(e=>{(e=e.toLowerCase()).includes("maximum nerve")&&(n+=0|new RegExp("[0-9].").exec(e)[0])})}),a.innerHTML="NNB: "+(t-n),i.style.display=null})}else{if(window.location.href.includes("index.php")&&document.title.includes("Home")){e=0|document.querySelector('#barNerve p[class^="bar-value___"]').innerText.split("/")[1];let n=0;return document.querySelectorAll("#personal-perks li").forEach(e=>{const t=e.innerText.toLowerCase();t.includes("maximum nerve")&&(n+=0|/[0-9]./.exec(t)[0])}),a.innerHTML="NNB: "+(e-n),void(i.style.display=null)}a.innerHTML='不在主页面,点击前往',i.style.display=null}})}}class P extends s{constructor(){super(),this.className="QuickLinksHandler",this.styleAdded=!1,this.list=[];let e=this.list;e.push({name:"生存手册",url:"https://docs.qq.com/doc/DTVpmV2ZaRnB0RG56",new_tab:!0,img:"https://www.torn.com/images/items/293/medium.png"}),e.push({name:"抢啤酒",url:"https://www.torn.com/shops.php?step=bitsnbobs",new_tab:!0,img:"https://www.torn.com/images/items/180/medium.png"}),e.push({name:"买XAN",url:"https://www.torn.com/imarket.php#/p=shop&step=shop&type=&searchname=Xanax",new_tab:!0,img:"https://www.torn.com/images/items/206/medium.png"}),e.push({name:"起飞",url:"https://www.torn.com/travelagency.php",new_tab:!0,img:"https://www.torn.com/images/items/396/medium.png"}),e.push({name:"买PT",url:"https://www.torn.com/pmarket.php",new_tab:!0,img:"https://www.torn.com/images/items/722/medium.png"}),e.push({name:"租PI",url:"https://www.torn.com/properties.php?step=rentalmarket#/property=13",new_tab:!1,img:"https://www.torn.com/images/v2/properties/350x230/350x230_default_private_island.png"}),e.push({name:"找工作",url:"https://www.torn.com/joblist.php#!p=main",new_tab:!1,img:"https://www.torn.com/images/items/421/medium.png"}),e.push({name:"下悬赏",url:"https://www.torn.com/bounties.php#/p=add",new_tab:!1,img:"https://www.torn.com/images/items/431/medium.png"})}handle(){this.styleAdded||(E.addStyle(".wh-link-collection-cont a {\n display: inline-block;\n border: solid 1px #b3b3b3;\n border-radius: 4px;\n margin: 0 5px 2px 0;\n padding: 4px 8px;\n text-align: center;\n background: #efefef;\n background: linear-gradient(#f1f1f1, #e3e3e3);\n color: black !important;\n}\n\n.wh-link-collection-cont span {\n display: block;\n /*padding: 0 4px 8px;*/\n}\n\n.wh-link-collection-cont .wh-link-collection-img {\n display: block;\n width: 60px;\n height: 30px;\n background-size: 100% auto !important;\n}"),this.styleAdded=!0);const e=this.list;let t="",n=(e.forEach(e=>{t+=`${e.name}`}),t+="
",new u(t,"常用链接"));n.getElement().classList.add("wh-link-collection-cont"),n.getElement().addEventListener("click",e=>{let t=e.target;"a"!==t.tagName.toLowerCase()&&"span"!==t.tagName.toLowerCase()||n.close()})}}class _ extends s{constructor(){super(...arguments),this.className="ItemPriceWatcherHandler"}handle(){const n=I.get("priceWatcher"),i=JSON.stringify(n);var e='\n输入需要监视的价格,低于该价格发出通知,-1为关闭
\n注:需要APIKey,当前可用APIKey为
\n (来自冰蛙)
\n (来自PDA)\n
\nPT
\nXAN
\n\n \n
'.replace("{{}}",localStorage.getItem("APIKey")||"不可用").replace("{{}}",l.getInstance().isPDA?l.getInstance().PDA_APIKey:"不可用").replace("{{}}",n.pt||-1).replace("{{}}",n.xan||-1);const o=new u(e,"价格监视设置");o.getElement().querySelector("button").onclick=()=>{var[e,t]=Array.from(o.getElement().querySelectorAll('input[type="number"]'));n.pt=0|e.value,n.xan=0|t.value,JSON.stringify(n)!==i&&I.set("priceWatcher",n),o.close()}}}class a extends s{constructor(){super(...arguments),this.className="MDUtils"}parse(e,t){t=t||500;const i=document.createElement("div");let n=e.split("\n"),o=(n.length>t&&(n=n.slice(0,t)).push("..."),""),a;return n.forEach(t=>{if(""!==t.trim()){let e;var n=t.split(" ")[0];switch(n){case"#":case"##":case"###":return"li"===o&&(a=null),o="h"+(n.length+1),(e=document.createElement(o)).innerText=t.slice(n.length+1),void i.append(e);case"-":return"li"!==o&&(a=document.createElement("ul"),i.contains(a)||i.append(a)),o="li",(e=document.createElement(o)).innerText=t.slice(2),void a.append(e)}o="p",(e=document.createElement(o)).innerText=t.trim(),i.append(e)}}),i}}class H extends s{constructor(){super(...arguments),this.className="ChangeLogHandler"}handle(){let t=new u('更新历史:
https://gitlab.com/JJins/wuhu-torn-helper/-/blob/dev/CHANGELOG.md
',"更新历史").getElement(),n=(t.classList.add("wh-changeLog"),document.createElement("div")),i=(n.style.height="2px",n.style.width="1%",n.style.backgroundColor="red",document.createElement("p")),e=(i.innerText="加载更新文件……",i.style.textAlign="center",document.createElement("style"));e.innerHTML=".wh-changeLog h2,.wh-changeLog h3,.wh-changeLog h4 {margin:8px 0;}.wh-changeLog li{list-style: inside;}",t.append(n,i,e),E.COFetch("https://gitlab.com/JJins/wuhu-torn-helper/-/raw/dev/CHANGELOG.md?"+performance.now()).then(e=>{n.style.width="60%",i.innerText="解析中……";e=a.getInstance().parse(e);t.append(e),n.style.width="100%",i.innerText="加载完成",window.setTimeout(()=>{n.remove(),i.remove()},3e3)}).catch(e=>{re.error(e),n.remove(),i.innerText="无法加载"})}}class B extends s{constructor(){super(...arguments),this.className="UpdateTranslateDict"}handle(){new C("计划中")}}function R(){let e=document.createElement("p"),t=document.createElement("input"),n=document.createElement("button"),i=document.createElement("button"),o=document.createElement("button"),a=document.createElement("button");var r=document.createElement("br");e.innerHTML="飞机落地后转跳的页面,关闭功能请置空:",t.placeholder="URL",t.value=I.get("landedRedirect")||"",t.style.display="block",t.style.textAlign="left",t.style.width="100%",t.style.padding="8px",t.style.margin="8px -8px",n.innerHTML="保存",i.innerHTML="填入公司金库",o.innerHTML="填入帮派金库金库",a.innerHTML="测试链接",n.addEventListener("click",()=>I.set("landedRedirect",t.value,!0)),i.addEventListener("click",()=>t.value="https://www.torn.com/companies.php#/option=funds"),o.addEventListener("click",()=>t.value="https://www.torn.com/factions.php?step=your#/tab=armoury"),a.addEventListener("click",()=>window.open(t.value));let s=new u("","落地转跳").getElement();s.append(e,t,n,r,i,o,a)}class q extends s{constructor(){super(...arguments),this.className="ViewLogsHandler"}handle(){let e=re.getCounter(),i=new u('\n{{}}信息 {{}}警告 {{}}错误\n \n
\n加载中
'.replace("{{}}",e.info.toString()).replace("{{}}",e.warning.toString()).replace("{{}}",e.error.toString()),"查看日志");window.setTimeout(()=>{let e=i.getElement().querySelector("div"),n=document.createElement("div"),t=re.getLogs().split("\r\n");t.forEach(e=>{let t=document.createElement("p");(t.innerText=e).slice(0,10).includes("ERR")?t.style.backgroundColor="#ff000080":e.slice(0,10).includes("WRN")&&(t.style.backgroundColor="#ffff0080"),n.append(t)}),i.getElement().querySelector("button").addEventListener("click",()=>window.setTimeout(()=>{E.getInstance().exportTextFile("wuhu_log_"+re.getTime().replace("[","").replace("]","").replace(" ","").replace(".","").replaceAll("-","").replaceAll(":","")+".log",[re.getLogs()])},0)),e.innerHTML="",e.append(n)},0)}}class F{constructor(e,t){re.info("创建DialogMsgBox",{msg:e,opt:t});let{title:n="提示",callback:i,cancel:o}=t;if(!i)throw re.error("无callback"),new Error("无callback");if(F.existed)throw re.error("无法创建DialogMsgBox:已存在"),new Error("无法创建DialogMsgBox:已存在");this.container=document.createElement("div"),this.container.id="wh-dialog",this.container.innerHTML='\n\n
{{}}
\n
\n
{{}}
\n
\n \n \n
\n
\n
'.replace("{{}}",n).replace("{{}}",e);let[a,r]=Array.from(this.container.querySelectorAll("button"));a.addEventListener("click",()=>{i(this.container),this.destroy()}),r.addEventListener("click",()=>{o&&o(),this.destroy()}),document.body.append(this.container),F.existed=!0}destroy(){this.container.remove(),F.existed=!1}}F.existed=!1;var O='\n
常用犯罪
\n
\n \x3c!--18-1--\x3e\n \n \x3c!--15-3--\x3e\n \n \x3c!--仓库--\x3e\n \n \x3c!--7-2--\x3e\n \n \x3c!--偷夹克--\x3e\n \n \x3c!--卖碟3-1--\x3e\n \n \x3c!--捡钱--\x3e\n \n
\n
\n
';class G extends s{constructor(){super(...arguments),this.className="IFrameCrimeHandler"}handle(){const t='';var e=`加载中请稍后${E.loading_gif_html()}
`;const n=new u(e,"小窗快速犯罪").getElement();let i=n.querySelector("p:first-of-type");const o=n.querySelector("#wh-quick-crime-if-container"),a=(o.innerHTML=t,document.createElement("div"));a.classList.add("wh-translate"),a.innerHTML=O;let r=n.querySelector("iframe");const s=()=>{const e=r.contentWindow.document;var t=r.contentWindow.WHTRANS,n=(i&&i.remove(),r.style.display="block",e.querySelector("h4#skip-to-content").innerText.toLowerCase().includes("validate"));void 0===t&&(E.elementReady("#header-root",e).then(e=>e.style.display="none"),E.elementReady("#sidebarroot",e).then(e=>e.style.display="none"),E.elementReady("#chatRoot",e).then(e=>e.style.display="none"),n||(e.body.style.overflow="hidden"),E.elementReady(".content-wrapper",e).then(n=>{n.prepend(a),n.style.margin="0px",n.style.position="absolute",n.style.top="-35px",new MutationObserver((e,t)=>{t.disconnect(),n.querySelector(".wh-translate")||n.prepend(a),t.observe(n,{childList:!0,subtree:!0})}).observe(n,{childList:!0,subtree:!0})}),E.elementReady("#go-to-top-btn button",e).then(e=>e.style.display="none"))};r.onload=s;let l=0,c=window.setInterval(()=>{if(!(i=n.querySelector("p:first-of-type")))return clearInterval(c),void(c=void 0);if(0<++l&&!i.querySelector("button")){const e=document.createElement("button");e.innerHTML="重新加载",e.onclick=()=>{e.remove(),l=0,o.innerHTML=null,o.innerHTML=t,(r=n.querySelector("iframe")).onload=s},i.append(e)}},1e3)}}function W(){try{return(JSON.parse(localStorage.getItem("wh_trans_settings"))||{}).isDev||!1}catch(e){return console.error("[wh] dev状态错误 "+e),!1}}const Ee={error:(...e)=>W()&&console.error("[WH]",...e),info:(...e)=>W()&&console.log("[WH]",...e),debug:W};function j(e){if(e===c.PDA){let o=document.querySelector("#wh-gs-loader-ifr");if(o)return void new C("飞贼小助手已经加载了");const n=document.createElement("div");n.id="wh-gs-loader",(o=document.createElement("iframe")).id="wh-gs-loader-ifr",o.src="https://www.torn.com/crimes.php",n.append(o),document.body.append(n);{var t=`
+${a.documentElement.tagName}, 耗时`+s.getTimeMs())},r),i.observe(a.documentElement,{childList:!0,subtree:!0})})}static querySelector(e,t=document,n=3e4){return E.elementReady(e,t,n)}static addStyle(e){let t=document.querySelector("style#wh-trans-gStyle");t?t.innerHTML+=e:((t=document.createElement("style")).id="wh-trans-gStyle",t.innerHTML=e,document.head.appendChild(t)),re.info("CSS规则已添加",t)}static loading_gif_html(){return"
"}audioPlay(e="https://www.torn.com/js/chat/sounds/Warble_1.mp3"){const t=new Audio(e);t.addEventListener("canplaythrough",()=>{t.play().catch(e=>re.error("播放音频出错",e.message,e.stack)).then()})}isNewDay(e,t=0){e="number"==typeof e?new Date(e):e;let n=new Date,i=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()));return i.setHours(i.getHours()+t),i>e}jQueryReady(){re.info("等待jQuery加载中..."),h.getInstance().fetchText("/js/script/lib/jquery-1.8.2.js?v=f9128651g").then(e=>window.eval(e));let t=window.setInterval(()=>{re.info("仍在等待jQuery加载中...")},1e3);return new Promise(e=>y(this,void 0,void 0,function*(){for(;;){if("function"==typeof window.$)break;yield this.sleep(100)}window.clearInterval(t),re.info("jQuery已加载"),e(null)}))}sleep(e){let t=Math.max(e,10);return new Promise(e=>setTimeout(()=>e(null),t))}elemGenerator(r,e){var{tip:s,domType:t}=r;let l=null;switch(t){case"checkbox":{l=document.createElement("div");let{domId:e,dictName:t,domText:n,changeEv:i}=r,o=new f(n),a=o.getInput();o.getBase().id=e,s&&o.getBase().setAttribute("title",s),a.checked=I.get(t),a.onchange=e=>{I.set(t,a.checked,!0),i&&i(e)},l.appendChild(o.getBase());break}case"button":{l=document.createElement("div");var{domId:c,domText:n,isTornBtn:i,clickFunc:o}=r;let e=document.createElement("button");s&&e.setAttribute("title",s),e.id=c,e.innerHTML=n,i&&e.classList.add("torn-btn"),e.addEventListener("click",o),l.appendChild(e);break}case"select":{l=document.createElement("div");let{domSelectOpt:e,dictName:o,domId:t,domText:n}=r,i=document.createElement("label");s&&i.setAttribute("title",s);c=document.createTextNode(n);let a=document.createElement("select");a.id=t,e.forEach((e,t)=>{var{domVal:e,domText:n}=e;let i=document.createElement("option");i.value=e,i.innerHTML=n,i.selected=t===I.get(o),i.innerHTML=n,a.appendChild(i)}),a.onchange=e=>I.set(o,e.target.selectedIndex),i.appendChild(c),i.appendChild(a),l.appendChild(i);break}case"plain":n=r.tagName||"div";l=document.createElement(n),r.domId&&(l.id=r.domId),l.innerHTML+=r.domHTML}return e.appendChild(l)}exportTextFile(e,t){const n=document.createElement("a");n.href=URL.createObjectURL(new Blob(t,{type:"text/plain",endings:"transparent"})),n.download=e,n.click(),n.remove(),URL.revokeObjectURL(n.href)}isValidUid(e){return/^[0-9]{1,7}$/.test("string"==typeof e?e:e.toString())}getTravelStage(){var e=E.glob;return"false"===e.bodyAttrs["data-abroad"]?S.IN_TORN:"false"===e.bodyAttrs["data-traveling"]?S.ABROAD:S.FLYING}matchOne(e,t){let n="string"==typeof t?new RegExp(t):t,i=null;t=e.match(n);return i=0y(this,void 0,void 0,function*(){let e=0;for(;!sessionStorage.getItem(n)&&e<50;)e++,yield E.getInstance().sleep(10);sessionStorage.getItem(n)?i=JSON.parse(sessionStorage.getItem(n)):(re.info("无法从sessionStorage获取数据"),i=yield(yield h.getInstance().ajaxFetch({url:window.addRFC("/sidebarAjaxAction.php?q=getSidebarData"),method:"POST"})).json(),sessionStorage.setItem(n,JSON.stringify(i))),i.headerData=JSON.parse(sessionStorage.getItem("headerData")),t(i)}))})}getSidebarData(){return y(this,void 0,void 0,function*(){return(yield this.getSessionData()).areas})}getUserState(){return y(this,void 0,void 0,function*(){return(yield this.getSessionData()).headerData.user.state})}}function b(){function s(){let a="战斗记录:
";c.list.forEach(e=>{var{TimeCreated:e,attackerID:t,attackerItemID:n,result:i,text:o}=c.details[e];a+=`[${e}] [${t}] [${n}] ${i} ${o}
`}),c.innerHTML=a}let e=new u("监测目标ID玩家的防御状态,找出隐身攻击者
","守望者 (测试中)"),t=document.createElement("p"),r=document.createElement("input"),n=document.createElement("button"),i=document.createElement("button"),o=document.createElement("button"),l=document.createElement("div"),c=(l.obj={},document.createElement("div")),d=(c.list=[],c.details={},null),a=(r.type="text",r.placeholder="目标ID",n.innerHTML="开启",i.innerHTML="关闭",i.disabled=!0,o.innerHTML="填入自己",e.close);e.close=()=>{null===d?(e.close=a,e.close()):new C("守望者运行中,请先停止",{timeout:2})},e.getElement().appendChild(t),e.getElement().appendChild(r),e.getElement().appendChild(n),e.getElement().appendChild(i),e.getElement().appendChild(o),e.getElement().appendChild(l),e.getElement().appendChild(c),n.addEventListener("click",()=>{if(null===d&&r.value){n.disabled=!0,i.disabled=!1,r.readOnly=!0,t.innerHTML="状态:已开 ✅";let a=0;d=window.setInterval(()=>y(this,void 0,void 0,function*(){var i=d;let o=yield(yield window.fetch("https://www.torn.com/loader.php?sid=attackData&mode=json&step=poll&user2ID="+r.value,{headers:{"X-Requested-With":"XMLHttpRequest"},referrer:"loader.php?sid=attack&user2ID="+r.value})).text();if(d===i){i=JSON.parse(o.split("{if(e!==r.value&&!l.obj[e]){l.obj[e]=!0;{let t="进攻者:
";Object.keys(l.obj).forEach(e=>t+=`[${e}]
`),l.innerHTML=t}}}),(e.currentFightHistory||[]).forEach(e=>{var t,n,i,o,a,r;c.list.includes(e.ID)||({ID:e,TimeCreated:t,attackID:n,attackerID:i,attackerItemID:o,result:a,text:r}=e,c.list.push(e),c.details[e]={TimeCreated:t,attackID:n,attackerID:i,attackerItemID:o,result:a,text:r},s())}),n&&n[r.value]&&n[r.value].forEach(e=>{var t,n,i,o;c.list.includes(e.ID)||({ID:e,TimeCreated:t,attackID:n,attackResult:i,userID:o}=e,c.list.push(e),c.details[e]={TimeCreated:t,attackID:n,attackerID:o,attackerItemID:0,result:i,text:""},s())})}}),900)}}),i.addEventListener("click",()=>{null!==d&&(n.disabled=!1,i.disabled=!0,r.readOnly=!1,window.clearInterval(d),d=null,t.innerHTML="状态:已关 ❎")}),o.addEventListener("click",()=>r.value=w.getInstance().getPlayerInfo().userID+"")}var v=[{start:[0,17,8],end:[0,24,8],name:"捡垃圾周",eff:"获得捡垃圾概率提升的增益"},{start:[3,5,20],end:[3,25,20],name:"复活节狩猎",eff:"复活节彩蛋会随机出现,集齐10个可兑换金蛋和一个独特的头像框(章)。"},{start:[5,20,20],end:[5,29,20],name:"狗牌",eff:"击败其他玩家以获得狗牌,小心保护你的狗牌。"},{start:[6,5,20],end:[6,25,20],name:"托恩先生和托恩女士",eff:"上传你的真实图片,然后拿章"},{start:[8,5,20],end:[8,23,20],name:"大逃杀",eff:"加入特定队伍后,攻击其他队伍玩家,存活下来的3个队伍可以拿章"},{start:[9,25,20],end:[10,1,20],name:"不给糖就捣蛋",eff:"买篮子之后攻击其他玩家后会随机掉落糖果,可用于兑换许多高价值物品"},{start:[11,14,20],end:[11,31,20],name:"圣诞小镇",eff:"在小镇中闲逛来获取随机掉落的物品"}],x={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:"获得双倍的能量饮料效果增益"}},T=[{name:"mex",show:"墨西哥",stocks:{Dahlia:"花","Jaguar Plushie":"偶"}},{name:"cay",show:"开曼",stocks:{"Banana Orchid":"花","Stingray Plushie":"偶"}},{name:"can",show:"加拿大",stocks:{Crocus:"花","Wolverine Plushie":"偶"}},{name:"haw",show:"夏威夷",stocks:{Orchid:"花","Large Suitcase":"大箱"}},{name:"uni",show:"嘤国",stocks:{Heather:"花","Red Fox Plushie":"赤狐","Nessie Plushie":"水怪"}},{name:"arg",show:"阿根廷",stocks:{"Ceibo Flower":"花","Monkey Plushie":"偶","Tear Gas":"催泪弹"}},{name:"swi",show:"瑞士",stocks:{Edelweiss:"花","Chamois Plushie":"偶"}},{name:"jap",show:"日本",stocks:{"Cherry Blossom":"花"}},{name:"chi",show:"祖国",stocks:{Peony:"花","Panda Plushie":"偶"}},{name:"uae",show:"迪拜",stocks:{"Tribulus Omanense":"花","Camel Plushie":"偶"}},{name:"sou",show:"南非",stocks:{"African Violet":"花","Lion Plushie":"偶",Xanax:"XAN"}}];class M extends s{constructor(){super(),this.className="TravelItem",this.apiUrl="https://yata.yt/api/v1/travel/export/",this.foreignStockInfo=null,window.setInterval(()=>y(this,void 0,void 0,function*(){m.getInstance().get()&&(re.info("fetching ",this.apiUrl),this.foreignStockInfo=JSON.parse(yield E.COFetch(this.apiUrl)),re.info({"fetch returned":this.foreignStockInfo}))}),3e4)}clickHandler(){return y(this,void 0,void 0,function*(){if(E.getScriptEngine()===c.RAW)new u('

'.replace("{{}}",performance.now().toString()),"飞花库存");else{const e=new u("请稍后 "+E.loading_gif_html(),"飞花库存");let i='
| 目的地 - 更新时间 | 库存 |
';const t=T,o=new Date,a=yield this.get();re.info({res:a}),a&&a.stocks&&(t.forEach(t=>{var e=(o.getTime()-new Date(1e3*a.stocks[t.name].update).getTime())/1e3|0;i+=`| ${t.show} | ${e/60|0}分${e%60|0}秒前 | `;let n=0;for(a.stocks[t.name].stocks.forEach(e=>{t.stocks[e.name]&&(i+=`${t.stocks[e.name]} (${e.quantity}) | `,n++)});n<3;)n++,i+=" | ";i+="
"}),i+="
",e.getElement().innerHTML=i)}})}get(){return y(this,void 0,void 0,function*(){return this.foreignStockInfo||(this.foreignStockInfo=JSON.parse(yield E.COFetch(this.apiUrl)))})}}class a extends s{constructor(){super(),this.className="CompanyHelper",I.get("CHTrainsDetectSwitch")&&this.trainsDetect().then()}trainsDetect(n=!1){return y(this,void 0,void 0,function*(){var e,t;"icon73"!==(yield w.getInstance().getSessionData()).statusIcons.icons.company.iconID?re.info("火车检测跳过:非公司老板"):(e=I.get("CHTrainsDetect")||0,n||E.getInstance().isNewDay(e,-6)?(e=E.getInstance().getTravelStage(),t=(yield w.getInstance().getUserState()).status,n&&re.info({travelStage:e,userStatus:t}),e===S.IN_TORN&&"ok"===t?h.getInstance().fetchText("/companies.php").then(e=>{let t=document.createElement("div");var n=E.getInstance().matchOne(e,/
/);if(!n)throw re.warn("火车检测: 无法获取数据"),new Error("火车检测: 无法获取数据");t.innerHTML=e.split(n)[1].split("