更新个人资料页面

This commit is contained in:
woohoo 2021-11-25 13:19:55 +08:00
parent 25a8d5c68e
commit d470f64c1c

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Torn翻译 // @name Torn翻译
// @namespace WOOH // @namespace WOOH
// @version 0.1.1124c // @version 0.1.1125a
// @description Torn UI翻译 // @description Torn UI翻译
// @author Woohoo-[2687093] sabrina_devil[2696209] // @author Woohoo-[2687093] sabrina_devil[2696209]
// @match https://www.torn.com/* // @match https://www.torn.com/*
@ -15,6 +15,8 @@
if (___window___.WHTRANS) return; if (___window___.WHTRANS) return;
___window___.WHTRANS = true; ___window___.WHTRANS = true;
const CC_set = /[\u4e00-\u9fa5]/;
const $ = window.jQuery; const $ = window.jQuery;
const titleDict = { const titleDict = {
'Home': '主页', 'Home': '主页',
@ -1115,6 +1117,7 @@
')': '一起)', ')': '一起)',
'Spouse': '配偶', 'Spouse': '配偶',
'Married to': '已婚', 'Married to': '已婚',
'Now': '现在',
}; };
const sendCashDict = { 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.': '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 { else {
//console.log(i, $(e).text())
if (profileDict[$(e).text().trim()]) { if (profileDict[$(e).text().trim()]) {
$(e).text(profileDict[$(e).text().trim()]); $(e).children().text(profileDict[$(e).text().trim()]);
return; return;
} }
switch (i) { switch (i) {
case 5: case 5:
case 7: { case 7: {
if ($(e).text().contains(CC_set)) return;
const $span = e.children[0].children[0]; const $span = e.children[0].children[0];
const pos = $span.firstChild.nodeValue.trim().split(' ').slice(0, -1).join(' '); const pos = $span.firstChild.nodeValue.trim().split(' ').slice(0, -1).join(' ');
$span.firstChild.nodeValue = ''; $span.firstChild.nodeValue = '';
@ -2248,7 +2251,7 @@
return; return;
} }
case 13: { case 13: {
if ($(e).text().contains(/[\u4e00-\u9fa5]/)) return; if ($(e).text().contains(CC_set)) return;
const days = $(e).text().contains(/ [0-9]+ /) const days = $(e).text().contains(/ [0-9]+ /)
? $(e).text().trim().split(' ')[4] ? $(e).text().trim().split(' ')[4]
: null; : null;
@ -2267,6 +2270,21 @@
return; return;
} }
case 23: { 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; return;
} }
} }