高级搜索现已翻译 gym逻辑调整 更新版本

This commit is contained in:
woohoo 2021-11-12 12:00:01 +08:00
parent 57eea7b056
commit cd4330fa4f

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Torn翻译 // @name Torn翻译
// @namespace WOOH // @namespace WOOH
// @version 0.1.1111a // @version 0.1.1112a
// @description UI翻译 // @description UI翻译
// @author Woohoo-[2687093] sabrina_devil[2696209] // @author Woohoo-[2687093] sabrina_devil[2696209]
// @match https://www.torn.com/* // @match https://www.torn.com/*
@ -449,6 +449,7 @@
}; };
const headerDict = { const headerDict = {
"User's Name / ID": '用户名或ID', "User's Name / ID": '用户名或ID',
"Name": '用户名',
'Faction': '帮派', 'Faction': '帮派',
'Company': '帮派', 'Company': '帮派',
'Places': '地点', 'Places': '地点',
@ -459,18 +460,38 @@
'Search users by...': '高级用户搜索', 'Search users by...': '高级用户搜索',
'Property': '住房', 'Property': '住房',
'Male': '男性', 'Male': '男性',
'Female': '女性',
'to': '到', 'to': '到',
'Condition': '条件',
'Married': '在已婚状态',
'Travelling': '在飞行中',
'In a faction': '在帮派中',
'In a company': '在公司中',
'In hospital': '在医院里',
'In jail': '在监狱里',
'In Federal jail': '在联邦监狱里',
'Level': '等级',
'Days old': '游戏天数',
'Offences': '违法行为',
'Last action': '上次动作',
'Reset': '重置', 'Reset': '重置',
'Search': '搜索', 'Search': '搜索',
'0 - 15 min': '0 - 15 分钟', '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': '不', 'Not': '不',
'View Log': '查看日志', 'View Log': '查看日志',
'View Profile': '查看个人资料', 'View Profile': '查看个人资料',
'Settings': '设置', 'Settings': '设置',
'Server:': '服务器 ', 'Server:': '服务器 ',
'Dark Mode': '', 'Dark Mode': '黑夜模式',
'News Ticker': '', 'News Ticker': '滚动通知',
'Logout': '', 'Logout': '登出',
'Gender': '性别',
}; };
const eventsDict = { const eventsDict = {
// "ALL EVENTS": "所有通知", // "ALL EVENTS": "所有通知",
@ -573,7 +594,6 @@
/** /**
* header * header
*/ */
// $('div#header-root').each((i,e)=>{
if ($('div#header-root').length > 0) { if ($('div#header-root').length > 0) {
const headerOB = new MutationObserver(_ => { const headerOB = new MutationObserver(_ => {
headerOB.disconnect(); headerOB.disconnect();
@ -609,8 +629,11 @@
}); });
// 高级搜索框的已选中 // 高级搜索框的已选中
$('ul.advancedSearchFormBody div.select-wrapper button.toggler.down').each((i, e) => { $('ul.advancedSearchFormBody div.select-wrapper button.toggler.down').each((i, e) => {
if (headerDict[$(e).text()]) // console.log($(e).text())
$(e).text(headerDict[$(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) => { $('ul.advancedSearchFormBody li.item').each((i, e) => {
@ -841,7 +864,7 @@
function gymOBInit() { function gymOBInit() {
gymOB.disconnect(); gymOB.disconnect();
gymTrans(); 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() { function gymTrans() {
@ -940,7 +963,7 @@
} }
gymTrans(); gymTrans();
gymOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); gymOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true, attributes: true});
return; return;
} }