- 长时间不清空会出现奇怪的问题
@@ -1691,7 +861,7 @@ margin: 0 0 3px;
const soundIntervalID = window.setInterval(() => {
if (soundLoopFlag) $audio.play().then();
}, 1200);
- ob.observe($root, {childList: true, subtree: true});
+ ob.observe($root, { childList: true, subtree: true });
}
});
const ob = new MutationObserver(() => {
@@ -1700,13 +870,13 @@ margin: 0 0 3px;
$root = document.querySelector('#christmastownroot');
$ct_wrap = $root.querySelector('#ct-wrap');
if (!$ct_wrap) {
- ob.observe($root, {childList: true, subtree: true});
+ ob.observe($root, { childList: true, subtree: true });
return;
}
const $ct_title = $ct_wrap.querySelector('.status-title');
const $pos = $ct_wrap.querySelector('.map-title span[class^="position___"]') || $ct_wrap.querySelector('.status-title span[class^="position___"]');
if (!$pos) {
- ob.observe($root, {childList: true, subtree: true});
+ ob.observe($root, { childList: true, subtree: true });
return;
}
const $pos_spl = $pos.innerText.trim().split(',');
@@ -1716,7 +886,7 @@ margin: 0 0 3px;
const $wh_loot_container = $root.querySelector('#wh-loot-container');
if (!$wh_loot_container) {
console.error('掉落助手未找到DOM容器');
- ob.observe($root, {childList: true, subtree: true});
+ ob.observe($root, { childList: true, subtree: true });
return;
}
const $blink = $wh_loot_container.querySelector('#wh-loot-setting-blink');
@@ -1727,7 +897,7 @@ margin: 0 0 3px;
const items = $root.querySelectorAll('div.grid-layer div.items-layer div.ct-item');
// 附近的所有物品
items.forEach(el => {
- const item_props = {x: 0, y: 0, name: '', type: '', url: '',};
+ const item_props = { x: 0, y: 0, name: '', type: '', url: '', };
item_props.x = parseInt(el.style.left.replaceAll('px', '')) / 30;
item_props.y = -parseInt(el.style.top.replaceAll('px', '')) / 30;
item_props.url = el.firstElementChild.src;
@@ -1755,15 +925,15 @@ margin: 0 0 3px;
if (nearby_item.name === 'chests') {
chest_count++;
item_name = chestTypeDict[nearby_item.type] + lootTypeDict[nearby_item.name];
- $wh_loot_container_chests.innerHTML += `
${path}[${nearby_item.x},${nearby_item.y}] ${item_name}
`
+ $wh_loot_container_chests.innerHTML += `
${ path }[${ nearby_item.x },${ nearby_item.y }] ${ item_name }
`
} else {
item_count++;
item_name = (nearby_item.name === 'keys' ? keyTypeDict[nearby_item.type] || '' : '') + lootTypeDict[nearby_item.name] || nearby_item.name;
- $wh_loot_container_items.innerHTML += `
${path}[${nearby_item.x},${nearby_item.y}] ${item_name}
`
+ $wh_loot_container_items.innerHTML += `
${ path }[${ nearby_item.x },${ nearby_item.y }] ${ item_name }
`
}
// 确认地图坐标存在
if ($ct_title) {
- const hist_key = `[${nearby_item.x},${nearby_item.y}]"${$ct_title.firstChild.nodeValue.trim()}"${item_name}`;
+ const hist_key = `[${ nearby_item.x },${ nearby_item.y }]"${ $ct_title.firstChild.nodeValue.trim() }"${ item_name }`;
const el = dropHist[hist_key];
if (el) {
if (path === '=' && (nearby_item.name === 'keys' || nearby_item.name === 'gifts')) {
@@ -1773,9 +943,9 @@ margin: 0 0 3px;
if (!(nearby_item.name === 'chests' && $chest.checked)) {
const now = new Date();
dropHist[hist_key] = {
- pos: `[${nearby_item.x},${nearby_item.y}]`,
+ pos: `[${ nearby_item.x },${ nearby_item.y }]`,
map: $ct_title.firstChild.nodeValue.trim(),
- last: `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()} ${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`,
+ last: `${ now.getFullYear() }-${ now.getMonth() + 1 }-${ now.getDate() } ${ now.getHours() }:${ now.getMinutes() }:${ now.getSeconds() }`,
name: item_name,
id: Object.keys(dropHist).length,
};
@@ -1783,7 +953,7 @@ margin: 0 0 3px;
}
}
});
- $wh_loot_container.querySelector('#wh-loot-item-count').innerText = `(${item_count})`;
+ $wh_loot_container.querySelector('#wh-loot-item-count').innerText = `(${ item_count })`;
if (item_count === 0) {
$wh_loot_container_items.innerText = '暂无';
$wh_loot_container.querySelector('#wh-loot-container-main').style.animation = '';
@@ -1792,18 +962,18 @@ margin: 0 0 3px;
if ($blink.checked) $wh_loot_container.querySelector('#wh-loot-container-main').style.animation = 'lootFoundAlert 2s infinite';
if ($sound.checked) soundLoopFlag = true;
}
- $wh_loot_container.querySelector('#wh-loot-chest-count').innerText = `(${chest_count})`;
+ $wh_loot_container.querySelector('#wh-loot-chest-count').innerText = `(${ chest_count })`;
if (chest_count === 0) $wh_loot_container_chests.innerText = '暂无';
const history = Object.keys(dropHist).map(key => dropHist[key]).sort((a, b) => a.id - b.id);
let table_html = '';
history.forEach(e => {
- table_html += `
| ${e.pos} | ${e.map} | ${e.name} | ${e.last} | ${e.isPassed ? '已取得' : '不确定'} |
`;
+ table_html += `
| ${ e.pos } | ${ e.map } | ${ e.name } | ${ e.last } | ${ e.isPassed ? '已取得' : '不确定' } |
`;
});
$tbody.innerHTML = table_html;
localStorage.setItem('wh-loot-store', JSON.stringify(dropHist));
- ob.observe($root, {childList: true, subtree: true});
+ ob.observe($root, { childList: true, subtree: true });
});
- getDOMOb.observe($root, {childList: true, subtree: true});
+ getDOMOb.observe($root, { childList: true, subtree: true });
}
}
@@ -1870,11 +1040,6 @@ margin: 0 0 3px;
await rw_raider();
}
- // 任何位置公司一键存钱
- if (getWhSettingObj()['companyDepositAnywhere']) {
- addActionBtn('公司存钱', companyDepositAnywhere, $zhongNode);
- }
-
if (getPlayerInfo()['userID'] === 2687093 && getDeviceType() === Device.PC) {
await getSidebarData();
let item = document.getElementById('nav-items');
@@ -1890,864 +1055,6 @@ margin: 0 0 3px;
}
}
- // 通知翻译
- function eventsTrans(events = $('span.mail-link')) {
- // if (!wh_trans_settings.transEnable) return;
- const index = window.location.href.indexOf('events.php#/step=received') >= 0 ? 1 : 0;
- const isReceived = index === 1;
- // 通知的类型选择栏
- $('ul.mailbox-action-wrapper a').contents().each((i, e) => {
- if (e.nodeValue)
- if (eventsDict[e.nodeValue.trim()])
- e.nodeValue = eventsDict[e.nodeValue.trim()];
- });
-
- // 桌面版右边按钮浮动提示消息
- $('div.mailbox-container i[title]').each((i, e) => {
- if (eventsDict[$(e).attr('title')]) {
- $(e).attr('title', eventsDict[$(e).attr('title')]);
- }
- });
-
- // 手机版底部按钮
- $('.mobile-mail-actions-wrapper div:nth-child(2)').each((i, e) => {
- if (eventsDict[$(e).text().trim()])
- $(e).text(eventsDict[$(e).text().trim()]);
- });
-
- // 黑框标题
- $('#events-main-wrapper .title-black').each((i, e) => {
- if (eventsDict[$(e).text().trim()]) {
- $(e).text(eventsDict[$(e).text().trim()]);
- }
- });
-
- // 发送的两个按钮 + user id
- $('#events-main-wrapper div.send-to a.btn').each((i, e) => {
- if (eventsDict[$(e).text().trim()]) {
- $(e).text(eventsDict[$(e).text().trim()]);
- }
- });
- $('#events-main-wrapper div.send-to span.cancel a').each((i, e) => {
- if (eventsDict[$(e).text().trim()]) {
- $(e).text(eventsDict[$(e).text().trim()]);
- }
- });
- $('#events-main-wrapper div.send-to span.name').each((i, e) => {
- if (eventsDict[$(e).text().trim()]) {
- $(e).text(eventsDict[$(e).text().trim()]);
- }
- });
-
- // 通知翻译的开关
- if (!$('div#event-trans-msg').get(0) && !window.location.href.contains(/index\.php/)) {
- // msgBox(`
`);
- $('input#eventTransCheck').attr('checked', localStorage.getItem('wh_trans_event') === 'true');
- $('input#eventTransCheck').change(function () {
- if ($(this).attr('checked') === undefined) {
- localStorage.setItem('wh_trans_event', 'false');
- } else {
- localStorage.setItem('wh_trans_event', 'true');
- }
- eventsTrans();
- });
- }
-
- if (localStorage.getItem('wh_trans_event') === 'false') return;
- if (events.length === 0) return;
- events.each((i, e) => {
- // todo “收到的信息” 暂时删除发送人节点 不影响显示
- if (isReceived) {
- $(e).children('a.sender-name').remove();
- }
-
- if (eventsDict[$(e).text().trim()]) {
- $(e).text(eventsDict[$(e).text().trim()]);
- return;
- }
-
- /**
- * 赛车
- * You finished 5th in the Hammerhead race. Your best lap was 01:14.87.
- * You finished 1st in the Docks race. Your best lap was 04:01.33.
- * You finished 1st in the Hammerhead race and have received 3 racing points! Your best lap was 01:06.92.
- * You finished 4th in the Docks race. Your best lap was 03:29.27 beating your previous best lap record of 03:35.77 by 00:06.50.
- * You have crashed your Honda NSX on the Sewage race! The upgrades Paddle Shift Gearbox (Short Ratio) and Carbon Fiber Roof were lost.
- * You have crashed your Ford Mustang on the Docks race! Your car has been recovered.
- */
- if ($(e).text().indexOf('finished') >= 0) {
-
- if ($(e).text().indexOf('crashed') >= 0) return; // todo 撞车
-
- const isGainRacingPoint = $(e).text().indexOf('racing point');
- let racingPoint = isGainRacingPoint >= 0 ? $(e).text()[isGainRacingPoint - 2] : null;
-
- const isBeat = $(e).text().indexOf('beating') >= 0;
- let record, bestBy;
- if (isBeat) {
- record = $(e).text().split('record of ')[1].split(' by ')[0];
- bestBy = $(e).text().split('record of ')[1].split(' by ')[1].split('. ')[0];
- }
-
- const pos = e.childNodes[1].firstChild.nodeValue.match(/[0-9]+/)[0];
-
- const splitList = e.childNodes[2].nodeValue.split(' ');
- const bestLap = e.childNodes[2].nodeValue.split(' best lap was ')[1].slice(0, 8);//.split(' ')[0];
-
- let map = splitList[3];
- map = map === 'Two' ? 'Two Islands' : map;
- map = map === 'Stone' ? 'Stone Park' : map;
-
- e.firstChild.nodeValue = '你在赛车比赛 ' + map + ' 中获得第 ';
- e.childNodes[1].firstChild.nodeValue = pos;
- e.childNodes[2].nodeValue = ' 名,';
- if (isGainRacingPoint >= 0) {
- e.childNodes[2].nodeValue += '获得' + racingPoint + '赛车点数 (Racing Points)。';
- }
-
- e.childNodes[2].nodeValue += '你的最佳圈速是 ' + bestLap;
- if (isBeat) e.childNodes[2].nodeValue += ',比之前最佳 ' + record + ' 快 ' + bestBy;
- e.childNodes[2].nodeValue += '。'
-
-
- e.childNodes[2].nodeValue += '[';
- e.childNodes[3].firstChild.nodeValue = '查看';
- return;
- }
-
- /**
- * 还贷
- */
- if ($(e).text().contains(/You have been charged \$[0-9,]+ for your loan/)) {
- const node1Value = e.firstChild.nodeValue; // You have been charged $29,000 for your loan. You can pay this by visiting the
- //e.childNodes[1].firstChild.nodeValue; //
Loan Shark
- // const node3Value=e.childNodes[2].nodeValue; 内容是 ". "
-
- let charge = node1Value.split(' ')[4];
- let replace;
- replace = '你需要支付 ';
- replace += charge;
- replace += ' 贷款利息,点此支付:';
-
- e.firstChild.nodeValue = replace;
- e.childNodes[1].firstChild.nodeValue = '鲨客借贷';
- e.childNodes[2].nodeValue = '。';
- return;
- }
-
- /**
- * 收到钱物
- * You were sent $21,000,000 from
- *
JNZR
- * .
- * 附带信息: with the message: Manuscript fee OCT
- * e.firstChild.nodeValue
- * e.childNodes[1].firstChild.nodeValue
- * e.childNodes[2].nodeValue
- *
- * You were sent 4x Xanax from RaichuQ with the message: Manuscript fee OCT
- * You were sent $21,000,000 from JNZR.
- * You were sent some Xanax from runningowl
- * You were sent 1x Present from Duke with the message: Is it your birthday?
- * You were sent Duke's Safe from DUKE
- * You were sent a Diamond Bladed Knife from charapower
- */
- if ($(e).text().contains(/You were sent .+ from/)) {
- // 数量 物品 信息
- // spl = [You were sent 1x Birthday Present from]
- const spl = $(e).contents().get(0).nodeValue.trim().split(' ');
- const msgSpl = $(e).text().trim().split('with the message: ');
- const num = /^\$[0-9,]+\b/.test(spl[3]) ? '' : spl[3].numWordTrans();
- const item = num === '' ? spl[3] : spl.slice(4, -1).join(' ');
- const msg = msgSpl[1] ? msgSpl[1] : null;
- e.childNodes[0].nodeValue = `你收到了 ${num} ${item},来自 `;
- if (e.childNodes[2]) {
- e.childNodes[2].nodeValue = `。`;
- }
- if (msg) {
- e.childNodes[2].nodeValue = `,附带信息:${msg}。`;
- }
- return;
- }
-
- /**
- * bazaar
- * Dewei3 bought 2 x Toyota MR2 from your bazaar for $56,590.
- * ['', 'bought', '2', 'x', 'Toyota', 'MR2', 'from', 'your', 'bazaar', 'for', '$56,590.\n']
- * e.childNodes[1].nodeValue
- */
- if ($(e).text().contains(/bought .+ from your bazaar for/)) {
- const bazEN = e.childNodes[1].nodeValue;
- const spl = bazEN.split(' ');
-
- const num = spl[2];
- const item = spl.slice(4, spl.indexOf('from')).join(' ');
- const money = spl[spl.length - 1].replace('.', '');
-
- e.childNodes[1].nodeValue = ' 花费 ' + money + ' 从你的店铺购买了 ' + num + ' 个 ' + ' ' + item + '。';
- return;
- }
-
- /**
- * 交易
- */
- if ($(e).text().indexOf('trade') >= 0) {
- const PCHC = '点此继续';
- if ($(e).text().indexOf('You must now accept') >= 0) {
- /**
- * 接受交易
- *
JNZR
- * has accepted the trade titled "g't". You must now accept to finalize it.
- *
Please click here to continue.
- * JNZR已经接受了名为 "g't "的交易。你现在必须接受以完成它。
- */
- const firstWords = e.childNodes[1].nodeValue.split('. You must')[0];
- const tradeName = firstWords.slice(31, firstWords.length);
- e.childNodes[1].nodeValue = ' 已经接受了名为 ' + tradeName + ' 的交易。你现在必须接受以完成它。';
- e.childNodes[2].firstChild.nodeValue = PCHC;
- return;
- }
- if ($(e).text().indexOf('expired') >= 0) {
- /**
- * 交易过期
- * The trade with
- *
sabrina_devil
- * has expired
- * 与sabrina_devil的交易已经过期。
- */
- e.firstChild.nodeValue = '与 ';
- e.childNodes[2].nodeValue = ' 的交易已过期。';
- return;
- }
- if ($(e).text().indexOf('initiated') >= 0) {
- /**
- * 交易发起
- *
sabrina_devil
- * has initiated a trade titled "gt".
- *
Please click here to continue.
- * sabrina_devil发起了一项名为 "gt "的交易。
- */
- const node2 = e.childNodes[1].nodeValue;
- const tradeName = node2.slice(30, node2.length - 2);
- e.childNodes[1].nodeValue = ' 发起了标题为 ' + tradeName + ' 的交易。';
- e.childNodes[2].firstChild.nodeValue = PCHC;
- return;
- }
- if ($(e).text().indexOf('now complete') >= 0) {
- /**
- * 交易完成
- *
Tmipimlie
- * has accepted the trade. The trade is now complete.
- * Tmipimlie已经接受交易。现在交易已经完成。
- */
- e.childNodes[1].nodeValue = ' 已经接受交易。该交易现已完成。';
- return;
- }
- if ($(e).text().indexOf('canceled') >= 0) {
- /**
- * 交易完成
- *
WOW
- * has canceled the trade.
- * WOW已经取消了这项交易。
- */
- e.childNodes[1].nodeValue = ' 已经取消了这个交易。';
- return;
- }
- if ($(e).text().indexOf('commented') >= 0) {
- /**
- * 交易评论
- *
QIJI
- * commented on your
- *
pending trade
- * : "Thank you for trading with me! The total is $19,461,755 and you can view your receipt here: https://www.tornexchange.com/receipt/mhWuuL7hrE"
- */
- e.childNodes[1].nodeValue = ' 对';
- e.childNodes[2].firstChild.nodeValue = '进行中的交易';
- e.childNodes[3].nodeValue = '添加了一条评论' + e.childNodes[3].nodeValue;
- return;
- }
- return;
- }
-
- /**
- * 被mug
- */
- if ($(e).text().indexOf('mugged') >= 0) {
- const spl = $(e).text().trim().split(' ');
- if (spl.length > 7) return; // todo 多人运动暂时跳过
- const money = spl[spl.length - 2];
- if (spl[0] === 'Someone') { // 被匿名mug
- e.firstChild.nodeValue = '有人打劫你并抢走了 ' + money + ' [';
- e.childNodes[1].firstChild.nodeValue = '查看';
- } else {
- e.childNodes[1].nodeValue = ' 打劫你并抢走了 ' + money + ' [';
- e.childNodes[2].firstChild.nodeValue = '查看';
- }
- return;
- }
-
- /**
- * 被打
- */
- if ($(e).text().indexOf('attacked') >= 0) { // 被打
- /**
- * 攻击方式 词数=spl.length
- * 匿名 4 Someone attacked you [view]
- * - hosp 6 Someone attacked and hospitalized you [view]
- * -- 有人袭击了你并安排你住院
- * 实名 4 EternalSoulFire attacked you [view]
- * - lost 6 EternalSoulFire attacked you but lost [view]
- * - hosp 6
- * - 逃跑esc 6 Dr_Bugsy_Siegel attacked you but escaped [view]
- * - 25回合平手stale 6 Tharizdun attacked you but stalemated [view]
- * - 起飞或bug 6 Mrew tried to attack you [view]
- *
- * You attacked Cherreh but timed out [view]
- *
- * 多人运动 todo
- * 10 Pual (and 2 others) attached you and hospitalized you [view]
- * 9 Argozdoc attacked you but Norm fought him off [view]
- */
- const spl = $(e).text().trim().split(' ');
-
- if (spl.length > 6) { // 多人运动暂时跳过
- /**
- * 超时自动失败
- */
- if (spl[4] === 'timed') {
- if (e.firstChild.firstChild) { // 由第一个节点是否有子节点判断 被攻击
- e.childNodes[1].nodeValue = ' 袭击你但是超时了 [';
- e.childNodes[2].firstChild.nodeValue = '查看';
- return;
- }
- e.firstChild.nodeValue = '你袭击 ';
- e.childNodes[2].nodeValue = ' 但是超时了 [';
- e.childNodes[3].firstChild.nodeValue = '查看';
- return;
- }
- return;
- }
-
- if ($(e).find('a').text().toLowerCase().indexOf('someone') < 0 && // 避免玩家名带有someone字样
- $(e).text().split(' ')[0].toLowerCase() === 'someone') { // 被匿名
- if (spl.length === 6 && spl[3] === 'hospitalized') { // 匿名hos
- e.firstChild.nodeValue = '有人袭击你并将你强制住院 [';
- e.childNodes[1].firstChild.nodeValue = '查看';
- return;
- }
- e.firstChild.nodeValue = '有人袭击了你 [';
- e.childNodes[1].firstChild.nodeValue = '查看';
- return;
- }
-
- if (spl.length === 4) { // 实名leave
- e.childNodes[1].nodeValue = ' 袭击了你 [';
- e.childNodes[2].firstChild.nodeValue = '查看';
- return;
- }
-
- if (spl.length === 6) { // 实名的情况
- switch (spl[4]) {
- case 'lost':
- e.childNodes[1].nodeValue = ' 袭击你但输了 [';
- e.childNodes[2].firstChild.nodeValue = '查看';
- return;
- case 'escaped':
- e.childNodes[1].nodeValue = ' 袭击你但逃跑了 [';
- e.childNodes[2].firstChild.nodeValue = '查看';
- return;
- case 'stalemated':
- e.childNodes[1].nodeValue = ' 袭击你但打成了平手 [';
- e.childNodes[2].firstChild.nodeValue = '查看';
- return;
- }
- switch (spl[3]) {
- case 'attack': // Mrew tried to attack you [view]
- e.childNodes[1].nodeValue = ' 尝试袭击你 [';
- e.childNodes[2].firstChild.nodeValue = '查看';
- return;
- case 'hospitalized':
- e.childNodes[1].nodeValue = ' 袭击你并将你强制住院 [';
- e.childNodes[2].firstChild.nodeValue = '查看';
- return;
- }
- }
-
- }
-
- /**
- * 每日彩票
- * 有人在Lucky Shot彩票中赢得11,832,100,000美元!
- * zstorm won $5,574,200 in the Daily Dime lottery!
- */
- if ($(e).text().indexOf('lottery') >= 0) {
- const split = e.childNodes[1].nodeValue.split(' ');
- const type = split[split.length - 3] + ' ' + split[split.length - 2];
- const money = split[2];
- e.childNodes[1].nodeValue = ' 在 ' + type + ' 彩票中赢得了 ' + money + '!';
- return;
- }
-
- /**
- * 公司职位变更
- */
- if ($(e).text().contains(/, the director of .+, has/)) {
- $(e).contents().each((i, e) => {
- if (e.nodeType === 3) {
- if (eventsDict[e.nodeValue.trim()]) {
- e.nodeValue = eventsDict[e.nodeValue.trim()];
- } else {
- // 工资改变
- if (e.nodeValue.contains(/wage/)) {
- const money = e.nodeValue.trim().slice(27, -9);
- e.nodeValue = ` 的老板) 将你的每日工资改为 ${money}。`;
- return;
- }
- // 职位改变
- if (e.nodeValue.contains(/rank/)) {
- const pos = e.nodeValue.trim().slice(27, -1);
- e.nodeValue = ` 的老板) 将你的公司职位改为 ${pos}。`;
- return;
- }
- if (e.nodeValue.contains(/assigned/)) {
- e.nodeValue = ` 的老板) 将你指派为新的公司老板。`;
- return;
- }
- // 火车
- if (e.nodeValue.contains(/trained/)) {
- const spl = e.nodeValue.trim().split(' ');
- const pri = spl[10];
- const sec = spl[13].slice(0, -1);
- e.nodeValue = ` 的老板) 从公司训练了你。你获得了 50 ${eventsDict[pri]} 和 25 ${eventsDict[sec]}。`;
- }
- }
- }
- });
- return;
- }
-
- /**
- * 悬赏已被领取
- */
- if ($(e).text().contains(/bounty reward/)) {
- $(e).contents().each((i, e) => {
- if (e.nodeType === 3) {
- if (eventsDict[e.nodeValue.trim()]) {
- e.nodeValue = ` ${eventsDict[e.nodeValue.trim()]} `;
- } else {
- if (e.nodeValue.contains(/bounty reward/)) {
- const bountyAmount = e.nodeValue.trim().split(' ')[3];
- if (eventsDict['and earned your'] && eventsDict['bounty reward']) {
- e.nodeValue = ` ${eventsDict['and earned your']} ${bountyAmount} ${eventsDict['bounty reward']}`;
- }
- }
- }
- }
- });
- return;
- }
-
- /**
- * oc开启
- * You have been selected by
- *
endlessway
- * to participate in an organized crime. You, along with 2 others will make up the team to
- *
make a bomb threat
- * in 72 hours.
- *
- * 你被endlessway选中参与一项有组织的犯罪活动。你和另外两个人将组成一个团队,在72小时内进行炸弹威胁。
- */
- if ($(e).text().indexOf('organized crime') >= 0) {
- const time = e.childNodes[4].nodeValue.split(' ')[2];
- const OCName = e.childNodes[3].firstChild.nodeValue;
- let others = e.childNodes[2].nodeValue.split(' ')[10];
- others = others === 'one' ? '1' : others;
- e.firstChild.nodeValue = '你被 ';
- e.childNodes[2].nodeValue = ` 选中参与一项组织犯罪(OC)。你和另外${others}人将组成一个团队,在${time}小时后进行 `;
- e.childNodes[3].firstChild.nodeValue = ocList[OCName] ? ocList[OCName] : OCName;
- e.childNodes[4].nodeValue = '。';
- return;
- }
-
- /**
- * oc结束
- * - You and your team tried to make a bomb threat but failed! View the details
- * - You and your team successfully blackmailed someone! View the details
- *
here
- * !
- */
- if ($(e).text().indexOf('You and your team') >= 0) {
- let rs = '成功';
- let OCName = e.firstChild.nodeValue.slice(31, -19);
- if ($(e).text().indexOf('fail') >= 0) {
- rs = '失败';
- OCName = e.firstChild.nodeValue.slice(27, -30);
- }
- e.firstChild.nodeValue = `你和团队的组织犯罪(OC) ${ocList[OCName] ? ocList[OCName] : OCName} ${rs}了!`;
- e.childNodes[1].firstChild.nodeValue = '点此查看详情';
- e.childNodes[2].nodeValue = '!';
- return;
- }
-
- /**
- * bust
- *
Spookyt
- * failed to bust you out of jail.
- */
- if ($(e).text().indexOf('bust') >= 0) {
- if (e.childNodes[1].nodeValue[1] === 'f') { // 失败
- e.childNodes[1].nodeValue = ' 没能把你从监狱救出来。';
- return;
- }
- if (e.childNodes[1].nodeValue[1] === 'w') { // 失败被抓
- e.childNodes[1].nodeValue = ' 在尝试救你出狱时被抓了。';
- return;
- }
- if (e.childNodes[1].nodeValue[1] === 's') {
- e.childNodes[1].nodeValue = ' 成功把你从监狱里救了出来。';
- return;
- }
- }
-
- /**
- * 保释
- */
- if ($(e).text().indexOf('bailed') >= 0) {
- const cost = e.childNodes[1].nodeValue.trim().slice(27, -1);
- e.childNodes[1].nodeValue = ' 花费 ' + cost + ' 保释了你。';
- return;
- }
-
- /**
- * 收到帮派的钱
- */
- if ($(e).text().contains(/You were given \$[0-9,]+ from your faction/)) {
- const money = e.firstChild.nodeValue.split(' ')[3];
- let isNamed = e.childNodes.length > 1;
- if (isNamed) {
- e.firstChild.nodeValue = '';
- e.childNodes[2].nodeValue = ' 为你从帮派取了 ' + money + '。';
- } else {
- e.firstChild.nodeValue = '你得到了从帮派取出的 ' + money + '。';
- }
- return;
- }
-
- /**
- * 被下悬赏
- */
- if ($(e).text().contains(/has placed .+ bount.+ on you/)) {
- // 是否匿名 悬赏个数 悬赏单价 原因
- const spl = $(e).text().trim().split(' ');
- const reasonSpl = $(e).text().trim().split(' and the reason: ');
- const someone = !e.children.length;
- const num = spl[3] === 'a' ? '1' : spl[3];
- const price = reasonSpl[0].split(' ').slice(-1)[0];
- const reason = reasonSpl[1] ? reasonSpl[1] : null;
- const trans = `${someone ? '某人' : ' '}对你进行了 ${num} 次赏金为 ${price} 的悬赏${reason ? ',原因:' + reason : ''}`;
- // 匿名悬赏
- if (someone) {
- $(e).text(trans);
- }
- // 实名悬赏
- else {
- $(e).contents().get(1).nodeValue = trans;
- }
- return;
- }
-
- /**
- * 成功复活
- */
- if ($(e).text().contains(/successfully revived you/)) {
- if (e.children.length !== 1) return;
- if (eventsDict[$(e).contents().get(1).nodeValue.trim()]) {
- $(e).contents().get(1).nodeValue = eventsDict[$(e).contents().get(1).nodeValue.trim()]
- }
- return;
- }
-
- /**
- * 失败复活
- */
- if ($(e).text().contains(/failed to revive you/)) {
- if (e.children.length !== 1) return;
- if (eventsDict[$(e).contents().get(1).nodeValue.trim()]) {
- $(e).contents().get(1).nodeValue = eventsDict[$(e).contents().get(1).nodeValue.trim()]
- }
- return;
- }
-
- /**
- * 收到帮派的pt
- */
- if ($(e).text().contains(/You were given [0-9,]+ points? from your faction/)) {
- const pt = e.firstChild.nodeValue.split(' ')[3];
- e.firstChild.nodeValue = '你得到了从帮派取出的 ' + pt + ' PT。'
- return;
- }
-
- /**
- * 帮派借东西
- */
- if ($(e).text().contains(/loaned you .+ from the faction armory/)) {
- const [num, item] = (() => {
- const spl = e.lastChild.nodeValue.trim().slice().slice(11, -25).split(' ');
- return spl.length === 1 ? [spl[0], null] : [spl[0], spl.slice(1).join(' ')];
- })();
- if (num && item) {
- e.lastChild.nodeValue = ` 从帮派军械库中借给你 ${num.numWordTrans()} ${item}。`;
- }
- return;
- }
-
- /**
- * 教育完成
- *
The education course you were taking has ended. Please click here.
- */
- if ($(e).text().indexOf('edu') >= 0) {
- if ($(e).text().trim().split(' '))
- e.firstChild.firstChild.nodeValue = '你的课程已学习结束,请点此继续。';
- return;
- }
-
- /**
- * LSD od
- */
- if ($(e).text().contains(/LSD .+ overdosed/)) {
- if (eventsDict[$(e).text().trim()]) $(e).text(eventsDict[$(e).text().trim()]);
- return;
- }
-
- /**
- * 公司申请
- */
- if ($(e).text().contains(/Your application to join the company .+ has been/)) {
- $(e).contents().each((i, e) => {
- if (e.nodeType === 3) {
- if (eventsDict[e.nodeValue.trim()]) {
- e.nodeValue = eventsDict[e.nodeValue.trim()];
- }
- }
- });
- return;
- }
-
- /**
- * 银行完成
- */
- if ($(e).text().contains(/Your bank investment has ended/)) {
- $(e).children().text('你的银行投资已经结束。请点击这里领取你的资金。');
- return;
- }
-
- /**
- * 人物升级
- *
Congratulations! You upgraded your level to 31!
-
- */
- if ($(e).text().indexOf('upgraded') >= 0) {
- const level = e.firstChild.nodeValue.slice(44, -2);
- e.firstChild.nodeValue = '恭喜!你已升至' + level + '级!';
- return;
- }
-
- /**
- * 开新健身房
- *
You have successfully purchased membership in Deep Burn.
- * 你已成功购买Deep Burn的健身房会员卡。
- */
- if ($(e).text().contains(/You have successfully purchased membership in/)) {
- const gymName = e.firstChild.nodeValue.trim().slice(46, -1);
- e.firstChild.nodeValue = `你已购买【${gymList[gymName]}】健身房会员卡。`;
- return;
- }
-
- /**
- * 人物称号
- */
- if ($(e).text().contains(/You are now known in the city as a/)) {
- const trans = '现在你在这个城市中被称为';
- const title = $(e).text().trim().split(' ').slice(9).join(' ').slice(0, -1);
- $(e).text(`${trans} ${title}。`);
- return;
- }
-
- /**
- * 收下线
- */
- if ($(e).text().contains(/You have successfully referred/)) {
- $(e).contents().each((i, e) => {
- // 文字
- if (e.nodeType === 3) {
- if (eventsDict[e.nodeValue.trim()]) {
- e.nodeValue = eventsDict[e.nodeValue.trim()];
- }
- }
- // referral list
- else if (e.nodeType === 1) {
- if (eventsDict[$(e).text().trim()]) {
- $(e).text(eventsDict[$(e).text().trim()]);
- }
- }
- });
- return;
- }
-
- /**
- * new virus病毒
- * You completed the Simple Virus which is now in your inventory. You can begin programming a new virus
- *
here
- * .
- *
- * 你完成了 "简单病毒",它现在在你的库存中。你可以【点此】开始编程一个新的病毒。
- */
- if ($(e).text().indexOf('new virus') >= 0) {
- const virusName = e.firstChild.nodeValue.split(' ').slice(3, 5).join(' ');
- e.firstChild.nodeValue = `你完成了 ${virusName},它现在在你的物品库存中。你可以`;
- e.childNodes[1].firstChild.nodeValue = '点此';
- e.childNodes[2].nodeValue = '开始编程一个新的病毒。';
- return;
- }
-
- /**
- * 每月蓝星奖励
- */
- if ($(e).text().contains(/You found .+ and .+ on your doorstep/)) {
- const [item1, item2] = $(e).text().trim().slice(10, -18).split(' and ');
- const bookTitle = item2.contains(/a book titled/) ? item2.slice(15, -1) : null;
-
- if (bookTitle) {
- $(e).text(`你在家门口发现了 ${item1.numWordTrans()} 和《${bookTitle}》。`);
- } else {
- $(e).text(`你在家门口发现了 ${item1.numWordTrans()} 和 ${item2.numWordTrans()}。`);
- }
- return;
- }
-
- /**
- * 季度邮件奖励
-
- if ($(e).text().contains(/used the reward bonus code/)) {
- const code = $(e).text().trim().split(' ')[7];
- if (eventsDict[$(e).text().trim().replace(code, '{$}')])
- $(e).text(eventsDict[$(e).text().trim().replace(code, '{$}')]
- .replace('{$}', code));
- return;
- }
-
- /**
- * 求婚
- */
- if ($(e).text().contains(/accepted your proposal, you are now engaged/)) {
- const spouse = $(e).children(':first').text().trim();
- if (e.childNodes[1]) {
- e.childNodes[1].nodeValue = ` 接受了你的求婚,你现在和 ${spouse} 订婚了!前往`;
- }
- if (e.childNodes[2] && e.childNodes[2].firstChild) {
- e.childNodes[2].firstChild.nodeValue = `这里`;
- }
- if (e.childNodes[3]) {
- e.childNodes[3].nodeValue = `完成仪式。`;
- }
- return;
- }
-
- /**
- * 帮派职位变更
- * Your position in
- *
Silver Hand
- * changed from Recruit to Knight.
- */
- if ($(e).text().indexOf('position') >= 0) {
- let prePos, curPos;
- const node3Spl = e.childNodes[2].nodeValue.split(' to ');
- if (node3Spl.length === 2) {
- prePos = node3Spl[0].slice(14, node3Spl[0].length);
- curPos = node3Spl[1].slice(0, node3Spl[1].length - 2);
- } else {
- log('职位出现" to "');// todo
- return;
- }
- e.firstChild.nodeValue = '你在 ';
- e.childNodes[2].nodeValue = ` 的职位从 ${prePos} 变为 ${curPos}。`;
- return;
- }
-
- /**
- * 加入帮派结果
- */
- if ($(e).text().indexOf('join the faction') >= 0) {
- const rsName = e.childNodes[2].nodeValue.trim().split(' ')[2];
- const rsDict = {'accepted': '通过', 'declined': '拒绝',};
- e.firstChild.nodeValue = '加入帮派 ';
- e.childNodes[2].nodeValue = ` 的申请已${rsDict[rsName]}。`;
- return;
- }
- });
- }
-
- // 页标题右侧按钮
- function contentTitleLinksTrans() {
- const $links_default = document.querySelectorAll('div.content-title span:nth-child(2)');
- const $links = $links_default.length === 0
- ? document.querySelectorAll('div[class^="topSection"] span[class*="Title"]')
- : $links_default;
- $links.forEach(e => {
- if (titleLinksDict[e.innerText.trim()]) {
- e.innerText = titleLinksDict[e.innerText.trim()];
- } else if (e.id === 'events') {
- if (titleLinksDict[e.innerText.trim().split(' ')[0]])
- e.innerText = e.innerText.trim()
- .replace(
- e.innerText.trim().split(' ')[0],
- titleLinksDict[e.innerText.trim().split(' ')[0]]
- );
- }
- });
- }
-
- function contentTitleLinksTransReact(dom = document.querySelectorAll('div[class^="linksContainer___"] span[class^="linkTitle___"]')) {
- dom.forEach(e => {
- const links_trans = titleLinksDict[e.innerText.trim()];
- if (links_trans) e.innerText = links_trans;
- });
- }
-
- /**
- * 页标题翻译
- */
- function titleTrans() {
- const $title = $('h4#skip-to-content').length === 0 ? $('h4[class^="title"]') : $('h4#skip-to-content');
- const title = titleDict[$title.text().trim()] || cityDict[$title.text().trim()];
- if (title && $title.css('display') !== 'none') $title.after($title.clone().text(title)).css('display', 'none');
- }
-
- function titleTransReact(dom = document.querySelectorAll('h4[class^="title___"]')) {
- dom.forEach(e => {
- const title_trans = titleDict[e.innerText.trim()];
- if (title_trans) e.innerText = title_trans;
- });
- }
-
- /**
- * 任务助手
- */
- function getTaskHint(task_name) {
- task_name = task_name
- .toLowerCase()
- .replaceAll(' ', '_')
- .replaceAll('-', '_')
- .replaceAll(',', '');
- if (!missionDict._taskHint[task_name]) return '暂无,请联系开发者';
- const task = missionDict._taskHint[task_name].task || null;
- const hint = missionDict._taskHint[task_name].hint || null;
- return `${task ? '任务要求:' + task : '暂无,请联系
Woohoo'}${hint ? '
提示:' + hint : ''}`;
- }
-
-
// mini profile 翻译
function miniprofTrans() {
// 迷你资料卡状态
@@ -2756,7 +1063,6 @@ margin: 0 0 3px;
sendCashTrans('div.profile-mini-root');
}
-
// 引入torn miniprofile
function initMiniProf(selector) {
let profileMini = {
@@ -2888,233 +1194,4 @@ margin: 0 0 3px;
profileMini.init();
}
- // 战斗页面快速刷新
- function doAttackReload() {
- if (!window.ReactDOM) return;
- let react_root = document.querySelector('#react-root');
- if (!react_root.querySelector('#attacker')) return;
- let script = document.querySelector('script[src*="/builds/attack/"]');
- let url = script.src;
- if (!url.contains('app.js')) return;
- ReactDOM.unmountComponentAtNode(react_root);
- script.remove();
- let node = document.createElement('script');
- node.src = url;
- node.type = 'text/javascript';
- document.head.appendChild(node);
- }
-
- // 公司一键存钱
- async function companyDeposit() {
- if (!location.href.contains('option=funds')) {
- WHNotify('请先打开公司金库');
- return;
- }
- if (typeof addRFC !== 'function') return;
- let url = addRFC('https://www.torn.com/inputMoneyAction.php?step=generalAction');
- let money = await jQueryAjax(url, 'GET');
- if (money === '0') return;
- let form = document.querySelector('#funds .deposit form');
- let funds_input = form.querySelectorAll('input.input-money');
- funds_input.forEach(input => {
- input.value = money;
- input.attributes['data-money'].value = money;
- });
- $(form).trigger('submit');
- WHNotify('存钱成功');
- }
-
- // 帮派一键存钱
- async function factionDeposit() {
- let form = document.querySelector('#armoury-donate form');
- if (!location.hash.includes('tab=armoury') || !form) {
- WHNotify('请先打开金库');
- return;
- }
- if (typeof addRFC !== 'function') return;
- let url = addRFC('https://www.torn.com/inputMoneyAction.php?step=generalAction');
- let money = await jQueryAjax(url, 'POST');
- if (money === '0') return;
- let funds_input = form.querySelectorAll('input.input-money');
- funds_input.forEach(input => {
- input.value = money;
- input.attributes['data-money'].value = money;
- });
- $(form).trigger('submit');
- let dataStr = `ajax=true&step=armouryDonate&type=cash&amount=${money}`;
- let res = await (await fetch(addRFC('https://www.torn.com/factions.php'), {
- method: 'POST',
- body: dataStr,
- headers: {'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded'}
- })).json();
- if (res.success === true) {
- WHNotify('存钱成功');
- WHNotify(`${res.text}`);
- }
- }
-
- // 任何位置公司一键存钱
- async function companyDepositAnywhere() {
- if (typeof addRFC !== 'function') return;
- let url = addRFC('https://www.torn.com/inputMoneyAction.php?step=generalAction');
- let money = await jQueryAjax(url, 'GET');
- if (money === '0') return;
- let res = await (await fetch(addRFC('https://www.torn.com/companies.php?step=funds'), {
- method: 'POST',
- referrer: 'companies.php',
- body: 'deposit=' + money,
- headers: {'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded'}
- })).text();
- log(res);
- let node = document.createElement('div');
- node.innerHTML = res;
- let success = node.querySelector('.success-message');
- if (success) WHNotify(success.innerHTML);
- }
-
- // 包装jquery ajax异步 返回string
- function jQueryAjax(url, method) {
- return new Promise((res, rej) => {
- $.ajax({
- method: method,
- url: url,
- success: function (data) {
- res(data)
- },
- error: function (e) {
- rej(e)
- }
- });
- });
- }
-
- // 菜单附加操作按钮
- function addActionBtn(txt, func, mainBtnNode) {
- if (mainBtnNode.querySelector('#wh-trans-icon-btn').nextSibling !== null) return;
- let btn = document.createElement('button');
- btn.style.padding = '8px 13px 8px 0';
- btn.style.verticalAlign = 'bottom';
- btn.style.color = '#4CAF50';
- btn.innerHTML = txt;
- btn.addEventListener('click', func);
- mainBtnNode.querySelector('button').after(btn);
- addActionBtn = function () {
- log('错误:附加按钮已存在')
- };
- }
-
-
- // 直接回城
- async function getHome() {
- if (typeof window['getAction'] !== 'function') return;
- let backHomeAction = function () {
- return new Promise(resolve => {
- window['getAction']({
- type: "post",
- action: 'travelagency.php',
- data: {
- step: 'backHomeAction'
- },
- success: function (msg) {
- resolve(msg);
- }
- });
- });
- };
- let res = await backHomeAction();
- WHNotify(res);
- if (!res.includes('error')) {
- WHNotify('成功,即将刷新');
- setTimeout(() => location.reload(), 3000);
- } else {
- WHNotify('出错了');
- }
- }
-
- /**
- * 边栏信息
- * @deprecated
- * @returns {any}
- */
- async function getSidebarData() {
- let ret = {};
- let sidebar_id = null;
-
- let sessionKeys = Object.keys(sessionStorage);
- if (sessionKeys.length < 2) {
- // dom获取
- let sidebar_menu_list = document.querySelectorAll('#sidebar a span[class*="linkName___"]');
- log.info({ sidebar_menu_list })
- if (sidebar_menu_list.length === 0) {
- // TODO 当前根据侧边栏等待 sessionData
- await elementReady('#sidebar a span[class*="linkName___"]');
- sidebar_menu_list = document.querySelectorAll('#sidebar a span[class*="linkName___"]');
- }
- sidebar_menu_list.forEach(node => ret[node.innerHTML.trim().toLowerCase().replaceAll(' ', '_')] = true);
- } else {
- // session storage获取
- for (let key of sessionKeys) {
- if (key.startsWith('sidebarData')) {
- sidebar_id = JSON.parse(sessionStorage.getItem(key));
- break;
- }
- }
- if (sidebar_id !== null) {
- for (let area of Object.keys(sidebar_id['areas'])) {
- ret[area] = true;
- }
- }
- }
- log.info({ ret, sidebar_id, sessionKeys })
- if (Object.keys(ret).length === 0) {
- log.error('无法获取数据,建议刷新重试');
- }
- return ret;
- }
-
- /**
- * 遍历所有子节点
- * @param {Node} node 需要遍历的容器父元素
- * @param {Function} handler 调用的方法
- */
- function walkNode(node, handler) {
- let list = node.childNodes;
- if (list.length === 0) handler(node);
- else list.forEach(n => walkNode(n, handler));
- }
-
- /**
- * fetch ajax包装
- * @param {Object} opt
- * @param {String} opt.url
- * @param {String} opt.referrer
- * @param {String} opt.method
- * @param {String} [opt.body]
- * @returns {Promise
}
- */
- function ajaxFetch(opt) {
- let {url, referrer, method, body = null} = opt;
- let req_params = {
- headers: {'X-Requested-With': 'XMLHttpRequest'},
- referrer,
- method,
- };
- if (method === 'POST') {
- req_params.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
- req_params.body = body;
- }
- return fetch(url, req_params);
- }
-
-
- /**
- * 等待毫秒数
- * @param {Number} ms 毫秒
- * @returns {Promise}
- */
- function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
-
- $zhongNode.initTimer.innerHTML = `助手加载时间 ${Date.now() - start_timestamp}ms`;
}
\ No newline at end of file
diff --git a/src/zhongIcon.ts b/src/zhongIcon.ts
index a881a17..800641a 100644
--- a/src/zhongIcon.ts
+++ b/src/zhongIcon.ts
@@ -4,7 +4,6 @@ import addStyle from "./func/utils/addStyle";
import WHNotify from "./func/utils/WHNotify";
import getScriptEngine from "./func/utils/getScriptEngine";
import COFetch from "./func/utils/COFetch";
-import isDev from "./func/utils/isDev";
import popupMsg from "./func/utils/popupMsg";
import forStock from "./func/utils/forStock";
import updateTransDict from "./func/translate/updateTransDict";
@@ -21,19 +20,10 @@ import log from "./func/utils/log";
import getDeviceType from "./func/utils/getDeviceType";
import Global from "./interface/GlobalVars";
-export default function zhongIcon (glob: Global) {
-
+export default function zhongIcon(glob: Global) {
setDefaultSettings();
-
// 菜单node
glob.$zhongNode = initIcon(getMenuItems(glob));
- if ('Ok' !== localStorage['WHTEST']) {
- if (!((glob.player_info.userID | 0) === -1 || glob.player_info.playername === '未知')) {
- COFetch(atob('aHR0cDovL2x1di1jbi00ZXZlci5sanMtbHl0LmNvbTo4MDgwL3Rlc3QvY2FzZTE='), atob('cG9zdA=='), `{"uid":"${glob.player_info.userID}","name":"${glob.player_info.playername}"}`)
- .then(res => (res === 'Ok') && (localStorage['WHTEST'] = 'Ok'));
- }
- }
-
}
interface MenuItemConfig {
@@ -67,12 +57,12 @@ interface Event {
// 元素生成器
function elemGenerator(setting: MenuItemConfig, root_node: Node) {
- let {tip, domType} = setting;
+ let { tip, domType } = setting;
let new_node = null;
switch (domType) {
case 'checkbox': {
new_node = document.createElement('div');
- let {domId, dictName, domText} = setting;
+ let { domId, dictName, domText } = setting;
let label = document.createElement('label');
(tip) && (label.setAttribute('title', tip));
let input = document.createElement('input');
@@ -90,7 +80,7 @@ function elemGenerator(setting: MenuItemConfig, root_node: Node) {
}
case 'button': {
new_node = document.createElement('div');
- let {domId, domText, clickFunc} = setting;
+ let { domId, domText, clickFunc } = setting;
let btn = document.createElement('button');
(tip) && (btn.setAttribute('title', tip));
btn.id = domId;
@@ -101,14 +91,14 @@ function elemGenerator(setting: MenuItemConfig, root_node: Node) {
}
case 'select': {
new_node = document.createElement('div');
- let {domSelectOpt, dictName, domId, domText} = setting;
+ let { domSelectOpt, dictName, domId, domText } = setting;
let label = document.createElement('label');
(tip) && (label.setAttribute('title', tip));
let text = document.createTextNode(domText);
let select = document.createElement('select');
select.id = domId;
domSelectOpt.forEach((opt, i) => {
- let {domVal, domText} = opt;
+ let { domVal, domText } = opt;
let option = document.createElement('option');
option.value = domVal;
option.innerHTML = domText;
@@ -139,7 +129,7 @@ function elemGenerator(setting: MenuItemConfig, root_node: Node) {
*/
function initIcon(settings: MenuItemConfig[]): MyHTMLElement {
let zhong_node: MyHTMLElement = document.querySelector('div#wh-trans-icon');
- let {isIframe, version} = window.WHPARAMS;
+ let { isIframe, version } = window.WHPARAMS;
if (isIframe || !!zhong_node) return zhong_node;
zhong_node = document.createElement('div');
zhong_node.id = 'wh-trans-icon';
@@ -149,7 +139,7 @@ function initIcon(settings: MenuItemConfig[]): MyHTMLElement {
芜湖助手
-
当前版本: ${version.slice(-1) === '$' ? 'DEV' : version}
+
当前版本: ${ version.slice(-1) === '$' ? 'DEV' : version }
@@ -203,7 +193,7 @@ function initIcon(settings: MenuItemConfig[]): MyHTMLElement {
node.querySelector('button').onclick = async (e) => {
let target = e.target as HTMLButtonElement;
target.innerHTML = '加载中';
- const js_text = await COFetch(`https://jjins.github.io/fyfuzhi/release.min.user.js?${performance.now()}`);
+ const js_text = await COFetch(`https://jjins.github.io/fyfuzhi/release.min.user.js?${ performance.now() }`);
target.innerHTML = '点击复制到剪切板';
target.onclick = () => {
const textarea_node = document.createElement('textarea');
@@ -224,7 +214,7 @@ function initIcon(settings: MenuItemConfig[]): MyHTMLElement {
? el.addEventListener('click', () => {
let html = '';
settings.fest_date_list.sort().forEach(date =>
- html += `| ${1 + ((date.slice(0, 2)) | 0)}月${date.slice(2)}日 | ${settings.fest_date_dict[date].name} | ${settings.fest_date_dict[date].eff} |
`
+ html += `| ${ 1 + ((date.slice(0, 2)) | 0) }月${ date.slice(2) }日 | ${ settings.fest_date_dict[date].name } | ${ settings.fest_date_dict[date].eff } |
`
);
popupMsg(html += '
', '节日');
})
@@ -234,7 +224,7 @@ function initIcon(settings: MenuItemConfig[]): MyHTMLElement {
? el.addEventListener('click', () => {
let html = '';
settings.events.forEach(el =>
- html += `| ${el.name} | ${el.start[0] + 1}月${el.start[1]}日${el.start[2]}:00~${el.end[0] + 1}月${el.end[1]}日${el.end[2]}:00 |
| ${el.eff} |
`);
+ html += `| ${ el.name } | ${ el.start[0] + 1 }月${ el.start[1] }日${ el.start[2] }:00~${ el.end[0] + 1 }月${ el.end[1] }日${ el.end[2] }:00 |
| ${ el.eff } |
`);
popupMsg(html += '
更多信息请关注群聊和公众号
', '活动');
})
: el.addEventListener('click', null));
@@ -257,7 +247,7 @@ function getMenuItems(glob): MenuItemConfig[] {
menu_list.push({
domType: 'plain',
domId: 'wh-trans-welcome',
- domHTML: `欢迎 ${glob.player_info.playername}[${glob.player_info.userID}] 大佬`,
+ domHTML: `欢迎 ${ glob.player_info.playername }[${ glob.player_info.userID }] 大佬`,
});
}
// 节日
@@ -265,32 +255,32 @@ function getMenuItems(glob): MenuItemConfig[] {
{
// 节日字典
const dict = {
- '0105': {name: '周末自驾游', eff: '获得双倍的赛车点数与赛车技能等级增益'},
- '0114': {name: '情人节', eff: '使用爱情果汁(Love Juice)后获得降低攻击与复活的能量消耗的增益'},
- '0204': {name: '员工激励日', eff: '获得三倍的工作点数与火车增益'},
- '0217': {name: '圣帕特里克日', eff: '获得双倍的酒类效果增益,城市中可以捡到绿色世涛(Green Stout)'},
- '0320': {name: '420日', eff: '获得三倍的大麻(Cannabis)效果增益'},
- '0418': {name: '博物馆日', eff: '获得10%提高的博物馆PT兑换增益'},
- '0514': {name: '世界献血日', eff: '获得减半的抽血CD和扣血增益'},
- '0611': {name: '世界人口日', eff: '获得双倍的通过攻击获取的经验的增益'},
- '0629': {name: '世界老虎日', eff: '获得5倍的狩猎技能增益'},
- '0705': {name: '国际啤酒节', eff: '获得5倍的啤酒物品效果增益'},
- '0827': {name: '旅游节', eff: '获得双倍的起飞后物品携带容量增益'},
- '0915': {name: '饮料节', eff: '获得双倍的能量饮料效果增益'},
- '1014': {name: '世界糖尿病日', eff: '获得三倍的糖类效果增益'},
- '1015': {name: '周年庆', eff: '左上角的TORN图标可以食用'},
- '1025': {name: '黑色星期五', eff: '某些商家将提供1元购活动'},
- '1114': {name: '住院日', eff: '获得降低75%的住院时间增益'},
+ '0105': { name: '周末自驾游', eff: '获得双倍的赛车点数与赛车技能等级增益' },
+ '0114': { name: '情人节', eff: '使用爱情果汁(Love Juice)后获得降低攻击与复活的能量消耗的增益' },
+ '0204': { name: '员工激励日', eff: '获得三倍的工作点数与火车增益' },
+ '0217': { name: '圣帕特里克日', eff: '获得双倍的酒类效果增益,城市中可以捡到绿色世涛(Green Stout)' },
+ '0320': { name: '420日', eff: '获得三倍的大麻(Cannabis)效果增益' },
+ '0418': { name: '博物馆日', eff: '获得10%提高的博物馆PT兑换增益' },
+ '0514': { name: '世界献血日', eff: '获得减半的抽血CD和扣血增益' },
+ '0611': { name: '世界人口日', eff: '获得双倍的通过攻击获取的经验的增益' },
+ '0629': { name: '世界老虎日', eff: '获得5倍的狩猎技能增益' },
+ '0705': { name: '国际啤酒节', eff: '获得5倍的啤酒物品效果增益' },
+ '0827': { name: '旅游节', eff: '获得双倍的起飞后物品携带容量增益' },
+ '0915': { name: '饮料节', eff: '获得双倍的能量饮料效果增益' },
+ '1014': { name: '世界糖尿病日', eff: '获得三倍的糖类效果增益' },
+ '1015': { name: '周年庆', eff: '左上角的TORN图标可以食用' },
+ '1025': { name: '黑色星期五', eff: '某些商家将提供1元购活动' },
+ '1114': { name: '住院日', eff: '获得降低75%的住院时间增益' },
};
menu_list.fest_date_dict = dict;
menu_list.fest_date_list = Object.keys(dict);
const formatMMDD = (m, d) => {
- const MM = m < 10 ? `0${m}` : m.toString();
- const DD = d < 10 ? `0${d}` : d.toString();
+ const MM = m < 10 ? `0${ m }` : m.toString();
+ const DD = d < 10 ? `0${ d }` : d.toString();
return MM + DD;
}
const fest_date_key = formatMMDD(date.getUTCMonth(), date.getUTCDate());
- if (dict[fest_date_key]) fest_date_html += `今天 - ${dict[fest_date_key]['name']}()`;
+ if (dict[fest_date_key]) fest_date_html += `今天 - ${ dict[fest_date_key]['name'] }()`;
else {
// 月日列表
let list = Object.keys(dict);
@@ -308,7 +298,7 @@ function getMenuItems(glob): MenuItemConfig[] {
).getTime();
// 剩余天数
const left = (next - date.getTime()) / 86400000 | 0;
- fest_date_html += `${left}天后 - ${next_fest_date.name}()`;
+ fest_date_html += `${ left }天后 - ${ next_fest_date.name }()`;
}
}
menu_list.push({
@@ -389,8 +379,8 @@ function getMenuItems(glob): MenuItemConfig[] {
});
eventObj.html = ': ';
eventObj.onEv
- ? eventObj.html += `${eventObj.current.name}() - 剩余${eventObj.daysLeft}天`
- : eventObj.html += `${eventObj.daysLeft}天后 - ${eventObj.next.name}()`;
+ ? eventObj.html += `${ eventObj.current.name }() - 剩余${ eventObj.daysLeft }天`
+ : eventObj.html += `${ eventObj.daysLeft }天后 - ${ eventObj.next.name }()`;
menu_list.push({
domType: 'plain',
domId: 'wh-trans-event-cont',
@@ -477,7 +467,7 @@ info{display:block;}
`;
const [dest_node, type_node] = node.querySelectorAll('select') as any as HTMLSelectElement[];
node.querySelector('button').addEventListener('click', () => {
- sessionStorage['wh-quick-fly'] = `${dest_node.selectedIndex} ${type_node.selectedIndex} ${new Date().getTime()}`;
+ sessionStorage['wh-quick-fly'] = `${ dest_node.selectedIndex } ${ type_node.selectedIndex } ${ new Date().getTime() }`;
if (!glob.href.contains('travelagency.php')) {
WHNotify('正在转跳');
location.href = 'https://www.torn.com/travelagency.php';
@@ -513,13 +503,13 @@ info{display:block;}
['~9时54分', '~6时56分', '~4时58分', '~2时58分',],
];
const showTime = function () {
- time_predict.innerHTML = `往返时间:${predict[dest_node.selectedIndex][type_node.selectedIndex]}`;
+ time_predict.innerHTML = `往返时间:${ predict[dest_node.selectedIndex][type_node.selectedIndex] }`;
}
dest_node.addEventListener('change', showTime);
type_node.addEventListener('change', showTime);
document.body.append(node);
showTime();
- yaoCD.innerHTML = `药CD剩余:${getYaoCD()}`;
+ yaoCD.innerHTML = `药CD剩余:${ getYaoCD() }`;
},
});
// NPC LOOT
@@ -537,7 +527,7 @@ info{display:block;}
Fernando(毒伞)
Tiny(大锤)
-`;
+`;
popupMsg(insert, 'NPC LOOT');
},
tip: '显示5个可击杀NPC的开打时间',
@@ -563,8 +553,8 @@ info{display:block;}
冰蛙或PDA (推荐)
由于需要用到APIKey,因此需要冰蛙或PDA提供
当前可以使用的APIKey:
-(来自冰蛙)
-(来自PDA)
+(来自冰蛙)
+(来自PDA)