更新房屋购买与租赁
This commit is contained in:
parent
e47467f2bb
commit
4010b3e9db
@ -136,9 +136,13 @@
|
|||||||
'Personal stats': '个人统计信息',
|
'Personal stats': '个人统计信息',
|
||||||
'Log': '日志',
|
'Log': '日志',
|
||||||
'Tell your story': '说出你的故事',
|
'Tell your story': '说出你的故事',
|
||||||
|
'Rental Market':'租赁市场',
|
||||||
|
'Selling Market':'销售市场',
|
||||||
|
'City':'城市',
|
||||||
|
'Back to Estate Agents':'返回地产中介',
|
||||||
};
|
};
|
||||||
const newspaperDict = {
|
const newspaperDict = {
|
||||||
'front page':'报纸首页',
|
'front page': '报纸头版',
|
||||||
'archive': '归档',
|
'archive': '归档',
|
||||||
'job listing': '工作清单',
|
'job listing': '工作清单',
|
||||||
'properties': '房产信息',
|
'properties': '房产信息',
|
||||||
@ -149,6 +153,35 @@
|
|||||||
'comics': '漫画',
|
'comics': '漫画',
|
||||||
'chronicles': '纪事档案馆',
|
'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();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 飞行
|
* 飞行
|
||||||
@ -209,11 +242,13 @@
|
|||||||
|
|
||||||
const remainingTime = new MutationObserver(mutations => {
|
const remainingTime = new MutationObserver(mutations => {
|
||||||
if (!travelingDict[$('span.description')[0].firstChild.nodeValue]) return;
|
if (!travelingDict[$('span.description')[0].firstChild.nodeValue]) return;
|
||||||
|
remainingTime.disconnect();
|
||||||
/**
|
/**
|
||||||
* Torn to {dest}.
|
* Torn to {dest}.
|
||||||
* <span class="description">Torn to Zurich.</span>
|
* <span class="description">Torn to Zurich.</span>
|
||||||
*/
|
*/
|
||||||
$('span.description')[0].firstChild.nodeValue = travelingDict[$('span.description')[0].firstChild.nodeValue];
|
$('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});
|
remainingTime.observe($('span.remaining-time')[0], {childList: true, subtree: true});
|
||||||
|
|
||||||
@ -318,7 +353,7 @@
|
|||||||
$('span.divider span').each((i, e) => {
|
$('span.divider span').each((i, e) => {
|
||||||
if (homeDict[$(e).text()])
|
if (homeDict[$(e).text()])
|
||||||
$(e).text(homeDict[$(e).text()]);
|
$(e).text(homeDict[$(e).text()]);
|
||||||
})
|
});
|
||||||
|
|
||||||
contentTitleLinksTrans();
|
contentTitleLinksTrans();
|
||||||
eventsTrans(homeEvents);
|
eventsTrans(homeEvents);
|
||||||
@ -327,26 +362,106 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报纸页面
|
* 报纸菜单
|
||||||
*/
|
*/
|
||||||
if (window.location.href.indexOf('newspaper.php') >= 0) {
|
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) => {
|
$('a.newspaper-link').contents().each((i, e) => {
|
||||||
if (newspaperDict[e.nodeValue])
|
if (newspaperDict[e.nodeValue])
|
||||||
e.nodeValue = 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();
|
contentTitleLinksTrans();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页标题按钮content-title-links
|
* npc买房
|
||||||
*/
|
*/
|
||||||
function contentTitleLinksTrans(){
|
if (window.location.href.indexOf('estateagents.php') >= 0) {
|
||||||
$('div.content-title-links a span:nth-child(2)').each((i,e)=>{
|
contentTitleLinksTrans();
|
||||||
if (titleLinksDict[$(e).text()])
|
|
||||||
$(e).text(titleLinksDict[$(e).text()]);
|
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) {
|
if (window.location.href.indexOf('events.php') >= 0) {
|
||||||
let events;
|
let events;
|
||||||
const eventMutation = new MutationObserver(() => {
|
const eventMutation = new MutationObserver(() => {
|
||||||
|
eventMutation.disconnect();
|
||||||
events = $('span.mail-link');
|
events = $('span.mail-link');
|
||||||
eventsTrans(events);
|
eventsTrans(events);
|
||||||
|
eventMutation.observe($('div#events-main-wrapper')[0], {childList: true, subtree: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
//初始化中内容未加载
|
//初始化中内容未加载
|
||||||
@ -371,6 +488,16 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 升级页面
|
||||||
|
*/
|
||||||
|
if (window.location.href.indexOf('level2.php') >= 0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知翻译函数
|
||||||
|
* @param events
|
||||||
|
*/
|
||||||
function eventsTrans(events) {
|
function eventsTrans(events) {
|
||||||
if (events.length === 0) return;
|
if (events.length === 0) return;
|
||||||
events.each((i, e) => {
|
events.each((i, e) => {
|
||||||
@ -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()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user