更新房屋买卖租赁页面

This commit is contained in:
woohoo 2021-11-06 20:17:48 +08:00
parent 852bf471f0
commit 36096527c6

View File

@ -136,10 +136,10 @@
'Personal stats': '个人统计信息',
'Log': '日志',
'Tell your story': '说出你的故事',
'Rental Market':'租赁市场',
'Selling Market':'销售市场',
'City':'城市',
'Back to Estate Agents':'返回地产中介',
'Rental Market': '租赁市场',
'Selling Market': '销售市场',
'City': '城市',
'Back to Estate Agents': '返回地产中介',
};
const newspaperDict = {
'front page': '报纸头版',
@ -153,32 +153,32 @@
'comics': '漫画',
'chronicles': '纪事档案馆',
};
const titleDict={
'Home':'主页',
'Estate Agents':'地产中介',
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':'购买',
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': '购买',
};
const travelingDict = { // todo jsonify
'Recruit Citizens': '招募玩家',
@ -421,25 +421,26 @@
* properties 从玩家租买和自己的房子页面
*/
if (window.location.href.indexOf('properties.php') >= 0) {
const propertyOB=new MutationObserver(()=>{
const isRent = window.location.href.indexOf('rent') >= 0;
const propertyOB = new MutationObserver(() => {
propertyOB.disconnect();
titleTrans();
contentTitleLinksTrans();
// 黑框标题
$('div.title-black span').each((i,e)=>{
e.firstChild.nodeValue='您想查看哪些房产?';
$('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];
$('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()])
$('div.users-list-title div').each((i, e) => {
if (propertyDict[$(e).text()])
$(e).text(propertyDict[$(e).text()]);
});
// 提示确认购买
@ -457,15 +458,34 @@
<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>
你确定要以2750万美元租用另一个私人岛屿为期30天
*/
$('div[class="confirm-text"] span.question').each((i,e)=>{
console.log($(e).text());
$('div[class="confirm-text"] span.question').each((i, e) => {
const cost=e.children[1].innerText.trim().split(' ')[1];
const period=isRent?e.children[1].innerText.trim().split(' ')[6]:null;
const propName=e.firstElementChild.innerText.trim().split(' ').slice(8).join(' ');
const hasAnother=$(e).text().indexOf('another')>0;
// console.log(cost);
// console.log(period);
// console.log(propName);
if(hasAnother){
e.firstElementChild.firstChild.nodeValue='你确定要';
e.firstElementChild.firstChild.nodeValue+=isRent?'租用':'购买';
e.firstElementChild.childNodes[1].firstChild.nodeValue='另一个';
e.firstElementChild.childNodes[2].nodeValue=propName;
}
else{
e.firstElementChild.firstChild.nodeValue='你确定要';
e.firstElementChild.firstChild.nodeValue+=isRent?'租用':'购买';
e.firstElementChild.firstChild.nodeValue+='另一个 '+propName;
}
});
propertyOB.observe($('div#properties-page-wrap')[0],{childList:true,subtree:true});
propertyOB.observe($('div#properties-page-wrap')[0], {childList: true, subtree: true});
});
propertyOB.observe($('div#properties-page-wrap')[0],{childList:true,subtree:true});
propertyOB.observe($('div#properties-page-wrap')[0], {childList: true, subtree: true});
return;
}
@ -964,16 +984,16 @@
*/
if ($(e).text().indexOf('position') >= 0) {
let prePos, curPos;
const node3Spl=e.childNodes[2].nodeValue.split(' to ');
if(node3Spl.length===2){
prePos=node3Spl[0].slice(14,node3Spl[0].length);
curPos=node3Spl[1].slice(0,node3Spl[1].length-2);
}else{
const node3Spl = e.childNodes[2].nodeValue.split(' to ');
if (node3Spl.length === 2) {
prePos = node3Spl[0].slice(14, node3Spl[0].length);
curPos = node3Spl[1].slice(0, node3Spl[1].length - 2);
} else {
console.log('职位出现" to "');// todo
return;
}
e.firstChild.nodeValue='你在 ';
e.childNodes[2].nodeValue=' 的职位从 '+prePos+' 变为 '+curPos+'。';
e.firstChild.nodeValue = '你在 ';
e.childNodes[2].nodeValue = ' 的职位从 ' + prePos + ' 变为 ' + curPos + '。';
return;
}
@ -1003,9 +1023,9 @@
/**
* 页标题翻译
*/
function titleTrans(){
if($('h4#skip-to-content').length===1)
if(titleDict[$('h4#skip-to-content').text().trim()])
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()]);
}