更新awards页面
This commit is contained in:
parent
60e9ffad31
commit
2ad1a6cb04
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Torn翻译
|
// @name Torn翻译
|
||||||
// @namespace WOOH
|
// @namespace WOOH
|
||||||
// @version 0.1.1112b
|
// @version 0.1.1113a
|
||||||
// @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/*
|
||||||
@ -596,6 +596,7 @@
|
|||||||
'Server:': '服务器 ',
|
'Server:': '服务器 ',
|
||||||
'Dark Mode': '黑夜模式',
|
'Dark Mode': '黑夜模式',
|
||||||
'News Ticker': '滚动通知',
|
'News Ticker': '滚动通知',
|
||||||
|
'Desktop View': '桌面视图',
|
||||||
'Logout': '登出',
|
'Logout': '登出',
|
||||||
'Gender': '性别',
|
'Gender': '性别',
|
||||||
};
|
};
|
||||||
@ -667,7 +668,37 @@
|
|||||||
'All':'全部',
|
'All':'全部',
|
||||||
'Enter a name or ID to add to this list':'输入用户名或ID来添加到这个列表',
|
'Enter a name or ID to add to this list':'输入用户名或ID来添加到这个列表',
|
||||||
};
|
};
|
||||||
const awDict = {};
|
const awDict = {
|
||||||
|
'Honors (':'荣誉 (',
|
||||||
|
'Medals (':'勋章 (',
|
||||||
|
'Merits (':'技能加点 (',
|
||||||
|
'As you progress, you will unlock new honors. To add an Honor to your name, click the one you want.':
|
||||||
|
'新的荣誉条将随着你的进步解锁。请点击想要在你的名字上显示的荣誉条。',
|
||||||
|
'As you progress, you will unlock new medals. Your medals will be pinned on your profile to show your\nprestige.':
|
||||||
|
'新的勋章将随着你的进步解锁。勋章将显示在个人资料上(展示是否够牌面)。',
|
||||||
|
'You have': '你有 ',
|
||||||
|
'merits': '技能点',
|
||||||
|
'medals': '勋章',
|
||||||
|
'honors': '荣誉',
|
||||||
|
'Available Merits:': '可用技能点: ',
|
||||||
|
'Merits Used:': ' 已用技能点: ',//
|
||||||
|
"to spend on anything you would like on\nthe list below.\nYou've earned these merits by attaining":
|
||||||
|
' 可用于升级以下列表中的任意技能。这些技能点是通过 ',
|
||||||
|
'and': ' 和 ',
|
||||||
|
".\nThe enhancements are incremental and will go up in cost the more you upgrade them.\nFor example, if you pay one merit to upgrade an improvement,\nnext time you want to upgrade it you will need to pay two merits, after that three etc.":
|
||||||
|
' 获得的。技能升级的花费是递增的,技能等级越高升级消耗的技能点就越高。如果花费一技能点来升级一项技能,下次要升级时,需要花费两个技能点,之后是三个等依此类推。',
|
||||||
|
'Awards you are about to unlock':'即将解锁的勋章',
|
||||||
|
'Upgrade':'升级',
|
||||||
|
'Progress':'升级进程',
|
||||||
|
'Expand All':'展开所有',
|
||||||
|
'Latest':'最新获得',
|
||||||
|
'Nerve Bar':'犯罪N上限',
|
||||||
|
'Are you sure you want to spend':'确定要花费 ',
|
||||||
|
'on\nyour Awareness upgrade?\nThis upgrade will increase the amount of items you can find in the city, however it will not necessarily increase their quality.':
|
||||||
|
' 在感知能力升级上?该升级会增加你在城市中能找到的物品数量,但不一定能提高它们的质量。',
|
||||||
|
'- Increases maximum nerve bar by 1 point':
|
||||||
|
'- 增加 1 点犯罪N上限',
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 边栏
|
* 边栏
|
||||||
@ -1312,7 +1343,7 @@
|
|||||||
// 菜单下的信息 工作 壁纸 广告 悬赏
|
// 菜单下的信息 工作 壁纸 广告 悬赏
|
||||||
$('div.help-message').find('*').contents().each((i, e) => {
|
$('div.help-message').find('*').contents().each((i, e) => {
|
||||||
if (!e.nodeValue || e.nodeValue.trim() === '') return;
|
if (!e.nodeValue || e.nodeValue.trim() === '') return;
|
||||||
console.log(e.nodeValue);
|
//console.log(e.nodeValue);
|
||||||
if (newspaperDict[e.nodeValue.trim()])
|
if (newspaperDict[e.nodeValue.trim()])
|
||||||
e.nodeValue = newspaperDict[e.nodeValue.trim()];
|
e.nodeValue = newspaperDict[e.nodeValue.trim()];
|
||||||
});
|
});
|
||||||
@ -1511,15 +1542,83 @@
|
|||||||
if (window.location.href.indexOf('awards.php') >= 0) {
|
if (window.location.href.indexOf('awards.php') >= 0) {
|
||||||
const awOB = new MutationObserver(() =>{
|
const awOB = new MutationObserver(() =>{
|
||||||
awOB.disconnect();
|
awOB.disconnect();
|
||||||
titleTrans();
|
|
||||||
contentTitleLinksTrans();
|
|
||||||
awTrans();
|
awTrans();
|
||||||
awOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
|
awOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
|
||||||
});
|
});
|
||||||
const awTrans = function awTrans(){
|
const awTrans = function awTrans(){
|
||||||
|
titleTrans();
|
||||||
|
contentTitleLinksTrans();
|
||||||
// 顶部的3个分类 Honors (106) Medals (44) Merits (3)
|
// 顶部的3个分类 Honors (106) Medals (44) Merits (3)
|
||||||
$('div.content-wrapper a.ui-tabs-anchor span.bold').each((i,e)=>{
|
$('div.content-wrapper a.ui-tabs-anchor span.bold').contents().each((i,e)=>{
|
||||||
|
if (e.nodeType !== 3) return;
|
||||||
|
if (awDict[e.nodeValue.trim()])
|
||||||
|
e.nodeValue = awDict[e.nodeValue.trim()];
|
||||||
|
});
|
||||||
|
// 分类标题下的描述
|
||||||
|
$('div.awards-msg').contents().each((i,e)=>{
|
||||||
|
// 文字节点
|
||||||
|
if (e.nodeType === 3) {
|
||||||
|
if (awDict[e.nodeValue.trim()])
|
||||||
|
e.nodeValue = awDict[e.nodeValue.trim()];
|
||||||
|
}
|
||||||
|
// 子节点
|
||||||
|
else if(e.nodeType === 1){
|
||||||
|
if (awDict[$(e).text().trim()])
|
||||||
|
$(e).text(awDict[$(e).text().trim()]);
|
||||||
|
else if ($(e).text().indexOf('medals')>=0)
|
||||||
|
$(e).text($(e).text().replace('medals', awDict['medals']));
|
||||||
|
else if ($(e).text().indexOf('honors')>=0)
|
||||||
|
$(e).text($(e).text().replace('honors', awDict['honors']));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 技能页面 Available Merits: x Merits Used: x
|
||||||
|
$('div.awards-msg p').contents().each((i,e)=>{
|
||||||
|
if(e.nodeType===3)
|
||||||
|
if(awDict[e.nodeValue.trim()])
|
||||||
|
e.nodeValue=e.nodeValue.replace(e.nodeValue.trim(),awDict[e.nodeValue.trim()]);
|
||||||
|
});
|
||||||
|
// 勋章下 即将解锁的勋章框标题 技能加点的表头标题
|
||||||
|
$('div.title-black').contents().each((i,e)=>{
|
||||||
|
// 勋章下 即将解锁的勋章框标题
|
||||||
|
if (e.nodeType === 1){
|
||||||
|
if (awDict[$(e).text().trim()])
|
||||||
|
$(e).text(awDict[$(e).text().trim()]);
|
||||||
|
}
|
||||||
|
// 技能加点的表头标题
|
||||||
|
else if (e.nodeType === 3){
|
||||||
|
if(awDict[e.nodeValue.trim()])
|
||||||
|
e.nodeValue = awDict[e.nodeValue.trim()];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 荣誉和勋章的左边栏分类选择菜单
|
||||||
|
$('div.tab-menu-cont li.ui-state-default a').each((i,e)=>{
|
||||||
|
if (awDict[$(e).text().trim()])
|
||||||
|
$(e).text(awDict[$(e).text().trim()]);
|
||||||
|
});
|
||||||
|
// 技能点名字
|
||||||
|
$('ul#merits-list span.name').each((i,e)=>{
|
||||||
|
if (awDict[$(e).text().trim()])
|
||||||
|
$(e).text(awDict[$(e).text().trim()]);
|
||||||
|
});
|
||||||
|
// 技能点短描述
|
||||||
|
$('ul#merits-list span.desc span[class^="t-"]').each((i,e)=>{
|
||||||
|
const slash = $(e).attr('class') === 't-show' ? '- ' : '';
|
||||||
|
const isShow = $(e).attr('class') === 't-show';
|
||||||
|
const key = isShow?$(e).text().slice(2):$(e).text();
|
||||||
|
if (awDict[key])
|
||||||
|
$(e).text((isShow?'- ':'')+awDict[key]);
|
||||||
|
});
|
||||||
|
// 技能点展开详细描述与确认
|
||||||
|
$('ul#merits-list div.msg').contents().each((i,e)=>{
|
||||||
|
if (e.nodeType === 1){
|
||||||
|
const spl=$(e).text().split(' ');
|
||||||
|
if (awDict[spl[1]])
|
||||||
|
$(e).text(spl[0]+' '+awDict[spl[1]]);
|
||||||
|
}
|
||||||
|
else if (e.nodeType === 3){
|
||||||
|
if(awDict[e.nodeValue.trim()])
|
||||||
|
e.nodeValue = awDict[e.nodeValue.trim()];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
awTrans();
|
awTrans();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user