更新健身房页面
This commit is contained in:
parent
ade9757b37
commit
fa4369e9c9
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Torn翻译
|
// @name Torn翻译
|
||||||
// @namespace WOOH
|
// @namespace WOOH
|
||||||
// @version 0.1.1108a
|
// @version 0.1.1109a
|
||||||
// @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/*
|
||||||
@ -200,7 +200,7 @@
|
|||||||
'Cost:': '花费:',
|
'Cost:': '花费:',
|
||||||
'Cost per Day': '平均日花费',
|
'Cost per Day': '平均日花费',
|
||||||
'Rental Period': '租期',
|
'Rental Period': '租期',
|
||||||
'Rental period:': '租期',
|
'Rental period:': '租期:',
|
||||||
'Rent': '租赁',
|
'Rent': '租赁',
|
||||||
'Info': '信息',
|
'Info': '信息',
|
||||||
'Buy': '购买',
|
'Buy': '购买',
|
||||||
@ -248,6 +248,33 @@
|
|||||||
'Sort by:': '分类排序方式:',
|
'Sort by:': '分类排序方式:',
|
||||||
'Area': '地区',
|
'Area': '地区',
|
||||||
};
|
};
|
||||||
|
const gymDict={
|
||||||
|
'Strength':'力量 STR',
|
||||||
|
'STR':'力量 STR',
|
||||||
|
'TRAIN':'锻炼',
|
||||||
|
'Welcome to':'欢迎来到 ',
|
||||||
|
'!':'!',
|
||||||
|
'You walk into the gym and begin browsing the exercises available.':
|
||||||
|
'你走进健身房,开始浏览可用的健身器材。',
|
||||||
|
'You have':'你有',
|
||||||
|
'available to use.':'可用于锻炼。',
|
||||||
|
'energy':'能量',
|
||||||
|
'Estimated Energy progress:':'(TornTools) 预估健身房解锁进程:',
|
||||||
|
'What would you like to train today?':'今天要练点什么?',
|
||||||
|
'BACK TO GYM':'返回健身房',
|
||||||
|
'ACTIVATE MEMBERSHIP':'激活会员身份',
|
||||||
|
'BUY MEMBERSHIP':'购买健身房会员',
|
||||||
|
'Cancel':'返回',
|
||||||
|
//'Damage you make on impact':'',
|
||||||
|
'Chance of hitting opponent':'击中对手的概率',
|
||||||
|
'{$} energy per train':'每次锻炼花费{$}能量',
|
||||||
|
'Class:':'健身房类别:',
|
||||||
|
'Heavyweight':'重型',
|
||||||
|
'Strength Gains':'力量获得',
|
||||||
|
'Boxing':'拳击',
|
||||||
|
'Are you sure you would like to buy this membership?':'确定购买这个健身房会员吗?',
|
||||||
|
'Not Available':'不可用',
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -378,10 +405,10 @@
|
|||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
const attackDict = {
|
// const attackDict = {
|
||||||
"mugged": "打劫了",
|
// "mugged": "打劫了",
|
||||||
"arrested": "逮捕了"
|
// "arrested": "逮捕了"
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主页 todo
|
* 主页 todo
|
||||||
@ -397,30 +424,31 @@
|
|||||||
if (!homeDict[e.firstChild.nodeValue]) return;
|
if (!homeDict[e.firstChild.nodeValue]) return;
|
||||||
if (e.firstChild.nodeValue === 'Latest Events') {
|
if (e.firstChild.nodeValue === 'Latest Events') {
|
||||||
homeEvents = $(e).parent().next().find('span');
|
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;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
// 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];
|
e.firstChild.nodeValue = homeDict[e.firstChild.nodeValue];
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -504,6 +532,90 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 健身房页面
|
||||||
|
*/
|
||||||
|
if (window.location.href.indexOf('gym.php') >= 0) {
|
||||||
|
const gymOB = new MutationObserver(gymOBInit);
|
||||||
|
|
||||||
|
function gymOBInit() {
|
||||||
|
gymOB.disconnect();
|
||||||
|
gymTrans();
|
||||||
|
gymOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
|
||||||
|
}
|
||||||
|
|
||||||
|
function gymTrans() {
|
||||||
|
titleTrans();
|
||||||
|
contentTitleLinksTrans();
|
||||||
|
const gymName=$('div[class^="notificationText"] b').text();
|
||||||
|
|
||||||
|
// 顶部提示信息
|
||||||
|
$('div[class^="notificationText"] p').contents().each((i,e)=>{
|
||||||
|
if(e.childNodes.length===0 && gymDict[e.nodeValue.trim()])
|
||||||
|
e.nodeValue=gymDict[e.nodeValue.trim()];
|
||||||
|
});
|
||||||
|
// 4属性标题
|
||||||
|
$('h3[class^="title"]').each((i,e)=>{
|
||||||
|
if (gymDict[$(e).text().trim()])
|
||||||
|
$(e).text(gymDict[$(e).text().trim()]);
|
||||||
|
});
|
||||||
|
// 4属性的介绍 与冰蛙冲突
|
||||||
|
$('div[class^="description"] p:nth-child(1)').each((i,e)=>{
|
||||||
|
if (gymDict[$(e).text().trim()])
|
||||||
|
$(e).text(gymDict[$(e).text().trim()]);
|
||||||
|
});
|
||||||
|
// 每次锻炼的花销
|
||||||
|
$('div[class^="description"] p:nth-child(2)').each((i,e)=>{
|
||||||
|
const energyPerTrain=$(e).text().split(' ').length===4?$(e).text().split(' ')[0]:null;
|
||||||
|
if(gymDict[$(e).text().replace(energyPerTrain,`{$}`)])
|
||||||
|
$(e).text(gymDict[$(e).text().replace(energyPerTrain,`{$}`)].replace(`{$}`,energyPerTrain));
|
||||||
|
});
|
||||||
|
// 锻炼按钮
|
||||||
|
$('button[class^="button"]').each((i,e)=>{
|
||||||
|
if (gymDict[$(e).text().trim()])
|
||||||
|
$(e).text(gymDict[$(e).text().trim()]);
|
||||||
|
});// cancel按钮
|
||||||
|
$('button[class^="cancel"]').each((i,e)=>{
|
||||||
|
if (gymDict[$(e).text().trim()])
|
||||||
|
$(e).text(gymDict[$(e).text().trim()]);
|
||||||
|
});
|
||||||
|
// 锻炼的提示信息
|
||||||
|
$('div[class^="messageWrapper"] p').each((i,e)=>{
|
||||||
|
if(gymDict[$(e).text()])
|
||||||
|
$(e).text(gymDict[$(e).text()]);
|
||||||
|
});
|
||||||
|
// 健身房信息 标题
|
||||||
|
$('div[class^="gymTitle"] h3').each((i,e)=>{
|
||||||
|
if(gymDict[$(e).text()])
|
||||||
|
$(e).text(gymDict[$(e).text()]);
|
||||||
|
});
|
||||||
|
// 健身房信息 属性名
|
||||||
|
$('ul[class^="gymInfo"] b').each((i,e)=>{
|
||||||
|
if(gymDict[$(e).text().trim()])
|
||||||
|
$(e).text(gymDict[$(e).text().trim()]);
|
||||||
|
});
|
||||||
|
// 健身房信息 属性值
|
||||||
|
$('ul[class^="gymInfo"] span[class^="value"]').each((i,e)=>{
|
||||||
|
if(gymDict[$(e).text().trim()])
|
||||||
|
$(e).text(gymDict[$(e).text().trim()]);
|
||||||
|
});
|
||||||
|
// 健身房信息 具体锻炼项目
|
||||||
|
$('span[class^="exerciseName"]').each((i,e)=>{
|
||||||
|
if(gymDict[$(e).text().trim()])
|
||||||
|
$(e).text(gymDict[$(e).text().trim()]);
|
||||||
|
});
|
||||||
|
// 购买提示信息
|
||||||
|
$('div[class^="confirmMessage"] p[role="alert"]').each((i,e)=>{
|
||||||
|
if(gymDict[$(e).text().trim()])
|
||||||
|
$(e).text(gymDict[$(e).text().trim()]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
gymTrans();
|
||||||
|
gymOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报纸菜单
|
* 报纸菜单
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user