From 04f5e187c2db563585bdc7bab235a589fd968302 Mon Sep 17 00:00:00 2001 From: woohoo Date: Wed, 24 Nov 2021 18:14:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=82=A1=E7=A5=A8=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- torn-trans-zhcn.user.js | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index 473b530..c6ae400 100644 --- a/torn-trans-zhcn.user.js +++ b/torn-trans-zhcn.user.js @@ -1121,10 +1121,10 @@ '1y': '1年', 'Live': '实时', 'live': '实时', - 'Last hour': '过去一小时', + 'Last hour': '过去一时', 'Last day': '过去一天', 'Last week': '过去一周', - 'Last month': '过去一个月', + 'Last month': '过去一月', 'Last year': '过去一年', 'All time': '有史以来', 'Owned': '持有', @@ -1172,7 +1172,7 @@ // '1x Six Pack of Alcohol': '', // '1x Lawyer Business Card': '', // '1x Box of Grenades': '', - '1x Random Property': '1 个随机房产', + '1x Random Property': '1个随机房产', '10% Bank Interest Bonus': '10% 银行利润增益', 'a 10% Bank Interest Bonus': '10% 银行利润增益', '100 Energy': '100 能量E', @@ -1206,7 +1206,7 @@ 'to unlock the': '用以解锁', 'increment': '增益', 'After': '在', - 'You currently have': '你目前有', + 'You currently have': '你已获得', 'benefit': '增益', 'You cannot buy shares while traveling': '你在旅行时无法购买', 'You cannot sell shares while traveling': '你在旅行时无法出售', @@ -1242,6 +1242,19 @@ 'Sell': '售出', 'Merge': '合并', }; + const itemNameDict = { + "Six Pack of Alcohol": '6瓶装酒箱', + "Ammunition Pack": '', + "Box of Grenades": '手雷箱', + "Feathery Hotel Coupon": 'FHC 金卡', + "Lawyer Business Card": '律师卡 (黑卡)', + "Lottery Voucher": '彩票券', + "Six Pack of Energy Drink": '6瓶装饮料箱', + "Erotic DVD": '瑟琴 DVD', + "Drug Pack": '药包 (小DP)', + "Clothing Cache": '服饰箱', + "Box of Medical Supplies": '医疗补给包', + }; // 默认开启通知翻译 if (!localStorage.getItem('wh_trans_event')) { @@ -1912,12 +1925,17 @@ }); // 右侧bb名 $('div[class^="dividendInfo"] p').each((i, e) => { + const spl = $(e).text().trim().split(' '); if (stockDict[$(e).text().trim()]) { $(e).text(stockDict[$(e).text().trim()]); + } else if (/[0-9]x$/.test(spl[0])) { + const itemName = spl.slice(1).join(' '); + const num = spl[0].slice(0, -1); + $(e).text(`${num}个${itemNameDict[itemName] ? itemNameDict[itemName] : itemName}`); } }); // 股价详情 - $('#panel-priceTab ul[role="tablist"] label span:last-child').each((i,e)=>{ + $('#panel-priceTab ul[role="tablist"] label span:last-child').each((i, e) => { if (stockDict[$(e).text()]) { $(e).text(stockDict[$(e).text()]); } @@ -1944,7 +1962,7 @@ $(e).text(stockDict[$(e).text().trim()]); } }); - // 点开分红后文字 + // 点开bb后 $('div#panel-dividendTab div[class^="message"] *').contents().each((i, e) => { if (e.nodeType !== 3) return; if (!e.nodeValue.trim()) return; @@ -1959,7 +1977,12 @@ else if (/[0-9]x$/.test(e.nodeValue.trim().split(' ')[0])) { const spl = e.nodeValue.trim().split(' '); const itemName = spl.slice(1).join(' '); - e.nodeValue = ` ${spl[0].replace('x', '个')} ${itemName}`; + e.nodeValue = + ` ${ + spl[0].replace('x', '个') + } ${ + itemNameDict[itemName] ? itemNameDict[itemName] : itemName + }`; } else { if (/[\u4e00-\u9fa5]/.test(e.nodeValue)) return; if (/\b\$?[0-9,]+$/.test(e.nodeValue)) return;