更新房屋购买与租赁

This commit is contained in:
woohoo 2021-11-06 01:18:14 +08:00
parent e47467f2bb
commit 4010b3e9db

View File

@ -53,12 +53,12 @@
'Community': '社区事件',
'Friends': '好友',
'Enemies': '敌人',
'Information':'信息',
'Areas':'区域',
'Lists':'列表',
'messages':'信息',
'events':'通知',
'awards':'勋章',
'Information': '信息',
'Areas': '区域',
'Lists': '列表',
'messages': '信息',
'events': '通知',
'awards': '勋章',
};
const tooltipDict = {
'Full ': '回满',
@ -88,67 +88,100 @@
'Faction Information': '帮派信息',
'Criminal Record': '犯罪记录',
'Personal Perks': '个人加成',
'Property':'房产',
'Cost':'花费',
'Fees':'开销费用',
'Job':'工作',
'Company':'公司',
'Days in company':'在公司的天数',
'Type':'公司类型',
'Position':'职位',
'Income':'公司收入',
'Job points':'工作点数',
'Rating':'星级',
'Faction':'帮派',
'Days in faction':'在帮派的天数',
'Respect':'面子',
'Members':'成员',
'Illegal products':'非法产品',
'Theft':'偷盗',
'Auto theft':'汽车盗窃',
'Drug deals':'非法药品交易',
'Computer crimes':'计算机犯罪',
'Murder':'谋杀',
'Fraud crimes':'诈骗犯罪Fraud crimes',
'Other':'其他犯罪',
'Total':'总计',
'Name':'名字',
'Money':'现金',
'Points':'PT',
'Level':'等级',
'Rank':'阶级',// todo 暂定
'Life':'血量',
'Age':'年龄',
'Marital status':'婚姻状态',
'Networth':'身价',
'Strength':'力量 STR',
'Defense':'防御 DEF',
'Speed':'速度 SPD',
'Dexterity':'敏捷 DEX',
'Property': '房产',
'Cost': '花费',
'Fees': '开销费用',
'Job': '工作',
'Company': '公司',
'Days in company': '在公司的天数',
'Type': '公司类型',
'Position': '职位',
'Income': '公司收入',
'Job points': '工作点数',
'Rating': '星级',
'Faction': '帮派',
'Days in faction': '在帮派的天数',
'Respect': '面子',
'Members': '成员',
'Illegal products': '非法产品',
'Theft': '偷盗',
'Auto theft': '汽车盗窃',
'Drug deals': '非法药品交易',
'Computer crimes': '计算机犯罪',
'Murder': '谋杀',
'Fraud crimes': '诈骗犯罪Fraud crimes',
'Other': '其他犯罪',
'Total': '总计',
'Name': '名字',
'Money': '现金',
'Points': 'PT',
'Level': '等级',
'Rank': '阶级',// todo 暂定
'Life': '血量',
'Age': '年龄',
'Marital status': '婚姻状态',
'Networth': '身价',
'Strength': '力量 STR',
'Defense': '防御 DEF',
'Speed': '速度 SPD',
'Dexterity': '敏捷 DEX',
//'Total':'',
'Hunting skill':'狩猎技能',
'Racing skill':'赛车技能',
'Manual labor':'体力 MAN',
'Intelligence':'智力 INT',
'Endurance':'耐心 END',
'Hunting skill': '狩猎技能',
'Racing skill': '赛车技能',
'Manual labor': '体力 MAN',
'Intelligence': '智力 INT',
'Endurance': '耐心 END',
};
const titleLinksDict={
'Personal stats':'个人统计信息',
'Log':'日志',
'Tell your story':'说出你的故事',
const titleLinksDict = {
'Personal stats': '个人统计信息',
'Log': '日志',
'Tell your story': '说出你的故事',
'Rental Market':'租赁市场',
'Selling Market':'销售市场',
'City':'城市',
'Back to Estate Agents':'返回地产中介',
};
const newspaperDict={
'front page':'报纸首页',
'archive':'归档',
'job listing':'工作清单',
'properties':'房产信息',
'freebies':'赠品',
'classified ads':'分类广告',
'personals':'个人情感',
'bounties':'悬赏',
'comics':'漫画',
'chronicles':'纪事档案馆',
const newspaperDict = {
'front page': '报纸头版',
'archive': '归档',
'job listing': '工作清单',
'properties': '房产信息',
'freebies': '赠品',
'classified ads': '分类广告',
'personals': '个人情感',
'bounties': '悬赏',
'comics': '漫画',
'chronicles': '纪事档案馆',
};
const titleDict={
'Home':'主页',
'Estate Agents':'地产中介',
};
const propertyDict={
'Trailer':'拖车',
'Apartment':'公寓',
'Semi - Detached':'半独立式住宅',
'Detached House':'独立式住宅',
'Beach House':'海滩小屋',
'Chalet':'小别墅',
'Villa':'别墅',
'Penthouse':'顶层公寓',
'Mansion':'豪宅',
'Ranch':'农场',
'Palace':'宫殿',
'Castle':'城堡',
'Private Island':'私人岛屿PI',
'Owner':'所有人',
'Happiness':'快乐值',
'Cost':'花费',
'Cost per Day':'平均日花费',
'Rental Period':'租期',
'Rent':'租赁',
'Info':'信息',
'Buy':'购买',
};
titleTrans();
/**
* 飞行
@ -164,8 +197,8 @@
'Travel Home': "回国",
'Rehabilitation': "戒毒康复",
'People': "用户列表",
'Torn to Zurich.':'正在飞往瑞士苏黎世Zurich。',
'Zurich to Torn.':'正从瑞士苏黎世Zurich回城。',
'Torn to Zurich.': '正在飞往瑞士苏黎世Zurich。',
'Zurich to Torn.': '正从瑞士苏黎世Zurich回城。',
};
// 界面tips todo 全收集全翻译
const tipsDict = {
@ -186,12 +219,12 @@
$('#skip-to-content')[0].firstChild.nodeValue = '飞行中';
// 气泡 需要判断是否存在 因为torntools默认关闭云和飞机 冰蛙也会关闭
if ($('div.inner-popup').length!==0 && tipsDict[$('div.inner-popup')[0].textContent]) {
if ($('div.inner-popup').length !== 0 && tipsDict[$('div.inner-popup')[0].textContent]) {
$('div.inner-popup')[0].textContent = tipsDict[$('div.inner-popup')[0].textContent];
}
// Remaining Flight Time -
if(travelingDict[$('span.remaining-time')[0].firstChild.nodeValue]) {
if (travelingDict[$('span.remaining-time')[0].firstChild.nodeValue]) {
$('span.remaining-time')[0].firstChild.nodeValue = travelingDict[$('span.remaining-time')[0].firstChild.nodeValue];
}
@ -207,13 +240,15 @@
$("#people")[0].firstChild.nodeValue = travelingDict[$("#people")[0].firstChild.nodeValue];
}
const remainingTime=new MutationObserver(mutations => {
if(!travelingDict[$('span.description')[0].firstChild.nodeValue]) return;
const remainingTime = new MutationObserver(mutations => {
if (!travelingDict[$('span.description')[0].firstChild.nodeValue]) return;
remainingTime.disconnect();
/**
* Torn to {dest}.
* <span class="description">Torn to Zurich.</span>
*/
$('span.description')[0].firstChild.nodeValue = travelingDict[$('span.description')[0].firstChild.nodeValue];
remainingTime.observe($('span.remaining-time')[0], {childList: true, subtree: true});
});
remainingTime.observe($('span.remaining-time')[0], {childList: true, subtree: true});
@ -224,7 +259,7 @@
* 边栏
* 目前默认所有页面调用边栏翻译
*/
let sidebarTimeOut=60; // 60秒后取消定时
let sidebarTimeOut = 60; // 60秒后取消定时
const sidebarInterval = setInterval(() => {
if ($('div[class^="sidebar"]').length === 0) {
sidebarTimeOut--;
@ -234,9 +269,9 @@
return;
}
// 边栏块标题
$('h2[class^="header"]').each((i,e)=>{
$('h2[class^="header"]').each((i, e) => {
if (sidebarDict[e.firstChild.nodeValue])
e.firstChild.nodeValue=sidebarDict[e.firstChild.nodeValue];
e.firstChild.nodeValue = sidebarDict[e.firstChild.nodeValue];
});
// 边栏人物名字
$('span[class^="menu-name"]').each((i, e) => {
@ -263,10 +298,10 @@
$('#pointsLevel')[0].firstChild.nodeValue = '[升级]';
// 手机 区域菜单
$('div[class*="areas-mobile"] span:nth-child(2)').contents().each((i,e)=>{
$('div[class*="areas-mobile"] span:nth-child(2)').contents().each((i, e) => {
console.log(e);
if(sidebarDict[e.nodeValue])
e.nodeValue=sidebarDict[e.nodeValue];
if (sidebarDict[e.nodeValue])
e.nodeValue = sidebarDict[e.nodeValue];
});
clearInterval(sidebarInterval);
@ -305,20 +340,20 @@
*/
if (window.location.href.indexOf('index.php') >= 0 &&
$('h4#skip-to-content').text().indexOf('Home') >= 0) {
let homeEvents=null;
let homeEvents = null;
$('h5.box-title').each((i, e) => {
if (!homeDict[e.firstChild.nodeValue]) return;
if(e.firstChild.nodeValue==='Latest Events') {
if (e.firstChild.nodeValue === 'Latest Events') {
homeEvents = $(e).parent().next().find('span');
}
e.firstChild.nodeValue = homeDict[e.firstChild.nodeValue];
});
$('span.divider span').each((i,e)=>{
$('span.divider span').each((i, e) => {
if (homeDict[$(e).text()])
$(e).text(homeDict[$(e).text()]);
})
});
contentTitleLinksTrans();
eventsTrans(homeEvents);
@ -327,26 +362,106 @@
}
/**
* 报纸页面
* 报纸菜单
*/
if (window.location.href.indexOf('newspaper.php') >= 0) {
$('a.newspaper-link').contents().each((i,e)=>{
if(newspaperDict[e.nodeValue])
e.nodeValue=newspaperDict[e.nodeValue];
if (window.location.href.indexOf('newspaper.php') >= 0 ||
window.location.href.indexOf('joblist.php') >= 0 ||
window.location.href.indexOf('freebies.php') >= 0 ||
window.location.href.indexOf('newspaper_class.php') >= 0 ||
window.location.href.indexOf('personals.php') >= 0 ||
window.location.href.indexOf('bounties.php') >= 0 ||
window.location.href.indexOf('comics.php') >= 0) {
let newspaperMenuOB = new MutationObserver(newspaperFunc);
const isOnBountyPage = window.location.href.indexOf('bounties.php') >= 0;
function newspaperFunc(isOBRunning = true) {
if ($('a.newspaper-link').length === 0) return;
// 报纸菜单
$('a.newspaper-link').contents().each((i, e) => {
if (newspaperDict[e.nodeValue])
e.nodeValue = newspaperDict[e.nodeValue];
});
// 公众号广告
$('div.price.left').contents()[2].nodeValue = '文章翻译请关注中文公众号Torncity';
if (isOBRunning && !isOnBountyPage) {
newspaperMenuOB.disconnect();
}
if (isOnBountyPage) {
let btInterval = setInterval(() => {
newspaperMenuOB.disconnect();
clearInterval(btInterval);
}, 1000);
}
}
if ($('a.newspaper-link').length === 0 || isOnBountyPage) {
newspaperMenuOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
} else {
newspaperFunc(false);
}
contentTitleLinksTrans();
return;
}
/**
* 页标题按钮content-title-links
* npc买房
*/
function contentTitleLinksTrans(){
$('div.content-title-links a span:nth-child(2)').each((i,e)=>{
if (titleLinksDict[$(e).text()])
$(e).text(titleLinksDict[$(e).text()]);
if (window.location.href.indexOf('estateagents.php') >= 0) {
contentTitleLinksTrans();
return;
}
/**
* properties 从玩家租买和自己的房子页面
*/
if (window.location.href.indexOf('properties.php') >= 0) {
const propertyOB=new MutationObserver(()=>{
propertyOB.disconnect();
contentTitleLinksTrans();
// 黑框标题
$('div.title-black span').each((i,e)=>{
e.firstChild.nodeValue='您想查看哪些待售房产?';
});
// 房屋汉化
$('ul.info-cont label.marker-css').contents().each((i,e)=>{
if(propertyDict[e.nodeValue])
e.nodeValue=propertyDict[e.nodeValue];
});
$('div.btn-search button').text('搜索');
// 表头信息
$('div.users-list-title div').each((i,e)=>{
if(propertyDict[$(e).text()])
$(e).text(propertyDict[$(e).text()]);
});
// 提示确认购买
/**
<span class="question">
<p>Are you sure you want to rent this Castle</p>
<p> for <span class="bold">$4,000,000</span> for a period of <span class="bold">30</span> days?</p>
<a class="t-blue bold m-left10 yes-btn c-pointer" href="#" data-id="258786" data-market="rental" data-price="4000000" i-data="i_759_415_21_14">Yes</a>
<a class="t-blue no-btn bold m-left10 c-pointer" href="#" i-data="i_793_415_16_14">No</a>
</span>
<span class="question">
<p>Are you sure you want to buy <span class="t-red bold">another</span> Private Island</p>
<p> for <span class="bold">$1,705,000,000</span>?</p>
<a class="t-blue bold m-left10 yes-btn c-pointer" href="#" data-id="3176475" data-market="selling" data-price="1705000000">Yes</a>
<a href="#" class="t-blue no-btn bold m-left10 c-pointer">No</a>
</span>
*/
$('div[class="confirm-text"] span.question').each((i,e)=>{
console.log($(e).text());
});
propertyOB.observe($('div#properties-page-wrap')[0],{childList:true,subtree:true});
});
propertyOB.observe($('div#properties-page-wrap')[0],{childList:true,subtree:true});
return;
}
/**
@ -355,8 +470,10 @@
if (window.location.href.indexOf('events.php') >= 0) {
let events;
const eventMutation = new MutationObserver(() => {
eventMutation.disconnect();
events = $('span.mail-link');
eventsTrans(events);
eventMutation.observe($('div#events-main-wrapper')[0], {childList: true, subtree: true});
});
//初始化中内容未加载
@ -371,6 +488,16 @@
}, 1000);
}
/**
* 升级页面
*/
if (window.location.href.indexOf('level2.php') >= 0) {
}
/**
* 通知翻译函数
* @param events
*/
function eventsTrans(events) {
if (events.length === 0) return;
events.each((i, e) => {
@ -776,7 +903,7 @@
* <a href="/education.php" i-data="i_199_234_363_14">The education course you were taking has ended. Please click here.</a>
*/
if ($(e).text().indexOf('edu') >= 0) {
if($(e).text().trim().split(' '))
if ($(e).text().trim().split(' '))
e.firstChild.firstChild.nodeValue = '你的课程已学习结束,请点此继续。';
return;
}
@ -848,9 +975,22 @@
}
/**
* 升级页面
* 页标题按钮content-title-links
*/
if (window.location.href.indexOf('level2.php') >= 0) {
function contentTitleLinksTrans() {
$('div.content-title-links a span:nth-child(2)').each((i, e) => {
if (titleLinksDict[$(e).text()])
$(e).text(titleLinksDict[$(e).text()]);
});
}
/**
* 页标题翻译
*/
function titleTrans(){
if($('h4#skip-to-content').length===1)
if(titleDict[$('h4#skip-to-content').text().trim()])
$('h4#skip-to-content').text(titleDict[$('h4#skip-to-content').text().trim()]);
}
})();