Greasy Fork

Greasy Fork is available in English.

冰蛙宝鉴

随时随地通过API接口看你想看!

当前为 2024-06-09 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         冰蛙宝鉴
// @namespace    SMTH
// @version      3.3.8
// @description  随时随地通过API接口看你想看!
// @author       bingri[1523812] kaeru[1769499] htys[1545351] mirrorhye[2564936] tobytorn[1617955] Microdust[2587304]
// @match        https://www.torn.com/*
// @grant        GM_xmlhttpRequest
// @grant        GM.xmlHttpRequest
// @connect      *
// @connect      tornsmth.website
// @require      https://cdn.staticfile.org/xlsx/0.17.5/xlsx.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js
// ==/UserScript==
function bingwaMain(){"use strict";if(!window.BINGWA){window.BINGWA=!0,console.log("冰蛙启动");const fe=window.jQuery;var f,u,m,y,i;f=fe,u=window,m=document,i="tornInputMoney",f.fn[i]=function(t){if("string"==typeof t){var e,a=t,n=Array.prototype.slice.call(arguments,1);return this.each(function(){if(!f.data(this,"plugin_"+i)||"function"!=typeof f.data(this,"plugin_"+i)[a])throw new Error("Method "+a+" does not exist on jQuery."+i);e=f.data(this,"plugin_"+i)[a].apply(this,n)}),e!==y?e:this}if("object"==typeof t||!t)return this.each(function(){f.data(this,"plugin_"+i)||f.data(this,"plugin_"+i,new Nt(this,t))})};const ue=Object.freeze({GM:"gm",PDA:"pda",OTHER:"other"});let e=ue.OTHER;"function"==typeof GM_xmlhttpRequest?e=ue.GM:"object"==typeof GM&&"function"==typeof GM.xmlHttpRequest?(e=ue.GM,window.GM_xmlhttpRequest=GM.xmlHttpRequest):"function"==typeof PDA_httpGet&&(e=ue.PDA);const be=[{name:"foo",title:"阅兵助手",desc:"在部分页面显示阅兵按钮,可以快速获取玩家信息",default:!1},{name:"noAssisting",title:"防打重",desc:"如果已有其他人进入战斗则屏蔽JOIN按钮",default:!1},{name:"mugoo",title:"山贼助手",desc:"在市场列表界面显示用户状态和攻击链接",default:!0},{name:"chatQuickWithdraw",title:"聊天快捷取钱",desc:"聊天频道内显示快捷取钱按钮",default:!1},{name:"travelFilter",title:"飞花过滤",desc:"在海外市场页面屏蔽不重要物品",default:!0},{name:"jailView",title:"监狱助手",desc:"在监狱页面屏蔽分数大于10000的目标,本帮人员置顶高亮显示",default:!0},{name:"crimeView",title:"犯罪助手",desc:"在犯罪界面显示额外信息",default:!1},{name:"stockexchange_show_abbr",title:"股票助手",desc:"在股票交易市场页面的股票名称前显示缩写",default:!0},{name:"gym_show_ratio",title:"健身房助手",desc:"在健身房页面显示推荐的属性比例",default:!0},{name:"common_modify_header_links",title:"顶部快捷入口",desc:"在页面顶部添加一些常用页面的链接",default:!0},{name:"hide_cloud_while_flying",title:"飞行无云",desc:"在飞行界面隐藏飞机和云彩",default:!0},{name:"withdrawal_helper",title:"取钱助手",desc:"右下角聊天people框高亮显示帮派可取钱名单",default:!0},{name:"bigger_screen_on_laptop",title:"laptop大屏",desc:"飞行中使用笔记本电脑时可以全屏显示",default:!0},{name:"taking_off_reminder",title:"起飞吃药提醒",desc:"起飞前根据CD提醒吃药和OC",default:!0},{name:"bounty_parade",title:"悬赏阅兵",desc:"报纸-悬赏页面显示目标BS",default:!1},{name:"nurse_suggestion",title:"护士建议",desc:"智能提醒出院吃药",default:!0},{name:"extra_recent_attacks",title:"更多最近攻击(帮派)",desc:"帮派chain页面显示更多5分钟内攻击记录(减少错过的复仇)",default:!1},{name:"shows_bingwa_icon",title:"显示冰蛙图标",desc:"在侧边栏显示冰蛙图标,可以作为冰蛙的快速入口",default:!0}];be.forEach(t=>{var e=Xt("BWM_SETTINGS",t.name);null==e&&Jt("BWM_SETTINGS",t.name,String(t.default)),window[t.name]="true"==Xt("BWM_SETTINGS",t.name)});let b=localStorage.getItem("APIKey");const me={20465:"SMTH - Phoenix Nirvana",36134:"SMTH - Silver Hand",10741:"SMTH - Trisolary",16335:"SMTH - November Chopin",16424:"SMTH - HoYoverse",9356:"SMTH - Party Animals",27902:"SMTH - Concord",11796:"SMTH - Bright Summit"};var n,a,d,o,t,r,s,l,c,p,h={8836:"Vinerri",2095:"Guerrilla Warfare",11356:"-UGK-",31312:"TORNado",8255:"Scream Silence",26312:"The Avengers",28205:"Invictus",10913:"Unbroken Warriors",8510:"Ara Pacis",5113:"ThugLife",13343:"The Defiant",39756:"Abusement Park",38761:"Shadow Healers",42125:"Octogenarian DirtyBombers",35739:"Kingsmen",14820:"Unbroken Legion",10140:"In Memory of the Fallen",9405:"Lake Of Lerna",30085:"Rampage Total Destruction"};const ye={gray:"#adadad",red:"#ff7373",green:"#8fbc8f",blue:"#65a5d1",purple:"#8d6dd7",yellow:"#f39826",yellowgreen:"#83a000",pink:"#e467b3",salmon:"#F9CDAD",orange:"#FFDEAD"};if(zt(".bw-hidden { display: none !important }"),zt(`.bw-no-select {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}`),zt(`.bw-chat-withdraw .bw-chat-withdraw-btn {
margin-left: auto;
height: fit-content;
background-color: #adadad;
color: white;
cursor: pointer;
padding: 2px;
}`),zt(`.bw-chat-withdraw.bw-chat-withdraw-amount .bw-chat-withdraw-btn {
background-color: #8fbc8f;
}`),zt(`.bw-shared-armory {
float: right;
margin-right: 4px;
}`),zt(`.bw-shared-armory::after {
content: '公';
background-color: #5d9525;
color: white;
padding: 4px;
border-radius: 4px;
}`),Date.prototype.format=function(t){var e,a={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(e in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),a)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?a[e]:("00"+a[e]).substr((""+a[e]).length)));return t},function(){var e=Xt("APICache_companies","last-updated");if(null!=e&&null!=e){var a=new Date;let t=new Date(e);t.setDate(t.getDate()+1),t<a&&se()}else se()}(),travelFilter&&function(){const r={186:"绵羊",187:"泰迪熊",215:"猫咪",258:"美洲豹",261:"貂熊",266:"尼斯湖水怪",268:"赤狐",269:"猴子",273:"岩羚羊",274:"大熊猫",281:"狮子",384:"骆驼",618:"黄貂鱼",260:"大丽花",263:"番红花",264:"兰花",267:"帚石楠",271:"木棉花",272:"雪绒花",276:"牡丹花",277:"樱花",282:"非洲堇",385:"蒺藜花",617:"香蕉兰",256:"催泪弹",226:"烟雾弹",222:"闪光弹",616:"鳟鱼"},t=fe(".travel-agency-market ul.users-list li"),s=new Set([8,11,20,21,26,31,50,63,99,107,108,110,111,159,175,177,178,229,230,231,232,259,399,409,432,640,612,613,614,615,619,620,621,622,623,624,625,626,196,197,201,205,252,253,262,402,410,413,645,240,241,242,243,265,419,420,421,430,196,197,198,201,203,205,217,218,219,220,221,397,408,411,415,416,418,431,438,439,641,196,198,199,203,204,255,257,270,333,391,407,196,198,199,201,203,204,223,224,361,398,435,436,197,198,200,203,204,205,233,234,235,236,237,238,239,278,279,334,395,427,429,433,434,197,199,200,201,204,244,245,246,247,248,249,250,251,275,400,381,382,383,386,387,388,412,414,440,4,199,200,201,203,225,227,228,280,332,406,651,652,653,654]);if(0<t.length&&"filtered"!=t.attr("filtered")){let o=parseInt(fe("div.delimiter div.msg:contains(You have purchased) span.bold").last().text());var e=parseInt(fe(fe("div.delimiter div.msg:contains(You have purchased) span.bold").get(-2)).text());o-=e,(isNaN(o)||o<=0)&&(o=1),t.each((t,e)=>{var a=parseInt(fe(e).find("div.details").attr("itemid"));if(isNaN(a)||!(0<a))return!1;if(s.has(a))fe(e).addClass("hide");else{const n=fe(e).find("input#item-"+a)[0];if(n.value=o,n.dispatchEvent(new Event("blur")),r[a]){a=r[a];const i=fe(e).find("span.name");i.html(i.html()+"<span style='float:right;padding-right:10px;'>"+a+"</span>")}}}),t.attr("filtered","filtered")}fe("#show_more").length<1&&(fe(".travel-agency-market").after("<div><div id='show_more' type='button' style='cursor:pointer;width:inherit;font-size:24px;margin:auto;padding:10px;border:5px solid gray;background-color:#c0542f;text-align:center;'>点击显示全部</div></div>"),fe("#show_more").click(function(){fe(this).parent().remove(),t.removeClass("hide")}))}(),common_modify_header_links&&le(),setInterval(function(){const t=fe("[class*=chat-box-header__info-btn___]").closest("[class*=chat-box___]");t.each(function(){var t=fe(this).find("[class*=chat-box-header__name___]").text();if(t){const n=fe(this).find("[class*=chat-box-message__timestamp___]").last().text();var e=n.trim().match(/^(\d\d):(\d\d)(\([0-9mhd]*\))?$/);if(e){var a=e[1],e=e[2];const i=new Date;i.setUTCHours(a<=i.getUTCHours()?a:a-24);e=`${a}:${e}:00 - ${i.getUTCDate().toString().padStart(2,0)}/${(i.getUTCMonth()+1).toString().padStart(2,0)}/${i.getUTCFullYear().toString().slice(2)} TCT`;const o=fe(this).find("[class*=chat-box-message__message___]").toArray().slice(-5).map(t=>`[${fe(t).text()}]`);Jt("CHAT_LAST_MESSAGE",t,e+"|||"+o.join(""))}}})},1e3),chatQuickWithdraw&&de(),setInterval(function(){if(0<fe("#profile-mini-root").children().children("[class^=profile-mini-_userImageWrapper]").length&&!fe("#profile-mini-root").children().children("[class^=profile-mini-_userProfileWrapper]").attr("hasdone")){fe("#profile-mini-root").children().children("[class^=profile-mini-_userProfileWrapper]").attr("hasdone","1");const t=fe("#profile-mini-root").children().children("[class^=profile-mini-_userImageWrapper]").children("a"),e=t?t.attr("href"):void 0,n=e?e.substr(20):void 0;n&&Zt(n,function(t){var e=fe("#profile-mini-root").children().css("background-color");fe("#profile-mini-root").children().children("[class^=profile-mini-_userProfileWrapper]").append(`
<div id="bingwa-mini-profile" class="border-round" style="overflow: hidden; width:254px; height:26px; position: absolute; right: -6px; top: -2px; z-index: 1; color: #fff ;background-image: linear-gradient(${e},#888 25%,${e}); border: 1px solid #000; margin: 5px; text-align: center;">
<div id="bingwa-mini-profile-bs" style="float: left; width:112px; height:16px; background-color: ${ye.purple}; border: 1px solid #000; margin: 4px 2px 4px 4px; text-align: center;"></div>
<div id="bingwa-mini-profile-hp" style="float: left; width:104px; height:16px; background-color: #fff; border: 1px solid #000; margin: 4px 2px; text-align: center;"></div>
<div id="bingwa-mini-profile-attack" style="float: left; width:16px; height:16px; background-color: ${ye.red}; border: 1px solid #000; margin: 4px 4px 4px 2px; text-align: center;"></div>
</div>`);e=`/loader.php?sid=attack&user2ID=${n}`;fe("#bingwa-mini-profile-attack").html(`<div style="padding: 2px 0px; text-shadow: none;"><a href="${e}" style="color:#fff;text-decoration: none;">打</a></div>`),Jt("battlestats",n,t.estimate_bs),fe("#bingwa-mini-profile-bs").html(`<div style="padding: 2px 0px;">${t.estimate_bs_display}</div>`);let a=parseInt(100*t.life.current/t.life.maximum);100<a&&(a=100);e=t.life.current+"/"+t.life.maximum+" ("+a+"%)";a<=66?fe("#bingwa-mini-profile-hp").html(Yt(16,a,"#c0542f","#fff",e)):fe("#bingwa-mini-profile-hp").html(Yt(16,a,"#5d9525","#fff",e)),fe("#bingwa-mini-profile-last").html(`<div style="padding: 2px 0px;">${t.last_action_details}</div>`)})}},500),withdrawal_helper&&ce(),hide_cloud_while_flying&&0<fe("#plane").length&&(fe("#clouds-1").remove(),fe("#clouds-2").remove(),fe("#clouds-3").remove(),fe("#plane").children().remove()),bigger_screen_on_laptop&&0<fe(".computer-wrap").length&&(fe(".computer-navigation").insertBefore(".computer-wrap"),fe("#computer-content-wrapper").insertBefore(".computer-wrap"),fe(".computer-wrap").css("visibility","hidden"),fe(".computer-navigation").attr("style","position: unset; margin-bottom: 10px;"),fe("#computer-content-wrapper").removeClass("left"),fe("#computer-content-wrapper").css("margin","auto")),0<=window.location.href.indexOf("loader.php?sid=racing")&&setInterval(function(){fe(".bar-tpl-wrap:not([show-value])").each(function(t,e){let a=0,n=0,i=0;i=fe(e).hasClass("negative")?(a=parseFloat(fe(e).find(".progress-light-gray")[0].style.width),n=parseFloat(fe(e).find(".progress-red")[0].style.width),a=parseFloat(a*n/100),a-n):fe(e).hasClass("positive")?(n=parseFloat(fe(e).find(".progress-light-gray")[0].style.width),a=parseFloat(fe(e).find(".progress-light-green")[0].style.width),n=parseFloat(a*n/100),a-n):(n=parseFloat(fe(e).find(".progress-")[0].style.width),0),fe(e).css("line-height","17px").css("margin-top","0px").css("width","88px").html("<span style='color: gray'>"+n.toFixed(2)+"</span>"+(0<=i?" + ":" - ")+Math.abs(i).toFixed(2)),fe(e).css("color",0<=i?"green":"red"),fe(e).attr("show-value","show-value")})},500),0<=window.location.href.indexOf("shops.php?step=bitsnbobs")&&fe(".buy-flexslider input[name^=buyAmount]").val("100"),0<=window.location.href.indexOf("factions.php?step=your")){class t{constructor(){this.data=null,this.error=null,this.whitelist=new Set,this.load()}async load(){try{var t=await te("https://bingwa-api.tornsmth.website/faction-loan/data.json"),e=JSON.parse(t),a=e.expire,n=Math.floor((new Date).getTime()/1e3);!a||a<n?this.error="数据过期":this.data=e.data}catch(t){this.error=t.toString(),console.log("Fail to load loan data:",t)}}}const xe=new t;function g(t){t=t.match(/\[(\d+)\]$/);const e=t?t[1]:"";return e.match(/^\d+$/)?parseInt(fe(`ul.money-depositors > li.depositor[user-id=${e}] div.amount [data-value]`).attr("data-value")):0}function x(){var t=JSON.parse(fe("#websocketConnectionData").text());return t.playername+" ["+t.userID+"]"}function v(e,a){const n=g(a);if(void 0===n||isNaN(n))e.text("").append(`<span>${a}</span><span class ='right'>$error</span>`);else{let t="$"+n;0!=n&&(t=n.toString().replace(/\d{1,3}(?=(\d{3})+$)/g,function(t){return t+","}).replace(/^[^\$]\S+/,function(t){return"$"+t})),t.includes("-")?e.text("").append(`<span>${a}</span><span class ='t-red right'>${t}</span>`):e.text("").append(`<span>${a}</span><span class ='right'>${t}</span>`)}}function w(){const i=fe(".money-wrap").children(".give-block"),a="give-money",o="array";function r(){fe(".button-wrap").remove(),t()}function t(){const n=Xt(a,o);var t=function(){let a=`<div class="button-wrap" style="margin:2px;">
<span id="deposit-self" class="border-round" style="display:inline-block; cursor:pointer; margin:2px; padding:3px; color:white; background-color:${ye.purple};">给自己</span>`;return n.forEach((t,e)=>{a+=(t=t,`<span id="deposit${e}" class="deposit-money-btn border-round" style="display:inline-block; cursor:pointer; margin:2px; padding:3px; color:white; background-color:${ye.blue};">${t.button_name}</span>`)}),a+=`<span id="deposit-add" class="border-round" style="display:inline-block; cursor:pointer; margin:2px; padding:3px; color:white; background-color:${ye.green};">+</span>
<span id="deposit-all" class="border-round" style="display:inline-block; cursor:pointer; margin:2px; padding:3px; color:white; background-color:${ye.blue};">全取</span>
<span id="deposit-remove" class="border-round" style="display:inline-block; cursor:pointer; margin:2px; padding:3px; color:white; background-color:${ye.red};">x</span>
</div>`,a}();i.before(t),fe("#deposit-add").click(()=>{0<fe("#deposit-input").length||(fe("#deposit-add").html('<span style="display: inline-block;"><input id="deposit-input" type="text" class="border-round"></input>'),fe("#deposit-input").tornInputMoney({groupMoneyClass:null}),fe("#deposit-input").focus(),fe("#deposit-input").blur(()=>{var t=fe("#deposit-input").val();let e=n;e.push({button_name:`取${function t(e){return e<0?"-"+t(-e):0==e?"0":e<=1?parseFloat((100*e).toFixed(2))+"%":e<1e3?""+parseInt(e):1e3<=e&&e<1e6?parseFloat((e/1e3).toFixed(2))+"k":1e6<=e&&e<1e9?parseFloat((e/1e6).toFixed(2))+"m":1e9<=e&&e<1e12?parseFloat((e/1e9).toFixed(2))+"b":1e12<=e&&e<1e15?parseFloat((e/1e12).toFixed(2))+"t":1e15<=e?"MAX":"error"}(Bt("$"+t))}`,"button-value":t}),Jt(a,o,e),r()}))}),fe("#deposit-remove").click(()=>{fe("#deposit-remove").hasClass("deposit-removing")?(fe(".deposit-money-btn").css("background-color",ye.blue),fe(".deposit-money-btn").removeClass("deposit-removing"),fe("#deposit-remove").css("background-color",ye.red),fe("#deposit-remove").removeClass("deposit-removing")):(fe(".deposit-money-btn").css("background-color",ye.red),fe(".deposit-money-btn").addClass("deposit-removing"),fe("#deposit-remove").css("background-color",ye.salmon),fe("#deposit-remove").addClass("deposit-removing"))}),fe("#deposit-self").click(()=>{fe("input#money-user").val(x()).addClass("chosen")}),n.forEach((t,e)=>{fe(`#deposit${e}`).click(()=>{if(fe(`#deposit${e}`).hasClass("deposit-removing")){let t=n;return t.splice(e,1),Jt(a,o,t),void r()}i.children(".inputs-wrap").children(".input-money-group").addClass("success").children("input").attr("value",t["button-value"]),i.children(".inputs-wrap").children(".radio-wp").children(".btn-wrap").children(".btn").children().attr("disabled",!1).removeClass("disabled"),i.children(".inputs-wrap").children(".radio-wp").find("#give-money").click()})}),fe("#deposit-all").click(()=>{const e=fe("#money-user").val();if(""===e)alert("全取请先输入玩家ID");else{let t=g(e);var a;t<0&&"string"==typeof e&&!xe.error&&xe.data&&((a=e.match(/\[(\d+)\]$/))&&(a=a[1],a=xe.data[a]||0,t+=a)),0<t&&(i.children(".inputs-wrap").children(".input-money-group").addClass("success").children("input").attr("value",Rt(t)),i.children(".inputs-wrap").children(".radio-wp").children(".btn-wrap").children(".btn").children().attr("disabled",!1).removeClass("disabled"))}})}Xt(a,o)||Jt(a,o,[{button_name:"取1m","button-value":"1,000,000"},{button_name:"取5m","button-value":"5,000,000"},{button_name:"取10m","button-value":"10,000,000"},{button_name:"取25m","button-value":"25,000,000"}]),fe(".button-wrap").length<1&&t()}setInterval(function(){if(0!==fe("#before-value").length){const i=fe("#money-user").val();if("string"==typeof i){var e=i.match(/\[(\d+)\]$/);if(e){var a=e[1];fe("#username-value").html(`<div style="padding: 3px 0px;">${fe("#money-user").val()}</div>`);var n=g(i);0<=n?(fe("#before-value").css("background-color","var(--default-green-color)").html(`<div style="padding: 3px 0px;">${Bt(n)}</div>`),fe("#before-title").css("color","var(--default-green-color)")):(fe("#before-value").css("background-color","var(--default-red-color)").html(`<div style="padding: 3px 0px;">${Bt(n)}</div>`),fe("#before-title").css("color","var(--default-red-color)"));e=Rt(fe(".money-wrap").find(".count.input-money").first().val()),n=n-e;0<=n?(fe("#after-value").css("background-color","var(--default-green-color)").html(`<div style="padding: 3px 0px;">${Bt(n)}</div>`),fe("#after-title").css("color","var(--default-green-color)")):(fe("#after-value").css("background-color","var(--default-red-color)").html(`<div style="padding: 3px 0px;">${Bt(n)}</div>`),fe("#after-title").css("color","var(--default-red-color)"));let t=0<=n;!xe.error&&xe.data?(e=xe.data[a]||0,-n<=e?(t=!0,fe("#loan-value").css("background-color","var(--default-green-color)").html(`<div style="padding: 3px 0px;">${Bt(e)}</div>`),fe("#loan-title").css("color","var(--default-green-color)")):(fe("#loan-value").css("background-color","var(--default-red-color)").html(`<div style="padding: 3px 0px;">${Bt(e)}</div>`),fe("#loan-title").css("color","var(--default-red-color)"))):xe.error?(fe("#loan-value").css("background-color","var(--default-red-color)").html(`<div style="padding: 3px 0px;">加载失败: ${xe.error}</div>`),fe("#loan-title").css("color","var(--default-red-color)")):(fe("#loan-value").css("background-color","var(--default-blue-color)").html('<div style="padding: 3px 0px;">正在加载</div>'),fe("#loan-title").css("color","var(--default-blue-color)")),"checked"!==fe(".money-wrap .give-block .inputs-wrap .radio-wp #give-money").attr("checked")&&(t=!0),xe.whitelist.has(a)&&(t=!0),fe(".money-wrap .give-block .action-confirm .btn-wrap button").attr("disabled",!t),t?fe("#bw-check-loan").hide():fe("#bw-check-loan").show().attr("data-uid",a)}}}},1e3);function _(e,a,n){let i=Bt(a);if(0<=a){let t=100*a/n;"准备金率"==e&&(t=Math.min(100*a,100),i=(100*a).toFixed(2)+"%"),fe("#faction_balance_li").append(`
<div style="overflow:hidden; margin:7px; border:1px solid gray;">
<div style="width:137px; height:22px; float:left; text-align:center; overflow:hidden;">${Yt(22,0,"var(--default-green-color)","var(--default-bg-panel-color)",e)}</div>
<div style="width:137px; height:22px; float:left; text-align:center; overflow:hidden;">${Yt(22,t,"var(--default-green-color)","var(--default-bg-panel-color)",i)}</div>
</div>`)}else{n=100*a/n+100;fe("#faction_balance_li").append(`
<div style="overflow:hidden; margin:7px; border:1px solid gray;">
<div style="width:137px; height:22px; float:left; text-align:center; overflow:hidden;">${Yt(22,n,"var(--default-bg-panel-color)","var(--default-red-color)",e)}</div>
<div style="width:137px; height:22px; float:left; text-align:center; overflow:hidden;">${Yt(22,0,"var(--default-red-color)","var(--default-bg-panel-color)",i)}</div>
</div>`)}}let e=new MutationObserver(function(t,e){!function(){const t=fe("div#money-user-cont").find("li.ui-custom-item");!fe("input#money-user")||"."!=fe("input#money-user").val()&&" "!=fe("input#money-user").val()||(fe("input#money-user").val(x()).addClass("chosen"),console.log(x()),v(t.children(),x())),0<t.length&&!t.children().text().includes("$")&&!t.hasClass("empty")&&t.each(function(){var t=fe(this).children().text();v(fe(this).children(),t)})}(),w(),function(){fe("div.input-money-group").attr("class","input-money-group no-max-value");const t=fe("ul.money-depositors").children("li.depositor");if(0<fe("div.give-block").length&&fe("#faction_balance_li").length<=0&&0<t.length){var e=Rt(fe(".money-wrap").children(".balance-message").children(".sum-of-deposit").text()),i=Rt(fe(".money-wrap").children(".balance-message").children(".faction-balance").text());let a=0,n=0;t.each((t,e)=>{e=parseInt(fe(e).find("span.money").attr("data-value"));0<e?a+=e:n+=e});var o=parseInt(i)+parseInt(e),r=Math.max(Math.abs(e),Math.abs(i),Math.abs(a),Math.abs(n),Math.abs(o));fe("#money").children(".balance-message").after(`
<div id="faction_balance_li" style="width:290px; border:4px solid gray; padding:5px 2px; margin:0px 0px 5px 5px; background-image: linear-gradient(rgba(209,73,78,0.2),rgba(209,73,78,0.1));"></div>
`),_("帮派余额",o,r),_("所有存款总和",e,r),_("帮派公共资金",i,r),_("正存款总和",a,r),_("负存款总和",n,r),_("准备金率",parseFloat(o/a),r)}}(),function(){const t=fe(".money-wrap").children(".give-block");0<t.length&&fe(".rest-money-wrap").length<1&&t.after(`
<div class= "rest-money-wrap" style="width:290px; border:4px solid gray; padding:5px 2px; margin:0px 0px 5px 5px; background-image: linear-gradient(rgba(209,73,78,0.2),rgba(209,73,78,0.1));">
<div style="overflow:hidden; margin:7px; border:1px solid gray;">
<div id="username-title" style="width:87px; height:22px; float:left; color: var(--default-blue-color); background-color: var(--default-bg-panel-color); text-align:center;"><div style="padding: 3px 0px;">收款人</div></div>
<div id="username-value" style="width:187px; height:22px; float:left; color: var(--default-bg-panel-color); background-color: var(--default-blue-color); text-align:center;"></div>
</div>
<div style="overflow:hidden; margin:7px; border:1px solid gray;">
<div id="before-title" style="width:137px; height:22px; float:left; color: var(--default-green-color); background-color: var(--default-bg-panel-color); text-align:center;"><div style="padding: 3px 0px;">取款前余额</div></div>
<div id="before-value" style="width:137px; height:22px; float:left; color: var(--default-bg-panel-color); background-color: var(--default-green-color); text-align:center;"></div>
</div>
<div style="overflow:hidden; margin:7px; border:1px solid gray;">
<div id="after-title" style="width:137px; height:22px; float:left; color: var(--default-green-color); background-color: var(--default-bg-panel-color); text-align:center;"><div style="padding: 3px 0px;">取款后余额</div></div>
<div id="after-value" style="width:137px; height:22px; float:left; color: var(--default-bg-panel-color); background-color: var(--default-green-color); text-align:center;"><div style="padding: 3px 0px;"></div></div>
</div>
<div style="overflow:hidden; margin:7px; border:1px solid gray;">
<div id="loan-title" style="width:137px; height:22px; float:left; color: var(--default-green-color); background-color: var(--default-bg-panel-color); text-align:center;"><div style="padding: 3px 0px;">贷款额度</div></div>
<div id="loan-value" style="width:137px; min-height:22px; float:left; color: var(--default-bg-panel-color); background-color: var(--default-green-color); text-align:center;"><div style="padding: 3px 0px;"></div></div>
</div>
</div>`)}(),function(){const t=fe(".money-wrap .give-block .action-confirm");0===t.length||0<fe("#bw-check-loan").length||(t.append('<a id="bw-check-loan" class="t-blue" style="margin-left: 10px" href="https://bingwa-api.tornsmth.website/faction-loan/view" target="_blank">手工检查贷款</a>'),fe("#bw-check-loan").click(function(){var t=fe(this).attr("data-uid");t&&xe.whitelist.add(t)}))}(),fe(".inputs-wrap .radio-wp input").removeAttr("disabled")});e.observe(document.getElementById("faction-controls"),{childList:!0,subtree:!0})}if(jailView&&0<=window.location.href.indexOf("jailview.php")){const ve="bingwa_bust";class t{constructor(t){this.refresh_callback=t;t=Ut(ve);t&&"3.0.5"===t.version?(this.info=t.info,this.conf=t.conf):(this.info={timestamp:0},this.conf={hidden:!1,prob_min:null,prob_max:null,order:"ASC",friend:"PIN",quick_bust:"ON"}),this.refreshInfo()}getBustSkill(){return this.info.level*(1+this.info.faction_perk/100)*(1+this.info.edu_perk/100)}getBustProb(t){let e=this.info.penalty;return this.info.job_perk&&(e/=2),276.536-(.73643*t+5309.59*e)/this.getBustSkill()}save(){var t,e;t=ve,e={info:this.info,conf:this.conf,version:"3.0.5"},void 0===window.localStorage||window.localStorage.setItem(t,JSON.stringify(e))}refreshInfo(){var t=Math.floor((new Date).getTime()/1e3),e=this.info.error?5:60;t-this.info.timestamp<e||(this.info={timestamp:t,error:"loading"},this.save(),new Promise(async()=>{await this.fetchInfo(),this.save(),this.refresh_callback&&this.refresh_callback()}))}increasePenalty(){"penalty"in this.info&&(this.info.penalty+=1,this.save())}async fetchInfo(){var t=Math.floor((new Date).getTime()/1e3),e=`https://api.torn.com/user/?selections=basic,perks,log&log=5360&to=${t+10}&key=${b}`;const a=await fetch(e);if(a.ok){const n=await a.json();if("error"in n)this.info={timestamp:t,error:n.error.error};else{this.info={timestamp:t},this.info.level=n.level;const i=n.faction_perks.find(t=>t.match(/bust success chance/i));this.info.faction_perk=i?parseInt(i.match(/\d+/)[0]):0,this.info.job_perk=0<=n.job_perks.indexOf("+ Easier to bust more people at once");const o=n.education_perks.find(t=>t.match(/Busting skill/i));this.info.edu_perk=o?parseInt(o.match(/\d+/)[0]):0,this.info.penalty=0;for(const r of Object.values(n.log))t-r.timestamp<=259200&&(this.info.penalty+=1/(1+(t-r.timestamp)/36e3))}}else this.info={timestamp:t,error:a.statusText}}}const we=new t(I),_e=new MutationObserver(async function(t){let e=!1;for(const a of t)for(const n of a.addedNodes)"LI"===n.tagName?e=function(t){if(fe(t).find("b.bust-score").attr("bust-score"))return!1;var e=(function(t){t=t.find("span.time").text().match(/\d+/g),t=t||[0];return t[1]?60*parseInt(t[0])+parseInt(t[1]):parseInt(t[0])}(fe(t))+180)*function(t){t=t.find("span.level").text().match(/\d+/g);return t?parseInt(t[0]):0}(fe(t));if(0==e)return!1;e=`<b class="bust-score t-red" style="margin-left: 0em" bust-score=${e}></b>`;return fe(t).find("span.reason").append(e),fe(t).removeClass("gray"),!0}(n)||e:fe(n).text().match(/You busted .* out of jail/i)&&(e=!0,we.increasePenalty());e&&I()});function k(t){const e=t.find("a.faction").attr("href");return e?e.substring(30):0}function $(){const t=fe("ul.user-info-list-wrap").children("li");t.each(function(){if(0!==fe(this).find("b.bust-score").length){var e=parseFloat(fe(this).find("b.bust-score").attr("bust-prob"));let t=!1;isNaN(e)||(null!==we.conf.prob_min&&e<we.conf.prob_min&&(t=!0),null!==we.conf.prob_max&&e>we.conf.prob_max&&(t=!0));e=k(fe(this))in me;"PIN"===we.conf.friend&&e&&(t=!1),t?fe(this).addClass("bw-hidden"):fe(this).removeClass("bw-hidden"),we.conf.friend&&e?fe(this).css("background-color","rgba(110, 160, 55, 0.15)"):fe(this).css("background-color","");const a=fe(this).children("a.bust");"ON"===we.conf.quick_bust||"ON_BOTH"===we.conf.quick_bust?a.attr("href",a.attr("href").replace(/\bstep=breakout\b/,"step=breakout1&")):a.attr("href",a.attr("href").replace(/\bstep=breakout1\b/,"step=breakout"));const n=fe(this).children("a.bye");"ON_BAIL"===we.conf.quick_bust||"ON_BOTH"===we.conf.quick_bust?n.attr("href",n.attr("href").replace(/\bstep=buy\b/,"step=buy1&")):n.attr("href",n.attr("href").replace(/\bstep=buy1\b/,"step=buy"))}}),we.conf.order&&(t.sort(function(t,e){var a=parseInt(fe(t).find("b.bust-score").attr("bust-score")),n=parseInt(fe(e).find("b.bust-score").attr("bust-score")),t=k(fe(t))in me,e=k(fe(e))in me;return"PIN"===we.conf.friend&&t!=e?Number(e)-Number(t):"ASC"===we.conf.order?a-n:n-a}),t.detach().appendTo("ul.user-info-list-wrap"))}function I(){const n=we.info,t=fe(".info-msg-cont").first();var e;t.css("background","var(--default-bg-panel-color)"),t.css("font-size","12px"),t.html(`
<div id="bust-info" style="display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 10px;"></div>
<div id="bust-conf" class="small-select-menu-wrap">
<hr />
<div style="display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 10px;">
<label style="width: 10em; display: flex; gap: 4px">
<b style="margin: auto 0">最低成功率</b>
<input id="bust-conf-prob-min" type="text" inputmode="numeric" maxlength="3" placeholder="-"
style="width: 3em; flex-grow: 1; border: 1px solid #ccc; border-radius: 4px; padding: 2px; text-align: center;">
</label>
<label style="width: 10em; display: flex; gap: 4px">
<b style="margin: auto 0">最高成功率</b>
<input id="bust-conf-prob-max" type="text" inputmode="numeric" maxlength="3" placeholder="-"
style="width: 3em; flex-grow: 1; border: 1px solid #ccc; border-radius: 4px; padding: 2px; text-align: center;">
</label>
<label style="width: 10em; display: flex; gap: 4px">
<b style="margin: auto 0">排序</b>
<div class="select-wrap dropdown-new dropdown-default" style="flex-grow: 1">
<select id="bust-conf-order">
<option value="ASC">由易到难</option>
<option value="DESC">由难到易</option>
<option value="">系统顺序</option>
</select>
<div id="bust-conf-order-list" class="select-list dropdown-content"></div>
</div>
</label>
<label style="width: 10em; display: flex; gap: 4px">
<b style="margin: auto 0">友军</b>
<div class="select-wrap dropdown-new dropdown-default" style="flex-grow: 1">
<select id="bust-conf-friend">
<option value="PIN">高亮置顶</option>
<option value="HIGHLIGHT">高亮</option>
<option value="">不高亮</option>
</select>
<div id="bust-conf-friend-list" class="select-list dropdown-content"></div>
</div>
</label>
<label style="width: 10em; display: flex; gap: 4px">
<b style="margin: auto 0">免确认</b>
<div class="select-wrap dropdown-new dropdown-default" style="flex-grow: 1">
<select id="bust-conf-quick-bust">
<option value="ON">Bust</option>
<option value="ON_BAIL">Bail</option>
<option value="ON_BOTH">全部</option>
<option value="">无</option>
</select>
<div id="bust-conf-quick-bust-list" class="select-list dropdown-content"></div>
</div>
</label>
</div>
</div>
`),null!==we.conf.prob_min&&fe("#bust-conf-prob-min").val(we.conf.prob_min),null!==we.conf.prob_max&&fe("#bust-conf-prob-max").val(we.conf.prob_max),fe("#bust-conf-order").val(we.conf.order),fe("#bust-conf-friend").val(we.conf.friend),fe("#bust-conf-quick-bust").val(we.conf.quick_bust),Qt(fe("#bust-conf-prob-min"),t=>/^\d*$/.test(t)),Qt(fe("#bust-conf-prob-max"),t=>/^\d*$/.test(t)),fe("#bust-conf input").change(D),fe("#bust-conf select").change(D),"loading"===n.error?fe("#bust-info").html("<span>正在读取 Bust 历史,请稍等。若 5 秒内未出结果,请刷新页面重试。</span>"):"Access level of this key is not high enough"===n.error?fe("#bust-info").html(`
<span class="t-red">权限不足,无法读取 Bust 惩罚!</span>
<a href="/preferences.php#tab=api">请使用 Full Access 类型的 API Key</a>
`):n.error?fe("#bust-info").html(`<span class="t-red">出错啦!${n.error}</span>`):(e=n.job_perk?"惩罚效果减半":"无",fe("#bust-info").html(`
<span style="width: 10em"><b>Bust 惩罚</b>: ${n.penalty.toFixed(2)}</span>
<span style="width: 10em" title><b>Bust 技能</b>: ${we.getBustSkill().toFixed(2)}</span>
<span style="width: 10em"><b>工作特技</b>: ${e}</span>
`),fe("#bust-info").tooltip({tooltipClass:"white-tooltip",content:function(){var t=50===n.faction_perk?"50%":`<span class="t-red">${n.faction_perk}%</span>`,e=65===n.edu_perk?"65%":`<span class="t-red">${n.edu_perk}%</span>`;return`个人等级: ${n.level}<br>帮派加成: ${t}<br>教育加成: ${e}`}})),fe("#bust-info").append('<a id="bust-info-toggle-conf" style="margin-left: auto" href="javascript: void">显示选项</a>'),S(we.conf.hidden),fe("#bust-info-toggle-conf").click(function(){we.conf.hidden=!we.conf.hidden,we.save(),S(we.conf.hidden)}),fe("b.bust-score").each(function(){var e=fe(this).attr("bust-score");if(e){let t="t-red";if(n.error)fe(this).text(` ${e}`),fe(this).removeAttr("bust-prob");else{const a=we.getBustProb(e);t=120<=a?"t-gray-9":100<=a?"t-green":80<=a?"t-yellow":0<=a?"t-red":"t-red bg-red active",fe(this).html(` ${e}&nbsp;&nbsp;${a.toFixed(1)}%`),fe(this).attr("bust-prob",a.toFixed(1))}fe(this).attr("class",`bust-score ${t}`)}}),$()}function S(t){t?(fe("#bust-info-toggle-conf").text("显示选项"),fe("#bust-conf").hide()):(fe("#bust-info-toggle-conf").text("隐藏选项"),fe("#bust-conf").show())}function D(){var t=fe("#bust-conf-prob-min").val();we.conf.prob_min=t?parseInt(t):null;t=fe("#bust-conf-prob-max").val();we.conf.prob_max=t?parseInt(t):null,we.conf.order=fe("#bust-conf-order").val(),we.conf.friend=fe("#bust-conf-friend").val(),we.conf.quick_bust=fe("#bust-conf-quick-bust").val(),we.save(),$()}_e.observe(document.getElementsByClassName("userlist-wrapper")[0],{childList:!0,characterData:!0,subtree:!0})}if(crimeView&&0<=window.location.href.indexOf("loader.php?sid=crimes")&&setInterval(function(){window.location.href.endsWith("#/")?function(){if(!(0<fe(".bw-crime1-prob").length)){const t=fe('.crimes-hub-crime[href="#/searchforcash"] path.CircularProgressbar-path');if(0<t.length){let a=-1,n;if(t.each(function(){var t=(fe(this).css("stroke-dasharray")||"").match(/([\d.]+)px/),e=(fe(this).css("stroke-dashoffset")||"").match(/([\d.]+)px/),t=100-Math.round(parseFloat(e[1])/parseFloat(t[1])*100);t>a&&t<=100&&(a=t,n=this)}),n){const e=fe(n).closest("svg").parent();e.append(`<div class="bw-crime1-prob t-green" style="font-size: 0.8em; background: white; text-align: center">${a}%</div>`),e.css("overflow","visible")}}}}():window.location.href.endsWith("#/searchforcash")&&function(){if(!(0<fe(".bw-crime1-prob").length)){const i=fe("div[class*='crimeOption___']");let n=-1;const o=[];i.each(function(){if(!(0<fe(this).find("button[disabled]").length)){const e=fe(this).find("div[class*='densityTooltipTrigger___']").attr("aria-label")||"";var t=e.match(/\((\d+)%\)$/);if(t){t=parseInt(t[1]);const a=fe(this).find("div").filter(function(){var t=this.childNodes[0];return t&&3===t.nodeType});o.push({$ele:a.first().contents().first(),prob:t}),t>n&&(n=t)}}});for(var{$ele:t,prob:e}of o){var a=e===n?"t-green":"t-gray-c";t.after(`<span class="bw-crime1-prob ${a}" style="margin-left: auto">${e}%<span>`)}}}()},1e3),gym_show_ratio&&0<=window.location.href.indexOf("gym.php")){const ke={0:{name:"balanced",description:"平衡比例",str:100,def:100,spd:100,dex:100},1:{name:"hank-str",description:"Hank比例-Str最高",str:100,def:80,spd:28,dex:80},2:{name:"hank-def",description:"Hank比例-Def最高",str:80,def:100,spd:80,dex:28},3:{name:"hank-spd",description:"Hank比例-Spd最高",str:28,def:80,spd:100,dex:80},4:{name:"hank-dex",description:"Hank比例-Dex最高",str:80,def:28,spd:80,dex:100},5:{name:"baldr-str",description:"Baldr比例-Str最高",str:100,def:72,spd:80,dex:72},6:{name:"baldr-def",description:"Baldr比例-Def最高",str:72,def:100,spd:72,dex:80},7:{name:"baldr-spd",description:"Baldr比例-Spd最高",str:80,def:72,spd:100,dex:72},8:{name:"baldr-dex",description:"Baldr比例-Dex最高",str:72,def:80,spd:72,dex:100}},$e={1:{name:"Premier Fitness",stage:1,cost:10,energy:5,strength:20,speed:20,defense:20,dexterity:20,note:""},2:{name:"Average Joes",stage:1,cost:100,energy:5,strength:24,speed:24,defense:27,dexterity:24,note:""},3:{name:"Woody's Workout Club",stage:1,cost:250,energy:5,strength:27,speed:32,defense:30,dexterity:27,note:""},4:{name:"Beach Bods",stage:1,cost:500,energy:5,strength:32,speed:32,defense:32,dexterity:0,note:""},5:{name:"Silver Gym",stage:1,cost:1e3,energy:5,strength:34,speed:36,defense:34,dexterity:32,note:""},6:{name:"Pour Femme",stage:1,cost:2500,energy:5,strength:34,speed:36,defense:36,dexterity:38,note:""},7:{name:"Davies Den",stage:1,cost:5e3,energy:5,strength:37,speed:0,defense:37,dexterity:37,note:""},8:{name:"Global Gym",stage:1,cost:1e4,energy:5,strength:40,speed:40,defense:40,dexterity:40,note:""},9:{name:"Knuckle Heads",stage:2,cost:5e4,energy:10,strength:48,speed:44,defense:40,dexterity:42,note:""},10:{name:"Pioneer Fitness",stage:2,cost:1e5,energy:10,strength:44,speed:46,defense:48,dexterity:44,note:""},11:{name:"Anabolic Anomalies",stage:2,cost:25e4,energy:10,strength:50,speed:46,defense:52,dexterity:46,note:""},12:{name:"Core",stage:2,cost:5e5,energy:10,strength:50,speed:52,defense:50,dexterity:50,note:""},13:{name:"Racing Fitness",stage:2,cost:1e6,energy:10,strength:50,speed:54,defense:48,dexterity:52,note:""},14:{name:"Complete Cardio",stage:2,cost:2e6,energy:10,strength:55,speed:57,defense:55,dexterity:52,note:""},15:{name:"Legs, Bums and Tums",stage:2,cost:3e6,energy:10,strength:0,speed:55,defense:55,dexterity:57,note:""},16:{name:"Deep Burn",stage:2,cost:5e6,energy:10,strength:60,speed:60,defense:60,dexterity:60,note:""},17:{name:"Apollo Gym",stage:3,cost:75e5,energy:10,strength:60,speed:62,defense:64,dexterity:62,note:""},18:{name:"Gun Shop",stage:3,cost:1e7,energy:10,strength:65,speed:64,defense:62,dexterity:62,note:""},19:{name:"Force Training",stage:3,cost:15e6,energy:10,strength:64,speed:65,defense:64,dexterity:68,note:""},20:{name:"Cha Cha's",stage:3,cost:2e7,energy:10,strength:64,speed:64,defense:68,dexterity:70,note:""},21:{name:"Atlas",stage:3,cost:3e7,energy:10,strength:70,speed:64,defense:64,dexterity:65,note:""},22:{name:"Last Round",stage:3,cost:5e7,energy:10,strength:68,speed:65,defense:70,dexterity:65,note:""},23:{name:"The Edge",stage:3,cost:75e6,energy:10,strength:68,speed:70,defense:70,dexterity:68,note:""},24:{name:"George's",stage:3,cost:1e8,energy:10,strength:73,speed:73,defense:73,dexterity:73,note:""},25:{name:"Balboas Gym",stage:4,cost:5e7,energy:25,strength:0,speed:0,defense:75,dexterity:75,note:"Requirements must be maintained to preserve access to this gym"},26:{name:"Frontline Fitness",stage:4,cost:5e7,energy:25,strength:75,speed:75,defense:0,dexterity:0,note:"Requirements must be maintained to preserve access to this gym"},27:{name:"Gym 3000",stage:4,cost:1e8,energy:50,strength:80,speed:0,defense:0,dexterity:0,note:"Requirements must be maintained to preserve access to this gym"},28:{name:"Mr. Isoyamas",stage:4,cost:1e8,energy:50,strength:0,speed:0,defense:80,dexterity:0,note:"Requirements must be maintained to preserve access to this gym"},29:{name:"Total Rebound",stage:4,cost:1e8,energy:50,strength:0,speed:80,defense:0,dexterity:0,note:"Requirements must be maintained to preserve access to this gym"},30:{name:"Elites",stage:4,cost:1e8,energy:50,strength:0,speed:0,defense:0,dexterity:80,note:"Requirements must be maintained to preserve access to this gym"},31:{name:"The Sports Science Lab",stage:4,cost:5e8,energy:25,strength:90,speed:90,defense:90,dexterity:90,note:"The use of drugs may result in the loss of membership without refunds"},32:{name:"Unknown",stage:4,cost:2147483647,energy:10,strength:100,speed:100,defense:100,dexterity:100,note:"Membership by invite only"},33:{name:"The Jail Gym",stage:0,cost:0,energy:5,strength:34,speed:34,defense:46,dexterity:0,note:""}};for(var C in fe("#gymroot").after(`
<div>
<div class="title-black m-top10 title-toggle tablet top-round faction-title active title" data-title="description" role="heading" aria-level="5">锻炼比例推荐
</div>
<div class="cont-gray bottom-rounded content" style="overflow:hidden; margin-bottom:10px;">
<div class="select-wrap" style="margin:5px; float:left">
<select id="gym-ratio" style="height:24px">
</select>
</div>
<div class="select-wrap" style="margin:5px 1px; float:left">
<p id="gym-ratio-info" style="height:12px; padding:6px 1px;">
</p>
</div>
</div>
<div class="title-black m-top10 title-toggle tablet top-round faction-title active title" data-title="description" role="heading" aria-level="5">按照当前健身房效果一枪25E超过多少钱可以放弃GYM吃SE
</div>
<div class="cont-gray bottom-rounded content" style="margin-bottom:10px;padding:4px;">
<table id="se-table" style="">
<tr><td>Strength</td><td class="value">$0</td></tr>
<tr><td>Defense</td><td class="value">$0</td></tr>
<tr><td>Speed</td><td class="value">$0</td></tr>
<tr><td>Dexterity</td><td class="value">$0</td></tr>
</table>
</div>
</div>`),fe("#se-table").find("td").attr("style","font-size: 18px; border: 4px solid darkgray; padding:6px; text-align:center;"),ke)fe("#gym-ratio").append(`<option value="${C}">${ke[C].description}</option>`);function A(t,e,a,n){const i=fe("[class^='gymContent___']").children("[class^='properties___']").children("li");var o=fe("#strength-val").text().split(",").join(""),r=fe("#defense-val").text().split(",").join(""),s=fe("#speed-val").text().split(",").join(""),l=fe("#dexterity-val").text().split(",").join(""),d=Math.max(o/t,r/e,s/a,l/n),t=Math.abs(d*t-o)<=1?o:parseInt(d*t),e=Math.abs(d*e-r)<=1?r:parseInt(d*e),a=Math.abs(d*a-s)<=1?s:parseInt(d*a),n=Math.abs(d*n-l)<=1?l:parseInt(d*n);const c=[t,e,a,n],p=[t-o,e-r,a-s,n-l];let h=0;fe(".gym-goal").remove(),i.each(function(){const t=fe(this).children("[class^='propertyContent___']").children("[class^=description___]").children("p:first");0==t.children(".gym-perks").length?t.html(`<span class="t-red gym-goal" title="目标:${Rt(c[h])}">还差:${Lt(p[h])} </span>`):t.prepend(`<span class="t-red gym-goal" title="目标:${Rt(c[h])}">还差:${Lt(p[h])} </span>`),h++})}setInterval(function(){const e=fe("[class^='gymContent___']").children("[class^='properties___']").children("li");"1"!=e.first().attr("hasdone")&&0<e.length&&(e.first().attr("hasdone","1"),new Promise((d,a)=>{var t=`https://api.torn.com/user/?selections=perks&key=${b}`;fetch(t).then(t=>t.ok?t.json():void console.log("---探测失败---"),t=>{console.log("---网络异常---")}).then(t=>{if(null!=t)if("error"in t)a(t.error);else{let a=[{},{},{},{}];for(var e in t){const l=t[e];var n,i,o,r=e.split("_")[0];for(let t=0;t<l.length;t++)0<=l[t].search(/strength gym gains/i)?(n=parseInt(/\d+%/.exec(l[t])[0].replace("%","")),a[0][r]=a[0].hasOwnProperty(r)?a[0][r]+n:n):0<=l[t].search(/defense gym gains/i)?(i=parseInt(/\d+%/.exec(l[t])[0].replace("%","")),a[1][r]=a[1].hasOwnProperty(r)?a[1][r]+i:i):0<=l[t].search(/speed gym gains/i)?(i=parseInt(/\d+%/.exec(l[t])[0].replace("%","")),a[2][r]=a[2].hasOwnProperty(r)?a[2][r]+i:i):0<=l[t].search(/dexterity gym gains/i)?(o=parseInt(/\d+%/.exec(l[t])[0].replace("%","")),a[3][r]=a[3].hasOwnProperty(r)?a[3][r]+o:o):0<=l[t].search(/gym gains/i)&&(o=parseInt(/\d+%/.exec(l[t])[0].replace("%","")),a[0][r]=a[0].hasOwnProperty(r)?a[0][r]+o:o,a[1][r]=a[1].hasOwnProperty(r)?a[1][r]+o:o,a[2][r]=a[2].hasOwnProperty(r)?a[2][r]+o:o,a[3][r]=a[3].hasOwnProperty(r)?a[3][r]+o:o)}for(let e=0;e<a.length;e++){let t=1;for(var s in a[e])t*=(a[e][s]+100)/100;a[e].total=t}d(a),console.log("perks API fetched")}else a()}).catch(t=>a(t))}).then(function(i){console.log(i);var t=$e[function(){for(let t=1;t<32;t++){const e=fe("#gym-"+t).attr("class");if(void 0===e)return 33;if(0<=e.indexOf("active"))return t}}()];const o=[(t.strength/10).toFixed(1),(t.defense/10).toFixed(1),(t.speed/10).toFixed(1),(t.dexterity/10).toFixed(1)];console.log(o);let r=0;e.each(function(){var t,e=(100*(i[r].total-1)).toFixed(2),a=(i[r].total*o[r]).toFixed(3);let n="<strong>健身房系数:</strong> +"+o[r];for(t in n+="<br><strong>系数外总加成:</strong> +"+e+"%",i[r])"total"!=t&&(n+="<br><strong>"+t+":</strong> +"+i[r][t]+"%");fe(this).children("[class^='propertyContent___']").children("[class^=description___]").children("p:first").append(`<span class="t-green gym-perks" title="${n}">实际系数: ${a} </span>`);a=function(t,e,a,n,i){let o=5e7;t<5e7&&(o=t);n=a*i*((3.480061091e-7*Math.log(n+250)+3091619094e-15)*o+682775184551527e-19*(n+250)-.0301431777),t*=.01;return e/t*n}(fe(this).children("[class^='propertyTitle___']").children("[class^='propertyValue___']").text().split(",").join(""),45e7,a,5025,25);fe("#se-table").children().children(":eq("+r+")").children(".value").text(Bt(parseInt(a))),r++})}).catch(t=>console.log("getGymPerks "+t)))},2e3);const Ie=Xt("gym-ratio","ratio_number");null!==Ie&&void 0!==Ie&&(fe("#gym-ratio").children("[value="+Ie+"]").attr("selected","true"),fe("#gym-ratio-info").text(`Str : Def : Spd : Dex = ${ke[Ie].str} : ${ke[Ie].def} : ${ke[Ie].spd} : ${ke[Ie].dex}`),setInterval(()=>{0<fe("[class^='gymContent___']").length&&A(ke[Ie].str,ke[Ie].def,ke[Ie].spd,ke[Ie].dex)},2e3)),fe("#gym-ratio").change(function(){console.log("ratio changed");var t=fe("#gym-ratio").val();Jt("gym-ratio","ratio_number",t),fe("#gym-ratio-info").text(`Str : Def : Spd : Dex = ${ke[t].str} : ${ke[t].def} : ${ke[t].spd} : ${ke[t].dex}`),A(ke[t].str,ke[t].def,ke[t].spd,ke[t].dex)})}if(noAssisting&&0<=window.location.href.indexOf("loader.php?sid=attack&user2ID")){let e=Math.floor(30*Math.random()+1),a=300;const Se=setInterval(function(){const t=fe("[class^='btn_']");t.text().includes("Start fight")&&(t.prop("hidden",!0),t.parent().parent().children(":first").text("Wait ("+(e/10).toFixed(1)+")s To Start fight"),0==e&&(clearInterval(Se),t.parent().parent().children(":first").text(""),t.removeAttr("hidden")),e--)},100),De=setInterval(function(){const t=fe("[class^='btn_']");t.text().includes("Join fight")&&(t.prop("hidden",!0),t.parent().parent().children(":first").text("Wait ("+(a/10).toFixed(1)+")s To Join fight 已有其他人进入此战斗"),0==a&&(clearInterval(De),t.parent().parent().children(":first").text(""),t.removeAttr("hidden")),a--)},100)}if(0<=window.location.href.indexOf("loader.php?sid=attack&user2ID")){let i=100;setInterval(function(){{var t,e,a,n;0<fe("[class^=level]").length&&0<fe("#log-header").length&&(n=fe("[class^=level]").attr("style").replace("height: ","").replace("%",""),(t=parseFloat(n))>i||(e=66<=(i=t)?"green":"red",a=66<=t?"高":"低",fe("#stealth-value").remove(),n=fe("#log-header").children(":first").attr("class"),fe("#log-header").children(":first").after(`
<span id="stealth-value" class="${n}">隐身几率:&nbsp;
<span class="t-${e}">${a}</span>
&nbsp;Stealth:&nbsp;
<span class="t-${e}">${t}%</span>
</span>`)))}},500)}{function M(){const t=fe("#defender_Primary").siblings().last(),e=fe("#defender_Secondary").siblings().last(),a=fe("#defender_Melee").siblings().last();0<t.length&&(clearInterval(n),T(t,0),T(e,100),T(a,200))}function T(e,a){const t=e.children().children();t.each(function(){var t=fe(this).attr("title");0<t.length&&e.parent().parent().parent().parent().append(`
<div style="position: absolute; z-index: 1; top: ${a}px; right: -420px; width: 400px; height: 42px; margin: 2px; border: 2px solid #000; background-color: ${ye.purple}; color: #eee; text-align: center;line-height: 20px;">${t}</div>`),a+=50})}0<=window.location.href.indexOf("loader.php?sid=attack&user2ID")&&(n=setInterval(M,1e3))}{function M(){const t=fe("[class^='playersModelWrap___']").find("[class^='topWrap___']");2==t.length&&(clearInterval(a),t.each(function(){fe(this).children(":first").after('<span class="bw-hp-percent"></span>')}))}0<=window.location.href.indexOf("loader.php?sid=attack&user2ID")&&(a=setInterval(M,1e3),setInterval(function(){const t=fe(".bw-hp-percent");2==t.length&&t.each(function(){var t=fe(this).siblings("span[class^='userName___']").text();const e=fe(this).siblings("div[class^='textEntries___']").find("[id^='player-health-value_']").text();var a=(e.split("/")[0].replace(",","").trim()/e.split("/")[1].replace(",","").trim()*100).toFixed(2);t&&a&&fe(this).text(` (${a}%)`)})},1e3))}if(0<=window.location.href.indexOf("loader.php?sid=attack&user2ID")){const Ce=setInterval(function(){0<fe("[class^=playerWindow___]").length&&fe("#lower-layer").length<1&&(function(t,a){const e=window.location.href.substring(51),n=fe("[class^=modal___]").css("background-color");t.last().append(`
<div id="${a}" class="border-round" style="overflow: hidden; width:228px; height:26px; position: absolute; right: 0px; top: -2px; z-index: 9; color: #fff ;background-image: linear-gradient(${n},#888 25%,${n}); border: 1px solid #000; margin: 5px; text-align: center;">
<div id="${a}-online" style="float: left; width:44px; height:16px; background-color: ${ye.blue}; border: 1px solid #000; margin: 4px 2px 4px 4px; text-align: center;"><div style="padding: 2px 0px">检测中</div></div>
<div id="${a}-last" style="float: left; width:126px; height:16px; background-color: ${ye.blue}; border: 1px solid #000; margin: 4px 2px; text-align: center;"><div style="padding: 2px 0px">检测中</div></div>
<div id="${a}-refresh-btn" style="cursor: pointer; float: left; width:36px; height:16px; background-color: ${ye.red}; border: 1px solid #000; margin: 4px 4px 4px 2px; text-align: center;"><div style="padding: 2px 0px">刷新</div></div>
</div>`),fe("#"+a+"-refresh-btn").click(()=>{location.reload()}),Zt(e,function(t){var e;null!=t&&"last_action"in t?("Online"==(e=t.last_action.status)?fe("#"+a+"-online").css("background-color",ye.green):"Idle"==e?fe("#"+a+"-online").css("background-color",ye.yellow):fe("#"+a+"-online").css("background-color",ye.gray),fe("#"+a+"-online").children().text(e),fe("#"+a+"-last").children().text(t.last_action_details)):"error"in t&&fe("#"+a+"-last").children().text("API读取失败")},function(t){fe("#"+a+"-last").children().text("蛙蛙探测 "+e+" 失败 "+t)})}(fe("[class^=playerWindow___]"),"lower-layer"),clearInterval(Ce))},500)}if(nurse_suggestion&&0<=window.location.href.indexOf("item.php")&&pe(".tutorial-cont"),0<=window.location.href.indexOf("factions.php?step=your")){class t{constructor(){this.sharedSet=null,this.lastActions=null,this.error=null,this.load().then(()=>{he(this)})}async load(){try{var t,e,a=await te("https://bingwa-api.tornsmth.website/faction-armory/armory.json"),n=await(await fetch(`https://api.torn.com/faction/?selections=basic&key=${b}`)).json(),i=JSON.parse(a),o=i.expire,r=Math.floor((new Date).getTime()/1e3);if(!o||o<r)this.error="数据过期";else{this.sharedSet=new Set;for(var[s,l]of Object.entries(i.armory))l.shared&&this.sharedSet.add(s)}this.lastActions={};for([t,e]of Object.entries(n.members))this.lastActions[t]=e.last_action.timestamp}catch(t){this.sharedSet=null,this.lastActions=null,this.error=t.toString(),console.log("Fail to load faction armory data:",t)}}}const Ae=new t;let e=new MutationObserver(function(t,e){console.log("changed"),pe("#faction-armoury-tabs"),he(Ae)});e.observe(document.getElementById("faction-armoury"),{childList:!0,subtree:!0})}if(taking_off_reminder&&0<=window.location.href.indexOf("travelagency.php")&&(0<fe("li[class^=icon86__]").length&&(fe("#tab-menu4").after(`<div><div id='oc-btn' type='button' style='cursor:pointer;width:inherit;font-size:24px;margin:auto;padding:10px;border:5px solid gray;
background-color:NavajoWhite;text-align:center;'>OC准备就绪 点击前往执行</div></div>`),fe("#oc-btn").click(function(){fe(this).text("蛙蛙正在前往……"),window.location.href="https://www.torn.com/factions.php?step=your#/tab=crimes"})),0<fe("li[class^=icon49__]").length?fe("#tab-menu4").after(`<div><div id='drug-btn' type='button' style='cursor:pointer;width:inherit;font-size:24px;margin:auto;padding:10px;border:5px solid gray;
background-color:#c0542f;text-align:center;'>DRUG CD 小于10分钟 先不要飞了哦</div></div>`):0<fe("li[class^=icon50__]").length?fe("#tab-menu4").after(`<div><div id='drug-btn' type='button' style='cursor:pointer;width:inherit;font-size:24px;margin:auto;padding:10px;border:5px solid gray;
background-color:#DAA520;text-align:center;'>DRUG CD 不足1小时 先不要飞了哦</div></div>`):0<fe("li[class^=icon51__]").length?fe("#tab-menu4").after(`<div><div id='drug-btn' type='button' style='cursor:pointer;width:inherit;font-size:24px;margin:auto;padding:10px;border:5px solid gray;
background-color:#5d9525;text-align:center;'>DRUG CD 为1-2小时之间 可尽情飞翔</div></div>`):0<fe("li[class^=icon52__]").length?fe("#tab-menu4").after(`<div><div id='drug-btn' type='button' style='cursor:pointer;width:inherit;font-size:24px;margin:auto;padding:10px;border:5px solid gray;
background-color:#5d9525;text-align:center;'>DRUG CD 为2-5小时之间 可尽情飞翔</div></div>`):0<fe("li[class^=icon53__]").length?fe("#tab-menu4").after(`<div><div id='drug-btn' type='button' style='cursor:pointer;width:inherit;font-size:24px;margin:auto;padding:10px;border:5px solid gray;
background-color:#5d9525;text-align:center;'>DRUG CD 大于5小时 可尽情飞翔</div></div>`):fe("#tab-menu4").after(`<div><div id='drug-btn' type='button' style='cursor:pointer;width:inherit;font-size:24px;margin:auto;padding:10px;border:5px solid gray;
background-color:#5d9525;text-align:center;'>DRUG CD 为零 是不是忘吃药了</div></div>`),async function(){try{var t=await(await fetch(`https://api.torn.com/user/?selections=icons&key=${b}`)).json();const e=t.icons.icon85||t.icons.icon86;if(!e)return;const[,a,n]=e.split("-").map(t=>t.trim());if(a.match(/Blackmail|Kidnapping|Bomb Threat/i))return;const o=function(t){var e={day:86400,hour:3600,minute:60,second:1};let a=0;for(const i of Object.keys(e)){var n=t.match(new RegExp(`(\\d+) *${i}`,"i"));n&&(a+=parseInt(n[1])*e[i])}return a}(n);fe(".travel-wrap").each(function(){if(0!==fe(this).find(".flight-time").length){const a=fe(this).find(".flight-time").text().split("-")[1];var[t,e]=a.trim().split(":"),t=3600*parseInt(t)+60*parseInt(e),e=o-2*t;if(!(7200<=e)){const n=fe(this).find(".travel-confirm .travel-info-btn");t=0<e?"OC 即将结束,请注意飞行时间,及时返程":0<o?"OC 即将结束,现在起飞将无法及时返程。还要坚持起飞吗?":"OC 已经结束,建议与队友沟通并在城中等待 OC 完成。即使耽误 OC 也要坚持起飞吗?";const i=fe(`<button class="bw-oc-reminder-btn torn-btn btn-dark-bg"
style="border: solid red" data-msg="${t}">注意 OC</button>`);e<=0&&i.attr("data-confirm",!0),n.hide(),i.insertBefore(n).click(ge)}}});const i=new MutationObserver(async function(t){for(const e of t)fe(e.addedNodes).find("button.bw-oc-reminder-btn").click(ge)});i.observe(fe(".travel-agency")[0],{childList:!0,subtree:!0})}catch(t){console.trace("Error in rendering OC reminder",t)}}()),0<=window.location.href.indexOf("factions.php?step=")){setInterval(function(){fe("div.title").children("div.id").text("BS");const t=fe("li.enemy,li.your").children("div.id");0<t.length&&t.each(function(t,e){const a=fe(this).siblings("span").children("div.member").children("a.user.name"),n=a?a.attr("href"):void 0;var i=n?n.substr(18):void 0;i&&((i=Me.get(i))?fe(this).text(O(i)):fe(this).text("nil"))});const e=fe(".faction-war li[class^='enemy']").parent(),a=fe(".faction-war li[class^='enemy']").children("div.attack").children();0<a.length&&a.each(function(){if("1"!=fe(this).attr("detected")){const e=fe(this).closest("li[class^='enemy']").find('div.member a[href^="/profiles.php?XID="]'),a=e?e.attr("href"):void 0;var t=a?a.substr(18):void 0;console.log(t),t&&((t=Me.get(t))?(fe(this).text(O(t)),fe(this).attr("bs",t)):fe(this).attr("bs",0))}fe(this).attr("detected","1")});0<e.length&&"1"!=e.attr("hasdone")&&(e.attr("hasdone","1"),function(t,a){const e=t.parent().siblings(),n=t.parent().siblings().children();t.click(function(){"decend"==fe(this).attr("sort")?(n.sort(function(t,e){return a(t)-a(e)}),n.detach().appendTo(e),fe(this).attr("sort","ascend")):(n.sort(function(t,e){return a(e)-a(t)}),n.detach().appendTo(e),fe(this).attr("sort","decend"))})}(e.siblings().children("div[class^='attack left attack___']"),F))},3e3);class t{constructor(){this.wawa_cache=Ut("battlestats")||{};const t=Ut("BINGWA_TARGET")||[];this.bw_target_cache=Object.assign({},...t.map(t=>({[parseInt(t.ID)]:t.TOTAL})))}get(t){return this.bw_target_cache[t]||this.wawa_cache[t]}}const Me=new t;function F(t){return fe(t).find("[bs]").attr("bs")}function O(t){return 1e15<=t?"max":1e13<=t?parseInt(t/1e12)+"t":1e12<=t?(t/1e12).toFixed(1)+"t":1e10<=t?parseInt(t/1e9)+"b":1e9<=t?(t/1e9).toFixed(1)+"b":1e7<=t?parseInt(t/1e6)+"m":1e6<=t?(t/1e6).toFixed(1)+"m":1e4<=t?parseInt(t/1e3)+"k":1e3<=t?(t/1e3).toFixed(1)+"k":t}let a=setInterval(E,3e3);setInterval(function(){const t=fe("[class^='status-wrap territoryBoxWp___']"),e=t.children(".ttwar-time");0<t.length&&0<e.length&&t.each(function(){var t=fe(this).find(".timer").text().split("(")[0],e=parseInt(fe(this).find(".swords-icon").parent().text()),a=parseInt(fe(this).find(".shield-icon").parent().text());const n=fe(this).find(".score").text();var i,o,r=jt(n.split("/")[0]),s=jt(n.split("/")[1]),l=s/5e4,d=parseInt((new Date).getTime()/1e3),o=(c=t,i=parseInt(c.split(":")[0]),o=parseInt(c.split(":")[1]),t=parseInt(c.split(":")[2]),c=parseInt(c.split(":")[3]),86400*i+3600*o+60*t+c),t=d+o,c=Math.abs(e-a);let p="",h="";if(a<=e){e=Math.ceil((s-r)/l);p=e<=o?(h=`最快: ${new Date(1e3*(d+e)).format("dd日hh:mm")}`,(e=Math.ceil((s-r)/c))<=o?`攻: ${N(e)} (${new Date(1e3*(d+e)).format("dd日hh:mm")})`:"当前进攻速度不足"):"防守成功"}else{let t=Math.ceil((r+o*l-s)/(c+l));c=Math.ceil(r/c);t>c&&(t=o-5e4),0<t?(p=`守: ${N(t)} (${new Date(1e3*(d+t)).format("dd日hh:mm")})`,0<c&&c<=o&&(h=`${N(c)} 后清零`)):p="防守成功"}fe(this).children(".ttwar-time").html(`
<div style="float: left; padding: 4px 0px; margin-left: 4px;">${p}</div>
<div style="float: right; padding: 4px 0px; margin-right: 4px;">${h}</div>
`),fe(this).find(".ttwar-end").text(`(${new Date(1e3*t).format("dd日hh:mm")})`)})},1e3);let n=0;function E(){const t=fe("[class^='status-wrap territoryBoxWp___']");if(0<t.length){console.log("war page detected"),clearInterval(a),n=setInterval(P,3e3);const e=t.width()-6;t.each(function(){fe(this).find(".timer").css("margin-left","-14px").css("margin-right","-14px").append('<span class="ttwar-end" style="width: auto; margin-left: 4px"></span>'),0<fe(this).parent("[class~='red']").length?fe(this).append(`<div class="ttwar-time border-round" style="width:${e}px; line-height:0.8; position: relative; left: 2px; top: -10px; z-index: 1;
color: #fff ;background-image: linear-gradient(#ff7373,#fda8a8 25%,#ff7373); border: 1px solid #000; overflow: hidden;"></div>`):fe(this).append(`<div class="ttwar-time border-round" style="width:${e}px; line-height:0.8; position: relative; left: 2px; top: -10px; z-index: 1;
color: #fff ;background-image: linear-gradient(#83a000,#abc170 25%,#83a000); border: 1px solid #000; overflow: hidden;"></div>`)})}}function P(){0===fe("[class^='status-wrap territoryBoxWp___']").length&&(console.log("war page closed"),clearInterval(n),a=setInterval(E,3e3))}function N(t){var e=parseInt(t/86400),a=e?e+"天":"",n=parseInt(t%86400/3600),e=parseInt(t%3600/60),t=t%60;return a+z(n,2)+":"+z(e,2)+":"+z(t,2)}function z(t,e){return t.toString().length>=e?t.toString():z(t="0"+t,e)}}if(extra_recent_attacks&&0<=window.location.href.indexOf("factions.php?step=")){function j(t,e){const a=t.split(" ");let n=0;return"s"==a[1]?n=e-parseInt(a[0]):"m"==a[1]?n=e-parseInt(60*a[0]):"h"==a[1]&&(n=e-parseInt(3600*a[0])),n}let s=[],l=[];setInterval(function(){const n=fe(".recent-attacks"),i=parseInt((new Date).getTime()/1e3);if(0<n.length){const r=Array.from(n.children("li")).slice(0,10);let e=[];for(let t=9;0<=t;t--)s.indexOf(r[t])<0&&e.push(r[t]);e.forEach(function(t,e){const a=fe(t).children(".time").text();var n;(0<a.indexOf("s")||"1 m"==a||"2 m"==a||"3 m"==a||"4 m"==a)&&(n=j(a,i),l.push(n),s.push(t))});let a=0;l.forEach(function(t,e){300<i-t&&(a=e+1)}),l=l.slice(a,l.length),s=s.slice(a,s.length),fe(".extra-attacks").remove();for(let t=s.length-1;0<=t;t--){var o;r.indexOf(s[t])<0&&(fe(s[t]).addClass("extra-attacks"),o=function(t,e){t=e-t;let a="";return a=t<60?t+" s*":t<3600?parseInt(t/60)+" m*":t<86400?parseInt(t/3600)+" h*":"Inf",a}(l[t],i),fe(s[t]).children(".time").text(o),n.append(s[t]))}}else s=[],l=[]},6e3)}if(0<=window.location.href.indexOf("page.php?sid=events")&&setInterval(function(){const t=fe("ul[class^=eventsList___]"),e=t.children("li[data-bw-updated]").last();if(!e.is(":last-child")){const a=0<e.length?e.nextAll("li"):t.children("li");a.last().attr("data-bw-updated",!0),a.each(function(){!function(t){const e=t.find("[class^=message___]");(t=e.text().match(/ balance from \$([\d,]*) to \$([\d,]*)/i))&&(t=jt(t[2])-jt(t[1]),e.append(` (<span class="${0<=t?"t-green":"t-red"}">${0<=t?"+":""}${Rt(t)}</span>)`))}(fe(this))})}},1e3),0<=window.location.href.indexOf("page.php?sid=log")){const Te=setInterval(function(){const t=fe(".panel > div[class^=title]");0!==t.length&&(clearInterval(Te),t.prepend('<button id="log-export-btn" class="torn-btn" style="margin:5px;">导出所选日志</button>'),fe("#log-export-btn").click(async function(){const t=new Proxy(new URLSearchParams(window.location.search),{get:(t,e)=>t.get(e)});var a=t.cat?t.cat.split(","):[];const n=t.log&&0===a.length?t.log.split(","):[];if(0!==a.length||0!==n.length){alert("注意:\n* 请勿同时使用其他频繁请求 API 的功能(例如:冰蛙目标、阅兵、犯罪经验)\n* 导出需要很长时间,请耐心等待\n* 若要取消,请刷新或关闭页面\n");try{fe(this).prop("disabled",!0),fe(this).text("正在导出,请耐心等待");var e=await(await fetch(`https://api.torn.com/user/?selections=basic&key=${b}`)).json();if("error"in e)throw new Error(e.error.error);const s=Math.max(Math.ceil(n.length/10),1),l=[];for(let e=0;e<s;e++){var i=t=>{fe(this).text(`正在导出,请耐心等待 (第 ${e+1}/${s} 批 ${new Date(1e3*t).format("yyyy-MM-dd")})`)};for await(const d of ee(a,n.slice(10*e,10*(e+1)),t.from,t.to,i))l.push(d)}l.sort((t,e)=>e.timestamp-t.timestamp);var o={user_id:e.player_id,user_name:e.name,timestamp:Math.floor((new Date).getTime()/1e3),categories:a,types:n,logs:l},r=`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(o))}`;fe(this).replaceWith(`<a download="torn-log-${o.user_id}-${o.timestamp}.json" href="${r}"
class="torn-btn" style="color: #333; margin:5px; display:inline-block;">导出完毕,点击保存</a>`)}catch(t){console.trace(t),"Access level of this key is not high enough"===t.message?fe(this).replaceWith('<a href="/preferences.php#tab=api">权限不足!请使用 Full Access 类型的 API Key</a>'):(fe(this).text("出错啦!请刷新重试"),alert(`出错啦!${t}`))}}else alert("请选择日志类型")}))},1e3)}if(0<=window.location.href.indexOf("preferences.php")){let i=setInterval(B,2e3),o=0;function R(){var t=fe("[class^=api___]"),e=fe("#name").attr("aria-expanded"),a=fe("#name").attr("aria-hidden");0<t.length&&"false"==e&&"false"==a?console.log("apikey node heartbeat"):(console.log("apikey node closed"),clearInterval(o),fe("#bingwa-apikey-setting").remove(),i=setInterval(B,2e3))}function B(){var t=fe("[class^=api___]"),e=fe("#name").attr("aria-expanded"),a=fe("#name").attr("aria-hidden");if(0<t.length&&"false"==e&&"false"==a){console.log("apikey node detected"),clearInterval(i),o=setInterval(R,2e3),fe(".content-title").after(`
<div id="bingwa-apikey-setting">
<div class="title-black m-top10 title-toggle tablet top-round faction-title active title" data-title="description" role="heading" aria-level="5">冰蛙APIKey设置</div>
<div id="bingwa-apikey-setting-wrapper" class="cont-gray bottom-rounded content" style="overflow:hidden; margin-bottom:10px;">
<div style="margin:5px;padding:5px;">你拥有的APIKey个数为 <span id="apikey-number" style="padding:3px;color:${ye.yellowgreen};font-size:18px;"></span> 个</div>
<div style="margin:5px;padding:5px;">冰蛙当前使用的APIKey为 <span id="apikey-current" style="padding:3px;color:${ye.yellowgreen};font-size:18px;"></span></div>
<div id= "apikey-wrapper"style="margin:5px;padding:5px;text-align:center;"></div>
</div>
</div>`);const n=fe("[class^=keyRow]");fe("#apikey-number").text(`${n.length}`),fe("#apikey-current").text(`${window.localStorage.getItem("APIKey")}`),0<n.length?(n.each(function(){var t=fe(this).children("[class^=key]").val(),e=fe(this).children("[class^=blockTablet]").children("[class^=type]").val();fe("#apikey-wrapper").append(`
<div id="${t}" style="overflow:hidden;color:white;margin-top:5px;">
<button class="key-btn torn-btn" style="float: left; line-height: 22px;">未使用</button>
<div class="key-level border-round" style="float: left; width: 50px; height: 30px; margin: 0px 5px; background-color: #333; border: 1px solid #fff"></div>
<div class="key-value border-round" style="float: left; width: 180px; height: 30px; background-color: #333; border: 1px solid #fff"></div>
</div>
`),t==window.localStorage.getItem("APIKey")?(fe("#"+t).children("button").text("已使用").attr("disabled","true"),fe("#"+t).children(".key-level").html(`<div style="padding: 3px 0px;">${e}</div>`).css("background-color",ye.red),fe("#"+t).children(".key-value").html(`<div style="padding: 6px 0px; font-size: 18px;">${t}</div>`).css("background-color",ye.red)):(fe("#"+t).children(".key-level").html(`<div style="padding: 3px;">${e}</div>`),fe("#"+t).children(".key-value").html(`<div style="padding: 6px; font-size: 18px;">${t}</div>`))}),fe(".key-btn").click(function(){fe(".key-btn").each(function(){fe(this).text("未使用").removeAttr("disabled"),fe(this).siblings().css("background-color","#333")}),window.localStorage.setItem("APIKey",fe(this).parent().attr("id")),fe(this).text("已使用").attr("disabled","true"),fe(this).siblings().css("background-color",ye.red),fe("#apikey-current").text(`${window.localStorage.getItem("APIKey")}`)})):fe("#apikey-wrapper").text("没有已存在的APIKEY,请先创建一个然后刷新页面")}else console.log("apikey node heartbeat")}}else if(null==b||""==b)fe("body").prepend(`<div style="position: relative; z-index: 999; font-size: 16px; line-height: 1.6; padding: 10px; text-align: center; background: lightyellow;">
<a href="/preferences.php#tab=api">宝鉴需要一个有效的 APIKey<br/>点击前往设置页面进行选择</a>
</div>`);else{const Fe=fe("#sidebarroot").find("[class^='status-icons___']"),Oe=fe("#top-page-links-list").children("a");if(0<Oe.length||0<Fe.length){console.log("当前页面有按钮,可以宝鉴");let n={user:["ammo","attacks","attacksfull","bars","basic","battlestats","bazaar","cooldowns","crimes","discord","display","education","events","gym","hof","honors","icons","inventory","jobpoints","log","medals","merits","messages","missions","money","networth","newevents","newmessages","notifications","perks","personalstats","profile","properties","refills","reports","revives","revivesfull","skills","stocks","timestamp","travel","weaponexp","workstats"],property:["property","timestamp"],faction:["applications","armor","armorynews","attacknews","attacks","attacksfull","basic","boosters","caches","cesium","chain","chainreport","chains","contributors","crimeexp","crimenews","crimes","currency","donations","drugs","fundsnews","mainnews","medical","membershipnews","positions","reports","revives","revivesfull","stats","temporary","territory","territorynews","timestamp","upgrades","weapons"],company:["applications","companies","detailed","employees","news","newsfull","profile","stock","timestamp"],market:["bazaar","itemmarket","pointsmarket","timestamp"],torn:["bank","cards","chainreport","cityshops","companies","competition","education","factiontree","gyms","honors","itemdetails","items","itemstats","logcategories","logtypes","medals","organisedcrimes","pawnshop","pokertables","properties","rackets","raids","rankedwarreport","rankedwars","stats","stocks","territory","territorynames","territorywars","timestamp"],key:["info"]},s="",d="",c="";shows_bingwa_icon&&Fe.prepend('<li class="a_click_view_api_info icon6___XChW2" title="冰蛙宝鉴 呱" style="cursor: pointer; background-image:url(/images/v2/editor/emoticons.svg); background-position: -470px -42px;"></li>');Oe.last().after('<a role="button" style="cursor: pointer" aria-labelledby="events" class="a_click_view_api_info events t-clear h c-pointer  m-icon line-h24 right last"><span class="icon-wrap svg-icon-wrap"><span class="link-icon-svg events "><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 17"><defs><style>.cls-1{opacity:0.35;}.cls-2{fill:#fff;}.cls-3{fill:#777;}</style></defs><g id="Слой_2" data-name="Слой 2"><g id="icons"><g class="cls-1"><path class="cls-2" d="M8,1a8,8,0,1,0,8,8A8,8,0,0,0,8,1ZM6.47,3.87H9.53l-.77,7.18H7.24ZM8,14.55A1.15,1.15,0,1,1,9.15,13.4,1.14,1.14,0,0,1,8,14.55Z"></path></g><path class="cls-3" d="M8,0a8,8,0,1,0,8,8A8,8,0,0,0,8,0ZM6.47,2.87H9.53l-.77,7.18H7.24ZM8,13.55A1.15,1.15,0,1,1,9.15,12.4,1.14,1.14,0,0,1,8,13.55Z"></path></g></g></svg></span></span><span id="a_click_view_api_info_text">宝鉴</span></a>'),fe(".a_click_view_api_info").click(function(){if(fe("#bwm").length<1){var e=fe("#mainContainer")[0].clientWidth;let t=985;e<985&&(t=e);e=`
<div id="bwm" style="width:${t}px; margin: auto;">
<div id="bwm-nav">
<ul style="list-style-type: none;margin: 10px 0px;padding: 0;overflow: hidden;background-color: #333;">
<li style="float: left">
<a id="bwm-version" role="button" style="cursor: pointer;display: block;color: black;background-color: #4CAF50;text-align: center;padding: 14px 16px;text-decoration: none;" >版本记录</a>
</li>
<li style="float: left">
<a id="bwm-api" role="button" style="cursor: pointer;display: block;color: white;text-align: center;padding: 14px 16px;text-decoration: none;" >查看API</a>
</li>
<li style="float: left">
<a id="bwm-company" role="button" style="cursor: pointer;display: block;color: white;text-align: center;padding: 14px 16px;text-decoration: none;" >我的公司</a>
</li>
<li style="float: left">
<a id="bwm-faction" role="button" style="cursor: pointer;display: block;color: white;text-align: center;padding: 14px 16px;text-decoration: none;" >帮派详情</a>
</li>
<li style="float: left">
<a id="bwm-target" role="button" style="cursor: pointer;display: block;color: white;text-align: center;padding: 14px 16px;text-decoration: none;" >冰蛙目标</a>
</li>
<li style="float: left">
<a id="bwm-chatlog" role="button" style="cursor: pointer;display: block;color: white;text-align: center;padding: 14px 16px;text-decoration: none;" >聊天记录</a>
</li>
<li style="float: left">
<a id="bwm-addiction" role="button" style="cursor: pointer;display: block;color: white;text-align: center;padding: 14px 16px;text-decoration: none;" >毒瘾</a>
</li>
<li style="float: left">
<a id="bwm-settings" role="button" style="cursor: pointer;display: block;color: white;text-align: center;padding: 14px 16px;text-decoration: none;" >设置</a>
</li>
<li style="float: right">
<a id="bwm-return" role="button" style="cursor: pointer;display: block;color: white;text-align: center;padding: 14px 16px;text-decoration: none;" >返回</a>
</li>
</ul>
</div>
</div>`;fe("#sidebarroot").hide(),fe(".content-wrapper").hide(),fe("#mainContainer").prepend(e);function l(t){const e=fe("#bwm-nav [id^=bwm-]");e.attr("style","cursor: pointer; display: block; color: white; text-align: center; padding: 14px 16px; text-decoration: none;"),fe(t).attr("style","cursor: pointer; display: block; color: black; background-color: #4CAF50; text-align: center; padding: 14px 16px; text-decoration: none;")}function a(){var t=getVersion();return`
<div id="version_container" style="width: inherit">
<div style="text-align:center; margin-bottom: 10px;">
<a role="button" style="cursor: pointer; font-size: large; color: #777;">冰蛙当前版本为 ${t[0]}</a>
</div>
<div style="text-align:center;">
<textarea  style="height:800px;width:100%;background-color: lightgray; font-family:\'Lucida Console\', Monaco, monospace; font-size: 0.8rem;line-height: 1.3;" readonly="readonly">${t[1]}</textarea>
</div>
</div>`}fe("#bwm").append(a()),fe("#bwm-version").click(function(){fe("#bwm").children(":last").remove(),fe("#bwm").append(a()),l("#bwm-version")}),fe("#bwm-api").click(function(){fe("#bwm").children(":last").remove(),fe("#bwm").append(function(){let t="";for(var e in n)t+='<a role="button" style="cursor: pointer; font-size: large; color: #777;" class="a_click_api_type">'+e+"</a>&nbsp;&nbsp;";t+='<br /><br /><input type="text" id="api_input_id" name="api_input_id" placeholder="ID (当前用户不用填)" size="25" style="font-size: larger; padding: 3px;" />&nbsp;&nbsp;<input type="text" id="api_input_from_time" name="api_input_from_time" placeholder="From (Eg: 2019/10/25 23:00:00)" size="29" style="font-size: larger; padding: 3px;" />&nbsp;&nbsp;<input type="text" id="api_input_to_time" name="api_input_to_time" placeholder="To (Eg: 2019/10/26 08:00:00)" size="28" style="font-size: larger; padding: 3px;" />';let a='<div id="api_container"><div id="api_types_container" style="text-align:center; margin-bottom: 10px;">'+t+'</div><div id="api_fields_container" style="text-align:center; margin-bottom: 10px;"></div><div id="api_result_header" style="text-align:center; margin-bottom: 3px; font-size: large;"></div><div style="text-align:center;"><textarea id="api_result_container" rows="40" style="width:100%; background-color: lightgray; font-family:\'Lucida Console\', Monaco, monospace; font-size: 0.8rem;line-height: 1.3;" readonly="readonly" /><br /><a id="api_result_download_csv" role="button" style="cursor: pointer; font-size: large; color: #777;">导出为CSV文件</a>';return foo?a+='&nbsp;&nbsp;&nbsp;&nbsp;<a id="a_faction_parade" role="button" style="cursor: pointer; font-size: large; color: #777;">帮派大阅兵</a><a id="a_faction_parade_download" role="button" style="display:none">帮派大阅兵下载</a>&nbsp;&nbsp;&nbsp;&nbsp;<a id="a_faction_attacks" role="button" style="cursor: pointer; font-size: large; color: #777;">帮战统计</a><a id="a_faction_attacks_download" role="button" style="display:none">帮战统计下载</a></div></div>':a+="</div></div>",a}()),l("#bwm-api"),fe(".a_click_api_type").click(function(){fe("#api_fields_container").empty(),s=fe(this).text(),console.log("click: "+s);var t,e=n[s].sort();for(t in e){var a=e[t];fe("#api_fields_container").append('<a role="button" style="cursor: pointer; font-size: large; color: #777;" class="a_click_api_field">'+a+"</a>&nbsp;&nbsp;"),t%10==8&&fe("#api_fields_container").append("<br />")}fe(".a_click_api_field").click(function(){fe("#api_result_container").val("");var t=fe(this).text(),e=fe("#api_input_id").val(),a=fe("#api_input_from_time").val(),n=new Date(a).getTime()/1e3,i=fe("#api_input_to_time").val(),o=new Date(i).getTime()/1e3;let r=`https://api.torn.com/${s}/${e}?selections=${t}&key=${b}&from=${n}&to=${o}`;(isNaN(n)||isNaN(o))&&(r=`https://api.torn.com/${s}/${e}?selections=${t}&key=${b}`),console.log(`Request: ${r}`),c=s+" - "+e+" - "+t+" - "+a+" - "+i,fe("#api_result_header").text(`探测中: ${c}`),fe("#api_result_download_csv").removeAttr("href"),fe("#api_result_download_csv").removeAttr("download"),d="",fetch(r).then(t=>t.ok?t.json():void fe("#api_result_header").text(`探测失败: ${c}`),t=>{fe("#api_result_header").text(`网络异常: ${c}`)}).then(t=>{console.log(`Response: ${r}`),console.log(t),void 0!==t&&(fe("#api_result_header").text(`探测完成: ${c}`),d=t,fe("#api_result_container").val(JSON.stringify(t,null,4)))})})}),fe("#api_result_download_csv").click(function(){var t;null==d||""==d||null==c||""==c||"object"!=typeof d||d.length<1?alert("没有可导出的数据"):null!=(t=Wt(d))?(t=qt(t),fe(this).attr("href","data:text/csv;charset=utf-8,\ufeff"+t),fe(this).attr("download",c+".csv")):alert("没找到有效的数据集")}),fe("#a_faction_parade").click(function(){fe("#api_result_container").val("");const l=fe("#api_input_id").val();ae("开始帮派大阅兵,将拉取帮派成员列表,然后逐个查询该成员的详细信息,再使用蛙蛙探测器增加分析结果,最后导出为csv文件。"),ae("请注意:"),ae("1、此功能会调用很多次API接口,所以不要太频繁使用。"),ae("2、为了避免太频繁被封接口,每次查询做了延时,所以运行时间较久,请耐心等待。"),ae("3、如果想中途放弃,请直接关掉本网页窗口。");let a=`https://api.torn.com/faction/${l}?selections=basic&key=${b}`;fe("#api_result_header").text(`帮派大阅兵 ${l}`),console.log(`Request: ${a}`),ae("\n开始获取帮派成员列表"),fetch(a).then(t=>t.ok?t.json():void ae("阅兵失败"),t=>{ae("阅兵失败,网络异常")}).then(t=>{console.log(`Response: ${a}`),console.log(t);const n=Object.keys(t.members),e=n.length;ae(`获取帮派成员列表完成,共有 ${e} 个成员`);let i=new Array,o=0;function r(){const e=n[o];let a=t.members[e];a.userId=e,i.push(a),Zt(e,function(t){ae(`蛙蛙探测 userId: ${e} 成功`),Object.assign(a,t),s()},function(t){ae(`蛙蛙探测 userId: ${e} 失败`),s()})}function s(){if(o<e-1)++o,setTimeout(r,1e3);else{ae("蛙蛙探测完成"),ae("\n开始转换为csv格式...");var a=qt(i);const n=fe("#a_faction_parade_download");n.attr("href","data:text/csv;charset=utf-8,\ufeff"+a);let t=new Date;n.attr("download",`FactionParade_${l}_${t.format("yyyyMMdd_hhmm")}.csv`),ae("转换为csv格式完成"),ae("\n开始下载");let e=document.createEvent("MouseEvents");e.initEvent("click",!0,!0),document.getElementById("a_faction_parade_download").dispatchEvent(e)}}ae("\n开始启动蛙蛙探测..."),r()})}),fe("#a_faction_attacks").click(function(){var t=fe("#api_input_from_time").val();const d=new Date(t);let c=d.getTime()/1e3;var e=fe("#api_input_to_time").val();const p=new Date(e),h=p.getTime()/1e3;if(isNaN(c)||isNaN(c))alert("此功能必须输入起止时间(你的电脑本地时间,不要转为TCT)");else{fe("#api_result_container").val(""),ae("开始帮战统计,将自动切分时间段,拉取帮派attacks记录(每次最多100条),然后拼接,最后导出为csv文件。"),ae("请注意:"),ae("1、此功能需要帮派API权限。"),ae("2、此功能会调用很多次API接口,所以不要太频繁使用。"),ae("3、每30秒才访问一次(因为测试发现数据有缓存),所以运行时间较久,请耐心等待。"),ae("4、如果想中途放弃,请直接关掉本网页窗口。"),ae(`\n开始时间:${t} 时间戳 ${c} ,结束时间:${e} 时间戳 ${h} \n`);let l=new Object;!function r(){const s=`https://api.torn.com/faction/?selections=attacks&key=${b}&from=${c}&to=${h}`;console.log(`Request: ${s}`),fe("#api_result_header").text("帮战统计"),fetch(s).then(t=>t.ok?t.json():(ae("抓取失败,将1秒后重试"),void setTimeout(r,1e3)),t=>{ae("抓取失败,将1秒后重试"),setTimeout(r,1e3)}).then(t=>{function e(){ae("\n攻击记录抓取完成,开始转换为csv格式...");var t=qt(Gt(l));const e=fe("#a_faction_attacks_download");e.attr("href","data:text/csv;charset=utf-8,\ufeff"+t),e.attr("download",`FactionAttacks_${d.format("yyyyMMddhhmmss")}_${p.format("yyyyMMddhhmmss")}.csv`),ae("转换为csv格式完成"),ae("\n开始下载");let a=document.createEvent("MouseEvents");a.initEvent("click",!0,!0),document.getElementById("a_faction_attacks_download").dispatchEvent(a)}console.log(`Response: ${s}`),console.log(t),Object.assign(l,t.attacks);var a=Gt(t.attacks);if(0<a.length){var n=a[0].timestamp_started;const i=new Date(1e3*n);t=a[a.length-1].timestamp_started;const o=new Date(1e3*t);ae(`抓取 ${c} - ${h} 有 ${a.length} 条,第一条 ${n} ${i.format("yyyy/MM/dd hh:mm:ss")},最后一条 ${t} ${o.format("yyyy/MM/dd hh:mm:ss")},累计 ${Object.keys(l).length} 条`),t<c||t>h?1<a.length?(ae("抓取的数据没有更新,准备重试"),setTimeout(r,1e4)):(ae("系统会莫名其妙的卡在最后一条,直接完成"),e()):(c=t+2,setTimeout(r,30500))}else e()})}()}})}),fe("#bwm-company").click(function(){fe("#bwm").children(":last").remove(),fe("#bwm").append(`
<div id="mycompany_container" style="width: inherit">
<div id="mycompany-head" style="margin:10px 0px; border:1px solid darkgray; text-align:center;">
<span id="companyname" role="button" style="font-size: large; color:#777;" >我的公司</span>
</div>
<div id="tips-view-company" style="text-align:center; margin-bottom: 3px; font-size: 4px;"></div>
<div id="mycompany-content" style="min-height:400px;margin:10px 0px; border:1px solid darkgray;  text-align:center;overflow:hidden; overflow-x: auto;"></div>
</div>`),l("#bwm-company");var t=re();console.log("userId "+t),wt(t).then(function(t){console.log(t);t=t[3];"Employee"===t?nt(fe("#mycompany-content")):"Director"===t&&it(fe("#mycompany-content"))}).catch(t=>console.log("userId2otherIds "+t))}),fe("#bwm-faction").click(function(){function r(){var t=window.localStorage.getItem("faction_compare_history");if(null!=t){var e,a=JSON.parse(t);for(e in a)fe("#bwm_faction_history").append(`
<div class="wrapper-history" style="width:135px;float:left;border:1px solid darkgray;margin:5px 10px;">
<div class="head-history" style="background-color:black;color:white;padding:5px;overflow:hidden;">
<div class="id-history" style="width:30%;float:left;margin-left:50%;position:relative;left:-15%;">${e}</div>
<div style="float:right;cursor:pointer;background-color:white;color:black;padding:0px 2px;">
<a class="delete-history" role="button" >X</a>
</div>
</div>
<div class="content-history" style="background-color:var(--default-bg-panel-color);padding:5px;">
<a style="width:100%;overflow:hidden; text-overflow:ellipsis; white-space:nowrap;" class="user faction" href="/factions.php?step=profile&amp;ID=${e}" target="_blank">${a[e]}</a>
</div>
</div>`);fe(".delete-history").click(function(){var t=fe(this).parent().parent().children(".id-history").text();Kt("faction_compare_history",t),fe(this).parent().parent().parent().remove(),console.log("删除成功: "+t)}),fe(".head-history").click(function(){const t=fe(this).siblings(".content-history");var e;"selected"==t.attr("selected")?(t.css("background-color","white"),t.removeAttr("selected"),fe("#faction-input-id").val("")):(fe(".content-history").css("background-color","white"),fe(".content-history").removeAttr("selected"),t.css("background-color","var(--default-bg-red-hover-color)"),t.attr("selected","selected"),e=fe(this).children(".id-history").text(),fe("#faction-input-id").val(e))})}}function n(i,t){t.empty(),t.append(`
<div id="name-faction" style="font-size: 20px; margin: 4px;"><img id="tag-faction" style="margin-right: 4px;"><span></span></div>
<div id="rank-faction" style="margin: 2px;"></div>
<div id="detail-faction" style="margin: 2px;"></div>
<div id="table-faction">
<table class="table-faction-table" style="margin:auto;background-color:var(--default-bg-panel-color);font-size:12px;">
<tr class="head">
<th class="table-online"></th>
<th class="table-level">Lv</th>
<th>Name</th>
<th class="table-last">Last</th>
<th class="table-status">Status</th>
<th class="table-bs">BS</th>
<th class="table-revivable">Revivable</th>
<th>ID</th>
<th class="table-position">Position</th>
<th class="table-days">Days</th>
<th>Description</th>
</tr>
</table>
</div>`),fe("#table-faction").find(".table-faction-table").find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;");t=`https://api.torn.com/faction/${i}?selections=basic&key=${b}`;const o=fe("#bmw_faction_tips");return o.text("---探测中 "+i+"---"),fetch(t).then(t=>t.ok?t.json():void o.text("---探测失败 "+i+"---"),t=>{o.text("---网络异常 "+i+"---")}).then(t=>{console.log("API fetched: "+i),null!=t&&o.text("---探测完成 "+i+"---"),fe("#name-faction").children("span").text(`${t.name} - ${i}`),fe("#tag-faction").attr("src",`https://factiontags.torn.com/${t.tag_image}`),fe("#rank-faction").text(`Rank: ${t.rank.name} - ${t.rank.division}`),Jt("faction_compare_history",i,t.name),fe("#bwm_faction_history").empty(),r(),fe(".id-history").each(function(){fe(this).text()==i&&fe(this).parent().parent().children(".content-history").css("background-color","var(--default-bg-red-hover-color)")});var e=Object.keys(t.members).length;const a=t.respect;var n=a.toString().replace(/\d{1,3}(?=(\d{3})+$)/g,function(t){return t+","});fe("#detail-faction").text(`Members: ${e} | Resp: ${n} | Best Chain: ${t.best_chain}`),fe.each(t.members,function(t,e){var a=t,n=Y(a),i=Q(e.last_action.timestamp),o=e.status.state,r=e.status.description,s=e.status.until,t=e.status.color;const l=Z(r,o,s);o=l[0].startsWith("海")?Ee[l[2]].name+l[0].slice(1):l[0],s=function(t){let e=Xt("revivable",t),a="unknown";null!=e&&null!=e&&(a=e);return a}(a);let d="var(--default-color)";"Leader"!=e.position&&"Co-leader"!=e.position||(d="var(--default-red-color)");let c="grey",p=1;"Online"==e.last_action.status?(c="DarkSeaGreen",p=3):"Idle"==e.last_action.status&&(c="Orange",p=2);e=`
<tr class="content">
<td class="table-online" code="${p}" style="border: 1px solid darkgray; min-width: 20px; background-color:${c}"></td>
<td class="table-level" style="border: 1px solid darkgray;padding:5px;color:var(--default-color);">${e.level}</td>
<td style="border: 1px solid darkgray;padding:5px;"><a class="user name" href="/profiles.php?XID=${a}" target="_blank">${e.name}</a></td>
<td class="table-last" style="border: 1px solid darkgray;padding:5px;color:var(--default-color);" last-action-minutes="${i[0]}">${i[1]}</td>
<td class="table-status t-${t}" style="border: 1px solid darkgray;padding:5px;" hospital-seconds="${l[1]}" hospital-location="${l[2]}">${o}</td>
<td class="table-bs t-blue" style="border: 1px solid darkgray;padding:5px" estimate-bs="${n[0]}">
<a style="text-decoration:none;" href="/loader.php?sid=attack&user2ID=${a}" target="_blank">${n[2]||"Attack"}</a>
</td>
<td class="table-revivable" style="border: 1px solid darkgray;padding:5px;color:var(--default-color);">${s}</td>
<td style="border: 1px solid darkgray;padding:5px;text-align:right;color:var(--default-color);">${a}</td>
<td class="table-position" style="border:1px solid darkgray;padding:5px;color:${d};">${e.position}</td>
<td class="table-days" style="border: 1px solid darkgray;padding:5px;color:var(--default-color);">${e.days_in_faction}</td>
<td style="border: 1px solid darkgray;padding:5px;color:var(--default-color);">${e.status.details}</td>
</tr>`;fe("#table-faction").children(".table-faction-table").children().append(e)})}).catch(t=>console.log("fetch error",t))}fe("#bwm").children(":last").remove(),fe("#bwm").append(`
<div id="bwm_faction_container" style="width: inherit">
<div id="bwm_faction_header" style="margin:10px 0px; border:1px solid darkgray; text-align:center;">
<input type="text" id="faction-input-id" name="faction-input-id" placeholder="帮派 ID" size="10" style="font-size: larger; padding: 5px; margin: 5px;" />
<button id="faction-load-btn" class="torn-btn" style="margin:5px;">读取帮派</button>
<button id="faction-parade-start-btn" class="torn-btn" style="margin:5px;">开始阅兵</button>
<button id="faction-parade-stop-btn" class="torn-btn" style="margin:5px;" disabled>停止阅兵</button>
</div>
<div id="bmw_faction_tips" style="text-align:center; margin-bottom: 3px; font-size: 4px;"></div>
<div id="bwm_faction_history" style="margin:10px 0px; border:1px solid darkgray;  text-align:center;overflow:hidden;"></div>
<div id="bmw_faction_wrapper" style="min-height:700px;margin:10px 0px; border:1px solid darkgray;  text-align:center;overflow:hidden; overflow-x: auto;"></div>
</div>`),l("#bwm-faction"),r();let i=window.localStorage.getItem("MY_FACTION_ID");void 0!==i&&null!==i||(i="20465"),fe("#faction-load-btn").click(function(){fe("#faction-input-id").val()||fe("#faction-input-id").val(i);const t=fe("#bmw_faction_wrapper").find("table.table-faction-table th[sort]"),e=t.index(),a=t.attr("sort");n(fe("#faction-input-id").val(),fe("#bmw_faction_wrapper")).then(function(){if(Vt(fe("th.table-bs"),V),Vt(fe("th.table-last"),J),Vt(fe("th.table-status"),K),Vt(fe("th.table-online"),H),Vt(fe("th.table-level"),W),Vt(fe("th.table-position"),U),Vt(fe("th.table-days"),X),Vt(fe("th.table-revivable"),q),0<=e){const t=fe("#bmw_faction_wrapper").find(`table.table-faction-table th:nth-child(${e+1})`);t.attr("sort","ascend"===a?"descend":"ascend"),t.click()}})});let o=!0;fe("#faction-parade-start-btn").click(function(){o=!0,fe("#faction-load-btn").prop("disabled",!0),fe("#faction-parade-start-btn").prop("disabled",!0),fe("#faction-parade-stop-btn").removeAttr("disabled"),fe("tr.head").attr("style","pointer-events: none;");const t=fe(".table-faction-table").children().children("tr.content").first();t.length<=0?(fe("#bmw_faction_tips").text("未找到用户列表"),fe("#faction-load-btn").removeAttr("disabled"),fe("#faction-parade-start-btn").removeAttr("disabled"),fe("#faction-parade-stop-btn").prop("disabled",!0),fe("tr.head").removeAttr("style")):(fe("#bmw_faction_tips").text("阅兵开始"),setTimeout(()=>{!function e(a){if("1"==a.attr("detected"))fe("#bmw_faction_tips").text("用户已完成"),setTimeout(()=>{e(a.next())},0);else if(a.length<=0||0==o)fe("#bmw_faction_tips").text("阅兵已结束"),fe("#faction-load-btn").removeAttr("disabled"),fe("#faction-parade-start-btn").removeAttr("disabled"),fe("#faction-parade-stop-btn").prop("disabled",!0),fe("tr.head").removeAttr("style");else{a.attr("detected","1");const n=a.find("a.user.name").attr("href").replace(/[^0-9|-]/gi,"");fe("#bmw_faction_tips").text("正在阅兵: "+n),Zt(n,function(t){a.children("td.table-bs").text(Lt(t.estimate_bs)),a.children("td.table-bs").attr("estimate-bs",t.estimate_bs),Jt("battlestats",n,t.estimate_bs),a.children("td.table-revivable").text(t.revivable),Jt("revivable",n,t.revivable),setTimeout(()=>{e(a.next())},1e3)},function(t){fe("#bmw_faction_tips").text("蛙蛙探测 "+n+" 失败 "+t),setTimeout(()=>{e(a.next())},1e3)})}}(t)},1e3))}),fe("#faction-parade-stop-btn").click(function(){o=!1})}),fe("#bwm-target").click(function(){fe("#bwm").children(":last").remove(),fe("#bwm").append(`
<div id="bwm_target_container" style="width: inherit">
<div id="bwm_target_header" style="margin:10px 0px; border:1px solid darkgray; text-align:center;">
<button id="target-load-excel" class="torn-btn" style="margin:5px;">加载本地excel文件</button>
<button id="target-clear-cache" class="torn-btn" style="margin:5px;" disabled>清除缓存</button>
</div>
<input type="file" id="file" style="display: none;" accept=".csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"/>
<div id="bmw_target_tips" style="text-align:center; margin-bottom: 3px; font-size: 4px;">请按以下模板来导入表格 仅限xlsx或csv格式</div>
<div id="bmw_target_wrapper" style="min-height:700px;margin:10px 0px; border:1px solid darkgray;  text-align:center;overflow:hidden; overflow-x: auto;">
<table style="margin: auto;">
<tr>
<th style="border: 1px solid darkgray; padding: 5px; background-color: white;"></th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: gray; color: green; font-weight: bold; text-align: center;">A</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: gray; color: green; font-weight: bold; text-align: center;">B</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: gray; color: green; font-weight: bold; text-align: center;">C</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: gray; color: green; font-weight: bold; text-align: center;">D</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: gray; color: green; font-weight: bold; text-align: center;">E</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: gray; color: green; font-weight: bold; text-align: center;">F</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: gray; color: green; font-weight: bold; text-align: center;">G</th>
</tr>
<tr>
<td style="border: 1px solid darkgray; padding: 5px; background-color: gray; color: green; font-weight: bold; text-align: center;">1</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">Name</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">ID</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">STR</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">DEF</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">SPD</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">DEX</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">TOTAL</td>
</tr>
<tr>
<td style="border: 1px solid darkgray; padding: 5px; background-color: gray; color: green; font-weight: bold; text-align: center;">2</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">GoodLuck</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">2356929</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">200,000,000</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">200,000,000</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">200,000,000</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">200,000,000</td>
<td style="border: 1px solid darkgray; padding: 5px; background-color: white; color: black; text-align: center;">800,000,000</td>
</tr>
</table>
</div>

</div>`),l("#bwm-target");let n=0;window.localStorage.setItem("BINGWA_TARGET_FLAG","");var t=window.localStorage.getItem("BINGWA_TARGET");let i=t?JSON.parse(t):{};function e(t,e){function a(t,e){"off"==e?t.parent().addClass("hide"):"on"==e&&t.parent().removeClass("hide")}fe("."+{Online:"target-online",Idle:"target-online",Offline:"target-online","在城内":"target-status","在城外":"target-status","住院时间<=5m":"target-status","住院时间>5m":"target-status","FF>=2.0":"target-fairfight","FF<2.0":"target-fairfight"}[t]).each(function(){fe(this).text()==t?a(fe(this),e):"在城内"==t?"town"==fe(this).attr("hospital-location")&&a(fe(this),e):"在城外"==t?"town"!==fe(this).attr("hospital-location")&&a(fe(this),e):"住院时间<=5m"==t?fe(this).attr("hospital-seconds")<=300&&a(fe(this),e):"住院时间>5m"==t?300<fe(this).attr("hospital-seconds")&&a(fe(this),e):"FF>=2.0"==t?2<=fe(this).text()&&a(fe(this),e):"FF<2.0"==t&&fe(this).text()<2&&a(fe(this),e)})}function o(t){0==t.length||"ID"in(t=Object.values(t)[0])&&(t=t.ID,console.log(t),wt(t).then(function(t){console.log("arr "+t),n=setInterval(()=>{!function(e){if(i.length<=0||fe(".target-id").length<=0)window.localStorage.setItem("BINGWA_TARGET_FLAG",""),clearInterval(n),console.log("faction api refreshing ended");else{window.localStorage.setItem("BINGWA_TARGET_FLAG","refreshing");var t=`https://api.torn.com/faction/${e}?selections=basic&key=${b}`;const a=fe("#bmw_target_tips");a.text("---刷新中---"),fetch(t).then(t=>t.ok?t.json():void a.text("---探测失败 "+e+"---"),t=>{a.text("---网络异常 "+e+"---")}).then(t=>{console.log("faction api refreshed"),fe.each(t.members,function(t,l){fe(".target-id").each(function(){if(t==fe(this).text()){var n=l.last_action.status;let t=ye.yellow;"Online"==n?t=ye.yellowgreen:"Offline"==n&&(t=ye.gray),fe(this).siblings(".target-online").css({"background-color":t,color:"white"}).text(n);var i=Q(l.last_action.timestamp);fe(this).siblings(".target-last").attr("last-action-seconds",i[0]).attr("timestamp",l.last_action.timestamp).text(i[1]);var o=Z(l.status.description,l.status.state,l.status.until);let e="var(--default-bg-green-hover-color)";"red"==l.status.color?e="var(--default-bg-red-hover-color)":"blue"==l.status.color&&(e="var(--default-bg-blue-hover-color)"),fe(this).siblings(".target-status").attr("hospital-seconds",o[1]).attr("hospital-location",o[2]).attr("description",l.status.description).attr("state",l.status.state).attr("until",l.status.until).css({"background-color":e,color:"var(--default-color)"}).text(o[0]),fe(this).siblings(".target-level").text(l.level);i=fe(this).siblings(".target-fairfight").text();if(i!=isNaN){const s=.25*i*(Math.log(l.level)+1);fe(this).siblings(".target-flatrespect").text(s.toFixed(2))}let a=[];const r=fe("#filters").find("[status='on']");r.each(function(){a.push(fe(this).text())});i=function(t,e,a,n,i){let o=1,r=1,s=1,l=1;o=t.includes(e)?1:0;r=t.includes("在城内")&&"town"==a||t.includes("在城外")&&"town"!==a?1:0;s=t.includes("住院时间<=5m")&&n<=300||t.includes("住院时间>5m")&&300<n?1:0;l=t.includes("FF>=2.0")&&2<=i||t.includes("FF<2.0")&&i<2?1:0;return o*r*s*l}(a,n,o[2],o[1],i);0==i?fe(this).parent().addClass("hide"):1==i&&fe(this).parent().removeClass("hide")}})})}).then(function(){return new Promise(function(t,e){setTimeout(function(){t()},1e3)})}).then(function(){0<fe(".target-last").length&&(console.log("fake refresh 1"),fe(".target-last").each(function(){var t=fe(this).attr("timestamp");if(null==t)return!0;t=Q(t);fe(this).attr("last-action-seconds",t[0]).text(t[1]);t=Z(fe(this).siblings(".target-status").attr("description"),fe(this).siblings(".target-status").attr("state"),fe(this).siblings(".target-status").attr("until"));fe(this).siblings(".target-status").attr("hospital-seconds",t[1]).text(t[0])}))}).then(function(){return new Promise(function(t,e){setTimeout(function(){t()},1e3)})}).then(function(){0<fe(".target-last").length&&(console.log("fake refresh 2"),fe(".target-last").each(function(){var t=fe(this).attr("timestamp");if(null==t)return!0;t=Q(t);fe(this).attr("last-action-seconds",t[0]).text(t[1]);t=Z(fe(this).siblings(".target-status").attr("description"),fe(this).siblings(".target-status").attr("state"),fe(this).siblings(".target-status").attr("until"));fe(this).siblings(".target-status").attr("hospital-seconds",t[1]).text(t[0])}))}).catch(t=>console.log("fetch error",t))}}(t[0])},3e3)}).catch(t=>console.log("startRefreshing "+t)))}function r(){var t=`https://api.torn.com/user/?selections=battlestats&key=${b}`;const e=fe("#bmw_target_tips");e.text("---BS探测中---"),fetch(t).then(t=>t.ok?t.json():void e.text("---BS探测失败---"),t=>{e.text("---BS网络异常---")}).then(l=>{if(null!=l)if("error"in l)e.text(l.error);else{const d=Math.sqrt(l.strength)+Math.sqrt(l.defense)+Math.sqrt(l.speed)+Math.sqrt(l.dexterity);console.log("My score:"+d),fe(".target-fairfight").each(function(){var t=Rt(fe(this).siblings(".target-str").text()),e=Rt(fe(this).siblings(".target-def").text()),a=Rt(fe(this).siblings(".target-spd").text()),n=Rt(fe(this).siblings(".target-dex").text()),i=Rt(fe(this).siblings(".target-total").text());let o=((Math.sqrt(t)+Math.sqrt(e)+Math.sqrt(a)+Math.sqrt(n))/d*8/3+1).toFixed(2);3<=o&&(o=3..toFixed(2)),fe(this).text(o);const r=i/l.total;i=r.toFixed(2);const s=fe(this).siblings(".target-total");(1.3<=r?s.css("color","var(--default-base-important-color)"):1.1<=r?s.css("color","var(--default-red-color)"):.9<=r?s.css("color","var(--default-base-brown-color)"):.7<=r?s.css("color","var(--default-base-gold-color)"):.5<=r?s.css("color","var(--default-base-green-color)"):.3<=r?s.css("color","var(--default-green-color)"):s.css("color","var(--default-base-grey1-color)")).attr("title","是你属性的"+i+"倍")})}else e.text("error")}).catch(t=>console.log("fetch error",t))}function s(t){let e=`
<div id="filters" style="overflow:hidden;">
<div status="on" class="filter-button" style="cursor:pointer; margin:5px 0px 5px 20px; padding:6px; border:6px double #CFCFCF; float:left; background-color: #83a000; color: white; font-weight: bold;">Online</div>
<div status="on" class="filter-button" style="cursor:pointer; margin:5px 0px 5px 20px; padding:6px; border:6px double #CFCFCF; float:left; background-color: #F39826; color: white; font-weight: bold;">Idle</div>
<div status="on" class="filter-button" style="cursor:pointer; margin:5px 0px 5px 20px; padding:6px; border:6px double #CFCFCF; float:left; background-color: #ADADAD; color: white; font-weight: bold;">Offline</div>
<div status="on" class="filter-button" style="cursor:pointer; margin:5px 0px 5px 20px; padding:6px; border:6px double #CFCFCF; float:left; background-color: #8FBC8F; color: white; font-weight: bold;">在城内</div>
<div status="on" class="filter-button" style="cursor:pointer; margin:5px 0px 5px 20px; padding:6px; border:6px double #CFCFCF; float:left; background-color: #65A5D1; color: white; font-weight: bold;">在城外</div>
<div status="on" class="filter-button" style="cursor:pointer; margin:5px 0px 5px 20px; padding:6px; border:6px double #CFCFCF; float:left; background-color: #8FBC8F; color: white; font-weight: bold;">住院时间<=5m</div>
<div status="on" class="filter-button" style="cursor:pointer; margin:5px 0px 5px 20px; padding:6px; border:6px double #CFCFCF; float:left; background-color: #FF7373; color: white; font-weight: bold;">住院时间>5m</div>
<div status="on" class="filter-button" style="cursor:pointer; margin:5px 0px 5px 20px; padding:6px; border:6px double #CFCFCF; float:left; background-color: #8FBC8F; color: white; font-weight: bold;">FF>=2.0</div>
<div status="on" class="filter-button" style="cursor:pointer; margin:5px 0px 5px 20px; padding:6px; border:6px double #CFCFCF; float:left; background-color: #FF7373; color: white; font-weight: bold;">FF<2.0</div>
</div>
<table style="margin: auto; background-color: var(--default-bg-panel-color)">
<tr>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #725334; color: white; font-weight: bold; text-align: center;">Online</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #725334; color: white; font-weight: bold; text-align: center;">Name</th>
<th class="head-last" style="border: 1px solid darkgray; padding: 5px; background-color: #725334; color: white; font-weight: bold; text-align: center;">Last</th>
<th class="head-status" style="border: 1px solid darkgray; padding: 5px; background-color: #725334; color: white; font-weight: bold; text-align: center;">Status</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #033649; color: white; font-weight: bold; text-align: center;">Attack</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #033649; color: white; font-weight: bold; text-align: center;" title="Fair fight 系数">FF</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #033649; color: white; font-weight: bold; text-align: center;">TOTAL</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #033649; color: white; font-weight: bold; text-align: center;">ID</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #033649; color: white; font-weight: bold; text-align: center;">Lvl</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #033649; color: white; font-weight: bold; text-align: center;" title="基础面子系数">FR</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #033649; color: white; font-weight: bold; text-align: center;">Hint</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #757947; color: white; font-weight: bold; text-align: center;">STR</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #757947; color: white; font-weight: bold; text-align: center;">DEF</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #757947; color: white; font-weight: bold; text-align: center;">SPD</th>
<th style="border: 1px solid darkgray; padding: 5px; background-color: #757947; color: white; font-weight: bold; text-align: center;">DEX</th>
</tr>
`;for(var a in t){var n=function(t,e,a){var n=["var(--default-bg-panel-color)","var(--default-color)"],i=["#008196","#eee"];let o="",r=[n,n,n,n];return e+a<.33*t?(o="脆",r[0]=i,r[2]=i):.15*t<e-a?(o="防",r[1]=i):.15*t<a-e?(o="闪",r[3]=i):.67*t<e+a&&(o="龟",r[1]=i,r[3]=i),[o].concat(r)}(t[a].TOTAL,t[a].DEF,t[a].DEX);e+=`
<tr>
<td class="target-online" style="border: 1px solid darkgray; padding: 5px; text-align: center;"></td>
<td class="target-name" style="border: 1px solid darkgray; padding: 5px; text-align: center;">
<a class="user name" href="/profiles.php?XID=${t[a].ID}" target="_blank">${t[a].Name}</a>
</td>
<td class="target-last" style="border: 1px solid darkgray; padding: 5px; color: var(--default-color); text-align: center;"></td>
<td class="target-status" style="border: 1px solid darkgray; padding: 5px; color: black; text-align: center;"></td>
<td class="target-attack t-blue" style="border: 1px solid darkgray; padding: 5px; color: black; text-align: center;">
<a href="/loader.php?sid=attack&user2ID=${t[a].ID}" style="text-decoration: none;" target="_blank">Attack</a>
</td>
<td class="target-fairfight" style="border: 1px solid darkgray; padding: 5px; color: var(--default-color); text-align: center;"></td>
<td class="target-total" style="border: 1px solid darkgray; padding: 5px; color: var(--default-color); text-align: center;">${Rt(t[a].TOTAL)||0}</td>
<td class="target-id" style="border: 1px solid darkgray; padding: 5px; color: var(--default-color); text-align: right;">${t[a].ID||""}</td>
<td class="target-level" style="border: 1px solid darkgray; padding: 5px; color: var(--default-color); text-align: center;"></td>
<td class="target-flatrespect" style="border: 1px solid darkgray; padding: 5px; color: var(--default-color); text-align: center;"></td>
<td class="target-hint" style="border: 1px solid darkgray; padding: 5px; color: var(--default-color); text-align: center;">${n[0]}</td>
<td class="target-str" style="border: 1px solid darkgray; padding: 5px; background-color: ${n[1][0]}; color: ${n[1][1]}; text-align: center;">${Rt(t[a].STR)||0}</td>
<td class="target-def" style="border: 1px solid darkgray; padding: 5px; background-color: ${n[2][0]}; color: ${n[2][1]}; text-align: center;">${Rt(t[a].DEF)||0}</td>
<td class="target-spd" style="border: 1px solid darkgray; padding: 5px; background-color: ${n[3][0]}; color: ${n[3][1]}; text-align: center;">${Rt(t[a].SPD)||0}</td>
<td class="target-dex" style="border: 1px solid darkgray; padding: 5px; background-color: ${n[4][0]}; color: ${n[4][1]}; text-align: center;">${Rt(t[a].DEX)||0}</td>
</tr>
`}return e+="</table>",e}0<i.length?(console.log("target cache detected"),fe("#target-load-excel").prop("disabled",!0),fe("#file").prop("disabled",!0),fe("#target-clear-cache").removeAttr("disabled"),fe("#bmw_target_tips").text("加载成功"),fe("#bmw_target_wrapper").html(s(i)),new Promise(function(t,e){setTimeout(function(){console.log("3 Seconds"),t()},3100)}).then(function(){r(),"refreshing"!=window.localStorage.getItem("BINGWA_TARGET_FLAG")?o(i):alert("已存在另外的冰蛙目标页面正在刷新中")}).catch(t=>console.log("First Refresh "+t))):console.log("target cache not available"),fe(".filter-button").click(function(){"on"==fe(this).attr("status")?(fe(this).css({border:"6px solid #CFCFCF","font-weight":"normal"}).attr("status","off"),e(fe(this).text(),"off")):(fe(this).css({border:"6px double #CFCFCF","font-weight":"bold"}).attr("status","on"),e(fe(this).text(),"on"))}),fe("#target-load-excel").click(function(){"undefined"!=typeof XLSX||1==confirm("未检测到xlsx支持组件,只支持导入csv格式,是否继续?")?document.getElementById("file").click():console.log("load cancelled")}),fe("#file").change(function(a){var t,e=a.target.files;0!=e.length&&(t=e[0],(e=/\.(xlsx|csv)$/g.exec(t.name))?function(t,o,r){const e=new FileReader;e.onload=function(t){var e,a=t.target.result;let n;if("xlsx"===o){if("undefined"==typeof XLSX)return void alert("不支持导入xlsx格式文件");n=(e=(t=XLSX.read(e=a,{type:"binary"})).SheetNames,e=t.Sheets[e[0]],XLSX.utils.sheet_to_json(e))}else{function i(t){return"string"==typeof t?Rt(t):t}"csv"===o&&(n=function(t,e){function a(t){let e=0,a="";for(const n of t)'"'===n&&0===e?e=1:'"'===n&&1==e&&(e=0),","===n&&0===e?a+="|":'"'!==n&&(a+=n);return a.split("|")}const n=t.split(/\r?\n/),i=a(n[0]),o=[];for(let t=1;t<n.length-1;t++){var r=a(n[t]);const l={};for(const d in i){var s=i[d];e[s]?l[s]=e[s].call(null,r[d]):l[s]=r[d]}o.push(l)}return o}(a,{STR:i,DEF:i,SPD:i,DEX:i,TOTAL:i}))}r&&r(n)},e.readAsBinaryString(t)}(t,e[1],function(t){if(0<t.length)if(t[0].hasOwnProperty("Name"))if(t[0].hasOwnProperty("ID"))if(t[0].hasOwnProperty("STR"))if(t[0].hasOwnProperty("SPD"))if(t[0].hasOwnProperty("DEF"))if(t[0].hasOwnProperty("DEX"))if(t[0].hasOwnProperty("TOTAL")){for(var e in t)t[e].Name&&"string"!=typeof t[e].Name&&(t[e].Name=t[e].Name.toString());fe("#target-load-excel").prop("disabled",!0),fe("#file").prop("disabled",!0),fe("#target-clear-cache").removeAttr("disabled"),console.log(t),a.target.value="",fe("#bmw_target_tips").text("加载成功"),fe("#bmw_target_wrapper").html(s(t)),window.localStorage.setItem("BINGWA_TARGET",JSON.stringify(t)),new Promise(function(t,e){setTimeout(function(){console.log("3 Seconds"),t()},3100)}).then(function(){r(),"refreshing"!=window.localStorage.getItem("BINGWA_TARGET_FLAG")?o(t):alert("已存在另外的冰蛙目标页面正在刷新中")}).catch(t=>console.log("First Refresh "+t))}else alert("表格中没有TOTAL,修改表格并刷新网页后再试");else alert("表格中没有DEX,修改表格并刷新网页后再试");else alert("表格中没有DEF,修改表格并刷新网页后再试");else alert("表格中没有SPD,修改表格并刷新网页后再试");else alert("表格中没有STR,修改表格并刷新网页后再试");else alert("表格中没有ID,修改表格并刷新网页后再试");else alert("表格中没有Name,修改表格并刷新网页后再试");else alert("表格中没有数据,修改表格并刷新网页后再试")}):alert("仅支持读取xlsx或csv格式!"))}),fe("#target-clear-cache").click(function(){1==confirm("确定清除缓存吗?")?(fe("#target-load-excel").removeAttr("disabled"),fe("#file").removeAttr("disabled"),fe("#target-clear-cache").prop("disabled",!0),fe("#bmw_target_wrapper").empty(),fe("#bmw_target_tips").text("无数据"),window.localStorage.removeItem("BINGWA_TARGET"),i={},window.localStorage.setItem("BINGWA_TARGET_FLAG",""),clearInterval(n),console.log("faction api refreshing ended")):console.log("clear cancelled")})}),fe("#bwm-settings").click(function(){fe("#bwm").children(":last").remove(),fe("#bwm").append(function(){let e="";return be.forEach(t=>{e+=`
<tr style="height: 32px;">
<td style="border:3px solid darkgray;padding:10px;color:#333;background-color:#ccc">${t.title}</td>
<td style="border:3px solid darkgray;padding:10px;color:#333;background-color:#ccc">${t.desc}</td>
<td style="border:3px solid darkgray;padding:10px;color:#333;background-color:#ccc">
<select id="bwm_settings_${t.name}">
<option value="false">关闭</option>
<option value="true">打开</option>
</select>
</td>
</tr>
`}),`
<div id="bwm_settings_container" style="width: inherit">
<div id="bwm_settings_header" style="text-align:center; margin-bottom: 10px;">
<table style="margin: auto">
<tr>
<td style="padding: 10px;">
<span class="border-round" style="font-size: large; color: #333; background-color:#ccc; padding:5px;border:3px solid #333;">设置</span>
</td>
</tr>
</table>
</div>
<div id="bwm_settings_table" style="text-align:center; margin-bottom: 10px;">
<table style="border:1px solid darkgray; padding: 5px; margin: auto">
<tr style="height: 32px;">
<th style="border:3px solid darkgray;padding:10px;color:#ccc;background-color:#111;">功能名称</th>
<th style="border:3px solid darkgray;padding:10px;color:#ccc;background-color:#111;">功能描述</th>
<th style="border:3px solid darkgray;padding:10px;color:#ccc;background-color:#111;">功能状态</th>
</tr>
${e}
</table>
</div>
</div>
`}()),l("#bwm-settings"),be.forEach(t=>{fe(`#bwm_settings_${t.name}`).val(Xt("BWM_SETTINGS",t.name)),fe(`#bwm_settings_${t.name}`).change(function(){Jt("BWM_SETTINGS",t.name,fe(this).val())}),window[t.name]="true"==Xt("BWM_SETTINGS",t.name)})}),fe("#bwm-chatlog").click(function(){fe("#bwm").children(":last").remove(),fe("#bwm").append(`
<div id="chatlog_container" style="width: inherit">
<div id="chatlog_header" style="margin: 10px 0px; border: 1px solid darkgray; text-align: center;">
<span style="font-size: large;">聊天记录</span>
</div>
<div id="chatlog" style="min-height:400px;margin:10px 0px; border:1px solid darkgray;  text-align:center;overflow:hidden; overflow-x: auto;"></div>
</div>`),l("#bwm-chatlog");const t=function(){var t=window.localStorage.getItem("CHAT_LAST_MESSAGE");if(null!=t){var o=JSON.parse(t);let i=[];for(const d in o){const c=o[d];let t="",e="";0<=c.indexOf("|||")?(t=c.split("|||")[0],e=c.split("|||")[1]):t=c;var r=ne(t),s=new Date(1e3*r).toLocaleString(),l=parseInt((new Date).getTime()/1e3)-r;let a="",n="";l<3600?(a=parseInt(l/60)+"m",n="#5d9525"):3600<=l&&l<86400?(a=parseInt(l/3600)+"h",n="#DAA520"):86400<=l&&l<3024e3?(a=parseInt(l/86400)+"d",n="#c0542f"):3024e3<=l&&(a=parseInt(l/86400)+"d",n="#777"),i.push({chat_ts:r,chat_beijing:s,username:d,diff_ts_format:a,diff_ts_color:n,last_message:e})}return i}}();if(void 0!==t){var e=t.sort(function(t,e){return e.chat_ts-t.chat_ts});let a=`
<table id="chatlog-table" style=" background-color: white; font-size:12px; margin: auto;">
<tr class=chatlog-table-head">
<th class="chatlog-time">最后聊天时间</th>
<th class="chatlog-name">玩家</th>
<th class="chatlog-last">距今</th>
<th class="chatlog-message">最后5条消息</th>
</tr>`;fe.each(e,function(t,e){a+=`
<tr class=chatlog-table-content">
<td class="chatlog-time">${e.chat_beijing}</td>
<td class="chatlog-name">${e.username}</td>
<td class="chatlog-last" style="color:white;background-color:${e.diff_ts_color}">${e.diff_ts_format}</td>
<td class="chatlog-message">${e.last_message}</td>
</tr>`}),a+="</table>",fe("#chatlog").append(a),fe("#chatlog-table").find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;"),fe("#chatlog-table").find("td").css({border:"1px solid darkgray",padding:"5px","text-align":"center"})}}),fe("#bwm-mug").click(function(){fe("#bwm").children(":last").remove(),fe("#bwm").append(`
<div id="mug_container" style="width: inherit">
<div id="mug-head" style="margin:10px 0px; border:1px solid darkgray; text-align:center;">
<input type="text" id="mug-watchlist-id-input" placeholder="肥羊 ID" size="10" style="font-size: larger; padding: 5px; margin: 5px;" />
<button id="mug-watchlist-add-input" class="torn-btn" style="margin: 5px;">加入监视</button>
</div>
<div id="mug-watchlist" style="margin:10px 0px; border:1px solid darkgray;  text-align:center;overflow:hidden;"></div>
<div id="mug-loglist" style="min-height:400px;margin:10px 0px; border:1px solid darkgray;  text-align:center;overflow:hidden; overflow-x: auto;"></div>
</div>`),l("#bwm-mug");let o={};function a(){var t=window.localStorage.getItem("muglog-watchlist");if(null!=t){var a,n=JSON.parse(t);let e=`
<table id="mug-watchlist-table" style=" background-color: white; font-size:12px; margin:auto;"><tr class="mug-watchlist-table-head"><th>Victim ID</th><th>Victim Name</th><th>Total Mugged</th><th>删除</th></tr>`;for(a in n){let t="$0";a in o&&(t=Bt(o[a].amount)),e+=`
<tr class="mug-watchlist-table-content">
<td class="mug-watchlsit-victimid">${a}</td>
<td><a class="user name" href="/profiles.php?XID=${a}" target="_blank">${n[a].name}</a></td>
<td>${t}</td>
<td><a class="mug-watchlist-delete" role="button" style="cursor: pointer; color: darkblue;">删除</a></td>
</tr>`}e+="</table>",fe("#mug-watchlist").append(e),fe("#mug-watchlist-table").find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;"),fe("#mug-watchlist-table").find("td").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;")}fe(".mug-watchlist-delete").click(function(){var t=fe(this).parent().parent().children(".mug-watchlsit-victimid").text();Kt("muglog-watchlist",t),fe(this).parent().parent().remove(),console.log("删除成功 "+t)})}!function(){var e=window.localStorage.getItem("muglog");if(null!=e){var a,n=JSON.parse(e);let t="</table>";for(a in n){var i=n[a].victim_id;i in o?o[i].amount+=Bt(n[a].money_mugged):o[i]={name:n[a].victim_name,amount:Bt(n[a].money_mugged)},t=`
<tr class="mug-loglist-table-content">
<td class="mug-loglist-ts">${a}</td>
<td class="mug-loglist-time">${n[a].timestring}</td>
<td class="mug-loglist-victimid">${n[a].victim_id}</td>
<td class="mug-loglist-victimname"><a class="user name" href="/profiles.php?XID=${n[a].victim_id}" target="_blank">${n[a].victim_name}</a></td>
<td class="mug-loglist-amount" title="${n[a].timestring}">${n[a].money_mugged}</td>
<td><a class="mug-loglist-watch" role="button" style="cursor: pointer; color: darkblue;">监视</a></td>
<td><a class="mug-loglist-delete" role="button" style="cursor: pointer; color: darkblue;">删除</a></td>
</tr>`+t}t=`
<table id="mug-loglist-table" style=" background-color: white; font-size:12px; margin: auto;">
<tr class="mug-loglist-table-head">
<th class="mug-loglist-ts">Timestamp</th>
<th class="mug-loglist-time">Time</th>
<th class="mug-loglist-victimid">Victim ID</th>
<th class="mug-loglist-victimname">Victim Name</th>
<th class="mug-loglist-amount">Money Mugged</th>
<th>监视</th><th>删除</th>
</tr>`+t,fe("#mug-loglist").append(t)}fe("#mug-loglist-table").find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;"),fe("#mug-loglist-table").find("td").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;"),fe("#mug_container")[0].clientWidth<400&&(fe(".mug-loglist-ts").hide(),fe(".mug-loglist-victimid").hide(),fe(".mug-loglist-time").hide())}(),a(),fe(".mug-loglist-delete").click(function(){var t=fe(this).parent().parent().children(".mug-loglist-ts").text();Kt("muglog",t),fe(this).parent().parent().remove(),console.log("删除成功 "+t)}),fe(".mug-loglist-watch").click(function(){var t=fe(this).parent().parent().children(".mug-loglist-victimid").text();Jt("muglog-watchlist",t,{name:fe(this).parent().parent().children(".mug-loglist-victimname").text()}),fe("#mug-watchlist-table").remove(),a(),console.log("监视成功 "+t)}),fe("#mug-watchlist-add-input").click(function(){const e=fe("#mug-watchlist-id-input").val();var t;isNaN(e)||0==e||""==e?alert("无效ID"):(t=`https://api.torn.com/user/${e}?selections=profile&key=${b}`,fetch(t).then(t=>t.json()).then(t=>{if(console.log("API fetched"),null!=t.error&&6==t.error.code)throw alert("无效ID "+e),new Error("Incorrect ID");Jt("muglog-watchlist",e,{name:t.name}),fe("#mug-watchlist-table").remove(),a(),alert("监视成功 "+t.name+"["+e+"]"),console.log("监视成功 "+t.name+"["+e+"]")}).catch(t=>console.log("fetch error: ",t.message)))})}),fe("#bwm-return").click(function(){fe("#bwm").remove(),fe("#sidebarroot").show(),fe(".content-wrapper").show()}),fe("#bwm-addiction").click(function(){fe("#bwm").children(":last").remove(),fe("#bwm").append(function(){const t=fe(`
<div style="width: inherit">
<div style="margin:10px 0px; border:1px solid darkgray; text-align:center;">
<button id="addiction-fast-btn" class="torn-btn addiction-analyze-btn" style="margin:5px;">快速分析</button>
<button id="addiction-full-btn" class="torn-btn addiction-analyze-btn" style="margin:5px;">完整分析</button>
<button id="addiction-faq-btn" class="torn-btn" style="margin:5px;">显示 FAQ</button>
</div>
<div id="addiction-faq" style="display: none; margin:10px 0px; padding: 10px; font-size: 100%; line-height: 1.6; color: #333; border:1px solid darkgray; overflow:hidden; overflow-x: auto;">
<p style="font-size: larger"><b>"自动衰减" 是什么?</b></p>
<p>毒瘾在每天 3:32 TCT 左右会自动减少 20 点。在临近这个时间点戒毒,或者长时间不能吃药时,最好留出一定量的毒瘾,避免浪费每天的自动衰减效果。</p>
<br />
<p style="font-size: larger"><b>"误差修正" 是什么?</b></p>
<p>由于各种原因,冰蛙可能在计算毒瘾的过程中出现误差。戒毒日志中的百分比可以帮助修正这些误差,从而保证后续毒瘾数据的正确性。如果你看到连续多次戒毒日志都伴随着误差修正,那么说明误差一直没有被完全修正。下边是一些可能导致误差的原因:</p>
<ul style="list-style: decimal inside">
<li>你在没有帮派加成的情况下吃了药(比如换帮或者 RW 切技能时)。</li>
<li>你某次戒毒时间与当日自然衰减比较接近。</li>
<li><s>冰蛙代码有 bug。</s></li>
</ul>
<br />
<p style="font-size: larger"><b>"找不到整数解" 和 "找不到计算起点" 是什么错误?</b></p>
<p>冰蛙会根据历史上的一些戒毒日志推算毒瘾,但这个过程有可能会失败。下边是一些可能的原因:</p>
<ul style="list-style: decimal inside">
<li>你戒毒经常拉满到 100%。请每次至少少戒 1 格,多次这样的戒毒才能修复这个错误。</li>
<li>你很久没有戒毒了。如果是这样,"快速分析" 有可能会失败,请尝试 "完整分析"。</li>
<li>你还小。冰蛙需要多次戒毒记录才能计算出毒瘾。</li>
<li><s>冰蛙代码有 bug。</s></li>
</ul>
<br />
<p style="font-size: larger"><b>如何帮助冰蛙改进毒瘾算法?</b></p>
<ul style="list-style: decimal inside">
<li><a href="/page.php?sid=log&log=2200,2210,2220,2230,2240,2250,2260,2270,2280,2290,2295,2201,2211,2221,2231,2241,2251,2261,2271,2281,2291,6005,6504,6253,6720,6722,6723">点这里跳转至日志页面</a></li>
<li>点击日志页面的 "<b>导出所选日志</b>" 按钮,并耐心等待,完成后再次点击该按钮,将数据保存至文件</li>
<li>将导出的文件通过 QQ 发送给 tobytorn [1617955]</li>
</ul>
<br />
<p style="font-size: larger"><b>这份日志里包含了哪些数据?</b></p>
<ul style="list-style: decimal inside">
<li title="日志类型: 2200, 2210, 2220, 2230, 2240, 2250, 2260, 2270, 2280, 2290, 2295, 2201, 2211, 2221, 2231, 2241, 2251, 2261, 2271, 2281, 2291">吃药记录</li>
<li title="日志类型: 6005">戒毒记录</li>
<li title="日志类型: 6504">使用 jp 减毒瘾的记录</li>
<li title="日志类型: 6253, 6720, 6722, 6723">帮派进出记录</li>
</ul>
</div>
<div style="margin:10px 0px; border:1px solid darkgray; text-align:center;">
<table style="margin: 5px auto; max-width: 380px; background-color: white; font-size: 12px; line-height: 1.6; text-align: right;">
<tr><th>当前毒瘾</th><td id="addiction-curr-ap" style="text-align: left"></td></tr>
<tr><th style="white-space:nowrap">近期戒毒效率</th><td id="addiction-efficiency" style="text-align: left"></td></tr>
<tr><th>戒毒建议</th><td style="text-align: left"><ul id="addiction-suggestion" style="list-style: decimal inside"></ul></td></tr>
</table>
<div id="addiction-status" style="text-align: center; margin: 5px;"></div>
</div>
<div style="min-height:700px;margin:10px 0px; border:1px solid darkgray; text-align:center; overflow:hidden; overflow-x: auto;">
<table id="addiction-ap-records" style="margin: 5px auto; background-color: white; font-size:12px;">
<tr class="head">
<th>时间</th>
<th>操作</th>
<th>变化</th>
<th>操作后毒瘾</th>
<th>戒毒效率</th>
</tr>
</table>
</div>
</div>`);return t.find("th").css({border:"1px solid darkgray",padding:"2px 5px","font-weight":"bold"}),t.find("td").css({border:"1px solid darkgray",padding:"2px 5px","min-width":"6em"}),t[0]}()),l("#bwm-addiction");const c=6005,d="误差修正",s="自动衰减",e=12720,p=20;function h(t,e){fe("#addiction-status").text(t),fe("#addiction-status").css("color",e?"red":"")}function g(t){return 86400*Math.ceil((t-e)/86400)+e}function f(t,e,a){let n=g(e);const i=[];for(;n<a&&0<t;){var o=n<1618963200?21:p,o=Math.max(t-o,0);i.push({timestamp:n,title:s,ap_before:t,ap_after:o}),t=o,n+=86400}return i}function u(t,e,a,n){let i=e,o=a;const r=[];for(const l of t.slice().reverse()){var s=f(i,o,l.timestamp);0<s.length&&(r.push(...s),i=r[r.length-1].ap_after),o=l.timestamp;let t=[];t=(l.log===c?function(t,e){const a=[],n=[e];for(let t=1;t<100;t++)n.push(e+t);20<e&&n.push(e-20);let i;for(const s of n){var o=Math.round(s*t.data.addiction/100);if(Math.abs(Math.round(1e4*o/s)-Math.round(100*t.data.addiction))<=1){i=s;break}}if(!i)throw new Error("找不到整数解");i!==e&&(a.push({timestamp:t.timestamp,title:d,ap_before:e,ap_after:i}),e=i);var r=e-Math.round(e*t.data.addiction/100);return a.push({timestamp:t.timestamp,title:"Rehab",ap_before:e,ap_after:r,times:t.data.rehab_times,cost:t.data.cost}),a}:function(t,e){var a={2200:1,2210:10,2220:4,2230:10,2240:5,2250:13,2260:3,2270:7,2280:7,2290:18,2295:25,2201:2,2211:10,2221:25,2231:25,2241:14,2251:25,2261:25,2271:25,2281:25,2291:50};const n=[];return 6504===t.log?(t.data.new_addiction!==e-t.data.job_points_used&&n.push({timestamp:t.timestamp,title:d,ap_before:e,ap_after:t.data.new_addiction+t.data.job_points_used}),n.push({timestamp:t.timestamp,title:t.title,ap_before:t.data.new_addiction+t.data.job_points_used,ap_after:t.data.new_addiction})):t.log in a?n.push({timestamp:t.timestamp,title:t.title,ap_before:e,ap_after:e+a[t.log]}):console.warn("未知毒瘾日志",t),n})(l,i),0<t.length&&(r.push(...t),i=r[r.length-1].ap_after)}return r.push(...f(i,o,n)),r.reverse()}async function a(t){const e=[];let a=null,n=null,i=null,o=null,r=0;for await(const d of ee([126],[],null,null,t=>h(`正在分析日志 (${new Date(1e3*t).format("yyyy-MM-dd")})`))){if(e.push(d),d.log===c){r++;var s=function(t){if(t[0].log!==c||t[t.length-1].log!=c)return null;if(100===t[0].data.addiction||100===t[t.length-1].data.addiction)return null;var e=0===(n=u(t.slice(1,-1),1e4,t[t.length-1].timestamp,t[0].timestamp)).length?0:n[0].ap_after-1e4;if(e<=0)return null;var a=t[t.length-1].data.rehab_times,n=t[t.length-1].data.addiction/100;return e/(t[0].data.rehab_times/(t[0].data.addiction/100)-a/n+a)}(e.slice(n));if(a&&s&&Math.abs(s-a)/s<.001){if(i=Math.round(s*d.data.rehab_times*100/d.data.addiction),o=e.length,t)break}else if(100===d.data.addiction&&2<r&&(i=d.data.rehab_times,o=e.length,t))break;a=s,n=e.length-1}if(t&&450<=e.length)break;if(d.timestamp<1577836800)break}if(!o)throw new Error("找不到计算起点");e.length=o;var l=Math.floor((new Date).getTime()/1e3),l=u(e,i,e[e.length-1].timestamp,l);return[e,l]}function n(t,e){const a={ap:"",efficiency:"",suggestions:[]};if(0===t.length)return a;const n=t[0].ap_after;a.ap=n.toString();var i=t.find(t=>"Rehab"===t.title),o=t.slice(t.indexOf(i)+1).find(t=>"Rehab"===t.title);let r=(i.ap_before-i.ap_after)/i.times,s=r;Math.abs(o.ap_before-o.ap_after-r*o.times)<1?a.efficiency=r.toPrecision(3):(s=(o.ap_before-o.ap_after)/o.times,s<r&&([r,s]=[s,r]),a.efficiency=`${r.toPrecision(3)} ~ ${s.toPrecision(3)}`);let l=n;var d=Math.floor((new Date).getTime()/1e3),o=g(d);o<e||o<d+21600?(l-=p,a.suggestions.push(`<li>下次自动衰减之前大概率没有机会继续吃药,建议戒毒后至少留 ${p} 点毒瘾,若有计划在戒毒之前继续吃药,请吃完再重新计算毒瘾</li>`)):o<Math.max(e,d)+28800&&(l-=p-18,a.suggestions.push(`<li>下次自动衰减之前只能再吃一颗 xan 了,建议戒毒后至少留 ${p-18} 点毒瘾</li>`)),l<=r?a.suggestions.push("<li>毒瘾不足一格戒毒量,不建议戒毒</li>"):r===s?(o=Math.floor(l/r),e=i.cost/i.times*o/1e6,i=Math.floor(r*o),a.suggestions.push(`<li>建议戒毒 ${o} 格,花费 $${e}m,预计戒掉 ${(i/n*100).toFixed(2)}%,剩余 ${n-i} 点毒瘾</li>`)):a.suggestions.push("<li>最近两次戒毒效率差异较大,无法估计下次戒毒次数</li>"),a.suggestions.push("<li>目前关于毒瘾的计算并不准确,上述建议可能存在误差</li>");const c=t.find(t=>t.title.startsWith("Item use"));return(!c||c.title.indexOf("xanax")<0||c.timestamp<d-86400)&&a.suggestions.push("<li>你似乎近期没有在坚持吃 xan,上述建议可能并不准确</li>"),a}function i(t,e){fe("#addiction-curr-ap").text(e.ap),fe("#addiction-efficiency").text(e.efficiency);const a=fe("#addiction-suggestion");a.find("li").remove(),a.append(e.suggestions);const n=fe("#addiction-ap-records");if(n.find("tr").slice(1).remove(),0!==t.length){for(const r of t){let t=r.title,e="";"Rehab"===t?t=`戒毒 ${r.times} 格`:t===s?r.ap_before-r.ap_after<20&&(e="t-red"):t===d?e="t-red":t.startsWith("Item use")&&(t=t.slice("Item use ".length),t=t[0].toUpperCase()+t.slice(1));var i=r.ap_after-r.ap_before,o=0<=i?"t-red":"t-green",i=fe(`<tr>
<td>${new Date(1e3*r.timestamp).format("yyyy-MM-dd hh:mm")}</td>
<td class="${e}">${t}</td>
<td class="${o}">${0<=i?"+":""}${i}</td>
<td>${r.ap_after}</td>
<td>${"Rehab"===r.title?(-i/r.times).toPrecision(3):""}</td>
</tr>`);n.append(i)}n.find("td").attr("style","border: 1px solid darkgray; padding: 5px")}}async function t(t){fe(".addiction-analyze-btn").prop("disabled",!0);try{i([],n([],0));var[,e]=await a(t);i(e,n(e,await async function(){var t=Math.floor((new Date).getTime()/1e3),e=await(await fetch(`https://api.torn.com/user/?selections=cooldowns&key=${b}`)).json();if("error"in e)throw new Error(e.error.error);return t+e.cooldowns.drug}())),h("完成!")}catch(t){console.trace(t),"Access level of this key is not high enough"===t.message?(h("权限不足!",!0),fe("#addiction-status").append('<a href="/preferences.php#tab=api">请使用 Full Access 类型的 API Key</a>')):h(`出错啦!${t}`,!0)}fe(".addiction-analyze-btn").prop("disabled",!1)}fe("#addiction-fast-btn").click(()=>t(!0)),fe("#addiction-full-btn").click(()=>t(!1)),fe("#addiction-faq-btn").click(function(){fe(this).prop("disabled",!0),fe("#addiction-faq").show()})})}})}{function L(){const c=fe("div.profile-buttons div.profile-container div.empty-block");if(0<c.length){c.hasClass("profile-container-description")||c.addClass("profile-container-description"),clearInterval(d),c.css({height:"75","padding-top":"5px","overflow-x":"auto"}),c.siblings(".buttons-wrap").css("padding","0px"),c.html("蛙蛙探测器工作中...");const t=fe(".basic-information").find(".info-table").children(":first").children(".user-info-value").children().text();console.log(`user: ${t}`);const e=t?t.split("[")[0].trim():"",a=t?t.split("[")[1].replace("]","").trim():"",n=`/loader.php?sid=attack&user2ID=${a}`;fe(".profile-status").children().children(".title-black").empty().append(`
<span class="border-round" style="color:white;background-color:#DAA520;padding:3px;text-shadow:none;">
<a href="${n}" style="color: white; text-decoration: none;">攻击</a></span>`);const i=function(n){const i=Xt("CHAT_LAST_MESSAGE",n);if(i){let t="";t=0<=i.indexOf("|||")?i.split("|||")[0]:i;n=ne(t),n=parseInt((new Date).getTime()/1e3)-n;let e="",a="";return n<3600?(e=parseInt(n/60)+"m",a="#5d9525"):3600<=n&&n<86400?(e=parseInt(n/3600)+"h",a="#DAA520"):86400<=n&&n<3024e3?(e=parseInt(n/86400)+"d",a="#c0542f"):3024e3<=n&&(e=parseInt(n/86400)+"d",a="#777"),[a,e]}}(e);i?fe(".profile-status").children().children(".title-black").append(`
<span class="border-round" style="color:white;background-color:${i[0]};padding:3px;margin-left:5px;">上次唠嗑: ${i[1]}</span>`):console.log("没唠过");const o=oe(a);if(console.log("mug_display_arr "+o),o){const r=o.split(",")[0],s=o.split(",")[1],l=o.split(",")[2];fe(".profile-status").children().children(".title-black").append(`
<span class="border-round" style="color:white;background-color:${r};padding:3px;margin-left:5px;">上次mug: ${l} - ${s}</span>`)}else console.log("没mug过");Zt(a,function(t){let e=parseInt(100*t.life.current/t.life.maximum);const a=t.life.current+"/"+t.life.maximum+" ("+e+"%)";let n="";n=e<=66?`
<div style="height:20px; overflow:hidden;">
${Yt(20,e,"#c0542f","#FFF5F7",a)}
</div>`:(100<e&&(e=100),`
<div style="height:20px; overflow:hidden;">
${Yt(20,e,"#5d9525","#FFF5F7",a)}
</div>`),c.html(`
<table style="width:100%; background-color: #FFF5F7;">
<tr>
<td class="bw-bs">战力</td>
<td>${t.estimate_bs_display}</td>
<td class="bw-stat">XAN</td>
<td>${t.personalstats.xantaken||0}</td>
<td class="bw-other">活跃天数</td>
<td>${parseInt(t.estimate_active_days)||0}</td>
</tr>
<tr>
<td class="bw-bs">血量</td>
<td class="bw-hp">${n}</td>
<td class="bw-stat">LSD</td>
<td>${t.personalstats.lsdtaken||0}</td>
<td class="bw-other">估算WS</td>
<td>${Lt(t.estimate_ws)||0}</td>
</tr>
<tr>
<td class="bw-nw">资产</td>
<td>${Lt(t.personalstats.networth)}</td>
<td class="bw-stat">SE</td>
<td>${t.personalstats.statenhancersused||0}</td>
<td colspan="2"><a class="t-blue" role="button" id="a_click_start_wawa" style="cursor: pointer">更多&gt;&gt;</a></td>
</tr>
</table>
`),c.find("td").attr("style","border: 2px solid darkgray; padding:2px; text-align:center;"),c.find(".bw-bs").attr("style","border: 2px solid darkgray; padding:2px; text-align:center;background-color: #033649;color: white;font-weight: bold;"),c.find(".bw-nw").attr("style","border: 2px solid darkgray; padding:2px; text-align:center;background-color: #757947;color: white;font-weight: bold;"),c.find(".bw-other").attr("style","border: 2px solid darkgray; padding:2px; text-align:center;background-color: #725334;color: white;font-weight: bold;"),c.find(".bw-stat").attr("style","border: 2px solid darkgray; padding:2px; text-align:center;background-color: #458994;color: white;font-weight: bold;"),c.find(".bw-hp").attr("style","border: 2px solid darkgray; text-align:center;"),fe("div.user-information-section:contains('Last action')").next().children("span").text(t.last_action_details);const i=fe("div.profile-buttons.profile-action").html(),o=`
<div>
<div class="title-black top-round">蛙蛙探测器&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a class="t-white" role="button" id="a_click_start_wawa_back" style="cursor: pointer">返回</a>
</div>
<div class="cont bottom-round ">
<div class="profile-container basic-info bottom-round">
<table style="width:100%; min-height: 320px;">
<tr>
<td style="vertical-align:middle"><span class="bold">估算战力</span></td>
<td style="vertical-align:middle"><span class="bold">${t.estimate_bs_display}</span></td>
<td style="vertical-align:middle"><span class="bold">Xanax数量</span></td>
<td style="vertical-align:middle"><span class="bold">${t.personalstats.xantaken||0}</span></td>
<td style="vertical-align:middle"><span class="bold">SE数量</span></td>
<td style="vertical-align:middle"><span class="bold">${t.personalstats.statenhancersused||0}</span></td>
</tr>
<tr>
<td style="vertical-align:middle"><span class="bold">攻击胜率</span></td>
<td style="vertical-align:middle"><span class="bold">${Lt(t.attackWinRatio)||0}</span></td>
<td style="vertical-align:middle"><span class="bold">防守胜率</td>
<td style="vertical-align:middle"><span class="bold">${Lt(t.defendWinRatio)||0}</span></td>
<td style="vertical-align:middle"><span class="bold">防守胜场</span></td>
<td style="vertical-align:middle"><span class="bold">${t.personalstats.defendswon||0}</span></td>
</tr>
<tr>
<td style="vertical-align:middle"><span class="bold">能量续满</span></td>
<td style="vertical-align:middle"><span class="bold">${t.personalstats.refills||0}</span></td>
<td style="vertical-align:middle"><span class="bold">LSD数量</span></td>
<td style="vertical-align:middle"><span class="bold">${t.personalstats.lsdtaken||0}</span></td>
<td style="vertical-align:middle"><span class="bold">DP占比</span></td>
<td style="vertical-align:middle"><span class="bold">${Lt(t.donator_percent)}</span></td>
</tr>
<tr>
<td style="vertical-align:middle"><span class="bold">活跃天数</span></td>
<td style="vertical-align:middle"><span class="bold">${t.estimate_active_days}</span></td>
<td style="vertical-align:middle"><span class="bold">日均嗑药</span></td>
<td style="vertical-align:middle"><span class="bold">${t.average_drugs}</span></td>
<td style="vertical-align:middle"><span class="bold">Booster</span></td>
<td style="vertical-align:middle"><span class="bold">${Lt(t.personalstats.boostersused)}</span></td>
</tr>
<tr>
<td style="vertical-align:middle"><span class="bold">估算ACE</span></td>
<td style="vertical-align:middle"><span class="bold">${t.estimate_ace}</span></td>
<td style="vertical-align:middle"><strike>估算NNB</strike></td>
<td style="vertical-align:middle"><strike>${t.estimate_nnb}</strike></td>
<td style="vertical-align:middle"><span class="bold">总资产</span></td>
<td style="vertical-align:middle"><span class="bold">${Lt(t.personalstats.networth)}</span></td>
</tr>
</table>
</div>
</div>`,r=function(){fe("div.profile-buttons.profile-action").html(o),fe("div.profile-status").hide(),fe("#a_click_start_wawa_back").click(function(){fe("div.profile-buttons.profile-action").html(i),fe("div.profile-status").show(),fe("#a_click_start_wawa").click(r)})};fe("#a_click_start_wawa").click(r);let s=0;s+=t.enemies/10,s-=t.friends/20,s+=t.personalstats.moneymugged/2e8,s+=t.personalstats.bountiesreceived/50,s=parseInt(s);let l="",d="";d=s<=0?(l="大善人",ye.yellowgreen):s<=10?(l="好人",ye.blue):s<=100?(l="坏人",ye.yellow):(l="大恶人",ye.red),fe("div.basic-information").find("ul.info-table").children("li:eq(9)").children("div.user-info-value").append(`
&nbsp;<span class="border-round" style="padding:2px;background-color:${d};color:white;" title="0分及以下:大善人<br>1-10分:好人<br>11-100分:坏人<br>100分以上:大恶人">${l}</span>
&nbsp;<span title="每有10个敌人加1分<br>每有20个朋友减1分<br>每mug200m加1分<br>每收到50次悬赏加1分"><b>坏比指数: ${s}</b></span>
`)},function(t){c.html(t)})}}0<=window.location.href.indexOf("profiles.php")&&(d=setInterval(L,500))}function G(n,t){let i=!0;if(fe("#parade_filter").length<=0){fe(n).before('<div class="title-black m-top10 title-toggle tablet top-round faction-title active title" data-title="description" role="heading" aria-level="5">阅兵</div><div id="parade_filter" class="cont-gray bottom-rounded content" style="overflow:hidden"><div class="checkboxset-wrap" style="margin:5px 10px; float:left"><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Level" checked="checked">Level</div><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="BS" checked="checked">BS</div><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Mugged" checked="checked">Mugged</div></div><div class="checkboxset-wrap" style="margin:5px 10px; float:left"><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Rehab" checked="checked">Rehab</div><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Rank" checked="checked">Rank</div><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Job" checked="checked">Job</div></div><div class="checkboxset-wrap" style="margin:5px 10px; float:left"><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Networth" checked="checked">Networth</div><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Bazaar">Bazaar</div><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Defendslost">Defendslost</div></div><div class="checkboxset-wrap" style="margin:5px 10px; float:left"><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Property">Property</div><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Elimination">Elimination</div><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Signup">Signup</div></div><div class="checkboxset-wrap" style="margin:5px 10px; float:left"><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Last" checked="checked">Last</div><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Status" checked="checked">Status</div><div class="checkbox-wrap" style="margin:5px 10px;"><input type="checkbox" style="margin:1px 5px;" value="Life">Life</div></div><div class="checkboxset-wrap" style="margin:5px 10px; float:left"><div class="input-wrap" style="margin:5px 10px;"><label for="nw">Bazaar价值 大于 </label><input id="parade_bazaar_value" type="text" style="margin:1px 5px; width:50px" value="10">M</div><div class="btn-wrap" style="margin:5px 10px;"><span class="btn"><button id="parade_start" class="torn-btn" style="margin:1px 5px;">开始阅兵</button></span><span class="btn"><button id="parade_stop" class="torn-btn" style="margin:1px 5px;">暂停阅兵</button></span></div></div></div>'),fe("#parade_stop").prop("disabled",!0);const a=Xt("parade_option","checkbox_vals");var e=Xt("parade_option","text_vals");null!=a&&null!=a&&(fe("#parade_bazaar_value").val(e),fe("#parade_filter input:checkbox").removeAttr("checked"),fe("#parade_filter input:checkbox").each(function(t,e){0<=a.indexOf(fe(this).val())&&fe(this).attr("checked","checked")}))}fe("#parade_start").click(function(){i=!0;let e=fe(t).children("li").first();if(e.length<=0)alert("未找到用户列表");else{const h=fe("#parade_bazaar_value").val().replace(/[^\d]/g,"");let c=[];fe("#parade_filter input:checkbox:checked").each(function(t,e){c.push(fe(this).val())}),console.log(c),fe("#parade_filter input[type='checkbox']").prop("disabled",!0),fe("#parade_filter input[type='text']").prop("disabled",!0),fe(this).prop("disabled",!0),fe("#parade_stop").removeAttr("disabled"),fe("#parade_filter").css("background-color",ye.blue);let t={};if(t.checkbox_vals=c,t.text_vals=h,window.localStorage.setItem("parade_option",JSON.stringify(t)),fe("#search_parade_table").length<1){let e='<p id="search_parade_progress">阅兵进度</p><table id="search_parade_table" style="width:100%;background-color: white;font-size:12px;"><tr><th>Name</th>';for(let t=0;t<c.length;t++)e+=`<th>${c[t]}</th>`;e+="<th>Attack</th></tr></table>",fe(n).before(e),fe("#search_parade_table").find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;")}function a(){if("1"==e.attr("detected"))console.log("user detected"),p(0);else{e.attr("detected","1");const d=e.find("a[href^='/profiles.php?XID=']").attr("href").replace(/[^0-9|-]/gi,"");fe("#search_parade_progress").text(`正在阅兵:${d}`),Zt(d,function(t){let n="Closed",i=0,o=0;if(t.basicicons.icon35){n="Opened";const e=t.bazaar;null!=e&&e.map(function(t,e,a){i+=t.quantity*t.market_price,o+=t.quantity*t.price})}if("Federal"==t.status.state||"Fallen"==t.status.state)console.log("被封/去世,跳过"),fe("#search_parade_progress").text(`阅兵:${d} 被封/去世,跳过`),p(1e3);else if(h&&i<1e6*h)console.log("太穷,跳过"),fe("#search_parade_progress").text(`阅兵:${d} 太穷,跳过`),Jt("battlestats",d,t.estimate_bs),p(1e3);else{let e={};e.Level=t.level,e.BS=Lt(t.estimate_bs),e.Mugged=Lt(t.personalstats.moneymugged),e.Rehab=Lt(t.personalstats.rehabcost||0),e.Rank=t.rank_title,e.Networth=Lt(t.personalstats.networth),e.Defendslost=t.personalstats.defendslost,e.Property=t.property,e.Signup=t.signup,e.Last=t.last_action_brief,e.Status=t.status.state,e.Elimination=null==t.competition?"":t.competition.team;const l=t.job.company_type;var r,s=t.job.job;0==l?e.Job=s:null!=(r=Xt("APICache_companies","companies"))&&null!=r?(e.Job=r[l.toString()].name,e.Job+="Director"==s?"(D)":"(E)"):e.Job=l,e.Life=parseInt(t.life.current/t.life.maximum*100)+"%",e.Bazaar='<span class="t-red">Closed</span>',"Opened"==n&&(e.Bazaar=`<a href="/bazaar.php?userId=${d}"><span class="t-green">${Lt(i)}</span><span class="t-red">/${Lt(o)}</span></a>`);let a=`<tr><td><a class="user name" href="/profiles.php?XID=${d}" target="_blank">${t.name}</a></td>`;for(let t=0;t<c.length;t++)a+=`<td>${e[c[t]]}</td>`;a+=`<td><a class="t-blue c-pointer h attack-act" href="/loader2.php?sid=getInAttack&user2ID=${d}" target="_blank">Attack</a></td></tr>`,console.log(`蛙蛙探测 userId ${d} 成功: ${a}`),fe("#search_parade_table").append(a),fe("#search_parade_table").find("td").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;"),Jt("battlestats",d,t.estimate_bs),p(1e3)}},function(t){console.log(`蛙蛙探测 userId: ${d} 失败`),p(1e3)})}}function p(t){e=fe(e.nextAll(e[0].tagName)[0]),0<e.length&&1==i?(console.log(i),setTimeout(a,t)):(console.log("阅兵完成"),fe("#search_parade_progress").text("阅兵完成"),fe("#parade_filter input[type='checkbox']").removeAttr("disabled"),fe("#parade_filter input[type='text']").removeAttr("disabled"),fe("#parade_start").removeAttr("disabled"),fe("#parade_stop").prop("disabled",!0),fe("#parade_start").text("继续阅兵"),fe("#parade_filter").css("background-color","#f2f2f2"))}console.log("阅兵开始"),a()}}),fe("#parade_stop").click(function(){i=!1,console.log("阅兵暂停"),fe("#search_parade_progress").text("阅兵暂停"),fe("#parade_filter input[type='checkbox']").removeAttr("disabled"),fe("#parade_filter input[type='text']").removeAttr("disabled"),fe("#parade_start").removeAttr("disabled"),fe("#parade_filter").css("background-color","#f2f2f2")})}0<=window.location.href.indexOf("page.php?sid=UserList")&&(G("div.userlist-wrapper","ul.user-info-list-wrap"),setInterval(function(){const t=fe(".user-info-list-wrap").find(".expander");0<t.length&&t.each(function(){if("1"!=fe(this).attr("hasdone")){fe(this).attr("hasdone","1");const e=fe(this).children(".user.name").attr("title");var t=ie(e.split("[")[0].trim());t&&(console.log(t),fe(this).children(".user.name").append(`
<div class= "border-round" title="<strong>上次唠嗑: </strong>${t[1]}"
style="position: absolute; z-index: 1; top: 0px; right: 30px; width: 44px; height: 20px; margin: 3px; border: 3px solid #000; background-color: ${t[0]}; color: #eee; text-align: center;line-height: 20px;">${t[1]}
</div>`))}})},1e3));{function k(t){const e=t.find("a.faction").attr("href");return e?e.substring(30):0}function L(){const t=fe("ul.users-list").children("li");0<t.length&&t.each(function(t,e){if("1"!=fe(this).attr("oversea")){const a=k(fe(this)),n=fe(this).find("a.name").attr("href").substring(18).trim();a in h&&fe(this).css("background-color","NavajoWhite"),a in me&&fe(this).css("background-color","DarkSeaGreen"),n in o&&fe(this).css("background-color",ye.purple),fe(this).attr("oversea","1")}})}foo&&0<=window.location.href.indexOf("index.php?page=people")&&(G("div.travel-people","ul.users-list"),o={},null!=(t=window.localStorage.getItem("muglog-watchlist"))&&(o=JSON.parse(t)),setInterval(L,1e3))}const Ee={Mexico:{name:"墨西",time:18},Cayman:{name:"开曼",time:25},Canada:{name:"加拿",time:29},Hawaii:{name:"夏威",time:94},Argentina:{name:"阿根",time:117},United:{name:"英国",time:111},Switzerland:{name:"瑞士",time:123},Japan:{name:"日本",time:158},China:{name:"中国",time:169},UAE:{name:"迪拜",time:190},South:{name:"南非",time:208},Unknown:{name:"剧院",time:1}},Pe={Mexican:"Mexico",Caymanian:"Cayman",Canadian:"Canada",Hawaiian:"Hawaii",Argentinian:"Argentina",British:"United",Swiss:"Switzerland",Japanese:"Japan",Chinese:"China",Emirati:"UAE",South:"South"};function W(t){return fe(t).find("td.table-level").text()}function H(t){return fe(t).find("td.table-online").attr("code")}function q(t){return fe(t).find("td.table-revivable").text()}function U(t){return fe(t).find("td.table-position").text()}function X(t){return fe(t).find("td.table-days").text()}function J(t){return fe(t).find("td.table-last").attr("last-action-minutes")}function K(t){var e=fe(t).find("td.table-status").attr("hospital-seconds"),t=fe(t).find("td.table-status").attr("hospital-location"),t=Ee[t];return t?-1e6*t.time+Math.max(e,0):e}function V(t){return fe(t).find("td.table-bs").attr("estimate-bs")}function Y(t){let e=Xt("battlestats",t),a="",n="";return null!=e&&null!=e?(a=Rt(e),n=Lt(e)):e=0,[e,a,n]}function Q(t){const e=new Date;t=parseInt(parseInt(e.getTime()/1e3)-t);let a="";return a=60<=t&&t<3600?parseInt(t/60)+"m":3600<=t&&t<86400?parseInt(t/3600)+"h":86400<=t?parseInt(t/86400)+"d":t+"s",[t,a]}function Z(i,o,r){let s=0,l="town";const d=new Date;i=i.split(" ");if("Abroad"==o)o="="+Ee[i[1]].name,s=0-Ee[i[1]].time,l=i[1];else if("Traveling"==o)1<i.length?"Traveling"==i[0]?(o=">"+Ee[i[2]].name,s=0-Ee[i[2]].time,l=i[2]):"Returning"==i[0]&&(o="<"+Ee[i[4]].name,s=0-Ee[i[4]].time,l=i[4]):(o="剧院",s=-1,l="Unknown");else if("Hospital"==o){let t=parseInt(r-parseInt(d.getTime()/1e3));t<0&&(t=0);let e=parseInt(t/3600);e=e<10?"0"+e:e;let a=parseInt(t%3600/60);a=a<10?"0"+a:a;let n=t%60;n=n<10?"0"+n:n,l="hospital"==i[1]?(o=e+":"+a+":"+n,"town"):(o="海"+e+":"+a+":"+n,Pe[i[2]]||"Unknown"),s=t}return[o,s,l]}function tt(t){fe("li.days").text("Last"),fe("li.position").text("BattleStats");let o=200;0<fe("li.position").length&&(o=window.getComputedStyle(fe("li.position")[0]).width.replace(/px$/g,""),console.log(o));var e=`https://api.torn.com/faction/${t}?selections=basic&key=${b}`;fetch(e).then(t=>t.json()).then(i=>{console.log("facPageEnhanced "+t),fe("li.table-row").each(function(){var t=fe(fe(this).find("[class^=userWrap]")).children().attr("href").substring(18),e=Y(t);100<Number(o)?fe(fe(this).find("div.position")).attr("estimate-bs",e[0]).children(":first").text(e[1]):fe(fe(this).find("div.position")).attr("estimate-bs",e[0]).children(":first").text(e[2]);var a=Q(i.members[t].last_action.timestamp);fe(fe(this).find("div.days")).attr("last-action-minutes",a[0]).text(a[1]);var n=i.members[t].status.state,e=i.members[t].status.description,a=i.members[t].status.until,t=i.members[t].status.color,a=Z(e,n,a);fe(fe(this).find("div.status")).attr("sort_score",a[1]).html(`<span class="t-${t}">${a[0]}</span>`)})}).catch(t=>console.log("fetch error",t))}function et(t,e,a){let n=[0,0,0];var i=Xt("APICache_companies","companies");function o(t){return t[0]+t[1]<t[2]?2:t[0]>t[1]?0:1}function r(t){return 0<(t[0]-t[1])*(t[1]-t[2])?1:0<(t[0]-t[2])*(t[2]-t[1])?2:0}function s(t,e){return e/t<=1?e/t:1+(e-t)/t*.5}function l(t,e){if(0==t)return"";t=1.2*e/t;return t<1?"eff-red":t<2?"eff-yellow":"eff-green"}"unassigned"!=e&&null!=i&&null!=i&&(c=i[t].positions[e].man_required,p=i[t].positions[e].int_required,h=i[t].positions[e].end_required,n=[c,p,h]);var d,e=n[o(n)],c=a[o(n)],p=n[r(n)],h=a[r(n)];const g=.67*s(e,c)+.33*s(p,h),f=(d=g)<1?"eff-red":d<1.5?"eff-yellow":"eff-green",u=l(n[0],a[0]),b=l(n[1],a[1]),m=l(n[2],a[2]);p=Math.floor(Math.min(45,c/e*45*1.2)+Math.floor(Math.min(45,h/p*45*1.2)+Math.floor(Math.max(0,5*Math.log2(1.2*c/e)))+Math.floor(Math.max(0,5*Math.log2(1.2*h/p)))));return[g,f,u,b,m].concat(n).concat(p)}function at(t){let e=0;t=Xt("EMPLOYEE_RANK",t);return null!=t&&null!=t&&(e=t),e}function nt(t){var e=`https://api.torn.com/company/?selections=profile,employees&key=${b}`;const a=fe("#tips-view-company");a.text("---探测中---"),fetch(e).then(t=>t.ok?t.json():void a.text("---探测失败---"),t=>{a.text("---网络异常---")}).then(c=>{if(a.text("---探测完成---"),"error"in c)a.text(`---错误代码:${c.error.code} 错误:${c.error.error}---`);else if("company_employees"in c){fe("#companyname").text(c.company.name),t.prepend(`
<table class="company-effectiveness" style="background-color: #FFF5F7;font-size:12px;margin:auto;">
<tr class="head">
<th class="employee-basic table-position">岗位</th>
<th class="employee-basic table-days">天</th>
<th class="employee-ws table-man">MAN</th>
<th class="employee-ws table-int">INT</th>
<th class="employee-ws table-end">END</th>
<th class="employee-effectiveness table-ws" title="Working Stats">属</th>
<th class="employee-effectiveness table-ep" title="Effectiveness Prediction">估</th>
<th class="employee-basic table-last">登</th>
<th class="employee-basic table-username">名字</th>
<th class="employee-effectiveness table-settled" title="Settled In">天</th>
<th class="employee-effectiveness table-merits" title="Merits">点</th>
<th class="employee-effectiveness table-education" title="Director Education">课</th>
<th class="employee-effectiveness table-management" title="Management">理</th>
<th class="employee-effectiveness table-addiction" title="Addiction">药</th>
<th class="employee-effectiveness table-total" title="Total">总</th>
<th class="employee-status table-tornstats">参</th>
</tr>
</table>`);const p=t.children(".company-effectiveness");p.find("th.employee-basic").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #033649;color: white;font-weight: bold;text-align:center;"),p.find("th.employee-ws").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #458994;color: white;font-weight: bold;text-align:center;"),p.find("th.employee-effectiveness").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #757947;color: white;font-weight: bold;text-align:center;"),p.find("th.employee-status").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #725334;color: white;font-weight: bold;text-align:center;");let a=[];fe.each(c.company_employees,function(t,e){e.userid=t,e.position_rank=at(t),a.push(e)}),a.sort(function(t,e){return t.position_rank-e.position_rank});const h={0:"",1:"eff-yellow",3:"eff-red"};fe.each(a,function(t,e){var a=Q(e.last_action.timestamp),n=172800<=a[0]?3:86400<=a[0]?1:0,i=e.effectiveness.addiction||0,o=i<=-10?3:i<=-5?1:0,r=e.effectiveness.merits||0,s=r<=2?3:r<=4?1:0,l=n+o+s,d=3<=l?3:1<=l?1:0,l=et(c.company.company_type,e.position,[e.manual_labor,e.intelligence,e.endurance]);p.children().append(`
<tr class="content">
<td class="table-position tleft" position-value="${e.position_rank}">${e.position}</td>
<td class="table-days">${e.days_in_company}</td>
<td class="table-man tright ${l[2]}" man="${e.manual_labor}" title="MAN Required: ${Rt(l[5])}">${vt(e.manual_labor)}</td>
<td class="table-int tright ${l[3]}" int="${e.intelligence}" title="INT Required: ${Rt(l[6])}">${vt(e.intelligence)}</td>
<td class="table-end tright ${l[4]}" end="${e.endurance}" title="END Required: ${Rt(l[7])}">${vt(e.endurance)}</td>
<td class="table-ws">${e.effectiveness.working_stats||0}</td>
<td class="table-ep">${l[8]}</td>
<td class="table-last ${h[n]}" last-action-minutes="${a[0]}">${a[1]}</td>
<td class="table-username ${h[d]}"><a class="user name" href="/profiles.php?XID=${e.userid}" target="_blank">${e.name}</a></td>
<td class="table-settled">${e.effectiveness.settled_in||0}</td>
<td class="table-merits ${h[s]}">${r}</td>
<td class="table-education">${e.effectiveness.director_education||0}</td>
<td class="table-management">${e.effectiveness.management||0}</td>
<td class="table-addiction ${h[o]}">${i}</td>
<td class="table-total"><b>${e.effectiveness.total||0}</b></td>
<td class="table-tornstats tright ${l[1]}" effectiveness="${l[0]}"><span>${(100*l[0]).toFixed(0)}%</span></td>
</tr>`)}),p.find("th").css("cursor","pointer"),p.find("td").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;"),p.find("td.tright").css("text-align","right"),p.find("td.tleft").css("text-align","left"),p.find("td.eff-green").css("background-color","#D0E9C6"),p.find("td.eff-yellow").css("background-color","#FAF2CC"),p.find("td.eff-red").css("background-color","#EBCCCC"),Vt(p.find("th.table-position"),ot),Vt(p.find("th.table-days"),rt),Vt(p.find("th.table-man"),st),Vt(p.find("th.table-int"),lt),Vt(p.find("th.table-end"),dt),Vt(p.find("th.table-ws"),ct),Vt(p.find("th.table-settled"),pt),Vt(p.find("th.table-merits"),ht),Vt(p.find("th.table-education"),gt),Vt(p.find("th.table-management"),ft),Vt(p.find("th.table-addiction"),ut),Vt(p.find("th.table-total"),mt),Vt(p.find("th.table-last"),J),Vt(p.find("th.table-tornstats"),xt)}}).catch(t=>console.log("fetch error",t))}function it(F){let O=Ut("company-history-items"),E=0;O&&(E=Object.keys(O).length);const t=new Date,P=new Date(new Date(t.setDate(t.getDate()-1)).setHours(t.getHours()-2)).format("yyyy-MM-dd"),N=Xt("company-history-items",P);const z=Xt("company-history-items",new Date(t.setDate(t.getDate()-1)).format("yyyy-MM-dd"));if(null===F){if(E<=0)return void console.log("没有历史数据,跳过自动获取公司产量数据");if(N)return void console.log("本次产量数据已存过,跳过自动获取公司产量数据");console.log("本次产量数据还没存过,将自动获取公司产量数据")}var e=`https://api.torn.com/company/?selections=profile,employees,stock,detailed,news&key=${b}`;const j=fe("#tips-view-company");j.text("---探测中---"),fetch(e).then(t=>t.ok?t.json():void j.text("---探测失败---"),t=>{j.text("---网络异常---")}).then(g=>{console.log(g);var t=g.company_detailed.trains_available,{rating:e,company_type:a}=g.company;let n=0;var i=Xt("APICache_companies","companies");if(i&&i[a]&&i[a].positions)for(const M in g.company_employees){var o=g.company_employees[M];"Trainer"===i[a].positions[o.position].special_ability&&n++}var r=t+e+3*n;let s=`${t}(当前)+${e}(星级)`;if(0<n&&(s+=`+0~${3*n}(Trainer)`),20<r&&fe("#bingwa-top-warn").append(`
<div class="info-msg border-round">
<i class="info-icon"></i>
<div class="delimiter">
<div class="msg right-round" tabindex="0" role="alert">
trains即将溢出。
${s}
</div>
</div>
</div>`),F){if(null!=g.error&&7==g.error.code)throw j.text("---员工无权限查看---"),new Error("not a director");null!=g&&j.text("---探测完成---"),fe("#companyname").text(g.company.name),F.append(`
<table class="company-effectiveness" style="width:100%;background-color: #FFF5F7;font-size:12px;">
<tr class="head">
<th class="employee-basic table-position">岗位</th>
<th class="employee-basic table-days">天</th>
<th class="employee-ws table-man">MAN</th>
<th class="employee-ws table-int">INT</th>
<th class="employee-ws table-end">END</th>
<th class="employee-effectiveness table-ws" title="Working Stats">属</th>
<th class="employee-effectiveness table-ep" title="Effectiveness Prediction">估</th>
<th class="employee-basic table-last">登</th>
<th class="employee-basic table-username">名字</th>
<th class="employee-effectiveness table-settled" title="Settled In">天</th>
<th class="employee-effectiveness table-merits" title="Merits">点</th>
<th class="employee-effectiveness table-education" title="Director Education">课</th>
<th class="employee-effectiveness table-management" title="Management">理</th>
<th class="employee-effectiveness table-addiction" title="Addiction">药</th>
<th class="employee-effectiveness table-inactivity" title="Inactivity">离</th>
<th class="employee-effectiveness table-total" title="Total">总</th>
<th class="employee-effectiveness table-wage" title="Wage">薪</th>
<th class="employee-status table-tornstats">参</th>
</tr>
</table><br /><br />
<table class="company-history" style="width:100%;background-color: #FFF5F7;font-size:12px;">
<tr class="head">
<th colspan=2>生产日期</th>
<th>收入</th>
<th>工资</th>
<th>广告费</th>
<th>利润</th>
<th>总效率</th>
<th>产量</th>
<th>销量</th>
<th>库存</th>
<th>单价</th>
<th>成本</th>
<th>记录时间</th>
</tr>
</table>`);const $=F.find(".company-effectiveness");$.find("th.employee-basic").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #033649;color: white;font-weight: bold;text-align:center;"),$.find("th.employee-ws").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #458994;color: white;font-weight: bold;text-align:center;"),$.find("th.employee-effectiveness").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #757947;color: white;font-weight: bold;text-align:center;"),$.find("th.employee-status").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #725334;color: white;font-weight: bold;text-align:center;")}let l='<br /><table class="company-stock" style="width:100%;background-color: #FFF5F7;font-size:12px;"><tr class="head"><th>库存种类</th>';fe.each(g.company_stock,function(t,e){l+=`<th>${t}</th>`}),l+='</tr><tr class="content"><td class="stock-title">单价</td>',fe.each(g.company_stock,function(t,e){l+=`<td class="stock-content">${Rt(e.price)}</td>`}),l+='</tr><tr class="content"><td class="stock-title">SOLD WORTH</td>',fe.each(g.company_stock,function(t,e){l+=`<td class="stock-content">${Rt(e.sold_worth)}</td>`}),l+='</tr><tr class="content"><td class="stock-title">SOLD AMOUNT</td>',fe.each(g.company_stock,function(t,e){l+=`<td class="stock-content">${Rt(e.sold_amount)}</td>`}),l+="</tr></table>",fe(".company-effectiveness").after(l),fe(".company-stock").find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #033649;color: white;font-weight: bold;text-align:center;"),fe(".company-stock").find("td.stock-content").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;"),fe(".company-stock").find("td.stock-title").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #458994;color: white;font-weight: bold;text-align:center;");let d=[];fe.each(g.company_employees,function(t,e){e.userid=t,e.position_rank=at(t),d.push(e)}),d.sort(function(t,e){return t.position_rank-e.position_rank});const f={0:"",1:"eff-yellow",3:"eff-red"};let u=0,b=0;fe.each(d,function(t,e){if(u+=e.wage||0,b+=e.effectiveness.total||0,null===F)return!0;var a=Q(e.last_action.timestamp),n=172800<=a[0]?3:86400<=a[0]?1:0,i=e.effectiveness.addiction||0,o=i<=-10?3:i<=-5?1:0,r=e.effectiveness.inactivity||0,s=r<0?3:0,l=e.effectiveness.merits||0,d=l<=2?3:l<=4?1:0,c=n+o+d,p=3<=c?3:1<=c?1:0,c=et(g.company.company_type,e.position,[e.manual_labor,e.intelligence,e.endurance]),c=`
<tr class="content">
<td class="table-position tleft" position-value="${e.position_rank}">${e.position}</td>
<td class="table-days">${e.days_in_company}</td>
<td class="table-man tright ${c[2]}" man="${e.manual_labor}" title="MAN Required: ${Rt(c[5])}">${vt(e.manual_labor)}</td>
<td class="table-int tright ${c[3]}" int="${e.intelligence}" title="INT Required: ${Rt(c[6])}">${vt(e.intelligence)}</td>
<td class="table-end tright ${c[4]}" end="${e.endurance}" title="END Required: ${Rt(c[7])}">${vt(e.endurance)}</td>
<td class="table-ws">${e.effectiveness.working_stats||0}</td>
<td class="table-ep">${c[8]}</td>
<td class="table-last ${f[n]}" last-action-minutes="${a[0]}">${a[1]}</td>
<td class="table-username ${f[p]}"><a class="user name" href="/profiles.php?XID=${e.userid}" target="_blank">${e.name}</a></td>
<td class="table-settled">${e.effectiveness.settled_in||0}</td>
<td class="table-merits ${f[d]}">${l}</td>
<td class="table-education">${e.effectiveness.director_education||0}</td>
<td class="table-management">${e.effectiveness.management||0}</td>
<td class="table-addiction ${f[o]}">${i}</td>
<td class="table-inactivity ${f[s]}">${r}</td>
<td class="table-total"><b>${e.effectiveness.total||0}</b></td>
<td class="table-wage" wage="${e.wage}"><b>$${Rt(e.wage||0)}</b></td>
<td class="table-tornstats tright ${c[1]}" effectiveness="${c[0]}"><span>${(100*c[0]).toFixed(0)}%</span></td>
</tr>`;const h=F.find(".company-effectiveness");h.children().append(c)});var c=parseInt(g.company.daily_income||0),t=parseInt(g.company_detailed.advertising_budget||0);let p=0,h=0,m=0,y=0,x=0;fe.each(g.company_stock,function(t,e){p+=e.sold_amount*e.cost,h+=e.sold_amount,m+=e.in_stock,y+=e.sold_worth}),0<h&&(x=parseInt(y/h));let v=m;z?(console.log("有上一次的产量数据"),console.log(z),v=z.Stock||m):console.log("没有上一次的产量数据,本次的产量将设置为与销量相等");e=m+h-v,r=c-u-t-p,e={Date:P,Income:c,Wages:u,Ad:t,Profit:r,Effectiveness:b,Produced:e,Sold:h,Stock:m,Price:x,Cost:p,RecordTime:(new Date).format("MM-dd hh:mm:ss")};console.log(e);let w=!1;var _,k=g.news;for(_ in k){const T=k[_];if(0<=T.news.indexOf("report"))if(new Date(1e3*(T.timestamp-86400)).format("yyyy-MM-dd")==P){w=!0;break}}if(N||!w?console.log("本次产量数据已存过,不再覆盖"):(console.log("本次产量数据未保存,现在保存"),Jt("company-history-items",P,e),O=Ut("company-history-items")),console.log(O),null===F)return!0;const $=F.find(".company-effectiveness");$.find("th").css("cursor","pointer"),$.find("td").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;"),$.find("td.tright").css("text-align","right"),$.find("td.tleft").css("text-align","left"),$.find("td.eff-green").css("background-color","#D0E9C6"),$.find("td.eff-yellow").css("background-color","#FAF2CC"),$.find("td.eff-red").css("background-color","#EBCCCC"),Vt($.find("th.table-position"),ot),Vt($.find("th.table-days"),rt),Vt($.find("th.table-man"),st),Vt($.find("th.table-int"),lt),Vt($.find("th.table-end"),dt),Vt($.find("th.table-ws"),ct),Vt($.find("th.table-si"),pt),Vt($.find("th.table-me"),ht),Vt($.find("th.table-de"),gt),Vt($.find("th.table-ma"),ft),Vt($.find("th.table-ad"),ut),Vt($.find("th.table-ia"),bt),Vt($.find("th.table-to"),mt),Vt($.find("th.table-wg"),yt),Vt($.find("th.table-last"),J),Vt($.find("th.table-tornstats"),xt),$.after(`<br /><b>实时人数:${Object.keys(g.company_employees).length},总工资:$${Rt(e.Wages)},广告费:$${Rt(e.Ad)},周销售:$${Rt(g.company.weekly_income)}</b><br />`);let I={Income:0,Wages:0,Ad:0,Profit:0,Effectiveness:0,Produced:0,Sold:0,Stock:0,Price:0,Cost:0};const S=F.find(".company-history");let D=0,C=0,A=0;fe.each(O,function(t,e){var a=parseInt(((new Date).getTime()-new Date(t).getTime())/864e5);if(31<a)return console.log(`删除过期数据:${t}`),Kt("company-history-items",t),delete O[t],!0;A++;t=`
<tr class="content">
<td>${A}</td>
<td>${t}</td>
<td>$${Rt(e.Income)}</td>
<td>$${Rt(e.Wages)}</td>
<td>$${Rt(e.Ad)}</td>
<td>$${Rt(e.Profit)}</td>
<td>${Rt(e.Effectiveness)}</td>
<td>${Rt(e.Produced)}</td>
<td>${Rt(e.Sold)}</td>
<td>${Rt(e.Stock)}</td>
<td>$${Rt(e.Price)}</td>
<td>$${Rt(e.Cost)}</td>
<td>${e.RecordTime||"-"}</td>
</tr>`;S.children().append(t),I.Income+=parseInt(e.Income),I.Wages+=parseInt(e.Wages),I.Ad+=parseInt(e.Ad),I.Profit+=parseInt(e.Profit),I.Effectiveness+=parseInt(e.Effectiveness),I.Produced+=parseInt(e.Produced),I.Sold+=parseInt(e.Sold),I.Stock+=parseInt(e.Stock),I.Price+=parseInt(e.Price),I.Cost+=parseInt(e.Cost||0),a<=7&&(D+=parseInt(e.Profit),C++)}),E=Object.keys(O).length;e=`
<tr class="content">
<td colspan=2><b>平均值</b></td>
<td>$${Rt((I.Income/E).toFixed(0))}</td>
<td>$${Rt((I.Wages/E).toFixed(0))}</td>
<td>$${Rt((I.Ad/E).toFixed(0))}</td>
<td>$${Rt((I.Profit/E).toFixed(0))}</td>
<td>${Rt((I.Effectiveness/E).toFixed(0))}</td>
<td>${Rt((I.Produced/E).toFixed(0))}</td>
<td>${Rt((I.Sold/E).toFixed(0))}</td>
<td>${Rt((I.Stock/E).toFixed(0))}</td>
<td>$${Rt((I.Price/E).toFixed(0))}</td>
<td>$${Rt((I.Cost/E).toFixed(0))}</td>
<td>${(new Date).format("MM-dd hh:mm:ss")}</td>
</tr>`;S.children().append(e),S.find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #033649;color: white;font-weight: bold;text-align:center;"),S.find("td").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;"),S.after(`<br /><b>共 ${E} 天数据,总利润:$${Rt(I.Profit)},近一周(${C}天)利润:$${Rt(D)}</b>`)}).catch(t=>console.log("fetch error: ",t.message))}function ot(t){return fe(t).find("td.table-position").attr("position-value")}function rt(t){return fe(t).find("td.table-days").text()}function st(t){return fe(t).find("td.table-man").attr("man")}function lt(t){return fe(t).find("td.table-int").attr("int")}function dt(t){return fe(t).find("td.table-end").attr("end")}function ct(t){return fe(t).find("td.table-ws").text()}function pt(t){return fe(t).find("td.table-settled").text()}function ht(t){return fe(t).find("td.table-merits").text()}function gt(t){return fe(t).find("td.table-education").text()}function ft(t){return fe(t).find("td.table-management").text()}function ut(t){return fe(t).find("td.table-addiction").text()}function bt(t){return fe(t).find("td.table-inactivity").text()}function mt(t){return fe(t).find("td.table-total").text()}function yt(t){return fe(t).find("td.table-wage").attr("wage")}function xt(t){return fe(t).find("td.table-tornstats").attr("effectiveness")}function vt(t){return t<1e4?t.toString().replace(/\d{1,3}(?=(\d{3})+$)/g,function(t){return t+","}):parseInt(t/1e3)+"k"}function wt(n){return new Promise((e,a)=>{var t=`https://api.torn.com/user/${n}?selections=profile&key=${b}`;fetch(t).then(t=>t.ok?t.json():void console.log("---探测失败 "+n+"---"),t=>{console.log("---网络异常 "+n+"---")}).then(t=>{null!=t?"error"in t?a(t.error):(console.log(`userId2otherIds: ${n} => (${t.faction.faction_id} - ${t.faction.position}) (${t.job.company_id} - ${t.job.job})`),e([t.faction.faction_id,t.faction.position,t.job.company_id,t.job.job])):a()}).catch(t=>a(t))})}function _t(o){return new Promise((e,n)=>{const i=fe("#mainContainer").find("div:contains('unavailable')").last();i.text("蛙蛙探测器工作中...");var t=`https://api.torn.com/faction/${o}?selections=basic,chain&key=${b}`;fetch(t).then(t=>t.ok?t.json():void i.text("---探测失败 "+o+"---"),t=>{i.text("---网络异常 "+o+"---")}).then(t=>{if(null!=t)if("error"in t)n(t.error);else{fe("#skip-to-content").text(`帮派: ${t.name}`),i.html(`<b>声望:</b> ${Rt(t.respect)}&nbsp;&nbsp;&nbsp;&nbsp;<b>天数:</b> ${Rt(t.age)}&nbsp;&nbsp;&nbsp;&nbsp;<b>最大连击:</b> ${Rt(t.best_chain)}&nbsp;&nbsp;&nbsp;&nbsp;<b>成员数:</b> ${Object.keys(t.members).length}`),0<t.chain.current&&i.append(`</br /></br /><b>正在连击:</b> ${Rt(t.chain.current)}/${Rt(t.chain.max)}&nbsp;&nbsp;&nbsp;&nbsp;<b>开始时间:</b> ${new Date(1e3*t.chain.start).format("yyyy-MM-dd hh:mm:ss")}&nbsp;&nbsp;&nbsp;&nbsp;<b>连击超时:</b> ${t.chain.timeout}(秒)&nbsp;&nbsp;&nbsp;&nbsp;<b>声望系数:</b> ${t.chain.modifier}&nbsp;&nbsp;&nbsp;&nbsp;<b>冷却时间:</b> ${t.chain.cooldown}`),t.territory_wars&&0<Object.keys(t.territory_wars).length&&(i.append("</br />"),fe.each(t.territory_wars,function(t,e){e.assaulting_faction==o?i.append(`</br /><b>正在进攻地盘:</b> ${e.territory}&nbsp;&nbsp;&nbsp;&nbsp;<b>防守方:</b> <a href='/factions.php?step=profile&ID=${e.defending_faction}' target='_blank'>${e.defending_faction}</a>`):i.append(`</br /><b>正在防守地盘:</b> ${e.territory}&nbsp;&nbsp;&nbsp;&nbsp;<b>进攻方:</b> <a href='/factions.php?step=profile&ID=${e.assaulting_faction}' target='_blank'>${e.assaulting_faction}</a>`),i.append(`&nbsp;&nbsp;&nbsp;&nbsp;<b>推墙进度:</b> ${Rt(e.score)}/${Rt(e.required_score)}&nbsp;&nbsp;&nbsp;&nbsp;<b>最迟结束时间:</b> ${new Date(1e3*e.end_time).format("yyyy-MM-dd hh:mm:ss")}`)})),t.peace&&0<Object.keys(t.peace).length&&(i.append("</br />"),fe.each(t.peace,function(t,e){i.append(`</br /><b>和平条约:</b> <a href='/factions.php?step=profile&ID=${t}' target='_blank'>${t}</a>&nbsp;&nbsp;&nbsp;&nbsp;<b>到期时间:</b> ${new Date(1e3*e).format("yyyy-MM-dd hh:mm:ss")}`)})),t.raid_wars&&0<Object.keys(t.raid_wars).length&&(i.append("</br />"),fe.each(t.raid_wars,function(t,e){e.raiding_faction==o?i.append(`</br /><b>正在突击:</b> <a href='/factions.php?step=profile&ID=${e.defending_faction}' target='_blank'>${e.defending_faction}</a>`):i.append(`</br /><b>正在被</b> <a href='/factions.php?step=profile&ID=${e.raiding_faction}' target='_blank'>${e.raiding_faction}</a> 突击`),i.append(`&nbsp;&nbsp;&nbsp;&nbsp;<b>突击进度(攻/守):</b> ${e.raider_score}/${e.defender_score}&nbsp;&nbsp;&nbsp;&nbsp;<b>开始时间:</b> ${new Date(1e3*e.start_time).format("yyyy-MM-dd hh:mm:ss")}`)})),fe(".content-wrapper").last().append(`
<table id="faction-members" style="width:100%;background-color: #FFF5F7;font-size:12px;">
<tr class="head">
<th>名字</th>
<th>天数</th>
<th>上次活动</th>
<th>状态</th>
<th>角色</th>
</tr>
</table>`);const a=fe("#faction-members");fe.each(t.members,function(t,e){e=`
<tr class="content">
<td><a href='/profiles.php?XID=${t}' target='_blank'>${e.name}</a></td>
<td>${e.days_in_faction}</td>
<td>${e.last_action.relative}</td>
<td>${e.status.description}</td>
<td>${e.position}</td>
</tr>`;a.children().append(e)}),a.find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #033649;color: white;font-weight: bold;text-align:center;"),a.find("td").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;"),e()}else n()}).catch(t=>i.text(t))})}function kt(r){return new Promise((t,i)=>{if(0<=fe("div.company-details").children("div.title-black").text().indexOf("Oil Rig")){var e,a=fe("div.company-details").find("li:contains('Daily income')").text().replace(/[^\d]/g,"");for(let t=250;120<=t;--t)a%t==0&&(e=parseInt(a/t),fe("div.company-details").children("div.title-black").append(`<span class="m-hide"> - 估算销售: ${t} x ${Rt(e)} </span>`))}const o=fe("#mainContainer").find("div:contains('unavailable')").last();o.text("蛙蛙探测器工作中...");var n=`https://api.torn.com/company/${r}?selections=profile&key=${b}`;fetch(n).then(t=>t.ok?t.json():void o.text("---探测失败 "+r+"---"),t=>{o.text("---网络异常 "+r+"---")}).then(e=>{if(null!=e)if("error"in e)i(e.error);else{var a,t={1:"Hair Salon",2:"Law Firm",3:"Flower Shop",4:"Car Dealership",5:"Clothing Store",6:"Gun Shop",7:"Game Shop",8:"Candle Shop",9:"Toy Shop",10:"Adult Novelties",11:"Cyber Cafe",12:"Grocery Store",13:"Theater",14:"Sweet Shop",15:"Cruise Line",16:"Television Network",18:"Zoo",19:"Firework Stand",20:"Property Broker",21:"Furniture Store",22:"Gas Station",23:"Music Store",24:"Nightclub",25:"Pub",26:"Gents Strip Club",27:"Restaurant",28:"Oil Rig",29:"Fitness Center",30:"Mechanic Shop",31:"Amusement Park",32:"Lingerie Store",33:"Meat Warehouse",34:"Farm",35:"Software Corporation",36:"Ladies Strip Club",37:"Private Security Firm",38:"Mining Corporation",39:"Detective Agency",40:"Logistics Management"};if(fe("#skip-to-content").html(`公司: ${e.company.name}`),o.html(`<b>类型:</b> ${t[e.company.company_type]}&nbsp;&nbsp;&nbsp;&nbsp;<b>星级:</b> ${e.company.rating}&nbsp;&nbsp;&nbsp;&nbsp;<b>员工数:</b> ${e.company.employees_hired}/${e.company.employees_capacity}&nbsp;&nbsp;&nbsp;&nbsp;<b>日销售:</b> $${Rt(e.company.daily_income)}&nbsp;&nbsp;&nbsp;&nbsp;<b>周销售:</b> $${Rt(e.company.weekly_income)}&nbsp;&nbsp;&nbsp;&nbsp;<b>天数:</b> ${Rt(e.company.days_old)}`),28==e.company.company_type){o.append("&nbsp;&nbsp;&nbsp;&nbsp;<b>估算单价x销量:</b>");for(let t=200;120<=t;--t)e.company.daily_income%t==0&&(a=parseInt(e.company.daily_income/t),o.append(` ${t}x${Rt(a)}`))}else 16==e.company.company_type&&(t=parseInt(e.company.daily_income/e.company.daily_customers),o.append(`&nbsp;&nbsp;&nbsp;&nbsp;<b>单价x销量:</b> ${Rt(t)}x${Rt(e.company.daily_customers)}`));fe(".content-wrapper").last().append(`
<table id="company-members" style="width:100%;background-color: #FFF5F7;font-size:12px;">
<tr class="head">
<th>名字</th>
<th>天数</th>
<th>上次活动</th>
<th>状态</th>
<th>职位</th>
</tr>
</table>`);const n=fe("#company-members");fe.each(e.company.employees,function(t,e){e=`
<tr class="content">
<td><a href='/profiles.php?XID=${t}' target='_blank'>${e.name}</a></td>
<td>${e.days_in_company}</td>
<td>${e.last_action.relative}</td>
<td>${e.status.description}</td>
<td>${e.position}</td>
</tr>`;n.children().append(e)}),n.find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #033649;color: white;font-weight: bold;text-align:center;"),n.find("td").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;")}else i()}).catch(t=>o.text(t))})}if(0<=window.location.href.indexOf("factions.php?step=your")){const Ne=fe("[href^='/forums.php#!p=forums&f=999&b=1&a=']").attr("href");var $t=0;if(null!=Ne&&($t=Ne.substring(34),window.localStorage.setItem("MY_FACTION_ID",$t)),foo){let e=setInterval(It,1e3),a=0;function It(){if(0<=window.location.href.indexOf("factions.php?step=your#/tab=info")&&0<fe("li.position").length){clearInterval(e),a=setInterval(St,1e3),console.log("li position"),G("div.f-war-list","ul.table-body");const t=fe("div[data-faction]").attr("data-faction");tt(t)}}function St(){console.log("faction info"),window.location.href.indexOf("factions.php?step=your#/tab=info")<0&&(clearInterval(a),e=setInterval(It,1e3))}}}if(0<=window.location.href.indexOf("factions.php?step=profile&"))if(0<fe("#mainContainer").find("div:contains('unavailable')").last().length)if(0<=window.location.href.indexOf("profile&ID=")){const fID=/profile&ID=(\d+)/.exec(window.location.href)[1];console.log("fID "+fID),_t(fID).catch(t=>console.log("factionPageRedraw "+t))}else 0<=window.location.href.indexOf("profile&userID=")&&($t=/userID=(\d+)/.exec(window.location.href)[1],console.log("userId "+$t),wt($t).then(function(t){console.log(t),_t(t[0]).catch(t=>console.log("factionPageRedraw "+t))}).catch(t=>console.log("userId2otherIds "+t)));else{function It(){if(0<fe("li.position").length){clearInterval(r),console.log("li position"),G("div.f-war-list","ul.table-body");const t=fe("div[data-faction]").attr("data-faction");tt(t)}}foo&&(r=setInterval(It,1e3))}if(0<=window.location.href.indexOf("p=corpinfo&"))if(0<=window.location.href.indexOf("corpinfo&ID=")){const ze=/corpinfo&ID=(\d+)/.exec(window.location.href)[1];console.log("companyID "+ze),new Promise(function(t,e){setTimeout(function(){console.log("2 Seconds"),t()},2e3)}).then(function(){kt(ze).catch(t=>console.log("companyPageRedraw "+t))}).catch(t=>console.log("companyPageRedraw "+t))}else 0<=window.location.href.indexOf("corpinfo&userID=")&&(s=/userID=(\d+)/.exec(window.location.href)[1],console.log("userId "+s),wt(s).then(function(a){return new Promise(function(t,e){setTimeout(function(){console.log("2 Seconds"),t(a)},2e3)})}).then(function(t){console.log(t),kt(t[2]).catch(t=>console.log("companyPageRedraw "+t))}).catch(t=>console.log("userId2otherIds "+t)));if("https://www.torn.com/competition.php"==window.location.href||"https://www.torn.com/competition.php#/p=main"==window.location.href){const je=fe("#mainContainer").find("div:contains('access')").last();0<je.length&&(je.text("蛙蛙探测器工作中..."),s=`https://api.torn.com/torn/?selections=competition&key=${b}`,fetch(s).then(t=>t.ok?t.json():void je.text("---探测失败 ---"),t=>{je.text("---网络异常 ---")}).then(t=>{fe(".content-wrapper").last().append(`
<table id="elim-teams" style="margin-top:10px;width:100%;background-color: #FFF5F7;font-size:12px;">
<tr class="head">
<th>排名</th>
<th>队伍</th>
<th>状态</th>
<th>分数</th>
<th>生命</th>
<th>参与人数</th>
<th>攻击胜利</th>
<th>被攻击</th>
</tr>
</table>`);const e=fe("#elim-teams"),a=t.competition.teams;a.forEach(function(t){t=`
<tr class="content">
<td>${t.position}</td>
<td>${t.name}</td>
<td>${t.status}</td>
<td>${t.score}</td>
<td>${t.lives}</td>
<td>${t.participants}</td>
<td>${t.wins}</td>
<td>${t.losses}</td>
</tr>`;e.children().append(t)}),e.find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: #033649;color: white;font-weight: bold;text-align:center;"),e.find("td").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;")}).catch(t=>je.text(t)))}if(0<=window.location.href.indexOf("competition.php")&&setInterval(function(){fe(".description").next().remove(),fe(".description").remove();const t=fe("#e-showAvailable-targets").parent();if(0<t.length&&"1"!=t.attr("hasdone")){t.after(`
<div id="elim-parade">
<div class="title-black m-top10 title-toggle tablet top-round faction-title active title" data-title="description" role="heading" aria-level="5">Elimination Parade
</div>
<div class="cont-gray bottom-rounded content" style="overflow:hidden; margin-bottom:10px;">
<div class="button-wrap" style="margin:5px; float:left">
<button id="elim-parade-start-btn" class="torn-btn" style="margin:5px;">开始阅兵</button>
<button id="elim-parade-stop-btn"class="torn-btn" style="margin:5px;">暂停阅兵</button>
<p id="elim-parade-status" style="height:12px; padding:6px 1px;"></p>
</div>
</div>
</div>`),t.attr("hasdone","1");const e=fe("#competition-wrap").children(".team-list-wrap").children(".competition-list").children("li");e.each(function(){var t=Y(fe(this).find("a.user.name").attr("href").replace(/[^0-9|-]/gi,""));0!=t[0]&&fe(this).children("ul.list-cols").children("li.attack").children("a").text(t[2])});let i=!0;fe("#elim-parade-start-btn").click(function(){i=!0,fe("#elim-parade-start-btn").prop("disabled",!0),fe("#elim-parade-stop-btn").removeAttr("disabled");const t=e.first();t.length<=0?(fe("#elim-parade-status").text("未找到用户列表"),fe("#elim-parade-start-btn").removeAttr("disabled")):(fe("#elim-parade-status").text("阅兵开始"),setTimeout(()=>{!function e(a){if("1"==a.attr("detected"))fe("#elim-parade-status").text("用户已完成"),setTimeout(()=>{e(a.next())},0);else if(a.length<=0||0==i)fe("#elim-parade-status").text("阅兵已结束"),fe("#elim-parade-start-btn").removeAttr("disabled"),fe("#elim-parade-stop-btn").prop("disabled",!0);else{a.attr("detected","1");const n=a.find("a.user.name").attr("href").replace(/[^0-9|-]/gi,"");fe("#elim-parade-status").text("正在阅兵: "+n),Zt(n,function(t){a.children("ul.list-cols").children("li.attack").children("a").text(Lt(t.estimate_bs)),Jt("battlestats",n,t.estimate_bs),Jt("networths",n,t.personalstats.networth),setTimeout(()=>{e(a.next())},1e3)},function(t){fe("#elim-parade-status").text("蛙蛙探测 "+n+" 失败 "+t),setTimeout(()=>{e(a.next())},1e3)})}}(t)},1e3))}),fe("#elim-parade-stop-btn").click(function(){i=!1})}},500),bounty_parade&&window.location.href.indexOf("bounties.php#!p=main")&&setInterval(function(){const t=fe("ul.bounties-list").children(),e=t.first();e.length<=0?fe("div.bounties-total").text("未找到用户列表"):"1"==e.attr("detected")||(fe("div.bounties-total").text("阅兵开始"),setTimeout(()=>{!function e(a){a.attr("detected","1");const n=a.find("div.status");if(0<n.children(".user-red-status").length||0<n.children(".user-blue-status").length)fe("div.bounties-total").text("本条已阅兵完毕"),setTimeout(()=>{e(a.next())},0);else if(null==a.attr("data-id"))fe("div.bounties-total").text("本页阅兵结束");else{const i=a.find("div.target").children("a"),o=i.attr("href").replace(/[^0-9]/gi,"");var t=i.text();fe("div.bounties-total").text("正在阅兵: "+o+" "+t),Zt(o,function(t){n.children(".user-green-status").text(Lt(t.estimate_bs)),Jt("battlestats",o,t.estimate_bs),setTimeout(()=>{e(a.next())},0)},function(t){fe("div.bounties-total").text("蛙蛙探测 "+o+" 失败 "+t),setTimeout(()=>{e(a.next())},0)})}}(e)},0))},2e3),mugoo&&0<=window.location.href.indexOf("imarket.php")){let c=window.location.href,f=setInterval(L,500),u=0;var Dt=["Donator Pack","Xanax","Erotic DVD","Drug Pack","Feathery Hotel Coupon","Anti Tank","Large Suitcase","Wind Proof Lighter","Six-Pack of Energy Drink","Sierra Cosworth"],Ct=["Tribulus Omanense","Peony","African Violet","Cherry Blossom","Heather","Ceibo Flower","Edelweiss"],At=["Camel Plushie","Lion Plushie","Panda Plushie","Monkey Plushie","Chamois Plushie","Red Fox Plushie","Nessie Plushie"],Mt=["Can of X-MASS","Can of Taurine Elite","Can of Rockstar Rudolph","Can of Red Cow","Can of Munster","Can of Santa Shooters"];function L(){const t=fe(".guns-list.cont-gray");if(t&&0<t.length){clearInterval(f),clearInterval(u),c=window.location.href,u=setInterval(Tt,500);const a=fe(".msg.right-round");a.html(`
<div id="important" style="margin:6px 0px; overflow:hidden;"><div style="float:left; padding:2px; margin:3px; background-color:${ye.gray}; color:white;">重要</div></div>
<div id="flower" style="margin:6px 0px; overflow:hidden;"><div style="float:left; padding:2px; margin:3px; background-color:${ye.gray}; color:white;">花花</div></div>
<div id="plushie" style="margin:6px 0px; overflow:hidden;"><div style="float:left; padding:2px; margin:3px; background-color:${ye.gray}; color:white;">玩偶</div></div>
<div id="can" style="margin:6px 0px; overflow:hidden;"><div style="float:left; padding:2px; margin:3px; background-color:${ye.gray}; color:white;">能饮</div></div>
`);for(let t=0;t<Dt.length;t++){const r=Dt[t].split(" ")[0];fe("#important").append(`<div class="border-round header-link" style="float:left; cursor:pointer; padding:2px; margin:3px; background-color:${ye.yellowgreen}; color:white;" name="${Dt[t]}">${r}</div>`)}for(let t=0;t<Ct.length;t++){const s=Ct[t].split(" ")[0];fe("#flower").append(`<div class="border-round header-link" style="float:left; cursor:pointer; padding:2px; margin:3px; background-color:${ye.pink}; color:white;" name="${Ct[t]}">${s}</div>`)}for(let t=0;t<At.length;t++){const l=At[t].replace(/ Plushie/g,"");fe("#plushie").append(`<div class="border-round header-link" style="float:left; cursor:pointer; padding:2px; margin:3px; background-color:${ye.blue}; color:white;" name="${At[t]}">${l}</div>`)}for(let t=0;t<Mt.length;t++){const d=Mt[t].replace(/Can of /g,"");fe("#can").append(`<div class="border-round header-link" style="float:left; cursor:pointer; padding:2px; margin:3px; background-color:${ye.yellow}; color:white;" name="${Mt[t]}">${d}</div>`)}fe(".header-link").click(function(){const t=fe(this).attr("name"),e="/imarket.php#/p=shop&step=shop&type=&searchname="+t.replace(/ /g,"+");console.log(e),window.location.href=e});let n=fe(".items").children(":first").find("[itemid]").attr("itemid");n=n||t.children(":first").find("img.torn-item.item-plate").attr("src").replace(/[^\d]/g,"");const i=t.children(":first").find(".name.t-gray-6").text();if(0<=Dt.indexOf(i)||0<=Ct.indexOf(i)||0<=At.indexOf(i)||0<=Mt.indexOf(i)){let d={};const p=Xt("bazaar_cache",i);let c=0;const h=fe(".desc.t-blue-cont.t-overflow");if(h.each(function(t,e){const a=fe(this).find(".price.t-gray-6"),n=fe(this).find(".user.t-overflow").children("a"),i=n.attr("href"),o=i?i.replace(/[^\d]/g,""):0,r=a.text().split("(")[0].trim(),s=Bt(r),l=a.text().split("(")[1].replace(/\)/g,"").trim();d[o]={price:s,price_formal:r,amount:l},s>c&&(c=s)}),!fe.isEmptyObject(p))for(var e in p)if(null==d[e]&&p[e].price>=c){const g=`
<li>
<span class="item-desc">
<span class="item">
<img class="img___3jDmV" src="/images/items/${n}/large.png?v=1528808940574" alt="${i}">
<a class="item-hover" href="/bazaar.php?userID=${e}"></a>
</span>
<span class="desc t-blue-cont t-overflow">
<span class="user t-overflow">
<a href="/bazaar.php?userID=${e}">Pampa's bazaar</a>
</span>
<span class="name t-gray-6">${i}</span>
<span class="price t-gray-6"> ${p[e].price_formal}
<span class="stock t-gray-9">(${p[e].amount})</span>
</span>
</span>
</span>
</li>`;t.children(":last").before(g)}Ft(n,i,d,p)}const o=fe(".desc.t-blue-cont.t-overflow");o.each(function(t,e){const m=fe(this).find(".price.t-gray-6"),y=fe(this).find(".user.t-overflow").children("a"),a=y.attr("href"),x=a?a.replace(/[^\d]/g,""):0;m.prev().remove(),Zt(x,function(r){const s=Q(r.last_action.timestamp),l=r.status.color,d=Z(r.status.description,r.status.state,r.status.until),c=r.job.company_type,p=r.basicicons.icon72,h=r.last_action.status,g=r.bazaar,f=r.faction.faction_id;if(g.some(t=>t.ID.toString()===n)){f in me&&y.parent().parent().css("background-color",ye.green);let t="";t="Online"==h?'<span title="<b>Online</b>" style="width:16px;height:16px;margin:0px 2px;vertical-align:bottom; display:inline-block; background-position:0px 0; background-image:url(/images/v2/svg_icons/sprites/user_status_icons_sprite.svg)"></span>':"Offline"==h?'<span title="<b>Offline</b>" style="width:16px;height:16px;margin:0px 2px;vertical-align:bottom; display:inline-block; background-position:-18px 0;   background-image:url(/images/v2/svg_icons/sprites/user_status_icons_sprite.svg)"></span>':'<span title="<b>Idle</b>" style="width:16px;height:16px;margin:0px 2px;vertical-align:bottom; display:inline-block; background-position:-1098px 0;  background-image:url(/images/v2/svg_icons/sprites/user_status_icons_sprite.svg)"></span>';let e="打",a=ye.purple;5==c&&(e="衣",a=ye.gray),null!=p&&(e="新",a=ye.gray),y.text("");const u=`${t}<a href="/profiles.php?XID=${x}">${r.name}</a>`,b=`<a class= "border-round" style="padding:1px 2px;background-color:${a};color:white;" href="/loader.php?sid=attack&user2ID=${x}">${e}</a>`;y.before(b),y.after(u);let n=0;null!=g&&g.map(function(t,e,a){n+=t.quantity*t.market_price}),m.parent().siblings(".item").css("margin","2px 10px"),m.parent().siblings(".item").append(`<div style="font-size: 13px; line-height: 17px; text-align: center;"><span class="border-round" style="background-color: ${ye.purple}; color: white; padding: 1px 3px;">全店 ${Lt(n)}</span></div>`);let i="";"blue"==l&&(i=ye.blue),"green"==l&&(i=ye.green),"red"==l&&(i=ye.red);let o=`
<span class="left" style="">
<span class= "border-round" style="padding: 1px 3px; background-color: ${i}; color: white;" title="Status: ${r.status.description}">${d[0]}</span>
<span style="padding: 1px 3px;" title="Last Action: ${r.last_action.relative}">${s[1]}</span>
<span style="padding: 1px 3px;" title="BattleStats: ${Lt(r.estimate_bs)}">${Lt(r.estimate_bs)}</span>
</span>`;m.after(o)}else m.parent().parent().parent().remove()})})}}function Tt(){c!=window.location.href&&(clearInterval(f),clearInterval(u),c=window.location.href,f=setInterval(L,500))}function Ft(o,r,s,l){var t=`https://api.torn.com/market/${o}?selections=bazaar&key=${b}`;fetch(t).then(t=>t.json()).then(t=>{console.log(o+" bazaar API fetched");var e=t.bazaar;let a={};for(let t=0;t<e.length;t++){if(!fe.isEmptyObject(l))for(var n in l)l[n].apiid==e[t].ID&&(a[n]={apiid:e[t].ID,price:e[t].cost,price_formal:Bt(e[t].cost),amount:e[t].quantity});if(!fe.isEmptyObject(s))for(var i in s)s[i].price==e[t].cost&&s[i].amount==e[t].quantity&&(a[i]={apiid:e[t].ID,price:e[t].cost,price_formal:Bt(e[t].cost),amount:e[t].quantity})}Jt("bazaar_cache",r,a)}).catch(t=>console.log("fetch error",t))}}{function L(){const t=fe(".users-point-sell").children("li");if(t&&0<t.length){clearInterval(l);let r=[];fe("li.total-price").attr("id","total-price");const e=document.getElementById("total-price"),s=window.getComputedStyle(e).width.replace(/px$/g,"");t.each(function(t,e){const c=fe(this).find(".total-price"),a=fe(this).find(".user.name").attr("href"),n=a?a.replace(/[^\d]/g,""):0,i=fe(this).find(".user.faction").attr("href"),o=i?i.replace(/[^\d]/g,""):0;o in me&&fe(this).css("background-color",ye.green),-1==r.indexOf(n)&&(r.push(n),Number(s)<200&&c.text(""),Zt(n,function(t){const e=Q(t.last_action.timestamp),a=t.status.color,n=Z(t.status.description,t.status.state,t.status.until),i=t.job.company_type,o=t.basicicons.icon72;let r="打",s=ye.purple;5==i&&(r="衣",s=ye.gray),null!=o&&(r="新",s=ye.gray);let l="";"blue"==a&&(l=ye.blue),"green"==a&&(l=ye.green),"red"==a&&(l=ye.red);let d="<span class='left'>";d+=`<span style="padding:1px;margin:1px;background-color:${s};color:white;">${r}</span>`,d+=`<span style="padding:1px;margin:1px;background-color:${l};color:white;" title="Status: ${t.status.description}">${n[0]}</span>`,d+=`<span style="padding:1px;margin:1px;background-color:${ye.gray};color:white;" title="Last Action: ${t.last_action.relative}">${e[1]}</span>`,d+=`<span style="padding:1px;margin:1px;background-color:${ye.blue};color:white;" title="BattleStats: ${Lt(t.estimate_bs)}">${Lt(t.estimate_bs)}</span></span>`,c.prepend(d)}))})}}mugoo&&0<=window.location.href.indexOf("pmarket.php")&&(l=setInterval(L,500))}if(mugoo&&0<=window.location.href.indexOf("bazaar.php")){var Ot={};const Re=fe("#mainContainer").find("div:contains('unavailable')").last();function j(){const e=Xt("ITEMS","last-updated");if(null!=e&&null!=e){const a=new Date;let t=new Date(e);t.setDate(t.getDate()+1),t<a&&Et()}else Et()}function Et(){var t=`https://api.torn.com/torn/?selections=items&key=${b}`;fetch(t).then(t=>t.json()).then(t=>{console.log("API fetched");let e={};const a=new Date;for(var n in e["last-updated"]=a.toString(),t.items)e[n]=t.items[n].market_value;window.localStorage.setItem("ITEMS",JSON.stringify(e))}).catch(t=>console.log("fetch error",t))}function L(){const g=fe("[class*='messageContent___']");if("1"!=g.attr("hasdone")){g.attr("hasdone","1"),fe("#sum").remove();let t='<div id="sum">',e=0;for(var a in Ot)t+=" (<span class='t-green'> "+Ot[a].name+" "+Ot[a].total_formal+" </span>) ",e+=Ot[a].total;t+="<span class='t-red'><b> Total Selected: "+Lt(e)+" </b></span></div>",g.append(t)}const t=Xt("ITEMS","last-updated"),e=fe("[class^='rowItems___']").children();t&&e&&0<e.length&&e.each(function(t,e){const a=fe(this).find("[class^='name___']").text(),n=fe(this).find("[class^='price___']");let i=0;""!=n.text()&&(i=n.text().replace(/[^\d]/g,""));const o=fe(this).find("img").attr("src");let r=0,s=0;null!=o&&(s=o.split("/")[3],0<s&&(r=Xt("ITEMS",s)));const l=fe(this).find("[class^='amount___']");let d=0;if(""!=l.text()&&(d=l.text().replace(/[^\d]/g,"")),0<r&&0<i&&0<d&&"1"!=fe(this).attr("hasdone")){fe(this).attr("hasdone","1");const c=((i-r)/r*100).toFixed(1),p=Lt(i*d);l.append(`&nbsp;&nbsp;<span><span class="t-blue">${p}</span></span>`),0<=c?n.append(`&nbsp;&nbsp;<span class="change up"><i class="arrow-change-icon" role="img" aria-label="stock price is up"></i><span class="t-green">${c}%</span></span>`):n.append(`&nbsp;&nbsp;<span class="change down"><i class="arrow-change-icon" role="img" aria-label="stock price is down"></i><span class="t-red">${c}%</span></span>`);const h=fe(this).find("[class^='description___']");null!=Ot[s]&&h.css("background-color","NavajoWhite"),h.click(function(){fe(this).attr("selected")?(delete Ot[s],fe(this).removeAttr("selected"),g.removeAttr("hasdone"),fe(this).css("background-color","")):(Ot[s]={name:a,price:i,amount:d,total:i*d,total_formal:Lt(i*d)},fe(this).attr("selected","selected"),g.removeAttr("hasdone"),fe(this).css("background-color","NavajoWhite"))})}})}0<Re.length?(Pt=window.location.href.replace(/[^\d]/g,""),Re.text("蛙蛙探测器工作中..."),Pt=`https://api.torn.com/user/${Pt}?selections=basic,bazaar&key=${b}`,fetch(Pt).then(t=>t.ok?t.json():void Re.text("---探测失败 "+fID+"---"),t=>{Re.text("---网络异常 "+fID+"---")}).then(a=>{if(Re.html(`蛙蛙探测成功^_^ [ <a class="t-blue" href="/profiles.php?XID=${a.player_id}">${a.name}</a>的小店 ]`),null==a.bazaar)Re.html(`货物卖光了:( [ <a class="t-blue" href="/profiles.php?XID=${a.player_id}">${a.name}</a>的小店 ]`),console.log("no item in bazaar");else{fe(".content-wrapper").last().append('<div class="bazaar-wrapper" style="margin-top:10px;"><div class="bazaar-content" style="width:inherit; overflow:hidden; background-color:white;"></div></div>');for(let e=0;e<a.bazaar.length;e++){var n=((a.bazaar[e].price-a.bazaar[e].market_price)/a.bazaar[e].market_price*100).toFixed(2);let t="";t=0<n?`&nbsp;&nbsp;<span class="change up"><i class="arrow-change-icon" role="img" aria-label="stock price is up"></i><span class="t-green">${n}%</span></span>`:`&nbsp;&nbsp;<span class="change down"><i class="arrow-change-icon" role="img" aria-label="stock price is down"></i><span class="t-red">${n}%</span></span>`,fe(".bazaar-content").append(`
<div class="item-wrapper" style="width:288px; float:left; overflow:hidden;">
<div style="width:100px; height:50px; margin:7px; padding:3px; float:left; border:1px solid darkgray;">
<img src="/images/items/${a.bazaar[e].ID}/large.png">
</div>
<div class="item-description" style="width:150px; margin:7px; float:left; border:1px solid darkgray;overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">
<p class="item-name" style="margin:5px">${a.bazaar[e].name}</p>
<p class="item-price" style="margin:5px">${Bt(a.bazaar[e].price)}${t}</p>
<p class="item-quantity" style="margin:5px">(${a.bazaar[e].quantity} in stock)
<span class="t-blue">&nbsp;&nbsp;${Lt(a.bazaar[e].price*a.bazaar[e].quantity)}</span>
</p>
</div>
</div>`)}}}).catch(t=>Re.text(t))):(j(),setInterval(L,500))}{function L(){const i=fe(".buy-item-info").find(".private-bazaar");0<i.length&&i.each(function(t,e){if("1"!=fe(this).attr("hasdone")){fe(this).attr("hasdone","1");const a=fe(this).find('[href^="bazaar"]').attr("href").replace(/[^\d]/g,""),n=fe(this);Zt(a,function(t){n.attr("user_id",a),n.attr("user_name",t.name),n.attr("user_level",t.level),n.attr("user_bs",Lt(t.estimate_bs)),n.attr("user_last",t.last_action.relative),n.attr("user_stat",t.status.description),n.attr("user_job_type",t.job.company_type),n.attr("newbie",t.basicicons.icon72)})}});const t=fe(".buy-item-info-wrap").find(".private-bazaar");0<t.length&&t.each(function(t,e){if("1"!=fe(this).attr("hasdone")){const c=fe(this).find('[href^="bazaar"]').attr("href").replace(/[^\d]/g,""),a=fe(this).find(".user.faction").attr("href"),n=a?a.replace(/[^\d]/g,""):0;n in me&&fe(this).css("background-color",ye.green);const p=fe(this);i.each(function(t,e){if(fe(this).attr("user_id")==c){console.log(fe(this).attr("user_name"));const a=fe(this).attr("user_name"),n=fe(this).attr("user_level"),i=fe(this).attr("user_bs"),o=fe(this).attr("user_last"),r=fe(this).attr("user_stat"),s=fe(this).attr("user_job_type"),l=fe(this).attr("newbie");let t="打";5==s?t="衣":null!=l&&(t="新");const d=`
<li class="private-bazaar wawa-bazaar" hasdone="1">
<ul class="item t-blue-cont h">
<li class="item-name">
<div class="item-t right t-gray-9">${r}</div>
<div class="name-t icons left">
<span class="t-gray-9">Lv:${n}</span>
<a class="user name" href="/profiles.php?XID=${c} ">
<span title="${a} [${c}]"><b>BS: ${i}</b><span></span></span>
</a>
</div>
<div class="name-t name-mobile left">
<span class="t-gray-9 italic">sold by</span>
<a class="t-blue" href="profiles.php?XID=${c}">BS: ${i}</a>
</div>
<div class="clear"></div>
</li>
<li class="cost">
<span class="t-gray-9" title="${r}">${o}</span>
</li>
<li class="view">
<a href="/loader.php?sid=attack&user2ID=${c}"><b>${t}</b></a>
</li>
<li class="clear"></li>
</ul>
</li>`;return p.after(d),p.attr("hasdone","1"),!1}})}})}mugoo&&0<=window.location.href.indexOf("imarket.php")&&setInterval(L,500)}{function L(){const t=fe("[class^='btn___']");if(0<t.length){const e=t[0];if(fe(e).text().includes("CONTINUE")){const a=fe(e).parent().parent().children(":first").text().split(" ");clearInterval(p),console.log(a);const n=a[2],i=a[1],o=new Date,r=parseInt(o.getTime()/1e3),s=o.format("yyyy-MM-dd hh:mm:ss");if("mugged"==i){let t=a[5];console.log(t),"wallet"==t&&(t="$0");const l={timestring:s,victim_id:c,victim_name:n,money_mugged:t};Jt("muglog",r,l)}}}}0<=window.location.href.indexOf("loader.php?sid=attack&user2ID")&&(c=window.location.href.match(/loader\.php\?sid=attack\&user2ID=(\d+)/)[1],p=setInterval(L,300))}if(0<=window.location.href.indexOf("companies.php")){fe(".info-msg-cont").after("<div id='effectiveness-wrap' style='margin-top:10px; overflow-x: auto;'></div>"),fe(".info-msg-cont").after('<div id="bingwa-top-warn" class="info-msg-cont red border-round m-top10">');var Pt=re();console.log("userId "+Pt),wt(Pt).then(function(t){console.log(t);t=t[3];"Employee"===t?nt(fe("#effectiveness-wrap")):"Director"===t&&it(fe("#effectiveness-wrap"))}).catch(t=>console.log("userId2otherIds "+t));const Be=setInterval(function(){const t=fe(".employee-list-wrap").children("ul.employee-list").children("li");if(0<t.length){clearInterval(Be);let n={},i=0;t.each(function(t,e){var a=fe(this).attr("data-user");n[a]=i,i+=1}),window.localStorage.setItem("EMPLOYEE_RANK",JSON.stringify(n))}},1e3)}else it(null);0<=window.location.href.indexOf("joblist.php")&&setInterval(function(){const t=fe("ul.rank-list");if(0<t.length&&"1"!=t.attr("hasdone")){t.attr("hasdone","1");t.after(`
<div id="company_parade">
<div class="title-black m-top10 title-toggle tablet top-round faction-title active title" data-title="description" role="heading" aria-level="5">公司阅兵</div>
<div class="cont-gray bottom-rounded content" style="overflow:hidden; margin-bottom:10px;">
<button id="company_parade_start_btn" class="torn-btn" style="margin:5px;">开始阅兵</button>
<button id="company_parade_stop_btn" class="torn-btn" style="margin:5px;">暂停阅兵</button>
<span id="company_parade_tip" style="margin:5px;"></span>
</div>
</div>`);let a=!0;fe("#company_parade_start_btn").click(function(){a=!0,fe("#company_parade_start_btn").prop("disabled",!0),fe("#company_parade_stop_btn").removeAttr("disabled");const t=fe("ul.company-list").children().first();t.length<=0?(fe("#company_parade_tip").text("未找到公司列表"),fe("#company_parade_start_btn").removeAttr("disabled"),fe("#company_parade_stop_btn").prop("disabled",!0)):(fe("#company_parade_tip").text("阅兵开始"),fe("#company_parade_table").length<=0&&(fe("#company_parade").after(`
<div id="company_parade_table">
<table style="margin:auto;background-color:white;font-size:12px;">
<tr class="head">
<th>星级</th>
<th>名称</th>
<th>老板</th>
<th>天数</th>
<th>员工数</th>
<th title="24h未上线">不活跃</th>
<th title="入职不到10天">新员工</th>
<th>日收入</th>
<th>日单价</th>
<th>周收入</th>
<th>周单价</th>
</tr>
</table>
</div>`),fe("#company_parade_table").find("th").attr("style","border: 1px solid darkgray;padding: 5px;background-color: black;color: white;font-weight: bold;text-align:center;")),setTimeout(()=>{!function d(c){if("1"==c.attr("detected"))fe("#company_parade_tip").text("公司已完成"),setTimeout(()=>{d(c.next())},0);else if(c.length<=0||0==a)fe("#company_parade_tip").text("阅兵已结束"),fe("#company_parade_start_btn").removeAttr("disabled"),fe("#company_parade_stop_btn").prop("disabled",!0);else{c.attr("detected","1");const e=c.children().children("li.view").children().attr("href"),p=e?e.replace(/[^\d]/g,""):0,h=c.children().children("li.company").text();var t=`https://api.torn.com/company/${p}?selections=profile&key=${b}`;fe("#company_parade_tip").text(`正在阅兵:${p} ${h}`),fetch(t).then(t=>t.json()).then(a=>{if("company"in a){var n=a.company.director,i=a.company.employees[n].name;let t=0,e=0;var o,r=parseInt((new Date).getTime()/1e3);for(o in a.company.employees){var s=a.company.employees[o].last_action.timestamp;86400<=r-s&&(t+=1);var l=a.company.employees[o].days_in_company;l<10&&(e+=1)}fe("#company_parade_table").children().append(`
<tr class="content">
<td>${a.company.rating}</td>
<td><a href="#!p=corpinfo&ID=${p}" target="_blank">${a.company.name}</a></td>
<td><a class="user name" href="/profiles.php?XID=${n}" target="_blank">${i}</a></td>
<td>${a.company.days_old}</td>
<td>${a.company.employees_hired}/${a.company.employees_capacity}</td>
<td>${t}</td>
<td>${e}</td>
<td>${Lt(a.company.daily_income)}</td>
<td>${Lt(a.company.daily_income/a.company.daily_customers)}</td>
<td>${Lt(a.company.weekly_income)}</td>
<td>${Lt(a.company.weekly_income/a.company.weekly_customers)}</td>
</tr>`),fe("#company_parade_table").find("td").attr("style","border: 1px solid darkgray;padding:5px;text-align:center;"),setTimeout(()=>{d(c.next())},1e3)}else"error"in a&&fe("#company_parade_tip").text(`蛙蛙探测失败:${p} ${h} ${a.error.error}`)}).catch(t=>console.log(t))}}(t)},1e3))}),fe("#company_parade_stop_btn").click(function(){a=!1})}},500)}function Nt(t,r){var s=t,l=f(t);f.fn[i].defaults={version:"1.0",symbol:"$",showSymbolButton:!0,errorClass:"error",successClass:"success",groupMoneyClass:"input-money-group",symbolMoneyClass:"input-money-symbol",inputMoneyClass:"input-money",inputHiddenMoneyClass:"",buttonElement:f(".torn-btn"),buttonDisabledClass:"disabled",buttonDisabledAttribute:"disabled",moneySourceData:"data-money",title:"Click here to add the maximum amount, or use shortcuts like <br /> 5k, 1.5m, max, half, quarter, 1/2, 1/3, 1/4, 25%",strictMode:!0,ajaxAction:null,disabled:!1,disabledAutoCorrect:!0,allowNegativeNumbers:!1,skipBlurCheck:!1,minValue:"data-minvalue",onInit:function(){},onDestroy:function(){}};var o=(r=f.extend({},f.fn[i].defaults,r)).allowNegativeNumbers?"[-]?":"",d={digit:function(t){var e=new RegExp("^("+o+"[1-9]\\d*)$","i"),t=t||l.val(),t=e.exec(t);return t?t[1]:null},float:function(t){var e=new RegExp("^("+o+"[1-9]\\d*(?:[,]\\d{3})*)(?:[.]\\d{10})?$","i"),t=t||l.val(),t=e.exec(t);return t?t[1]:null},all:function(t){var e=t||l.val(),t=/^(all|max){1}$/i.exec(e),e=l.attr(r.moneySourceData);return t&&e?e:null},thousand:function(t){var e=new RegExp("^("+o+"\\d+[.]?(\\d{1,3})?)k$","i"),t=t||l.val(),t=e.exec(t);return t?Math.round(1e3*t[1]):null},million:function(t){var e=new RegExp("^("+o+"\\d+[.]?(\\d{1,6})?)m$","i"),t=t||l.val(),t=e.exec(t);return t?Math.round(1e6*t[1]):null},billion:function(t){var e=new RegExp("^("+o+"\\d+[.]?(\\d{1,9})?)b$","i"),t=t||l.val(),t=e.exec(t);return t?Math.round(1e9*t[1]):null},quarter:function(t){var e=t||l.val(),t=/^(1\/4|quarter){1}$/i.exec(e),e=l.attr(r.moneySourceData);return t&&e?Math.round(parseInt(e)/4):null},third:function(t){var e=t||l.val(),t=/^(1\/3){1}$/i.exec(e),e=l.attr(r.moneySourceData);return t&&e?Math.round(parseInt(e)/3):null},half:function(t){var e=t||l.val(),t=/^(1\/2|half){1}$/i.exec(e),e=l.attr(r.moneySourceData);return t&&e?Math.round(parseInt(e)/2):null},percent:function(t){var e=t||l.val(),t=/^([1-9][0-9]?|100)%$/i.exec(e),e=l.attr(r.moneySourceData);return t&&e?Math.round(parseInt(e)*t[1]/100):null},firstZero:function(t){var e=t||l.val(),t=/^([0])/i.exec(e),e=l.attr(r.moneySourceData),e=e?parseInt(e.replace(/,/g,"")):null;return t&&0==e?t[1]:null},zero:function(t){t=t||l.val(),t=/^([0])$/i.exec(t);return t&&!r.strictMode?t[1]:null},fraction:function(t){var e=t||l.val(),t=/^(([1-9])\/([2-9]|10))$/i.exec(e),e=l.attr(r.moneySourceData);return t&&e&&parseInt(t[2])<parseInt(t[3])?Math.round(parseInt(e)*t[2]/t[3]):null}};function c(t){return 65==t.which||17==t.which&&!t.ctrlKey||(91==t.which||224==t.which)&&!t.metaKey}function p(){return r.ajaxAction?f.ajax({method:"POST",url:addRFC(r.ajaxAction),success:function(t){t=h("onMoneyUpdate",t)||t;l.attr(r.moneySourceData,t),l.next().filter('input[type="hidden"].'+r.inputMoneyClass).attr(r.moneySourceData,t)}}):Promise.resolve()}function h(t,e){if(r[t]!==y)return r[t].call(s,e||{})}function g(){var n,a,i=l.val().replace(/,/g,"");if(f.each(d,function(t,e){if(i=f.trim(i),(n=e.call(this,i))||0==n){var a=parseInt(n.toString().replace(/,/g,"")),e=l.attr(r.moneySourceData),e=e?parseInt(e.replace(/,/g,"")):null;return i=(a=(e||0==e)&&e<=a?e:a).toString().replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g,"$1,"),l.next().val(a),!1}}),l.val()!=i){var t=l.get(0);Object.getOwnPropertyDescriptor(u.HTMLInputElement.prototype,"value").set.call(t,i);try{t.dispatchEvent(new Event("input",{bubbles:!0}))}catch(t){console.error("Couldn't dispatch the event")}o=f.data(l,"selection_length")||0,e=f.data(l,"old_length")-f.data(l,"old_position"),a=(o=l.get(0).value.length-e+o)<0?0:o,l.each(function(t,e){e.setSelectionRange?e.setSelectionRange(a,a):e.createTextRange&&((e=e.createTextRange()).collapse(!0),e.moveEnd("character",a),e.moveStart("character",a),e.select())}),f.data(l,"selection_length",0)}var t=l.closest("."+r.groupMoneyClass).removeClass(r.successClass).removeClass(r.errorClass),e=r.buttonElement,o=l.attr(r.minValue),o=o?parseInt(o.replace(/,/g,"")):null;!n||0==n&&r.strictMode||(o||0==o)&&i<o?0<i.length&&(t.addClass(r.errorClass),e&&e.addClass(r.buttonDisabledClass),e&&e.prop(r.buttonDisabledAttribute,!0)):(t.addClass(r.successClass),e&&e.removeClass(r.buttonDisabledClass),e&&e.prop(r.buttonDisabledAttribute,!1))}return l.each(function(){var e=f(this),a=e.attr("disabled")||r.disabled;e.attr("disabled",a),e.attr("data-lpignore",!0),a&&e.attr("readonly",!0),r.disabledAutoCorrect&&(e.attr("autocomplete","off"),e.attr("autocorrect","off"),e.attr("autocapitalize","off"),e.attr("spellcheck","false"));var t=f("<input/>").attr("type","button").addClass("wai-btn").attr("aria-label",r.title),n=f("<span/>").attr("title",r.title).addClass(r.symbolMoneyClass).html(r.symbol).append(t),i=f("<div/>").addClass(r.groupMoneyClass+(a?" disabled":"")),t=e.wrap(i).parent();e.addClass(r.inputMoneyClass);i=e.clone();i.attr("type","hidden"),e.after(i),i.addClass(r.inputHiddenMoneyClass),e.attr("name",null);i=e.attr(r.moneySourceData);i?(e.attr(r.moneySourceData,i.replace(/([,\.])/g,"")),r.showSymbolButton&&n.prependTo(t)):t.addClass("no-max-value"),e.on("input",function(t){var e,a,n,i=l.val();r.buttonElement&&(l.val()?(r.buttonElement.removeClass(r.buttonDisabledClass),r.buttonElement.prop(r.buttonDisabledAttribute,!1)):(r.buttonElement.addClass(r.buttonDisabledClass),r.buttonElement.attr(r.buttonDisabledAttribute,!0))),n=l.closest("."+r.groupMoneyClass),l.val()&&n.removeClass(r.errorClass),i?(e=(a=new RegExp("("+o+"[0-9,\\.]*)").exec(i))&&a.input===a[0],n=parseInt(i.replace(/,/g,"")),n=(a=(a=l.attr(r.moneySourceData))?parseInt(a.replace(/,/g,"")):null)&&a<n,e&&!n||n&&p().then(g)):(l.closest("."+r.groupMoneyClass).removeClass(r.successClass),l.closest("."+r.groupMoneyClass).removeClass(r.errorClass)),"0"!==i&&""!==i||l.next().val(i),g();i=l.closest("."+r.groupMoneyClass);h("onAfterChange",{value:l.val(),error:i.hasClass(r.errorClass)}),t.preventDefault()}),e.on("keydown",function(t){c(t)||(f.data(l,"old_position",function(){var t=0,e=l.get(0);{var a,n;m.selection?(e.focus(),a=m.selection.createRange(),n=m.selection.createRange().text.length,a.moveStart("character",-e.value.length),t=a.text.length-n):!e.selectionStart&&"0"!=e.selectionStart||(t=e.selectionStart)}return t}()),f.data(l,"old_length",l.get(0).value.length))}),e.on("select",function(t){c(t)||f.data(l,"selection_length",function(){var t,e,a,n,i=0,o=0;"number"==typeof s.selectionStart&&"number"==typeof s.selectionEnd?(i=s.selectionStart,o=s.selectionEnd):(n=m.selection.createRange())&&n.parentElement()==s&&(a=s.value.length,t=s.value.replace(/\r\n/g,"\n"),(e=s.createTextRange()).moveToBookmark(n.getBookmark()),(n=s.createTextRange()).collapse(!1),-1<e.compareEndPoints("StartToEnd",n)?i=o=a:(i=-e.moveStart("character",-a),i+=t.slice(0,i).split("\n").length-1,-1<e.compareEndPoints("EndToEnd",n)?o=a:(o=-e.moveEnd("character",-a),o+=t.slice(0,o).split("\n").length-1)));return o-i}())}),e.closest("."+r.groupMoneyClass).find("."+r.symbolMoneyClass).on("click",function(t){a||e.attr("readonly")!==y||p().then(function(){e.val("max"),g(),h("onAfterMoneyUpdate")})}),e.val()?g():(r.buttonElement&&r.buttonElement.addClass(r.buttonDisabledClass),r.buttonElement&&r.buttonElement.prop(r.buttonDisabledAttribute,!0)),f(u).focus(function(){}),h("onInit")}),{option:function(t,e){if(!e)return r[t];r[t]=e},destroy:function(){l.each(function(){var t=f(this),e=t.clone(),a=t.parent();e.removeClass(r.inputMoneyClass),a.before(e),t.parent().remove(),h("onDestroy"),t.removeData("plugin_"+i)})},format:g,addRules:function(t,e){var a={};a[t]=e,d=f.extend(d,a)}}}function zt(t){const e=document.getElementById("BINGWA-GLOBAL-STYLE")||function(){const t=document.createElement("style");return t.type="text/css",t.id="BINGWA-GLOBAL-STYLE",document.head.appendChild(t),t}();e.sheet.insertRule(t)}function jt(t){return Number(t.replace(/,/g,""))}function Rt(t){return 0<=t.toString().indexOf(",")?jt(t):Number.isNaN(Number(t))?0:t.toString().replace(/\d{1,3}(?=(\d{3})+$)/g,function(t){return t+","})}function Bt(t){return 0<=t.toString().indexOf("$")?Number(t.replace(/\$|,/g,"")):Number.isNaN(Number(t))?0:t.toString().replace(/\d{1,3}(?=(\d{3})+$)/g,function(t){return t+","}).replace(/^[^\$]\S+/,function(t){return"$"+t})}function Lt(t){return t<0?"-"+Lt(-t):0==t?"0":t<=1?(100*t).toFixed(2)+"%":t<1e3?""+parseInt(t):1e3<=t&&t<1e6?(t/1e3).toFixed(2)+"k":1e6<=t&&t<1e9?(t/1e6).toFixed(2)+"m":1e9<=t&&t<1e12?(t/1e9).toFixed(2)+"b":1e12<=t&&t<1e15?(t/1e12).toFixed(2)+"t":1e15<=t?"MAX":void 0}function Gt(t){return"[object Array]"===Object.prototype.toString.call(t)?t:"[object Object]"===Object.prototype.toString.call(t)?Object.values(t):null}function Wt(t){var e=Gt(t);if(null==e||e.length<=0)return null;if(t=e,"[object Array]"===Object.prototype.toString.call(t)&&(!(t.length<=1)&&("[object Object]"===Object.prototype.toString.call(t[0])&&0<Object.keys(t[0]).length)))return e;for(let t=0;t<e.length;++t){var a=Wt(e[t]);if(null!=a)return console.log(`在第 ${t} 个节点发现有效数据集`),a}return null}function Ht(t){for(var e in t)!function(t,e){var a=t[e];if("object"==typeof a){for(var n in a){var i=a[n];"object"==typeof i?Ht(a):t[n+"_"+e]=i}delete t[e]}}(t,e)}function qt(e){var t=e[0];Ht(t);let a=Object.keys(t);console.log(`item_keys: ${a}`);for(let t=1;t<e.length;++t){var n=e[t];Ht(n);var i=Object.keys(n);for(let t=0;t<i.length;t++){var o=i[t];console.log(`add item_key: ${o}`),-1==a.indexOf(o)&&a.push(o)}}let r=a.sort().join(",");for(let t=0;t<e.length;++t){r+="\n";var s=e[t];Ht(s);for(let e=0;e<a.length;++e){let t=s[a[e]]+"";"object"==typeof t&&(t=JSON.stringify(t)),t='"'+t.replace(/<[^>]+>/g,"").trim().replace(/\"/g,'""')+'"',0<e&&(r+=","),r+=t}}return encodeURIComponent(r)}function Ut(t){if(void 0!==window.localStorage)return null===window.localStorage.getItem(t)?null:JSON.parse(window.localStorage.getItem(t))}function Xt(t,e){t=Ut(t);if(void 0!==t)return null===t?null:void 0!==t[e]?t[e]:void 0}function Jt(e,a,n){if(void 0!==window.localStorage)if(null===window.localStorage.getItem(e)){let t={};t[a]=n,window.localStorage.setItem(e,JSON.stringify(t))}else{let t=JSON.parse(window.localStorage.getItem(e));t[a]=n,window.localStorage.setItem(e,JSON.stringify(t))}}function Kt(t,e){if(void 0!==window.localStorage&&null!==window.localStorage.getItem(t)){const a=JSON.parse(window.localStorage.getItem(t));void 0===a[e]||(delete a[e],window.localStorage.setItem(t,JSON.stringify(a)))}}function Vt(i,o){i.click(function(){const t=fe(this).siblings();t.each(function(){var t=fe(this).text().replace(/[↑↓]/,"");fe(this).text(t),fe(this).removeAttr("sort")});var e=fe(this).text().replace(/[↑↓]/,"");let a="",n="";n="TH"==i[0].tagName?(a=i.parent().siblings(),i.parent().parent()):(a=i.parent().next().children(),i.parent().next()),"descend"==fe(this).attr("sort")?(a.sort(function(t,e){const a=o(t);e=o(e);return isNaN(a)?a.localeCompare(e):a-e}),a.detach().appendTo(n),fe(this).attr("sort","ascend").text(e+"↑")):(a.sort(function(t,e){t=o(t);const a=o(e);return isNaN(t)?a.localeCompare(t):a-t}),a.detach().appendTo(n),fe(this).attr("sort","descend").text(e+"↓"))})}function Yt(t,e,a,n,i){return`
<div style="position:relative; top:0; width:100%; height:${t-4}px; color:${a}; background-color:${n}; padding:2px 0px; text-align:center;">${i}</div>
<div style="position:relative; top:-${t}px; width:100%; left:${e-100}%; height:${t-4}px; padding:2px 0px; z-index:2; overflow:hidden;">
<div style="position:absolute; top:0; width:100%; left:${100-e}%; height:${t-4}px; color:${n}; background-color:${a}; padding:2px 0px; text-align:center;">${i}</div>
</div>`}function Qt(t,e){return fe(t).on("input keydown keyup mousedown mouseup select contextmenu drop focusout",function(t){e(this.value)?this.oldValue=this.value:this.hasOwnProperty("oldValue")?this.value=this.oldValue:this.value=""})}function Zt(t,st,e){t=`https://api.torn.com/user/${t}?selections=profile,crimes,personalstats,bazaar&key=${b}`;fetch(t).then(t=>t.ok?t.json():void e("蛙蛙探测失败,请刷新重试"),t=>{e("蛙蛙探测失败,网络异常,请刷新重试")}).then(h=>{if(null!=h)if(h.hasOwnProperty("error"))e(`蛙蛙探测失败:${JSON.stringify(h,null,4)}`);else{var g=h.personalstats,f=g.defendslost||0,u=g.defendsstalemated||0,b=g.defendswon||0,m=g.attackswon||0,y=g.attacksdraw||0,x=g.attackslost||0,v=g.cantaken||0,w=g.exttaken||0,_=g.kettaken||0,k=g.lsdtaken||0,$=g.opitaken||0,I=g.pcptaken||0,S=g.shrtaken||0,D=g.spetaken||0,C=g.victaken||0,A=g.xantaken||0,M=h.age||1,T=g.trainsreceived||0,F=w+k+A,O=((h.xan_lsd_ecs=F)/M).toFixed(2);h.average_drugs=O;var E=g.refills||0,P=g.statenhancersused||0,N=g.useractivity||0,z=g.traveltime||0,j=(g.logins,g.dumpsearches||0),R=g.energydrinkused||0,B=g.boostersused||0,L=g.revives||0,F=m+y+x,O=g.daysbeendonator||0,y=Math.min(M,parseInt((new Date-new Date("2011/11/22"))/864e5));const at=Math.min(O/y,1);h.donator_percent=at.toFixed(2);x=480+240*at,O=611255/x,y=h.last_action.timestamp||0;let t=parseInt((new Date).getTime()/1e3)-y,e="";86400<t&&(e+=parseInt(t/86400)+"天",t%=86400),3600<t&&(e+=parseInt(t/3600)+"时",t%=3600),60<t&&(e+=parseInt(t/60)+"分",t%=60),e+=t+"秒",h.last_action_details=e;const nt=h.last_action.relative;h.last_action_brief=nt.replace(" minute ago","m").replace(" minutes ago","m").replace(" hours ago","h").replace(" hour ago","h").replace(" days ago","d").replace(" day ago","d");let a=0;nt.includes("d")&&(a=parseInt(nt.replace(/[^0-9|-]/gi,"")));y=Math.max(1,21*(M-a)/24),N=3*(N/86400)+z/86400,z=(75*v+210*w+52.5*_+425*k+215*$+430*I+209.5*S+301*D+300*C+420*A)/1440,v=h.criminalrecord.hasOwnProperty("vandalism"),w=(v?.1*h.criminalrecord.theft:h.criminalrecord.other)||0,_=(v?h.criminalrecord.counterfeiting:h.criminalrecord.selling_illegal_products)||0,$=(v?.65*h.criminalrecord.theft:h.criminalrecord.theft)||0,I=(v?h.criminalrecord.illicitservices/2:h.criminalrecord.drug_deals)||0,S=(v?h.criminalrecord.cybercrime:h.criminalrecord.computer_crimes)||0,D=(v?h.criminalrecord.illicitservices/2:h.criminalrecord.murder)||0,C=(v?h.criminalrecord.fraud:h.criminalrecord.fraud_crimes)||0,v=(v?.25*h.criminalrecord.theft:h.criminalrecord.auto_theft)||0;let n=.11*$+.5*S+.66*D+C+.66*v+.05*I;n<0&&(n=0),h.estimate_ace=parseInt(n),12862<n?h.estimate_nnb=60:9171<n?h.estimate_nnb=55:5950<n?h.estimate_nnb=50:4324<n?h.estimate_nnb=45:2750<n?h.estimate_nnb=40:1198<n?h.estimate_nnb=35:450<n?h.estimate_nnb=30:250<n?h.estimate_nnb=25:100<n?h.estimate_nnb=20:50<n?h.estimate_nnb=15:h.estimate_nnb=10;let i=5*(2*w+3*_+5*$+8*I/.8+9*S/.75+10*D/.75+11*C/.95+12*v/.7)/1440;i<O&&(O=Math.min(O/i,3),i*=O);z=Math.min(y,Math.max(N,z,i)).toFixed(2);h.estimate_active_days=z;M=parseInt(75*T+30*z+70*M);h.estimate_ws=M;const it=parseInt(x*z),ot=parseInt(150*E)+(250*A+50*k)+20*R+150*B,rt=25*F+25*L+5*j;let o=it+ot-rt;o<0&&(o=0),h.total_energy=o.toFixed(0),h.nature_energy=it.toFixed(0),h.item_energy=ot.toFixed(0),h.expend_energy=rt.toFixed(0);let r=40;var G=[2,2.8,3.2,3.2,3.6,3.8,3.7,4,4.8,4.8,5.2,5.2,5.4,5.8,5.8,6,6.4,6.6,6.8,7,7,7,7,7.3],W=[200,500,1e3,2e3,2750,3e3,3500,4e3,6e3,7e3,8e3,11e3,12420,18e3,18100,24140,31260,36610,46640,56520,67775,84535,106305,Number.MAX_SAFE_INTEGER];let s=0,l=o,d=W[0];for(;0<l&&r<2e8;){var H=Math.min(W[s],l,d,1e3),q=1.122*1.02*G[s]*H*((348e-9*Math.log(4750)+31e-7)*r/4+.32433-.0301431777);r+=q,l-=H,d-=H,l<=0||2e8<=r||s<G.length-1&&d<=0&&(++s,d=W[s])}0<l&&(A<k&&A<=100?(V=3240*l,r+=V):(Y=2510*l,r+=Y)),0<P&&(r=.5*r+.5*r*(1+.9*(Math.pow(1.01,.5*P)-1))),r=parseInt(r);let c=Lt(r);var U,X=[2,6,11,26,31,50,71,100],J=[100,5e3,1e4,2e4,3e4,5e4],K=[5e6,5e7,5e8,5e9,5e10],V=[2e3,2e4,2e5,2e6,2e7,2e8],Y=[2500,25e3,25e4,25e5,35e6,25e7],Q={"Absolute beginner":1,Beginner:2,Inexperienced:3,Rookie:4,Novice:5,"Below average":6,Average:7,Reasonable:8,"Above average":9,Competent:10,"Highly competent":11,Veteran:12,Distinguished:13,"Highly distinguished":14,Professional:15,Star:16,Master:17,Outstanding:18,Celebrity:19,Supreme:20,Idolised:21,Champion:22,Heroic:23,Legendary:24,Elite:25,Invincible:26};let p=0;for(U in Q)if(0==h.rank.indexOf(U)){p=Q[U],h.rank_value=p,h.rank_name=U;break}P=h.rank.split(" ");if(h.rank_title=P[P.length-1],0<p&&r<Number.MAX_SAFE_INTEGER){--p;var Z=h.level||0;for(let t=0;t<X.length;++t)Z>=X[t]&&--p;var tt=h.criminalrecord.total||0;for(let t=0;t<J.length;++t)tt>=J[t]&&--p;var et=g.networth||0;for(let t=0;t<K.length;++t)et>=K[t]&&--p;let t=0,e=Number.MAX_SAFE_INTEGER;p<=0?e=Y[0]:p>=V.length?t=V[V.length-1]:(t=V[p-1],e=Y[p]),r<t?c=`${c} ~ ${Lt(t)}`:r>e&&(c=`${Lt(e)} ~ ${c}`)}h.estimate_bs=r,h.estimate_bs_display=c,h.attackWinRatio=m/F,h.defendWinRatio=(b+u)/(b+u+f),st(h)}})}console.log("冰蛙启动完毕");async function te(t){switch(console.log(`[cors] get ${t}`),e){case ue.GM:return new Promise((e,a)=>{GM_xmlhttpRequest({method:"get",url:t,headers:{"Cache-Control":"no-cache"},timeout:5e3,ontimeout:t=>a("请求超时"),onload:t=>e(t.responseText),onerror:t=>a(`error: ${t}`)})});case ue.PDA:return new Promise((e,a)=>{PDA_httpGet(`${t}`).then(t=>{e(t.responseText)}).catch(t=>{a(`error: ${t}`)})});case ue.OTHER:default:return new Promise((t,e)=>{e("不支持跨域")})}}async function*ee(t,e,a,n,i){for(n=n||Math.floor((new Date).getTime()/1e3);;){i&&i(n);var o=await async function(t,e,a,n){let i=`https://api.torn.com/user/?selections=log&key=${b}`;0<t.length&&(i+=`&cat=${t.join(",")}`),0<e.length&&(i+=`&log=${e.join(",")}`),a&&(i+=`&from=${a}`),n&&(i+=`&to=${n}`);let o=3;for(;;){let t;if(0<o){const s=new AbortController;t=s.signal,setTimeout(()=>s.abort(),5e3)}let e;try{e=await fetch(i,{signal:t})}catch(t){if("AbortError"!==t.name)throw t;o--;continue}if(!e.ok)throw new Error(e.statusText);var r=await e.json();if("error"in r){if(17===r.error.code&&0<o){o--;continue}throw new Error(r.error.error)}return null===r.log?[]:Object.values(r.log).sort((t,e)=>e.timestamp-t.timestamp)}}(t,e,a,n);if(0===o.length)break;var r=o[o.length-1].timestamp;if(o[0].timestamp==r){for(const s of o)yield s;break}for(const l of o){if(l.timestamp<=r)break;yield l}n=r+1,await new Promise(t=>setTimeout(t,1e3))}}function ae(t){fe("#api_result_container").val(fe("#api_result_container").val()+"\n"+t)}function ne(t){var e=t.split("-")[0].trim();const a=t.split("-")[1].replace("TCT","").trim();var n="20"+a.split("/")[2].trim(),i=a.split("/")[1].trim(),t=a.split("/")[0].trim();const o=new Date(n+"/"+i+"/"+t+" "+e);return o.setHours(o.getHours()-(new Date).getTimezoneOffset()/60),parseInt(o.getTime()/1e3)}function ie(n){const i=Xt("CHAT_LAST_MESSAGE",n);if(i){let t="";t=0<=i.indexOf("|||")?i.split("|||")[0]:i;n=ne(t),n=parseInt((new Date).getTime()/1e3)-n;let e="",a="";return n<3600?(e=parseInt(n/60)+"m",a="#5d9525"):3600<=n&&n<86400?(e=parseInt(n/3600)+"h",a="#DAA520"):86400<=n&&n<3024e3?(e=parseInt(n/86400)+"d",a="#c0542f"):3024e3<=n&&(e=parseInt(n/86400)+"d",a="#777"),[a,e]}}function oe(t){var e=window.localStorage.getItem("muglog");if(e){var e=JSON.parse(e),n=Object.entries(e);for(let a=n.length-1;0<=a;a--)if(n[a][1].victim_id==t){var i=n[a][0],o="$"+Lt(Bt(n[a][1].money_mugged)),i=parseInt((new Date).getTime()/1e3)-i;let t="",e="";return i<3600?(t=parseInt(i/60)+"m ago",e="#5d9525"):3600<=i&&i<86400?(t=parseInt(i/3600)+"h ago",e="#DAA520"):86400<=i&&(t=parseInt(i/86400)+"d ago",e="#c0542f"),e+","+t+","+o}}}function re(){return fe("script[uid]").attr("uid")}function se(){var t=`https://api.torn.com/torn/?selections=companies&key=${b}`;fetch(t).then(t=>t.json()).then(e=>{const a=new Date;if("companies"in e){let t={};for(var n in t["last-updated"]=a.toString(),t.companies={},e.companies)t.companies[n]={name:e.companies[n].name,positions:e.companies[n].positions};window.localStorage.setItem("APICache_companies",JSON.stringify(t))}else"error"in e&&Jt("APICache_companies","last-updated",a.toString())}).catch(t=>console.log("fetch error",t))}function le(){const n={"中文Wiki":"<a href='https://torn.huijiwiki.com/' target='_blank'>",YATA:"<a href='https://yata.yt/' target='_blank'>",NGA:"<a href='https://nga.178.com/thread.php?stid=30081562' target='_blank'>","赛车":"<a href='/loader.php?sid=racing'>","啤酒":"<a href='/shops.php?step=bitsnbobs'>","飞行":"<a href='/travelagency.php'>","库存":"<a href='https://yata.yt/bazaar/abroad/' target='_blank'>","市场":"<a href='/imarket.php'>","点市":"<a href='/pmarket.php'>","股市":"<a href='/page.php?sid=stocks'>","巴扎":"<a href='/bazaar.php'>"};setInterval(function(){const t=fe("ul.menu-items");if("1"!=t.attr("hasdone")){if(0<t.siblings().length)for(var e in n)t.append('<li class="menu-item-link">'+n[e]+e+"</a></li>");else for(var a in t.attr("style","width:295px; margin-top:6px; line-height:16px;"),t.children(":last").remove(),t.children(":last").remove(),t.children(":last").remove(),n)t.append('<li class="menu-item-link">'+n[a]+a+"</a></li>");t.attr("hasdone","1")}},1e3)}function de(){setInterval(function(){const t=fe("#chatRoot [class*=chat-box___] [class*=chat-box-body___]");e.disconnect(),t.each(function(){fe(this).children("div").each(function(){n(this)}),e.observe(this,{childList:!0})})},1e3);const e=new MutationObserver(function(t){for(const e of t)for(const a of e.addedNodes)n(a)});function n(t){if(!function(a){const n=fe(a).find("[class*=chat-box-message__timestamp___] p");if(!(0===n.length||0<n.find(".bw-chat-ts").length)){const l=new Date;var i=Math.floor(l.getTime()/1e3);const d=n.text().trim();var o=d.match(/^(\d\d):(\d\d)$/);const c=d.match(/^([A-Za-z]+) (\d\d):(\d\d)$/);var r,s=d.match(/^(\d\d):(\d\d):\d\d - (\d\d)\/(\d\d)\/(\d\d)$/);o?(r=l.getUTCHours(),a=parseInt(o[1]),l.setUTCHours(a<=r?a:a-24),l.setUTCMinutes(parseInt(o[2]))):c?(o={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6}[c[1].toLowerCase()],o=(l.getUTCDay()+7-o)%7,l.setUTCDate(l.getUTCDate()-(o||0)),l.setUTCHours(parseInt(c[2])),l.setUTCMinutes(parseInt(c[3]))):s&&(l.setUTCHours(parseInt(s[1])),l.setUTCMinutes(parseInt(s[2])),l.setUTCDate(parseInt(s[3])),l.setUTCMonth(parseInt(s[4])-1),l.setUTCFullYear(parseInt(s[5])+2e3));i=i-Math.floor(l.getTime()/1e3);let t="",e="";86400<=i?(t=`(${Math.floor(i/86400)}d)`,e="t-red"):3600<=i?(t=`(${Math.floor(i/3600)}h)`,e="t-yellow"):0<i&&(t=`(${Math.floor(i/60)}m)`,e="t-green"),n.append(`<span class="bw-chat-ts ${e}" style="margin-left: 4px">${t}</span>`)}}(t),!fe(t).is(".bw-chat-withdraw")&&0!==fe(t).find("[class*=chat-box-message__avatar___]").length){const i=fe(t).find("[class*=chat-box-message__message___]").text().match(/(\bwithdraw|取)(.*)/i);if(i){fe(t).addClass("bw-chat-withdraw");let a=0;const o=i[2].match(/([\.0-9]+)([k|m|b]?)/i);if(o){var e=o[1].replace(/,/g,""),n=o[2].toLowerCase();let t=1;"k"==n?t=1e3:"m"==n?t=1e6:"b"==n&&(t=1e9),a=parseInt(parseFloat(e)*t)}fe(t).toggleClass("bw-chat-withdraw-amount",0<a);const r=fe(t).find("a").last();e=r.text().replace(/[:\s]/g,"");const s=r.attr("href")||"",l=s.substr(s.indexOf("XID=")+4),d=`${e} [${l}]`;fe(t).find("div[class*=chat-box-message--public___]").append('<div class="bw-chat-withdraw-btn bw-no-select">取</div>'),fe(t).find(".bw-chat-withdraw-btn").click(function(){console.log(`${d} ${a}`);const t=window.location.href;if(t.indexOf("#/tab=controls")<0||0<=t.indexOf("option")&&t.indexOf("giveMoneyTo")<0){const e=`https://www.torn.com/factions.php?step=your#/tab=controls&giveMoneyTo=${l}&money=${a}`;window.location.href=e,0<=t.indexOf("factions.php")&&setTimeout(()=>{window.location.href=e,location.reload()},500)}else!function(t,e){const a=fe(".money-wrap").children(".give-block");fe("input#money-user").val(t).addClass("chosen"),a.children(".inputs-wrap").children(".input-money-group").addClass("success").children("input").attr("value",Rt(e)),a.children(".inputs-wrap").children(".radio-wp").children(".btn-wrap").children(".btn").children().attr("disabled",!1).removeClass("disabled"),a.children(".inputs-wrap").children(".radio-wp").find("#give-money").click()}(d,a)})}}}}function ce(){setInterval(function(){const t=fe("[class*=chat-list-header__tabs___]");if(0<t.length){const e=t.children(":eq(3)").attr("class");if(0<=e.indexOf("active")){const a=fe("[class*=chat-tab-content___]");"1"!=a.attr("hasDone")&&(a.attr("hasDone","1"),function(o){var t=`https://api.torn.com/faction/?selections=basic,positions&key=${b}`;fetch(t).then(t=>t.json()).then(e=>{if("members"in e&&"positions"in e){const n=Object.keys(e.positions).filter(t=>e.positions[t].canGiveMoney);n.push("Leader","Co-leader");let r=[];for(const i in e.members){var t=e.members[i].position,a=e.members[i].status.state;0<=n.indexOf(t)&&"Okay"==a&&r.push(i)}o.each(function(t,e){var a=0<fe(this).find("[class*=online-status--online___]").length;const n=fe(this).find("a[class*=member-card-detail___]"),i=n.attr("href");var o=i?i.substring(18):0;0<=r.indexOf(o)&&a&&(fe(this).find("a").append("<span style='color:white'><b> 可取钱 在城内</b></span>"),fe(this).css("background-color","Darkseagreen"))})}else"error"in e&&console.log(e.error.error)}).catch(t=>console.log("fetch error",t))}(a.children("div")))}}},3e3)}function pe(t){0<fe("li[class^=icon15__]").length&&fe("#nurse").length<1&&(fe(t).before(`
<div style="margin-bottom:5px;">
<div id='nurse' style='color:#333;width:inherit;margin:auto;padding:10px;border:5px solid gray;background-color:#ccc;text-align:center;'>
<div id='nurse-eff' style='font-size:12px;padding:2px;'></div>
<div id='nurse-cd' style='font-size:24px;padding:2px;'>小护士竭诚为你服务</div>
<div id='nurse-item' style='font-size:12px;padding:2px;'></div>
<div id='nurse-suggestion' style='font-size:24px;padding:2px;'></div>
<div id='nurse-item-life' style='font-size:12px;padding:2px;'></div>
<div id='nurse-suggestion-life' style='font-size:24px;padding:2px;'></div>
</div>
</div>`),t=`https://api.torn.com/user/?selections=profile,cooldowns,perks&key=${b}`,fetch(t).then(t=>t.ok?t.json():void fe("#nurse-cd").text("--- 小护士探测失败 ---"),t=>{fe("#nurse-cd").text("--- 小护士网络异常 ---")}).then(f=>{if(null!=f)if("error"in f)fe("#nurse-cd").text(`--- API错误 --- code: ${f.error.code} error: ${f.error.error}`);else if("basicicons"in f&&"icon15"in f.basicicons){function u(t){let e=parseInt(t/3600);e=e<10?"0"+e:e;let a=parseInt(t/60)%60;a=a<10?"0"+a:a;let n=t%60;return n=n<10?"0"+n:n,e+":"+a+":"+n}var b=f.states.hospital_timestamp,m=b?b-parseInt((new Date).getTime()/1e3):0,y=u(m),x=Math.ceil(m/60),v=100-(f.life.current||0)/(f.life.maximum||7500)*100,w=u(f.cooldowns.medical||0);let a=!1,t=0,e=0,n=0;if("education_perks"in f){const A=f.education_perks;0<=A.indexOf("+ Withdraw and deliver blood")&&(a=!0),0<=A.indexOf("+ 20% medical item effectiveness")&&(t=20),0<=A.indexOf("+ 10% medical item effectiveness")&&(t=10)}if("faction_perks"in f){const M=f.faction_perks;M.forEach(function(t){0<=t.indexOf("medical item effectiveness")&&(e=t?parseInt(t.match(/\d+/)[0]):0),0<=t.indexOf("minutes of maximum medical cooldown")&&(n=t?parseInt(t.match(/\d+/)[0]):0)})}let i=6+parseInt(n/60);i=i<10?"0"+i:i;let o=n%60;o=o<10?"0"+o:o;var _=i+":"+o+":00";const C=parseInt(t)+parseInt(e)+100;console.log(C);let r=0,s=0,l=0,d=0;console.log(x);var k=function t(e){return a&&e>.7*C?(r+=1,t(e-1.2*C)):e>.4*C?(s+=1,t(e-.7*C)):e>.2*C?(l+=1,t(e-.4*C)):0<e?(d+=1,t(e-.2*C)):e}(x);console.log(k);var $=0==r?"":"大血包*"+r,I=0==s?"":"吗啡*"+s,S=0==l?"":"小蓝包*"+l,D=0==d?"":"小红包*"+d,b=30*r+20*s+15*l+10*d;let c=0,p=0,h=0,g=0;m=function t(e){return a&&e>.15*C?(c+=1,t(e-.3*C)):e>.1*C?(p+=1,t(e-.15*C)):e>.05*C?(h+=1,t(e-.1*C)):0<e?(g+=1,t(e-.05*C)):e}(v);console.log(m);f=0==c?"":"大血包*"+c,x=0==p?"":"吗啡*"+p,k=0==h?"":"小蓝包*"+h,v=0==g?"":"小红包*"+g,m=30*c+20*p+15*h+10*g;fe("#nurse-cd").text(`住院时间 ${y} 医疗冷却 ${w}/${_}`),fe("#nurse-eff").text(`抽血: ${a} 教育加成: +${t}% 帮派加成: +${e}%`),fe("#nurse-item").text(`大血包: -${parseInt(1.2*C)}分钟 吗啡: -${parseInt(.7*C)}分钟 小蓝包: -${parseInt(.4*C)}分钟 小红包: -${parseInt(.2*C)}分钟`),fe("#nurse-suggestion").text(`【出院模式】 ${$} ${I} ${S} ${D} (冷却 +${b}分钟)`),fe("#nurse-item-life").text(`大血包: 回血+${parseInt(.3*C)}% 吗啡: 回血+${parseInt(.15*C)}% 小蓝包: 回血+${parseInt(.1*C)}% 小红包: 回血+${parseInt(.05*C)}%`),fe("#nurse-suggestion-life").text(`【满血模式】 ${f} ${x} ${k} ${v} (冷却 +${m}分钟)`)}}).catch(t=>fe("#nurse-cd").text(t)))}function he(e){if(null!==e.sharedSet){const t=fe("#faction-armoury-tabs div.armoury-tabs:visible ul.item-list > li");if(0!==t.length){const i=Math.floor(Date.now()/1e3);t.each(function(){var a=fe(this).find("[data-armoryid]").first().attr("data-armoryid");if(e.sharedSet.has(a)&&!(0<fe(this).find(".bw-shared-armory").length)){fe(this).children(".name").append('<div class="bw-shared-armory"></div>');const n=fe(this).find('.loaned a[href^="/profiles.php?XID="]').first(),t=n.attr("href");a=t?t.substr(18):void 0,a=e.lastActions[a];if(a){a=i-a;let t="",e="";e=a<3600?(t=`${(a/60).toFixed(0)}m`,"#5d9525"):a<86400?(t=`${(a/3600).toFixed(0)}h`,"#DAA520"):(t=`${(a/86400).toFixed(0)}d`,"#c0542f"),n.after(`<span style="color:white;background-color:${e};padding:4px;margin-left:4px;border-radius:4px">${t}</span>`)}}})}}else e.error}function ge(){if(this.dataset.confirm){if(!confirm(this.dataset.msg))return}else alert(this.dataset.msg);fe(this).hide(),fe(this).siblings(".travel-info-btn").show()}}}function getVersion(){var e,a={"3.3.8":{date:"2023.05.19",notes:["新功能: 显示帮派仓库中的共享装备 by toby","修复: 删除对 torn.com 脚本的依赖,改为使用 cdnjs by toby","修复: 最近聊天记录时间戳识别错误 by toby"]},"3.3.7":{date:"2023.01.26",notes:["修复: 跨域请求(加载帮派贷款)在新版 PDA 上的错误 by toby"]},"3.3.6":{date:"2023.12.19",notes:["修复: 聊天快捷取钱及时间戳 by toby","修复: 最近聊天记录 by toby","删除: 插件中心 by toby","删除: 复活助手功能 by toby"]},"3.3.5":{date:"2023.11.26",notes:["修复: RW 墙上敌人 bs 显示 by toby","修改: 添加聊天时间戳距离现在的时间差 by toby","修改: 加载贷款额度失败时显示失败原因 by toby","修改: 更新帮派贷款相关的跨域 URL by toby"]},"3.3.4":{date:"2023.11.05",notes:["修复: 聊天取钱玩家名称识别错误 by toby","修复: 最近聊天时间戳 by toby"]},"3.3.3":{date:"2023.10.23",notes:["修复: 聊天快捷取钱适配新聊天 by toby","修复: 取钱助手适配新聊天 by toby","修复: 聊天记录适配新聊天 by toby","修复: 高级搜索界面的上次聊天时间戳 by toby","删除: 聊天时间戳 by toby"]},"3.3.2":{date:"2023.10.20",notes:["修复: 帮派取钱界面 by toby","修改: 提高毒瘾分析的计算精度 by toby"]},"3.3.1":{date:"2023.09.23",notes:["修复: 系统商店买不了啤酒的问题 by toby","修复: 市场快捷搜索中饮料箱的名称 by toby","修复: 快捷取钱全取按钮对贷款额度的处理 by toby","修复: 第一个犯罪百分比的显示问题 by toby","修改: 在脚本结尾添加一行标志结束的注释 by toby"]},"3.3.0":{date:"2023.08.13",notes:["重要改动: 基于安全方面的考虑,删除插件中心的自动安装功能,之前自动安装的插件需重新手工安装 by toby","新功能: 显示调账 event 变化金额 by toby","修复: 市场中武器防具的 bazaar 价格显示错误的问题 by toby","修复: 起飞前提醒 by toby","修复: 将锻炼比例选项挪回健身房列表下方 by toby","修改: 飞花过滤由白名单改为黑名单,以避免过滤新增物品 by toby","修改: 添加手工检查贷款按钮以绕过贷款检查 by toby","删除: 犯罪经验 by toby"]},"3.2.3":{date:"2023.07.16",notes:["新功能: 取钱时检查贷款额度 by toby","修复: Firefox 上的跨域请求 by toby","修改: raid 墙上也显示 bs by toby"]},"3.2.2":{date:"2023.07.13",notes:["修复: 小护士智能提醒出院吃药 by toby","修改: 海外市场不再屏蔽墨西哥酒和中国crime道具 by toby","修改: 快捷取钱无需金额也会显示按钮(例如全取)by toby","修改: 地盘战显示最快攻陷时间 by toby","修改: 适配工作信息相关的 API 更新 by toby"]},"3.2.1":{date:"2023.06.24",notes:["新功能: 犯罪助手 - 显示成功率最高的选项的百分比,需要手动在设置中打开 by toby","修复: 护士建议住院时间取整问题 by toby","修改: 蛙蛙探测勉强支持 crime 2.0 by toby","修改: 估算地盘战的最少进攻人数和最少防守时间 by toby","修改: 计划删除犯罪经验估算功能 by toby","修改: 隐藏并计划删除蛙蛙探测中的估算 NNB by toby"]},"3.2.0":{date:"2023.06.18",notes:["修复: 悬赏阅兵 by toby","修复: 修复自定义取钱快捷方式 by toby","修改: 帮派详情页重排各列顺序 by toby","修改: 帮派详情页重新读取时保留排序方式 by toby","修改: 快捷取钱中避免在住院时调账 by toby","修改: 快捷取钱支持英文关键字 withdraw by toby","修改: 犯罪经验中 nnb < 50 时不再计算预估升级天数 by toby"]},"3.1.11":{date:"2023.05.16",notes:["新功能: 设置中添加侧边栏冰蛙图标的开关 by kaeru","新功能: 新增快速 bail by toby","修复: 同时开启冰蛙和 TT 的快速 bust 时可以正常工作了 by toby","修复: 修复取钱助手(右下角people框)可取钱名单不全的问题 by toby","修改: 将 Bright Summit 加入友帮列表 by toby","修改: 简化攻击界面目标状态相关代码 by toby","修改: 更新冰蛙菜单查看 API 中的选项列表 by toby"]},"3.1.10":{date:"2023.03.19",notes:["修复: 修复起飞时 OC 提醒按钮点击无效的问题 by toby","修改: 犯罪经验中忽略 merit 重置导致的 nnb 变化 by toby"]},"3.1.9":{date:"2023.02.19",notes:["修复: 适配 PDA 2.9.5 (建议 PDA 用户在 START/END 中选择 START) by toby","修改: 毒瘾分析中正确处理拉满的戒毒记录 by toby","修改: 未设置 API Key 时不再自动跳转 by toby","修改: PDA 不再需要手工修改 @match 部分 by toby"]},"3.1.8":{date:"2023.02.15",notes:["新功能: 毒瘾分析 by toby","新功能: 增加起飞前 OC 弹窗提醒 by toby","修复: 在 API 超时或返回临时错误时重试 by toby","修改: 墙上敌人 bs 优先使用冰娃目标缓存数据 by toby","修改: 删除世界局势和近期RW功能 by toby","修改: 使聊天窗口时间戳和快捷取钱按钮不可选中 by toby"]},"3.1.7":{date:"2022.10.28",notes:["新功能: attack页面右侧显示RW武器技能描述 by htys","修复: 修复最近攻击功能的错误,并且设为默认不开启,需要在设置中手动开启 by htys","修复: 修复attack页面玩家名字英文大写被改成小写的错误 by htys","修改: 聊天记录被保存时间从5秒减少到1秒 by htys","修改: 取消最近唠嗑的阅兵需求,并可以在手机上显示了 by htys","修改: 修改了部分页面的颜色显示,使其在dark mode下更加和谐 by htys"]},"3.1.6":{date:"2022.10.23",notes:["新功能: 帮派chain页面额外显示更多5分钟内攻击记录(减少错过的复仇) by htys","新功能: 帮派取钱页面在更加明显的位置显示收款人余额 by htys"]},"3.1.5":{date:"2022.10.22",notes:["修复: 取钱快捷方式和帮派聊天快速取钱 by htys","修复: 冰蛙目标页面可以长按显示mini profile了 by htys","修复: PDA可以使用冰蛙目标了(只能导入csv格式) by htys"]},"3.1.4":{date:"2022.10.20",notes:["修复: 冰蛙主页面宽度现在可以适配手机了 by htys","修复: attack界面血量百分比,手机上出现攻守双方名字相同的bug by htys","修改: 修改冰蛙目标栏目顺序以更加适合手机上输出 by htys"]},"3.1.3":{date:"2022.10.20",notes:["新功能: mini profile界面新增攻击按钮 by htys","新功能: attack界面显示敌我双方血量百分比(斩杀武器技能可能有用) by htys","修复: 冰蛙主界面位置偏左的问题 by htys","修改: 优化手机模式下APIKEY选取界面UI by htys","修改: attack界面取消chain显示,将刷新按钮移动到原来显示chain的位置 by htys"]},"3.1.2":{date:"2022.10.11",notes:["修复: 在脚本头部引用了jQuery插件库以解决bust菜单无法使用的问题 by toby"]},"3.1.1":{date:"2022.10.11",notes:["修复: Update regex of bust perks by toby","修复: 在脚本头部引用了jQuery库以解决油猴更新后冰蛙无法使用的问题 by htys","修复: 更新了perks的正则匹配以解决小护士的显示问题 by htys","修改: 缩小了mini profile界面BS显示的区域以避免在手机模式下遮挡重要信息 by htys"]},"3.1.0":{date:"2022.09.23",notes:["修复: Fix bust filter not hiding targets with zero probability by toby","修改: 优化APIKEY选取界面UI by htys","修改: 优化mini profile界面额外信息UI by htys","修改: 地盘战显示墙上BS - 可以显示友方和第三方BS了 by htys","修改: 地盘战显示预估结束时间 by htys"]},"3.0.9":{date:"2022.09.21",notes:["修复: 修复犯罪经验计算中 NNB 升降时间识别问题 by toby","修复: Match API responses case-insensitively by toby","修复: 友邦列表新增 SMTH - Concord by htys"]},"3.0.8":{date:"2022.08.11",notes:["修复: 无论在城里还是在飞行,看别人的公司页面都输出员工状态表"]},"3.0.7":{date:"2022.08.09",notes:["修复: 修复监狱助手与新版 TornPDA 的冲突 by toby"]},"3.0.6":{date:"2022.07.10",notes:["修改: 冰蛙目标 - 重写部分内容以改善页面卡顿 by htys","修改: 冰蛙目标 - 住院时间更新频率为每秒一次 by htys","修改: 冰蛙目标 - 当有多个冰蛙目标页面打开时,最多只允许一个页面正常刷新 by htys"]},"3.0.5":{date:"2022.07.01",notes:["新功能: 监狱bust - 完全重做并新增估算bust成功率 by toby","新功能: gym页面 - 界面微调并新增检测何时可吃SE by htys"]},"3.0.4":{date:"2022.06.23",notes:["新功能: 冰蛙目标 - 加入过滤功能 by htys","修改: 冰蛙目标 - 当cdn不可用时增加了错误提示 by htys","修改: 从友方帮派中移除LND by htys"]},"3.0.3":{date:"2022.06.10",notes:["新功能: 聊天记录(代替抢劫历史) by htys","新功能: 帮派详情 - 新增显示能否被复活(需要阅兵) by htys","修改: 犯罪经验 - 修正犯罪惩罚公式 by toby","修改: 犯罪经验 - 删除犯罪经验的保存数据按钮 by toby","修改: 插件中心添加对PDA 2.8.0的支持 by mirror","修改: 聊天时间戳外观微调 by htys","修复: 修复最后唠嗑时间不显示的问题 by microdust"]},"3.0.2":{date:"2022.05.13",notes:["新功能: 插件中心 by mirror","新功能: 查询bust惩罚 by toby","修改: 犯罪经验 - 日志页面增加导出按钮 by toby","修改: 犯罪经验 - 增加犯罪经验数据收集说明 by toby","修改: 冰蛙目标支持导入csv格式文件 by microdust","修复: gym页面加成数字不显示的问题 by htys","修复: home页面perks显示错位的问题 by htys","修复: market search页面有时会不显示bazaar的问题 by htys"]},"3.0.1":{date:"2022.04.29",notes:["修改: 公司效率估算公式 by microdust","修改: 聊天框取钱跳转优化 by mirror","修改: 放宽对 NNB 升降级事件的时间要求 by toby","修复: 阅兵 by mirror","修复: 替换空值合并运算符 by toby"]},"3.0.0":{date:"2022.04.07",notes:["新功能: 犯罪经验 by toby"]},"2.9.9":{date:"2022.04.05",notes:["新功能: 灵活配置快捷取钱按钮 by mirror","新功能: 聊天栏添加取钱按钮 by mirror","修改: 公司数据拉取时机 by mirror","修复: 修复在高级搜索界面时,打开honerbar的时候上次唠嗑不显示的问题 by mirror"]},"2.9.8":{date:"2022.03.31",notes:["修改: 冰蛙目标页面 - 添加bs提示","修改: 友好帮派增加pta新帮","修复: 唠嗑时间在转换时区时有多余空格的bug"]},"2.9.7":{date:"2022.02.27",notes:["新功能: attack页面 - 显示chain进度,防止bonus打偏","修改: 公司页面 - 新增效率估算","修改: 冰蛙目标页面 - 若出院时间小于10分钟,则根据出院时间逐渐降低背景色透明度","修改: 搜索页面 - 若与目标超过35天未有聊天行为,则最近唠嗑显示为灰色","修复: 无法阅兵的bug"]},"2.9.6":{date:"2022.02.22",notes:["新功能: profile页面和mini profile页面显示血条"]},"2.9.5":{date:"2022.02.15",notes:["新功能: 冰蛙目标,自动刷新的目标监视利器","新功能: 帮派详情增加level和id显示","修复: 小护士调整小数保留位数"]},"2.9.4":{date:"2022.01.24",notes:["修复: 部分顶部链接","修复: miniBS显示位置","修复: PTA取钱功能","修复: 帮派页面显示阅兵、BS、离线时间和住院时间,取消排序功能"]},"2.9.3":{date:"2022.01.08",notes:["新功能:近期RW显示服务器近期RW的记录"]},"2.9.2":{date:"2022.01.04",notes:["新功能:帮派取钱现在在更加明显的位置提示余额,并且新增加了全取按钮","新功能:侧边栏现在有冰蛙图标了","修复:修复了飞行时读取不到自己id导致的公司页面无法显示问题","修复:帮派详情页面增加了显示内容(帮派图标和rank等级)"]},"2.9.1":{date:"2021.12.30",notes:["修复:修正了某些API的匹配格式,使得小护士可以正常运行","修复:更新了profile页面的攻击链接,现在玩家在医院可以读取完整的战斗页面了","修复:为一部分表格增加横向拖动条,使其在超出手机屏幕宽度时也可以显示完整内容(感谢Woohoo)","修复:微调了profile页面BS显示相关内容"]},"2.9.0":{date:"2021.12.28",notes:["新功能:小护士现在可以分别按照【出院模式】和【满血模式】提供建议","新功能:profile页面新增估算WS","新功能:针对公司老板新增显示公司货物库存","修复:修复了mini profile上估算bs重复显示的问题","修复:修复了小护士有时获取不到住院时间的问题","修复:修复了帮派余额和准备金率显示错误的问题","修复:profile连续活跃天数重新修改为冰蛙活跃天数","修复:修改了某些配色以解决深色模式下看不清的问题","修复:现在飞行无云功能不再显示飞机图片了","修复:针对非东8区用户修改了唠嗑时间显示不正确的问题","修复:更新了key->info和rankedwarreport等API条目"]},"2.8.9":{date:"2021.12.09",notes:["新功能:自己帮派的Ranked War界面会显示敌人bs(需提前对该帮派阅兵),并且可以按bs排序","修复:小护士读取不到API时的报错","修复:faction和company重绘读取不到API时的报错"]},"2.8.8":{date:"2021.11.24",notes:["修复:使用API重绘faction和company页面时匹配不同url","修复:一个神奇的bug"]},"2.8.7":{date:"2021.11.23",notes:["新功能:在个人profile页面显示上次聊天时间和上次mug时间金额","新功能:在高级搜索页面显示上次聊天时间"]},"2.8.6":{date:"2021.11.19",notes:["新功能:mini profile显示冰蛙估算战力","新功能:帮派仓库增加快捷取钱按钮","修改:使用帮派药品出院时也可以获得小护士建议了"]},"2.8.5":{date:"2021.11.08",notes:["新功能:战斗页面增加显示目标在线状态","修改:冰蛙APIKey读取页面UI","修改:阅兵可以按bazaar金额筛选目标,增加bazaar链接","修改:在飞行入院或入狱时也可以在company.php页面查看效率表格了"]},"2.8.4":{date:"2021.11.01",notes:["新功能:战斗页面增加量化显示stealth隐身概率","新功能:item页面增加小护士智能出院建议","新功能:在自己帮派的战斗中,会显示墙上敌人的bs(需提前对该帮派阅兵)","修复PDA会重复载入冰蛙的bug(感谢Woohoo-)"]},"2.8.3.1":{date:"2021.10.25",notes:["公司管理中增加显示本周销售额(实时数据)和近一周利润(缓存数据)","公司管理表格改为显示到公司页面的下方"]},"2.8.3":{date:"2021.10.23",notes:["起飞页面增加吃药cd和oc提醒功能","bounty页面增加自动阅兵功能,默认关闭需在设置中手动开启","个人页面的冰蛙检测增加显示活跃天数,删除ECS数量","在个人页面enemy数量右侧增加显示坏比指数","points市场目标提示现在可以显示新人和衣服店了"]},"2.8.2":{date:"2021.10.08",notes:["启用更精确的计算监狱分数公式并且显示分数提高到25000","修复阅兵bug"]},"2.8.1":{date:"2021.09.30",notes:["取消大乱斗功能","取消oc提醒功能"]},"2.8.0":{date:"2021.09.11",notes:["新增大乱斗阅兵","优化了大乱斗界面"]},"2.7.9":{date:"2021.09.09",notes:["新增了API条目","更新了顶部快捷链接","阅兵可以显示大乱斗所在队伍","在海外也可以查看大乱斗"]},"2.7.8":{date:"2021.08.18",notes:["阅兵可以显示目标bazaar内全部物品价值总和"]},"2.7.7":{date:"2021.06.20",notes:["公司排行页面可以进行公司阅兵了","增加新的快捷打劫链接","不再显示已售空的额外的bazaar","buymug时加入自己人防误伤提醒","OC即将开始时进入飞行界面将获得更加明显的提示","隐藏laptop边框","飞行时不显示云和飞机"]},"2.7.6":{date:"2021.05.29",notes:["不是老板也能查看我的公司表格了","新增帮派取钱助手"]},"2.7.5.2":{date:"2021.05.29",notes:["聊天框时间戳不显示秒","Jail界面增加显示更多按钮","海外库存界面增加显示更多按钮"]},"2.7.5.1":{date:"2021.05.27",notes:["修复聊天框时间戳"]},"2.7.5":{date:"2021.04.12",notes:["顶部链接、健身房、赛车界面UI微调"]},"2.7.4":{date:"2021.04.01",notes:["飞行时查看的公司页面增加TV和油厂的单价估算"]},"2.7.3":{date:"2021.03.30",notes:["我的公司页面UI微调"]},"2.7.2":{date:"2021.03.23",notes:["添加顶部链接和健身房的开关","在股票交易市场页面显示股票缩写"]},"2.7.1":{date:"2021.03.10",notes:["我的公司页面新增显示各员工工资和当前公司实时数据,修复保存31天显示32天的bug","飞行中的帮派信息页区分显示正在被突击和主动突击别人"]},"2.7.0":{date:"2021.02.14",notes:["修改imarket search页面,增加显示目标bazaar内全部物品价值总和","新增功能复活助手"]},"2.6.9":{date:"2021.02.11",notes:["帮派对比功能重做以显示更多数据","加入更多设置选项","index页面加入一键显示全部perks"]},"2.6.8":{date:"2021.02.02",notes:["新增世界局势功能,显示所有正在进行的地盘战,按战况激烈程度染色"]},"2.6.7":{date:"2021.01.24",notes:["在飞行/医院/监狱中也可以查看自己/他人Bazaar中物品"]},"2.6.6.3":{date:"2021.01.22",notes:["解决gym页面与torntools兼容问题"]},"2.6.6.2":{date:"2021.01.19",notes:["修改一些可能存在的bug","Gym页面提供Hank和Baldr属性比例参考","监视列表可以自由添加玩家ID,被监视的目标在海外被高亮(橙色)显示"]},"2.6.6.1":{date:"2021.01.19",notes:["查看个人profile页面的Last action显示为x天x时x分x秒"]},"2.6.6":{date:"2021.01.14",notes:["我的公司及飞行中看帮派、公司功能汉化。","飞行中看帮派信息增加chain、地盘战、raid战的信息。","产量数据支持多种库存的公司。"]},"2.6.5.1":{date:"2021.01.13",notes:["对使用过【我的公司】功能的,每天进游戏时自动检查抓取昨晚的公司运营数据。"]},"2.6.5":{date:"2021.01.11",notes:["公司效率表格微调:增加inactivy,调整列顺序","新增公司历史数据表格","飞行时也能看帮派和公司页面"]},"2.6.4.1":{date:"2021.01.05",notes:["优化公司效率表格显示,并且海外可查看"]},"2.6.4":{date:"2021.01.04",notes:["公司页面显示效率表格","聊天框显示时间戳"]},"2.6.3":{date:"2020.12.28",notes:["顶部增加简易导航条,从api.torn.com更新了API条目","优化阅兵功能,增加暂停和继续按钮","优化帮派对比功能,增加历史记录和高亮显示leader","增加抢劫历史功能,可以从历史记录中选择目标加入监视列表"]},"2.6.2":{date:"2020.11.11",notes:["修复顶部链接导致页面排版错乱的问题","payday功能只向leader和coleader提供"]},"2.6.1":{date:"2020.10.22",notes:["美化排版:pmarket、imarket(search)、imarket页面在显示bs时不再影响原始布局","市场显示超过3个bazaar:imarket(search)页面显示bazaar数量不再局限于3个","bazaar页面简易计算器:可以通过点击选中物品,页面顶部显示选中物品的总价值"]},"2.6.0":{date:"2020.09.28",notes:["itemmarket/pointmarket/bazaar界面增加3个mug相关脚本(感谢Mirror),使用mugoo=true开启","revivehelper重命名为facPageEnhanced,显示内容优化,使用foo=true开启","阅兵模块优化,增加阅兵内容选项,所有阅兵相关功能都使用foo=true开启","监狱置顶标记友帮成员,无视分数","海外people界面用颜色标记友帮和敌帮成员"]},"2.5.9":{date:"2020.09.16",notes:["修复飞花增强功能失效的bug"]},"2.5.8":{date:"2020.11.11",notes:["回滚上版本第一条,因为networth会变化,持续7天才触发rank","蛙蛙探测显示更多页面里的锻炼总能量换成Booster数量"]},"2.5.7":{date:"2020.08.14",notes:["当rank反推的bs上限低于估算值时,忽略估算值,使用rank反推的上下限区间","修复蛙蛙探测显示更多页面排版问题","帮派页面Revive增强功能默认关闭,需要时请将代码头部 reviveHelper 设为 true 手动开启"]},"2.5.6":{date:"2020.08.01",notes:["飞行中也可以方便的查看帮派成员状态,以及支持包括自己帮在内的最多3个帮派横向对比"]},"2.5.5.1":{date:"2020.07.30",notes:["修复一些取款小bug,给自己取款时,输入.或者?(英文标点)可自动替换为本人名字,减少输入时间"]},"2.5.5":{date:"2020.07.30",notes:["屏蔽全取按钮,选择取款目标时显示目标额度"]},"2.5.4":{date:"2020.07.27",notes:["增加帮派成员界面一系列功能:阅兵,显示bs、上次登录时间、旅行状态和住院时间,高亮标记住院成员,排序等"]},"2.5.3":{date:"2020.07.07",notes:["增加防打重功能,开关noAssisting = true"]},"2.5.2":{date:"2020.06.17",notes:["修复顶部链接导致页面排版错乱的问题"]},"2.5.1":{date:"2020.06.15",notes:["修复阅兵转换为csv有时丢失某些列的问题"]},"2.5.0":{date:"2020.06.05",notes:["搜索及海外用户列表阅兵功能优化:过滤5b以下,显示mugged, rehabcost, rank, job"]},"2.4.9":{date:"2020.06.05",notes:["飞行中也可以方便的查看帮派成员状态,以及支持包括自己帮在内的最多3个帮派横向对比"]},"2.4.8":{date:"2020.06.04",notes:["jailview 按 jailscore 排序,并优化体验","更新看库存的链接","用户搜索页面增加阅兵功能"]},"2.4.7":{date:"2020.04.26",notes:["左上角菜单中新增常用链接:市场","jailview页面增强:显示各目标的 分钟数*级别;过滤大于1万的;bust不需要二次确认(类似DN的quick bust功能)"]},"2.4.6":{date:"2020.04.26",notes:["左上角菜单中新增常用链接:赛车/啤酒/飞行/库存"]}};let n="",i=0,o="",r=0;for(e in a)if(r<10){o+=a[e].date+" --v"+e+"\n";for(let t=0;t<a[e].notes.length;t++)o+="    "+a[e].notes[t]+"\n";o+="\n";let t=e.split(".");t.splice(1,0,"."),t.join("");var s=parseFloat(t);s>i&&(i=s,n=e),r++}return[n,o]}"loading"===document.readyState?document.addEventListener("readystatechange",()=>{"interactive"===document.readyState&&bingwaMain()}):bingwaMain();
/* 冰蛙宝鉴到此结束 */