From 291331e60e2488e5340e511f04bbf0755bb52e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=98=B1=E5=BD=A4?= Date: Sat, 13 Nov 2021 02:07:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=8F=E9=99=A2=E7=90=86=E7=94=B1=E9=9B=86?= =?UTF-8?q?=E5=90=88=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- torn-trans-zhcn.user.js | 112 +++++++++++++++++++++++++--------------- 1 file changed, 71 insertions(+), 41 deletions(-) diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index cd54eff..2d80d1d 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.1112b +// @version 0.1.1113a // @description UI翻译 // @author Woohoo-[2687093] sabrina_devil[2696209] // @match https://www.torn.com/* @@ -657,15 +657,53 @@ 'Subtle':'', 'Transmission 1':'', 'Transmission 2':'', - 'Warble 1':'', - 'Warble 2':'', - 'Only people you know or have met':'只有你认识或遇到过的人', - 'Anyone can initiate chat with you':'任何人都可以主动与你聊天', - 'Recent':'最近', - 'Friends':'好友', - 'Blocked':'拉黑', - 'All':'全部', - 'Enter a name or ID to add to this list':'输入用户名或ID来添加到这个列表', + 'Warble 1': '', + 'Warble 2': '', + 'Only people you know or have met': '只有你认识或遇到过的人', + 'Anyone can initiate chat with you': '任何人都可以主动与你聊天', + 'Recent': '最近', + 'Friends': '好友', + 'Blocked': '拉黑', + 'All': '全部', + 'Enter a name or ID to add to this list': '输入用户名或ID来添加到这个列表', + }; + const hosDict = { + "You take a trip down to the hospital to see who's been unlucky today.": "你来了一趟医院,看看今天是谁那么倒霉", + "Nobody can revive you.": "现在没有玩家可以复活你", + "Anyone can now revive you.": "现在任何玩家都能复活你", + "Only those on your friends list & your faction members can now revive you.": "现在只有好友以及帮派成员可以复活你", + "in Hospital": "在住院", + "People are": "名玩家", + "Time": "时长", + "Level": "等级", + "Reason": "原因", + "Overdosed on Xanax": "吸食Xanax过量", + "Shot while attempting to take down a president": "在试图袭击总统时受了枪伤", + "Taken down by guards": "被保安击倒", + "Got a nasty surprise in the post.": "收到并打开了一个伤害性包裹", + "Dropped by Swiss Guards": "被瑞士警卫队抛下", + "Mauled by a guard dog": "被警卫犬袭击受伤", + "Burned in an arson attempt": "在一次纵火案中被烧伤", + "Fallen ill with radiation poisoning": "因辐射中毒而病倒", + "Crashed his": "出车祸并撞毁了他的", + "Crashed her": "出车祸并撞毁了她的", + "Taken down by members of The Black Hand": "被黑手党成员拿下", + "Got derailed": "火车脱轨致伤", + "Third degree burns on back from explosion": "爆炸造成的背部三度烧伤", + "general": "被玩家 ", + "Hit in the head by flying metal": "被飞来的金属击中头部", + "Shot themselves in the foot": "打了自己腿一枪", + "Hospitalized by someone": "被某人殴打并送入医院", + "Attacked by someone": "被某人攻击", + "Mugged by someone": "被某人抢劫", + "Gunned down by FBI agents": "被联邦调查局特工枪击", + "Taken down by a SWAT marksman": "被一名特警射手击倒", + "Exploded": "被炸伤", + "Fell from a two story building while on a hitman mission": "在执行杀手任务时从两层的建筑坠落", + "Suffering from an acute hemolytic transfusion reaction": "患上了急性溶血性输血反应疾病", + "Choked out by Leslie": "被Leslie掐喉", + "Shot in the back": "背部中枪", + "Lost to": "输给了 ", }; const awDict = {}; @@ -1544,34 +1582,6 @@ } function hospTrans() { - const hosDict = { - "You take a trip down to the hospital to see who's been unlucky today.": "你来了一趟医院,看看今天是谁那么倒霉", - "Nobody can revive you.": "现在没有玩家可以复活你", - "Anyone can now revive you.": "现在任何玩家都能复活你", - "Only those on your friends list & your faction members can now revive you.": "现在只有好友以及帮派成员可以复活你", - "in Hospital": "在住院", - "People are": "名玩家", - "Time": "时长", - "Level": "等级", - "Reason": "原因", - "Overdosed on Xanax": "吸食Xanax过量", - "Shot while attempting to take down a president": "在试图袭击总统时受了枪伤", - "Taken down by guards": "被卫兵拿下", - "Got a nasty surprise in the post.": "收到并打开了一个伤害性包裹", - "Dropped by Swiss Guards": "被瑞士警卫队丢弃", - "Mauled by a guard dog": "被警卫犬袭击受伤", - "Burned in an arson attempt": "在一次纵火案中被烧伤", - "Fallen ill with radiation poisoning": "因辐射中毒而病倒", - "Crashed his": "撞毁了他的", - "Crashed her": "撞毁了她的", - "Hospitalized by": "", - "Hospitalized by someone": "被某人殴打入院", - "Attacked by": "", - "Attacked by someone": "被某人攻击", - "Mugged by": "", - "Mugged by someone": "被某人抢劫", - "Exploded": "被炸伤" - } titleTrans(); contentTitleLinksTrans(); @@ -1589,10 +1599,30 @@ }) //玩家列表住院理由 - $('ul[class^="user-info-list-wrap"] span[class^="reason"]').contents().each((i, e) => { - let reasonStr = $(e).text().trim(); + $('ul[class^="user-info-list-wrap"] span[class^="reason"]').each((i, e) => { + let reasonStr = $(e).get(0).childNodes[1].nodeValue.trim(); + if (hosDict[reasonStr]) { - e.nodeValue = (hosDict[reasonStr]); + $(e)[0].childNodes[1].nodeValue = hosDict[reasonStr]; + } else if (reasonStr.indexOf("Crashed") >= 0) { + $(e)[0].childNodes[1].nodeValue = reasonStr + .replace("Crashed her", hosDict["Crashed her"]) + .replace("Crashed his", hosDict["Crashed his"]); + } else { + switch (reasonStr) { + case "Attacked by": + $(e)[0].childNodes[1].nodeValue = hosDict["general"]; + $(e).append(" 攻击"); + break; + case "Hospitalized by": + $(e)[0].childNodes[1].nodeValue = hosDict["general"]; + $(e).append(" 殴打并送入医院"); + break; + case "Mugged by": + $(e)[0].childNodes[1].nodeValue = hosDict["general"]; + $(e).append(" 抢劫"); + break; + } } }) }