From 93419aeec32eea965a9e03dd3c1e950045a36492 Mon Sep 17 00:00:00 2001 From: AshleyLiuuuuu Date: Mon, 8 Nov 2021 18:08:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E7=9F=A5=E7=BF=BB=E8=AF=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BB=A5=E5=8F=8A=E8=BF=91=E6=9C=9F=E6=94=BB=E5=87=BB?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=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 | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index 47b177a..5c6fad1 100644 --- a/torn-trans-zhcn.user.js +++ b/torn-trans-zhcn.user.js @@ -231,7 +231,7 @@ /** - * 飞行 + * 飞行页面 */ if (window.location.href.indexOf('index.php') >= 0 && $('.travelling h4').length !== 0) { @@ -358,6 +358,11 @@ } }, 500); + const attackDict = { + "mugged": "打劫了", + "arrested": "逮捕了" + } + /** * 主页 todo */ @@ -371,6 +376,29 @@ if (!homeDict[e.firstChild.nodeValue]) return; if (e.firstChild.nodeValue === 'Latest Events') { homeEvents = $(e).parent().next().find('span'); + } else if (e.firstChild.nodeValue === 'Latest Attacks') { + const attackDict = { + "mugged": "打劫了", + "arrested": "逮捕了" + } + $(e).parent().next().find('span').each(function () { + var attackMsg = $(this).context.textContent; + + //Convert to an array for attacking ways determination + var keyAtk = attackMsg.split(" "); + var someone = keyAtk[0] === "Someone" ? "有人" : keyAtk[0]; + var textTsf = ""; + switch (keyAtk[1]) { + + case "hospitalized": + textTsf = "攻击并送" + keyAtk[2] + "入院"; + break; + + default: + textTsf = attackDict[keyAtk[1]] + keyAtk[2]; + } + $(this).context.textContent = someone + textTsf; + }); } e.firstChild.nodeValue = homeDict[e.firstChild.nodeValue]; }); @@ -554,7 +582,7 @@ } /** - * 通知 + * 通知页面 */ if (window.location.href.indexOf('events.php') >= 0) { titleTrans(); @@ -720,7 +748,7 @@ const item = spl.slice(4, spl.indexOf('from')).join(' '); const money = spl[spl.length - 1].replace('.', ''); - e.childNodes[1].nodeValue = ' 花费 ' + money + ' 从你的 bazaar 买了 ' + num + ' 个 ' + ' ' + item + '。'; + e.childNodes[1].nodeValue = ' 花费 ' + money + ' 从你的店铺购买了 ' + num + ' 个 ' + ' ' + item + '。'; return; }