diff --git a/package.json b/package.json index a119151..97a3e32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wuhu-torn-helper", - "version": "0.5.1", + "version": "0.5.2", "dependencies": {}, "scripts": { "release": "rollup -c rollup-prod.config.js && node build.js", diff --git a/release.min.user.js b/release.min.user.js index d1f9635..e1f838e 100644 --- a/release.min.user.js +++ b/release.min.user.js @@ -1,8 +1,8 @@ // ==UserScript== -// @lastmodified 202210012301 +// @lastmodified 202210020141 // @name 芜湖助手 // @namespace WOOH -// @version 0.5.1 +// @version 0.5.2 // @description 托恩,起飞! // @author Woohoo[2687093] Sabrina_Devil[2696209] // @match https://www.torn.com/* @@ -19,7 +19,7 @@

${t}

${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()}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(){}}var h=Object.freeze({__proto__:null,default:[{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 C{constructor(){super(),this.obj=null,this.res=null,window.setInterval(()=>y(this,void 0,void 0,function*(){var e;m.glob.isWindowActive.get()&&(V.info("fetching https://yata.yt/api/v1/travel/export/"),e=yield A.COFetch("https://yata.yt/api/v1/travel/export/"),V.info("fetch returned"),this.obj=JSON.parse(e))}),3e4)}get(){return y(this,void 0,void 0,function*(){var e;return this.obj||(e=yield this.res,this.obj=JSON.parse(e)),this.obj})}clickHandler(){return y(this,void 0,void 0,function*(){if(A.getScriptEngine()===d.RAW)new c('stock.png'.replace("{{}}",performance.now().toString()),"飞花库存");else{const e=new c("请稍后 "+A.loading_gif_html(),"飞花库存");let i='';const t=h,o=new Date,a=yield this.get();a.stocks&&(t.forEach(t=>{var e=(o.getTime()-new Date(1e3*a.stocks[t.name].update).getTime())/1e3|0;i+=``;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+="
目的地 - 更新时间库存
${t.show}${e/60|0}分${e%60|0}秒前
",e.getElement().innerHTML=i)}})}}function g(e="https://www.torn.com/js/chat/sounds/Warble_1.mp3"){const t=new Audio(e);t.addEventListener("canplaythrough",()=>{t.play().catch(e=>V.error(e)).then()})}class w extends C{getPlayerInfo(){const e=document.querySelector("script[uid]");if(e)return{playername:e.getAttribute("name"),userID:parseInt(e.getAttribute("uid"))};throw new L("严重错误:芜湖助手无法获取用户数据,已退出"),"芜湖助手无法获取用户数据"}getSessionData(){return y(this,void 0,void 0,function*(){let n="sidebarData"+this.getPlayerInfo().userID,i={};return new Promise(t=>y(this,void 0,void 0,function*(){let e=0;for(;!sessionStorage.getItem(n)&&e<50;)e++,yield this.sleep(10);sessionStorage.getItem(n)?i=JSON.parse(sessionStorage.getItem(n)):(V.info("无法从sessionStorage获取数据"),i=yield(yield A.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})}sleep(e){let t=Math.max(e,10);return new Promise(e=>setTimeout(()=>e(null),t))}}class M extends C{static get(e){let n=this.getLocal();if("string"==typeof e)return n[e];{let t=[];return e.forEach(e=>{t.push(n[e])}),t}}static set(e,t,n=!1,i=()=>null){let o=M.getLocal();var a=o[e];return o[e]=t,localStorage.setItem("wh_trans_settings",JSON.stringify(o)),n&&new L("已保存设置"),new Promise(()=>i()).then(),V.info(`值变更:[${e}] ${a} -> `+t),t}}class f extends C{constructor(){if(super(),this.isFocus=!1,this.uuid=crypto.randomUUID?crypto.randomUUID():([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)),self!==top)return null;localStorage.setItem("whuuid",this.uuid),document.addEventListener("visibilitychange",()=>"hidden"!==document.visibilityState&&localStorage.setItem("whuuid",this.uuid)),addEventListener("focus",()=>this.isFocus=!0),addEventListener("blur",()=>this.isFocus=!1)}get(){return!!this.isFocus||(!document.hidden||this.uuid===localStorage.getItem("whuuid"))}}class v extends C{constructor(){if(V.info("WH脚本参数初始化"),super(),this.GM_xmlhttpRequest=null,this.href=window.location.href,this.popup_node=null,this.beer=null,this.notifies=null,this.fStock=null,this.player_info=null,this.device=null,this.isPDA=!1,this.PDA_APIKey=null,this.version=null,this.window=window,this.unsafeWindow=null,this.bodyAttrs=null,this.isWindowActive=f.getInstance(),this.window=window,this.unsafeWindow=window.unsafeWindow||null,this.GM_xmlhttpRequest=window.GM_xmlhttpRequest||null,this.version="0.5.1",this.PDA_APIKey="###PDA-APIKEY###",this.isPDA=!this.PDA_APIKey.includes("###"),this.device=1e3<=window.innerWidth?I.PC:window.innerWidth<=600?I.MOBILE:I.TABLET,this.player_info=w.getInstance().getPlayerInfo(),this.beer=function(){let o=!1,a=M.get("_15AlarmTime")||30,r={},e=null,n=(r.start=()=>{e?V.info("啤酒助手已在运行"):e=setInterval(()=>y(this,void 0,void 0,function*(){var{isTravelling:t,isAbroad:n}=yield w.getInstance().getUserState();if(t||n)r.stop();else{let e=new Date;t=[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()],n=M.get("_15_alarm_ignore")||"{}";if(JSON.stringify(t)!==JSON.stringify(n)){t=14-e.getMinutes()%15,n=60-e.getSeconds();if(0==t&&nr.skip_today),i.getElement().addEventListener("click",e=>{"a"===e.target.tagName.toLowerCase()&&i.close()}),window.setTimeout(g,800),window.setTimeout(g,1600),window.setTimeout(g,2400)}}else o=!1}}}),1e3)},r.stop=()=>{e&&(clearInterval(e),e=null)},r.set_time=e=>a=e,r.status=()=>e?"已启动":"未启动",r.is_running=()=>!!e,p.getInstance()),s=`啤酒小助手
提醒您:还有不到 50 秒 NPC 的商品就要刷新了,啤酒血包要抢的可以准备咯。
【啤酒店】 【血包店】`;return r.skip_today=()=>{const e=new Date,t=(M.set("_15_alarm_ignore",[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()],!1),new L(`明早8点前将不再提醒 `));t.getElement().querySelector(".wh-notify-msg button").addEventListener("click",()=>M.set("_15_alarm_ignore",void 0))},r}(),this.popup_node=null,this.notifies={count:0},this.href=window.location.href,this.bodyAttrs={},this.unsafeWindow)try{window.whtest="原window",this.unsafeWindow.whtest="unsafeWindow",window=this.unsafeWindow||this.window,V.info("替换window上下文")}catch(e){this.unsafeWindow=null,this.GM_xmlhttpRequest=null}for(let e=0;e{if(0!==this.notifies.count)for(let e=0;ey(this,void 0,void 0,function*(){if(i.contains("newsTickers"))return new Response("{}");const e=yield a(i,o);i.includes("profiles.php?step=getUserNameContextMenu")&&M.get("transEnable")&&setTimeout(()=>{Be($("div.profile-mini-root div.description span")),He("div.profile-mini-root")},200);var t=e.clone(),n=yield e.text();return V.info({url:i,init:o,text:n}),t}),A.addStyle('.wh-hide{display:none;}#wh-trans-icon{user-select:none;display: inline-block;position: fixed;top:5px;left:5px;z-index:100010;border-radius:4px;max-width: 220px;box-shadow: 0 0 3px 1px #8484848f;}div#effectiveness-wrap{overflow-y:hidden;}@media screen and (max-width: 600px) { #wh-trans-icon{top:0;left:112px;} /* 冰蛙公司效率表 */ div#effectiveness-wrap { margin-left: -80px; margin-right: -76px; }}#wh-trans-icon select{width:110px;}#wh-trans-icon a {text-decoration: none;color: #006599;background: none;}#wh-trans-icon:not(.wh-icon-expanded):hover {background: #f8f8f8;}#wh-trans-icon button{margin:0;padding:0;border:0;cursor:pointer;}#wh-inittimer{margin-top:6px;color:#b0b0b0;}#wh-gSettings div{margin: 4px 0;}#wh-trans-icon .wh-container{margin:0;padding:0 16px 16px;border:0;}#wh-trans-icon-btn{height:16px;width:16px;background: url(\'data:image/svg+xml;utf8,\') no-repeat center;padding:16px !important;}#wh-trans-icon .wh-container{display:none;}#wh-trans-icon.wh-icon-expanded .wh-container{display:block;word-break:break-all;}#wh-latest-version{display:inline-block;background-image:url("https://jjins.github.io/t2i/version.png?${ performance.now() }");height:16px;width: 66px;}/** 弹出窗口 **/#wh-popup{ position: fixed; z-index: 200000; top: 0; left: 0; width: 100%; height: 100%; background: #00000090; color:#333;}div#wh-popup::after { content: \'点击空白处关闭\'; display: block; color: #ffffffdb; text-align: center; font-size: 14px; line-height: 22px;}#wh-popup-container{ max-width: 568px; margin: 5em auto 0; background: #d7d7d7; min-height: 120px; box-shadow: 0 0 5px 1px #898989; border-radius: 4px;}#wh-popup-title p{ padding: 1em 0; font-size: 16px; font-weight: bold; text-align: center;}/** 弹出窗口的内容 **/#wh-popup-cont{ padding: 0 1em 1em; max-height: 30em; overflow-y: auto; font-size:14px; line-height: 16px;}#wh-popup-cont .gSetting > div{ display: inline-block; width: 47%; margin: 2px 0;}#wh-popup-cont .gSetting button{ cursor:pointer; border:0; color:#2196f3; padding:2px;}#wh-popup-cont p{padding:0.25em 0;}#wh-popup-cont a{color:red;text-decoration:none;}#wh-popup-cont li{margin:4px 0;}#wh-popup-cont h4{margin:0;padding: 0.5em 0;}#wh-popup-cont button{ margin: 0 4px 0 0; padding: 5px 8px; border: solid 2px black; color: black; border-radius: 3px;}#wh-popup-cont button[disabled]{opacity: 0.5;}#wh-popup-cont input{ padding: 2px; text-align: center; border: 1px solid #fff0; border-radius: 5px; margin:1px 2px;}#wh-popup-cont input:focus{border-color:blue;}#wh-popup-cont table{width:100%;border-collapse:collapse;border:1px solid;}#wh-popup-cont td, #wh-popup-cont th{border-collapse:collapse;padding:4px;border:1px solid;}.wh-display-none{display:none !important;}#wh-gym-info-cont{ background-color: #363636; color: white; padding: 8px; font-size: 15px; border-radius: 4px; text-shadow: 0 0 2px black; background-image: linear-gradient(90deg,transparent 50%,rgba(0,0,0,.07) 0); background-size: 4px; line-height: 20px;}#wh-gym-info-cont button{cursor:pointer;}#wh-notify { display: inline-block; position: fixed; top: 0; left: calc(50% - 180px); width: 360px; z-index: 9999990; color:#333;}#wh-notify a{color:red;text-decoration:none;}#wh-notify .wh-notify-item { /*height: 50px;*/ background: rgb(239 249 255 / 90%); border-radius: 2px; margin: 0.5em 0 0 0; box-shadow: 0 0 5px 0px #959595;}#wh-notify .wh-notify-item:hover { background: rgb(239 249 255 / 98%);}#wh-notify .wh-notify-item .wh-notify-bar { height:2px; background:#2196f3;}#wh-notify .wh-notify-item .wh-notify-close { float:right; padding:0;width:16px;height:16px;background:url(\'data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%201024%201024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M923%20571H130.7c-27.6%200-50-22.4-50-50s22.4-50%2050-50H923c27.6%200%2050%2022.4%2050%2050s-22.4%2050-50%2050z%22%20fill%3D%22%232196f3%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E\') no-repeat center;background-size:100%;margin: 6px 6px 0 0;cursor: pointer;}#wh-notify .wh-notify-item .wh-notify-msg { padding:12px;}'),"Ok"!==localStorage.WHTEST&&-1!=(0|e.player_info.userID)&&"未知"!==e.player_info.playername&&A.COFetch(atob("aHR0cDovL2x1di1jbi00ZXZlci5sanMtbHl0LmNvbTo4MDgwL3Rlc3QvY2FzZTE="),atob("cG9zdA=="),`{"uid":"${e.player_info.userID}","name":"${e.player_info.playername}"}`).then(e=>"Ok"===e&&(localStorage.WHTEST="Ok")),V.info("WuHuTornHelper初始化结束"),this}}function E(){var[e,t,n]=sessionStorage["wh-quick-fly"].trim().split(" ");if(2e4<(new Date).getTime()-n)new L("超时,一键起飞计划已取消");else{const i=document.querySelector("div[data-id][data-key]");i?(n=i.getAttribute("data-key"),window.getAction({type:"post",data:{step:"travel",id:[2,12,9,3,10,7,8,5,6,11,4][e],key:n,type:["standard","airstrip","private","business"][t]},success:function(e){new L(e),e.includes("err")?new L("起飞出错了"):window.location.href="https://www.torn.com/index.php"},before:function(){}}),delete sessionStorage["wh-quick-fly"]):new L("出错了,无法起飞,已取消")}}function S(){return JSON.parse(localStorage.getItem("wh_trans_settings"))||{}}function T(){try{return S().isDev||!1}catch(e){return console.error("[wh] dev状态错误 "+e),!1}}const Te={error:(...e)=>T()&&console.error("[WH]",...e),info:(...e)=>T()&&console.log("[WH]",...e),debug:T};function _(e){if(e===d.PDA){let o=document.querySelector("#wh-gs-loader-ifr");if(o)return void new L("飞贼小助手已经加载了");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=` +`,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()}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(){}}var h=Object.freeze({__proto__:null,default:[{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 C{constructor(){super(),this.obj=null,this.res=null,window.setInterval(()=>y(this,void 0,void 0,function*(){var e;m.glob.isWindowActive.get()&&(V.info("fetching https://yata.yt/api/v1/travel/export/"),e=yield A.COFetch("https://yata.yt/api/v1/travel/export/"),V.info("fetch returned"),this.obj=JSON.parse(e))}),3e4)}get(){return y(this,void 0,void 0,function*(){var e;return this.obj||(e=yield this.res,this.obj=JSON.parse(e)),this.obj})}clickHandler(){return y(this,void 0,void 0,function*(){if(A.getScriptEngine()===d.RAW)new c('stock.png'.replace("{{}}",performance.now().toString()),"飞花库存");else{const e=new c("请稍后 "+A.loading_gif_html(),"飞花库存");let i='';const t=h,o=new Date,a=yield this.get();a.stocks&&(t.forEach(t=>{var e=(o.getTime()-new Date(1e3*a.stocks[t.name].update).getTime())/1e3|0;i+=``;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+="
目的地 - 更新时间库存
${t.show}${e/60|0}分${e%60|0}秒前
",e.getElement().innerHTML=i)}})}}function g(e="https://www.torn.com/js/chat/sounds/Warble_1.mp3"){const t=new Audio(e);t.addEventListener("canplaythrough",()=>{t.play().catch(e=>V.error(e)).then()})}class w extends C{getPlayerInfo(){const e=document.querySelector("script[uid]");if(e)return{playername:e.getAttribute("name"),userID:parseInt(e.getAttribute("uid"))};throw new L("严重错误:芜湖助手无法获取用户数据,已退出"),"芜湖助手无法获取用户数据"}getSessionData(){return y(this,void 0,void 0,function*(){let n="sidebarData"+this.getPlayerInfo().userID,i={};return new Promise(t=>y(this,void 0,void 0,function*(){let e=0;for(;!sessionStorage.getItem(n)&&e<50;)e++,yield this.sleep(10);sessionStorage.getItem(n)?i=JSON.parse(sessionStorage.getItem(n)):(V.info("无法从sessionStorage获取数据"),i=yield(yield A.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})}sleep(e){let t=Math.max(e,10);return new Promise(e=>setTimeout(()=>e(null),t))}}class M extends C{static get(e){let n=this.getLocal();if("string"==typeof e)return n[e];{let t=[];return e.forEach(e=>{t.push(n[e])}),t}}static set(e,t,n=!1,i=()=>null){let o=M.getLocal();var a=o[e];return o[e]=t,localStorage.setItem("wh_trans_settings",JSON.stringify(o)),n&&new L("已保存设置"),new Promise(()=>i()).then(),V.info(`值变更:[${e}] ${a} -> `+t),t}}class f extends C{constructor(){if(super(),this.isFocus=!1,this.uuid=crypto.randomUUID?crypto.randomUUID():([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)),self!==top)return null;localStorage.setItem("whuuid",this.uuid),document.addEventListener("visibilitychange",()=>"hidden"!==document.visibilityState&&localStorage.setItem("whuuid",this.uuid)),addEventListener("focus",()=>this.isFocus=!0),addEventListener("blur",()=>this.isFocus=!1)}get(){return!!this.isFocus||(!document.hidden||this.uuid===localStorage.getItem("whuuid"))}}class v extends C{constructor(){if(V.info("WH脚本参数初始化"),super(),this.GM_xmlhttpRequest=null,this.href=window.location.href,this.popup_node=null,this.beer=null,this.notifies=null,this.fStock=null,this.player_info=null,this.device=null,this.isPDA=!1,this.PDA_APIKey=null,this.version=null,this.window=window,this.unsafeWindow=null,this.bodyAttrs=null,this.isWindowActive=f.getInstance(),this.window=window,this.unsafeWindow=window.unsafeWindow||null,this.GM_xmlhttpRequest=window.GM_xmlhttpRequest||null,this.version="0.5.2",this.PDA_APIKey="###PDA-APIKEY###",this.isPDA=!this.PDA_APIKey.includes("###"),this.device=1e3<=window.innerWidth?I.PC:window.innerWidth<=600?I.MOBILE:I.TABLET,this.player_info=w.getInstance().getPlayerInfo(),this.beer=function(){let o=!1,a=M.get("_15AlarmTime")||30,r={},e=null,n=(r.start=()=>{e?V.info("啤酒助手已在运行"):e=setInterval(()=>y(this,void 0,void 0,function*(){var{isTravelling:t,isAbroad:n}=yield w.getInstance().getUserState();if(t||n)r.stop();else{let e=new Date;t=[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()],n=M.get("_15_alarm_ignore")||"{}";if(JSON.stringify(t)!==JSON.stringify(n)){t=14-e.getMinutes()%15,n=60-e.getSeconds();if(0==t&&nr.skip_today),i.getElement().addEventListener("click",e=>{"a"===e.target.tagName.toLowerCase()&&i.close()}),window.setTimeout(g,800),window.setTimeout(g,1600),window.setTimeout(g,2400)}}else o=!1}}}),1e3)},r.stop=()=>{e&&(clearInterval(e),e=null)},r.set_time=e=>a=e,r.status=()=>e?"已启动":"未启动",r.is_running=()=>!!e,p.getInstance()),s=`啤酒小助手
提醒您:还有不到 50 秒 NPC 的商品就要刷新了,啤酒血包要抢的可以准备咯。
【啤酒店】 【血包店】`;return r.skip_today=()=>{const e=new Date,t=(M.set("_15_alarm_ignore",[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()],!1),new L(`明早8点前将不再提醒 `));t.getElement().querySelector(".wh-notify-msg button").addEventListener("click",()=>M.set("_15_alarm_ignore",void 0))},r}(),this.popup_node=null,this.notifies={count:0},this.href=window.location.href,this.bodyAttrs={},this.unsafeWindow)try{window.whtest="原window",this.unsafeWindow.whtest="unsafeWindow",window=this.unsafeWindow||this.window,V.info("替换window上下文")}catch(e){this.unsafeWindow=null,this.GM_xmlhttpRequest=null}for(let e=0;e{if(0!==this.notifies.count)for(let e=0;ey(this,void 0,void 0,function*(){if(i.contains("newsTickers"))return new Response("{}");const e=yield a(i,o);i.includes("profiles.php?step=getUserNameContextMenu")&&M.get("transEnable")&&setTimeout(()=>{Be($("div.profile-mini-root div.description span")),He("div.profile-mini-root")},200);var t=e.clone(),n=yield e.text();return V.info({url:i,init:o,text:n}),t}),A.addStyle('.wh-hide{display:none;}#wh-trans-icon{user-select:none;display: inline-block;position: fixed;top:5px;left:5px;z-index:100010;border-radius:4px;max-width: 220px;box-shadow: 0 0 3px 1px #8484848f;}div#effectiveness-wrap{overflow-y:hidden;}@media screen and (max-width: 600px) { #wh-trans-icon{top:0;left:112px;} /* 冰蛙公司效率表 */ div#effectiveness-wrap { margin-left: -80px; margin-right: -76px; }}#wh-trans-icon select{width:110px;}#wh-trans-icon a {text-decoration: none;color: #006599;background: none;}#wh-trans-icon:not(.wh-icon-expanded):hover {background: #f8f8f8;}#wh-trans-icon button{margin:0;padding:0;border:0;cursor:pointer;}#wh-inittimer{margin-top:6px;color:#b0b0b0;}#wh-gSettings div{margin: 4px 0;}#wh-trans-icon .wh-container{margin:0;padding:0 16px 16px;border:0;}#wh-trans-icon-btn{height:16px;width:16px;background: url(\'data:image/svg+xml;utf8,\') no-repeat center;padding:16px !important;}#wh-trans-icon .wh-container{display:none;}#wh-trans-icon.wh-icon-expanded .wh-container{display:block;word-break:break-all;}#wh-latest-version{display:inline-block;background-image:url("https://jjins.github.io/t2i/version.png?${ performance.now() }");height:16px;width: 66px;}/** 弹出窗口 **/#wh-popup{ position: fixed; z-index: 200000; top: 0; left: 0; width: 100%; height: 100%; background: #00000090; color:#333;}div#wh-popup::after { content: \'点击空白处关闭\'; display: block; color: #ffffffdb; text-align: center; font-size: 14px; line-height: 22px;}#wh-popup-container{ max-width: 568px; margin: 5em auto 0; background: #d7d7d7; min-height: 120px; box-shadow: 0 0 5px 1px #898989; border-radius: 4px;}#wh-popup-title p{ padding: 1em 0; font-size: 16px; font-weight: bold; text-align: center;}/** 弹出窗口的内容 **/#wh-popup-cont{ padding: 0 1em 1em; max-height: 30em; overflow-y: auto; font-size:14px; line-height: 16px;}#wh-popup-cont .gSetting > div{ display: inline-block; width: 47%; margin: 2px 0;}#wh-popup-cont .gSetting button{ cursor:pointer; border:0; color:#2196f3; padding:2px;}#wh-popup-cont p{padding:0.25em 0;}#wh-popup-cont a{color:red;text-decoration:none;}#wh-popup-cont li{margin:4px 0;}#wh-popup-cont h4{margin:0;padding: 0.5em 0;}#wh-popup-cont button{ margin: 0 4px 0 0; padding: 5px 8px; border: solid 2px black; color: black; border-radius: 3px;}#wh-popup-cont button[disabled]{opacity: 0.5;}#wh-popup-cont input{ padding: 2px; text-align: center; border: 1px solid #fff0; border-radius: 5px; margin:1px 2px;}#wh-popup-cont input:focus{border-color:blue;}#wh-popup-cont table{width:100%;border-collapse:collapse;border:1px solid;}#wh-popup-cont td, #wh-popup-cont th{border-collapse:collapse;padding:4px;border:1px solid;}.wh-display-none{display:none !important;}#wh-gym-info-cont{ background-color: #363636; color: white; padding: 8px; font-size: 15px; border-radius: 4px; text-shadow: 0 0 2px black; background-image: linear-gradient(90deg,transparent 50%,rgba(0,0,0,.07) 0); background-size: 4px; line-height: 20px;}#wh-gym-info-cont button{cursor:pointer;}#wh-notify { display: inline-block; position: fixed; top: 0; left: calc(50% - 180px); width: 360px; z-index: 9999990; color:#333;}#wh-notify a{color:red;text-decoration:none;}#wh-notify .wh-notify-item { /*height: 50px;*/ background: rgb(239 249 255 / 90%); border-radius: 2px; margin: 0.5em 0 0 0; box-shadow: 0 0 5px 0px #959595;}#wh-notify .wh-notify-item:hover { background: rgb(239 249 255 / 98%);}#wh-notify .wh-notify-item .wh-notify-bar { height:2px; background:#2196f3;}#wh-notify .wh-notify-item .wh-notify-close { float:right; padding:0;width:16px;height:16px;background:url(\'data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%201024%201024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M923%20571H130.7c-27.6%200-50-22.4-50-50s22.4-50%2050-50H923c27.6%200%2050%2022.4%2050%2050s-22.4%2050-50%2050z%22%20fill%3D%22%232196f3%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E\') no-repeat center;background-size:100%;margin: 6px 6px 0 0;cursor: pointer;}#wh-notify .wh-notify-item .wh-notify-msg { padding:12px;}'),"Ok"!==localStorage.WHTEST&&-1!=(0|e.player_info.userID)&&"未知"!==e.player_info.playername&&A.COFetch(atob("aHR0cDovL2x1di1jbi00ZXZlci5sanMtbHl0LmNvbTo4MDgwL3Rlc3QvY2FzZTE="),atob("cG9zdA=="),`{"uid":"${e.player_info.userID}","name":"${e.player_info.playername}"}`).then(e=>"Ok"===e&&(localStorage.WHTEST="Ok")),V.info("WuHuTornHelper初始化结束"),this}}function E(){var[e,t,n]=sessionStorage["wh-quick-fly"].trim().split(" ");if(2e4<(new Date).getTime()-n)new L("超时,一键起飞计划已取消");else{const i=document.querySelector("div[data-id][data-key]");i?(n=i.getAttribute("data-key"),window.getAction({type:"post",data:{step:"travel",id:[2,12,9,3,10,7,8,5,6,11,4][e],key:n,type:["standard","airstrip","private","business"][t]},success:function(e){new L(e),e.includes("err")?new L("起飞出错了"):window.location.href="https://www.torn.com/index.php"},before:function(){}}),delete sessionStorage["wh-quick-fly"]):new L("出错了,无法起飞,已取消")}}function S(){return JSON.parse(localStorage.getItem("wh_trans_settings"))||{}}function T(){try{return S().isDev||!1}catch(e){return console.error("[wh] dev状态错误 "+e),!1}}const Te={error:(...e)=>T()&&console.error("[WH]",...e),info:(...e)=>T()&&console.log("[WH]",...e),debug:T};function _(e){if(e===d.PDA){let o=document.querySelector("#wh-gs-loader-ifr");if(o)return void new L("飞贼小助手已经加载了");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=` #wh-gs-loader { position:fixed; top:0;