From cd4330fa4f90bc3b1d62aed84e065fd5e9375186 Mon Sep 17 00:00:00 2001 From: woohoo Date: Fri, 12 Nov 2021 12:00:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E7=BA=A7=E6=90=9C=E7=B4=A2=E7=8E=B0?= =?UTF-8?q?=E5=B7=B2=E7=BF=BB=E8=AF=91=20gym=E9=80=BB=E8=BE=91=E8=B0=83?= =?UTF-8?q?=E6=95=B4=20=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- torn-trans-zhcn.user.js | 45 +++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index f4584f8..dc90fa5 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.1111a +// @version 0.1.1112a // @description UI翻译 // @author Woohoo-[2687093] sabrina_devil[2696209] // @match https://www.torn.com/* @@ -449,6 +449,7 @@ }; const headerDict = { "User's Name / ID": '用户名或ID', + "Name": '用户名', 'Faction': '帮派', 'Company': '帮派', 'Places': '地点', @@ -459,18 +460,38 @@ 'Search users by...': '高级用户搜索', 'Property': '住房', 'Male': '男性', + 'Female': '女性', 'to': '到', + 'Condition': '条件', + 'Married': '在已婚状态', + 'Travelling': '在飞行中', + 'In a faction': '在帮派中', + 'In a company': '在公司中', + 'In hospital': '在医院里', + 'In jail': '在监狱里', + 'In Federal jail': '在联邦监狱里', + 'Level': '等级', + 'Days old': '游戏天数', + 'Offences': '违法行为', + 'Last action': '上次动作', 'Reset': '重置', 'Search': '搜索', '0 - 15 min': '0 - 15 分钟', + '15 min - 1 hour': '15 分钟 - 1 小时', + '1 hour - 1 day': '1 小时 - 1 天', + '1 day - 1 week': '1 天 - 1 周', + '1 week - 1 month': '1 周 - 1 月', + '1 month - 1 year': '1 月 - 1 年', + 'longer than 1 year ago': '久于 1 年前', 'Not': '不', 'View Log': '查看日志', 'View Profile': '查看个人资料', 'Settings': '设置', 'Server:': '服务器 ', - 'Dark Mode': '', - 'News Ticker': '', - 'Logout': '', + 'Dark Mode': '黑夜模式', + 'News Ticker': '滚动通知', + 'Logout': '登出', + 'Gender': '性别', }; const eventsDict = { // "ALL EVENTS": "所有通知", @@ -573,7 +594,6 @@ /** * header */ - // $('div#header-root').each((i,e)=>{ if ($('div#header-root').length > 0) { const headerOB = new MutationObserver(_ => { headerOB.disconnect(); @@ -609,8 +629,11 @@ }); // 高级搜索框的已选中 $('ul.advancedSearchFormBody div.select-wrapper button.toggler.down').each((i, e) => { - if (headerDict[$(e).text()]) - $(e).text(headerDict[$(e).text()]); + // console.log($(e).text()) + if (headerDict[$(e).text().trim()]) + $(e).text(headerDict[$(e).text().trim()]); + else if (propertyDict[$(e).text().trim()]) + $(e).text(propertyDict[$(e).text().trim()]); }); // 高级搜索的下拉选项 $('ul.advancedSearchFormBody li.item').each((i, e) => { @@ -841,7 +864,7 @@ function gymOBInit() { gymOB.disconnect(); gymTrans(); - gymOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); + gymOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true, attributes: true}); } function gymTrans() { @@ -940,7 +963,7 @@ } gymTrans(); - gymOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); + gymOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true, attributes: true}); return; } @@ -1838,10 +1861,10 @@ $('div.content-title-links a span:nth-child(2)').each((i, e) => { if (titleLinksDict[$(e).text()]) $(e).text(titleLinksDict[$(e).text()]); - else if($(e).attr('id')==='events') + else if ($(e).attr('id') === 'events') if (titleLinksDict[$(e).text().split(' ')[0]]) $(e).text($(e).text() - .replace($(e).text().split(' ')[0],titleLinksDict[$(e).text().split(' ')[0]])); + .replace($(e).text().split(' ')[0], titleLinksDict[$(e).text().split(' ')[0]])); }); }