diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index ceed2c1..473b530 100644 --- a/torn-trans-zhcn.user.js +++ b/torn-trans-zhcn.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Torn翻译 // @namespace WOOH -// @version 0.1.1124a +// @version 0.1.1124b // @description Torn UI翻译 // @author Woohoo-[2687093] sabrina_devil[2696209] // @match https://www.torn.com/* @@ -71,7 +71,7 @@ 'Money': '现金', 'Level': '等级', 'Points': 'PT', - 'Merits': '技能点', + 'Merits': '天赋点', 'Energy': '能量E', 'Nerve': '犯罪N', 'Happy': '快乐', @@ -822,23 +822,23 @@ const awDict = { 'Honors (': '荣誉 (', 'Medals (': '勋章 (', - 'Merits (': '技能加点 (', + 'Merits (': '天赋加点 (', 'As you progress, you will unlock new honors. To add an Honor to your name, click the one you want.': '新的荣誉条将随着你的进步解锁。请点击想要在你的名字上显示的荣誉条。', 'As you progress, you will unlock new medals. Your medals will be pinned on your profile to show your\nprestige.': '新的勋章将随着你的进步解锁。勋章将显示在个人资料上。', 'You have': '你有 ', - 'merits': '技能点', - 'merit': '技能点', + 'merits': '天赋点', + 'merit': '天赋点', 'medals': '勋章', 'honors': '荣誉', - 'Available Merits:': '可用技能点:', - 'Merits Used:': '已用技能点:', + 'Available Merits:': '可用天赋点:', + 'Merits Used:': '已用天赋点:', "to spend on anything you would like on\nthe list below.\nYou've earned these merits by attaining": - ' 可用于升级以下列表中的任意技能。这些技能点是通过 ', + ' 可用于升级以下列表中的任意天赋。这些天赋点是通过 ', 'and': ' 和 ', ".\nThe enhancements are incremental and will go up in cost the more you upgrade them.\nFor example, if you pay one merit to upgrade an improvement,\nnext time you want to upgrade it you will need to pay two merits, after that three etc.": - ' 获得的。技能升级的花费是递增的,技能等级越高升级消耗的技能点就越高。如果花费一技能点来升级一项技能,下次要升级时,需要花费两个技能点,之后是三个等依此类推。', + ' 获得的。天赋升级的花费是递增的,等级越高升级需要的天赋点就越高。如果花费1天赋点来升级一个天赋,下次就需要花费2天赋点升级该天赋,之后是三个等依次类推。', 'Awards you are about to unlock': '即将解锁的勋章', 'Upgrade': '升级', 'Progress': '升级进程', @@ -1126,6 +1126,7 @@ 'Last week': '过去一周', 'Last month': '过去一个月', 'Last year': '过去一年', + 'All time': '有史以来', 'Owned': '持有', 'Dividend': '分红', 'West Side University': '西城大学', @@ -1153,7 +1154,7 @@ 'The Torn City Times': '托恩时代', 'Grain': '谷物', 'Eaglewood Mercenary': '鹰林佣兵', - 'Home Retail Group': '家居零售集团', + 'Home Retail Group': '家庭零售集团', 'Empty Lunchbox Traders': '空饭盒贸易商', 'Messaging Inc.': '信息公司', 'TC Music Industries': 'TC 音乐工业公司', @@ -1209,6 +1210,37 @@ 'benefit': '增益', 'You cannot buy shares while traveling': '你在旅行时无法购买', 'You cannot sell shares while traveling': '你在旅行时无法出售', + 'How many shares would you like to': '多少股你想', + 'buy': '买入', + 'sell': '卖出', + 'will buy you': '可以买', + 'shares': '股', + 'share': '股', + 'Your': '你持有的', + 'shares are worth': '股目前值', + 'Do you want to': '你想', + 'shares at': '股', + 'each?': '单价?', + 'For a total of': '总价:', + 'Back': '返回', + 'Confirm Transaction': '确认交易', + 'Price updating...': '价格更新中', + 'after the': '已扣除', + 'fee of': '手续费:', + 'You have': '你已', + 'sold': '卖出', + 'bought': '购入', + 'each': '单价', + 'Buy date': '购入日期', + 'Shares': '购入数量', + 'Value': '购入总价', + 'Bought': '购入单价', + 'Current': '目前单价', + 'Change': '变化', + 'Profit': '利润', + 'View': '查看', + 'Sell': '售出', + 'Merge': '合并', }; // 默认开启通知翻译 @@ -1279,7 +1311,7 @@ $('span[class^="menu-name"]').each((i, e) => { e.firstChild.nodeValue = '名字:'; }); - // 钱 等级 pt 技能点 + // 钱 等级 pt 天赋点 $('p[class^="point-block"]').each((i, e) => { if (sidebarDict[e.firstChild.firstChild.nodeValue]) e.firstChild.firstChild.nodeValue = sidebarDict[e.firstChild.firstChild.nodeValue]; @@ -1884,18 +1916,54 @@ $(e).text(stockDict[$(e).text().trim()]); } }); - // 天上点开购买后的提示 - $('div[class^="manageTab"] div[class^="manageBlock"] div').each((i, e) => { - if (stockDict[$(e).text().trim()]) $(e).text(stockDict[$(e).text().trim()]); + // 股价详情 + $('#panel-priceTab ul[role="tablist"] label span:last-child').each((i,e)=>{ + if (stockDict[$(e).text()]) { + $(e).text(stockDict[$(e).text()]); + } + }); + // 点开购买后 + $('div#panel-ownedTab div[class^="manageBlock"] *').contents().each((i, e) => { + if (e.nodeType === 1) { + if (stockDict[$(e).text().trim()]) { + $(e).text(stockDict[$(e).text().trim()]); + } + } else if (e.nodeType === 3) { + if (stockDict[e.nodeValue.trim()]) e.nodeValue = stockDict[e.nodeValue.trim()]; + else if (/\$[0-9]+ after the 0\.1% fee of \$[0-9]+$/.test(e.nodeValue.trim())) { + e.nodeValue = e.nodeValue.trim() + .replace('after the', stockDict['after the']) + .replace('fee of', stockDict['fee of']); + } + } + }); + // 点开购买后的历史栏 + $('div#panel-ownedTab div[class^="transactionsContainer"] li').each((i, e) => { + e = e.childElementCount === 0 ? e : e.children[0]; + if (stockDict[$(e).text().trim()]) { + $(e).text(stockDict[$(e).text().trim()]); + } }); // 点开分红后文字 - $('div[class^="stockMarket"] div[class^="message"] *').contents().each((i, e) => { + $('div#panel-dividendTab div[class^="message"] *').contents().each((i, e) => { if (e.nodeType !== 3) return; if (!e.nodeValue.trim()) return; if (stockDict[e.nodeValue.trim()]) { e.nodeValue = stockDict[e.nodeValue.trim()]; + } + // 第n个increment 1st 2nd 3rd 4th + else if (/[0-9][snrt][tdh]$/.test(e.nodeValue.trim())) { + e.nodeValue = `第${e.nodeValue.trim().slice(0, -2)}个`; + } + // 物品 + 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}`; } else { - if (!/[\u4e00-\u9fa5]/.test(e.nodeValue)) console.log(`未找到翻译:[${e.nodeValue.trim()}]`); + if (/[\u4e00-\u9fa5]/.test(e.nodeValue)) return; + if (/\b\$?[0-9,]+$/.test(e.nodeValue)) return; + console.log(`未找到翻译:[${e.nodeValue.trim()}]`); } }); }; @@ -2432,20 +2500,20 @@ if (awDict[$(e).text().trim()]) $(e).text(awDict[$(e).text().trim()]); }); - // 技能页面 Available Merits: x Merits Used: x + // 天赋页面 Available Merits: x Merits Used: x $('div.awards-msg p').contents().each((i, e) => { if (e.nodeType === 3) if (awDict[e.nodeValue.trim()]) e.nodeValue = e.nodeValue.replace(e.nodeValue.trim(), awDict[e.nodeValue.trim()]); }); - // 勋章下 即将解锁的勋章框标题 技能加点的表头标题 + // 勋章下 即将解锁的勋章框标题 天赋加点的表头标题 $('div.title-black').contents().each((i, e) => { // 勋章下 即将解锁的勋章框标题 if (e.nodeType === 1) { if (awDict[$(e).text().trim()]) $(e).text(awDict[$(e).text().trim()]); } - // 技能加点的表头标题 + // 天赋加点的表头标题 else if (e.nodeType === 3) { if (awDict[e.nodeValue.trim()]) e.nodeValue = awDict[e.nodeValue.trim()]; @@ -2456,12 +2524,12 @@ if (awDict[$(e).text().trim()]) $(e).text(awDict[$(e).text().trim()]); }); - // 技能点名字 + // 天赋点名字 $('ul#merits-list span.name').each((i, e) => { if (awDict[$(e).text().trim()]) $(e).text(awDict[$(e).text().trim()]); }); - // 技能点短描述 + // 天赋点短描述 $('ul#merits-list span.desc span[class^="t-"]').each((i, e) => { // const slash = $(e).attr('class') === 't-show' ? '- ' : ''; const isShow = $(e).attr('class') === 't-hide'; @@ -2469,7 +2537,7 @@ if (awDict[key]) $(e).text((isShow ? '- ' : '') + awDict[key]); }); - // 技能点展开详细描述与确认 + // 天赋点展开详细描述与确认 $('ul#merits-list div.msg').contents().each((i, e) => { // x merit(s) if (e.nodeType === 1) {