diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index 5bc03bd..02fa182 100644 --- a/torn-trans-zhcn.user.js +++ b/torn-trans-zhcn.user.js @@ -34,6 +34,7 @@ 'Received Events': '收到的通知', 'Saved Events': '保存的通知', 'Awards': '勋章', + 'Faction': '帮派', }; const titleLinksDict = { 'Personal stats': '个人统计信息', @@ -56,7 +57,9 @@ 'Hospital': '医院', 'Everyone': '所有人', 'Nobody': '仅自己', - 'Friends & faction': '好友 & 帮派成员' + 'Friends & faction': '好友 & 帮派成员', + 'Forum': '论坛', + 'Leave Faction': '离开帮派', }; const sidebarDict = { // todo 从json加载 'Money': '现金', @@ -498,7 +501,7 @@ 'Parameters:': '课程参数:', 'As the ultimate module - you will focus on maximum gym gain with the least amount of input.': '', 'Ability to withdraw and deliver blood': '抽取和输送血液的能力(使用血包)', - //'Gain {$1} {$2} upon completion': '获得{$1}点{$2}', + // 'Gain {$1} {$2} upon completion': '获得{$1}点{$2}', 'intelligence': '智力(INT)', 'endurance': '耐心(END)', 'manual labor': '体力(MAN)', @@ -1574,7 +1577,7 @@ if (window.location.href.indexOf('level2.php') >= 0) { } - /* 医院页面 */ + /** 医院页面 **/ if (window.location.href.indexOf("hospitalview.php") >= 0) { const hospitalOB = new MutationObserver(hosOBInit); @@ -1635,6 +1638,91 @@ return; } + /** 帮派页面 **/ + if (window.location.href.indexOf("actions.php") >= 0) { + const factionOB = new MutationObserver(factionOBInit); + + function factionOBInit() { + factionOB.disconnect(); + factionTrans(); + factionOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); + } + + const factionDict = { + "INFO": "信息", + "TERRITORY": "领地", + "RANK": "名次", + "CRIMES": "组织犯罪", + "UPGRADES": "升级", + "ARMORY": "军械库", + "CONTROLS": "控制面板", + "FACTION": "帮派", + "YOUR FACTION IS NOT IN A WAR": "你的帮派没有处于战争状态", + "TIER": "级别", + "RESPECT": "声望", + "No active chain": "暂无攻击链", + "Main News": "主要消息", + "Attacking": "攻击", + "Funds": "资金流动", + "Armory": "军械库", + "Crimes": "组织犯罪", + "Membership": "成员资格", + "has claimed sovereignty of": "", + "has abandoned": "弃用了", + "Achieved a chain of": "达成了连击链值", + "and": "和", + "respect [": "点声望", + "deposited ${$1}": "存放了${$1}", + "Leadership was transferred to": "帮派领导权被移交给了 " + } + + function factionTrans() { + titleTrans(); + contentTitleLinksTrans(); + + //帮派大标题 + $('span[class^="tab-name"]').each((i, e) => { + if (factionDict[$(e).text().trim()]) { + $(e).text(factionDict[$(e).text().trim()]); + } + }) + + //帮派战争状态 + $('div[class^="f-msg"]').contents().each((i, e) => { + let word2Trans = $(e).text().trim().split(":")[0]; + if (word2Trans && factionDict[word2Trans]) { + $(e).text($(e).text().replace(word2Trans, factionDict[word2Trans])); + } + }) + + //攻击链盒 + $('div[class^="chain-box"]').contents().each((i, e) => { + if (factionDict[$(e).text().trim()]) { + $(e).text(factionDict[$(e).text().trim()]); + } + }) + + //帮派消息类别 + $('div[class^="newsHeader"]').contents().each((i, e) => { + if (factionDict[$(e).text().trim()]) { + $(e).text(factionDict[$(e).text().trim()]); + } + }) + + //帮派主要消息日志 + $('ul[class^="news-list"] span[class^="info"]').contents().each((i, e) => { + if (factionDict[$(e).text().trim()]) { + e.nodeValue = e.nodeValue.replace($(e).text().trim(), factionDict[$(e).text().trim()]); + } + }) + + } + + factionTrans(); + factionOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); + return; + } + /** * 通知翻译函数 * @param events