gym页面bug修复

This commit is contained in:
woohoo 2021-11-09 19:23:40 +08:00
parent f88e140655
commit e190a5cb89

View File

@ -25,9 +25,9 @@
'Classified Ads': '分类广告',
'Properties': '房产',
'City': '城市',
'Education':'教育',
'Gym':'健身房',
'Biology Modules':'生物学课程',
'Education': '教育',
'Gym': '健身房',
'Biology Modules': '生物学课程',
};
const titleLinksDict = {
'Personal stats': '个人统计信息',
@ -38,7 +38,7 @@
'City': '城市',
'Back to Estate Agents': '返回地产中介',
'Tutorial': '教程',
'Back to Education':'返回',
'Back to Education': '返回',
};
const sidebarDict = { // todo 从json加载
'Money': '现金',
@ -261,15 +261,15 @@
'Sort by:': '分类排序方式:',
'Area': '地区',
};
const gymDict={
'Strength':'力量 STR',
'STR':'力量 STR',
'TRAIN':'锻炼',
'Welcome to':'欢迎来到 ',
'!':'',
const gymDict = {
'Strength': '力量 STR',
'STR': '力量 STR',
'TRAIN': '锻炼',
'Welcome to': '欢迎来到 ',
'!': '',
'You walk into the gym and begin browsing the exercises available.':
'你走进健身房,开始浏览可用的健身器材。',
'You have':'你有',
'You have': '你有',
'available to use.': '可用于锻炼。',
'energy': '能量',
'Estimated Energy progress:': '(TornTools) 预估健身房解锁进程:',
@ -278,7 +278,6 @@
'ACTIVATE MEMBERSHIP': '激活会员身份',
'BUY MEMBERSHIP': '购买健身房会员',
'Cancel': '返回',
//'Damage you make on impact':'',
'Chance of hitting opponent': '击中对手的概率',
"Ability to withstand damage": "承受伤害的能力",
"Damage you make on impact": "攻击时造成的伤害",
@ -289,23 +288,24 @@
'Boxing': '拳击',
'Are you sure you would like to buy this membership?': '确定购买这个健身房会员吗?',
'Not Available': '不可用',
'Unavailable': '不可用',
};
const eduDict={
'Biology':'生物学',
'Biology Modules':'生物学课程',
'Introduction to Biochemistry':'生物化学概论',
const eduDict = {
'Biology': '生物学',
'Biology Modules': '生物学课程',
'Introduction to Biochemistry': '生物化学概论',
'You do not meet the requirements for this course. Please complete the prerequisites first.':
'你不符合本课程的要求。请先学习前置课程。',
'Description:':'描述:',
'Learning outcomes:':'学习后可获得:',
'Prerequisites:':'前置课程:',
'Parameters:':'课程参数:',
'As the ultimate module - you will focus on maximum gym gain with the least amount of input.':'',
'Ability to withdraw and deliver blood':'抽取和输送血液的能力(使用血包)',
'Gain {$1} {$2} upon completion':'获得{$1}点{$2}',
'intelligence':'智力(INT)',
'endurance':'耐心(END)',
'manual labor':'体力(MAN)',
'Description:': '描述:',
'Learning outcomes:': '学习后可获得:',
'Prerequisites:': '前置课程:',
'Parameters:': '课程参数:',
'As the ultimate module - you will focus on maximum gym gain with the least amount of input.': '',
'Ability to withdraw and deliver blood': '抽取和输送血液的能力(使用血包)',
'Gain {$1} {$2} upon completion': '获得{$1}点{$2}',
'intelligence': '智力(INT)',
'endurance': '耐心(END)',
'manual labor': '体力(MAN)',
};
@ -485,7 +485,6 @@
return;
}
/**
* city
*/
@ -571,73 +570,80 @@
function gymTrans() {
titleTrans();
contentTitleLinksTrans();
const gymName=$('div[class^="notificationText"] b').text();
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()];
$('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)=>{
$('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)=>{
$('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));
// });
$('div[class^="description"] p:nth-child(2)').each((i, e) => {
if ($(e).text().split(' ').length === 1) {
if (gymDict[$(e).text().trim()])
$(e).text(gymDict[$(e).text().trim()]);
return;
}
const energyPerTrain = $(e).text().split(' ')[0];
if (gymDict[$(e).text().replace(energyPerTrain, `{$}`)]) {
e.firstChild.nodeValue = gymDict[$(e).text().replace(energyPerTrain, `{$}`)].replace(`{$}`, energyPerTrain);
e.lastChild.nodeValue = '';
}
});
// 锻炼页面所有按钮
$('button[class^="button"]').each((i,e)=>{
$('button[class^="button"]').each((i, e) => {
if (gymDict[$(e).text().trim()])
$(e).text(gymDict[$(e).text().trim()]);
});
// cancel按钮
$('button[class^="cancel"]').each((i,e)=>{
$('button[class^="cancel"]').each((i, e) => {
if (gymDict[$(e).text().trim()])
$(e).text(gymDict[$(e).text().trim()]);
});
// 锻炼的提示信息
$('div[class^="messageWrapper"] p').each((i,e)=>{
$('div[class^="messageWrapper"] p').each((i, e) => {
/**
* todo
* <p>You dug deep and completed 15 minutes of incline sprints</p>
* <p role="alert" class="gained___3T_GZ">You gained 1,854.05 speed</p>
*/
//$(e).attr('class').match(/gained/)
if(gymDict[$(e).text()])
if (gymDict[$(e).text()])
$(e).text(gymDict[$(e).text()]);
});
// 健身房信息 标题
$('div[class^="gymTitle"] h3').each((i,e)=>{
if(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()])
$('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()])
$('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()])
$('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()])
$('div[class^="confirmMessage"] p[role="alert"]').each((i, e) => {
if (gymDict[$(e).text().trim()])
$(e).text(gymDict[$(e).text().trim()]);
});
}
@ -664,36 +670,40 @@
contentTitleLinksTrans();
// 大科目、学院标题
$('div.content-wrapper div.title').each((i,e)=>{
if(eduDict[$(e).text().trim()])
e.firstChild.nodeValue=eduDict[$(e).text().trim()];
$('div.content-wrapper div.title').each((i, e) => {
if (eduDict[$(e).text().trim()])
e.firstChild.nodeValue = eduDict[$(e).text().trim()];
});
// 教育主页提示内容
$('#info_wrapper div.msg').find('*').contents().each((i, e) => {
console.log(e.nodeValue)
});
// 学院详情标题
$('div.content-wrapper div.title-black').each((i,e)=>{
if(e.childNodes.length===3)
if(eduDict[e.lastChild.nodeValue.trim()])
e.lastChild.nodeValue=' '+eduDict[e.lastChild.nodeValue.trim()];
if(eduDict[$(e).text().trim()])
$('div.content-wrapper div.title-black').each((i, e) => {
if (e.childNodes.length === 3)
if (eduDict[e.lastChild.nodeValue.trim()])
e.lastChild.nodeValue = ' ' + eduDict[e.lastChild.nodeValue.trim()];
if (eduDict[$(e).text().trim()])
$(e).text(eduDict[$(e).text().trim()]);
});
// 学院详情 小课程标题
$('div.content-wrapper span.module-name').each((i,e)=>{
if(eduDict[$(e).text().trim()])
$('div.content-wrapper span.module-name').each((i, e) => {
if (eduDict[$(e).text().trim()])
$(e).text(eduDict[$(e).text().trim()]);
});
// 课程详情 7 标题
$('div.module-desc p.title').each((i,e)=>{
if(eduDict[$(e).text().trim()])
$('div.module-desc p.title').each((i, e) => {
if (eduDict[$(e).text().trim()])
$(e).text(eduDict[$(e).text().trim()]);
});
// 学院详情 小课程提示信息
$('div.content-wrapper div.msg-cont div').each((i,e)=>{
if(eduDict[$(e).text().trim()])
$('div.content-wrapper div.msg-cont div').each((i, e) => {
if (eduDict[$(e).text().trim()])
$(e).text(eduDict[$(e).text().trim()]);
});
// 课程介绍中的所有li元素
$('div.module-desc ul.info li').each((i,e)=>{
if(e.childNodes.length===1) {
$('div.module-desc ul.info li').each((i, e) => {
if (e.childNodes.length === 1) {
const spl = $(e).text().trim().split(' ');
switch (spl[0]) {
case 'Length:': {//Length
@ -712,27 +722,28 @@
return;
}
case 'Gain': {
if(isNumber(spl[1])) {//Gain 40 intelligence upon completion
if (typeof parseInt(spl[1]) === 'number') {//Gain 40 intelligence upon completion
const wsGained = spl.slice(2, -2).join(' ');
if(eduDict[$(e).text().trim().replace(spl[1],'{$1}')
.replace(wsGained,'{$2}')])
$(e).text(eduDict[$(e).text().trim().replace(spl[1],'{$1}').replace(wsGained,'{$2}')]
.replace('{$1}',spl[1]).replace('{$2}',eduDict[wsGained]?eduDict[wsGained]:wsGained));
}
else{
if(eduDict[$(e).text().trim()])
if (eduDict[$(e).text().trim().replace(spl[1], '{$1}')
.replace(wsGained, '{$2}')])
$(e).text(eduDict[$(e).text().trim()
.replace(spl[1], '{$1}')
.replace(wsGained, '{$2}')]
.replace('{$1}', spl[1])
.replace('{$2}', eduDict[wsGained] ? eduDict[wsGained] : wsGained));
} else {
if (eduDict[$(e).text().trim()])
$(e).text(eduDict[$(e).text().trim()]);
}
return;
}
default:{
if(eduDict[$(e).text().trim()])
default: {
if (eduDict[$(e).text().trim()])
$(e).text(eduDict[$(e).text().trim()]);
}
}
}
else{ // 前置课程
if(eduDict[$(e).children().text().trim()])
} else { // 前置课程
if (eduDict[$(e).children().text().trim()])
$(e).children().text(eduDict[$(e).children().text().trim()]);
}
});
@ -1229,7 +1240,7 @@
}
if ($(e).find('a').text().toLowerCase().indexOf('someone') < 0 && // 避免玩家名带有someone字样
$(e).text().split(' ')[0].toLowerCase()==='someone') { // 被匿名
$(e).text().split(' ')[0].toLowerCase() === 'someone') { // 被匿名
if (spl.length === 6 && spl[3] === 'hospitalized') { // 匿名hos
e.firstChild.nodeValue = '有人袭击你并安排你住院 [';
e.childNodes[1].firstChild.nodeValue = '查看';