diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index c95967b..ca59e74 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.1124c +// @version 0.1.1125a // @description Torn UI翻译 // @author Woohoo-[2687093] sabrina_devil[2696209] // @match https://www.torn.com/* @@ -15,6 +15,8 @@ if (___window___.WHTRANS) return; ___window___.WHTRANS = true; + const CC_set = /[\u4e00-\u9fa5]/; + const $ = window.jQuery; const titleDict = { 'Home': '主页', @@ -1115,6 +1117,7 @@ ')': '一起)', 'Spouse': '配偶', 'Married to': '已婚', + 'Now': '现在', }; const sendCashDict = { 'Some players may be out to part you from your money, using any means necessary. Use the secure trade feature if you want to protect an exchange and check the contents very carefully.': @@ -2221,14 +2224,14 @@ } // 右 值 else { - //console.log(i, $(e).text()) if (profileDict[$(e).text().trim()]) { - $(e).text(profileDict[$(e).text().trim()]); + $(e).children().text(profileDict[$(e).text().trim()]); return; } switch (i) { case 5: case 7: { + if ($(e).text().contains(CC_set)) return; const $span = e.children[0].children[0]; const pos = $span.firstChild.nodeValue.trim().split(' ').slice(0, -1).join(' '); $span.firstChild.nodeValue = ''; @@ -2248,7 +2251,7 @@ return; } case 13: { - if ($(e).text().contains(/[\u4e00-\u9fa5]/)) return; + if ($(e).text().contains(CC_set)) return; const days = $(e).text().contains(/ [0-9]+ /) ? $(e).text().trim().split(' ')[4] : null; @@ -2267,6 +2270,21 @@ return; } case 23: { + // 39 minutes ago + if ($(e).text().contains(/ago/)) { + $(e).children().text($(e).text() + .replace('ago','前') + .replace('and','') + .replace('seconds','秒') + .replace('second','秒') + .replace('minutes','分') + .replace('minute','分') + .replace('hours','时') + .replace('hour','时') + .replace('days','时') + .replace('day','时') + ) + } return; } }