更新房屋买卖租赁页面

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': '个人统计信息', 'Personal stats': '个人统计信息',
'Log': '日志', 'Log': '日志',
'Tell your story': '说出你的故事', 'Tell your story': '说出你的故事',
'Rental Market':'租赁市场', 'Rental Market': '租赁市场',
'Selling Market':'销售市场', 'Selling Market': '销售市场',
'City':'城市', 'City': '城市',
'Back to Estate Agents':'返回地产中介', 'Back to Estate Agents': '返回地产中介',
}; };
const newspaperDict = { const newspaperDict = {
'front page': '报纸头版', 'front page': '报纸头版',
@ -153,32 +153,32 @@
'comics': '漫画', 'comics': '漫画',
'chronicles': '纪事档案馆', 'chronicles': '纪事档案馆',
}; };
const titleDict={ const titleDict = {
'Home':'主页', 'Home': '主页',
'Estate Agents':'地产中介', 'Estate Agents': '地产中介',
}; };
const propertyDict={ const propertyDict = {
'Trailer':'拖车', 'Trailer': '拖车',
'Apartment':'公寓', 'Apartment': '公寓',
'Semi - Detached':'半独立式住宅', 'Semi - Detached': '半独立式住宅',
'Detached House':'独立式住宅', 'Detached House': '独立式住宅',
'Beach House':'海滩小屋', 'Beach House': '海滩小屋',
'Chalet':'小别墅', 'Chalet': '小别墅',
'Villa':'别墅', 'Villa': '别墅',
'Penthouse':'顶层公寓', 'Penthouse': '顶层公寓',
'Mansion':'豪宅', 'Mansion': '豪宅',
'Ranch':'山庄', 'Ranch': '山庄',
'Palace':'宫殿', 'Palace': '宫殿',
'Castle':'城堡', 'Castle': '城堡',
'Private Island':'私人岛屿PI', 'Private Island': '私人岛屿PI',
'Owner':'所有人', 'Owner': '所有人',
'Happiness':'快乐值', 'Happiness': '快乐值',
'Cost':'花费', 'Cost': '花费',
'Cost per Day':'平均日花费', 'Cost per Day': '平均日花费',
'Rental Period':'租期', 'Rental Period': '租期',
'Rent':'租赁', 'Rent': '租赁',
'Info':'信息', 'Info': '信息',
'Buy':'购买', 'Buy': '购买',
}; };
const travelingDict = { // todo jsonify const travelingDict = { // todo jsonify
'Recruit Citizens': '招募玩家', 'Recruit Citizens': '招募玩家',
@ -421,25 +421,26 @@
* properties 从玩家租买和自己的房子页面 * properties 从玩家租买和自己的房子页面
*/ */
if (window.location.href.indexOf('properties.php') >= 0) { 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(); propertyOB.disconnect();
titleTrans(); titleTrans();
contentTitleLinksTrans(); contentTitleLinksTrans();
// 黑框标题 // 黑框标题
$('div.title-black span').each((i,e)=>{ $('div.title-black span').each((i, e) => {
e.firstChild.nodeValue='您想查看哪些房产?'; e.firstChild.nodeValue = '您想查看哪些房产?';
}); });
// 房屋汉化 // 房屋汉化
$('ul.info-cont label.marker-css').contents().each((i,e)=>{ $('ul.info-cont label.marker-css').contents().each((i, e) => {
if(propertyDict[e.nodeValue]) if (propertyDict[e.nodeValue])
e.nodeValue=propertyDict[e.nodeValue]; e.nodeValue = propertyDict[e.nodeValue];
}); });
$('div.btn-search button').text('搜索'); $('div.btn-search button').text('搜索');
// 表头信息 // 表头信息
$('div.users-list-title div').each((i,e)=>{ $('div.users-list-title div').each((i, e) => {
if(propertyDict[$(e).text()]) if (propertyDict[$(e).text()])
$(e).text(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 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> <a href="#" class="t-blue no-btn bold m-left10 c-pointer">No</a>
</span> </span>
你确定要以2750万美元租用另一个私人岛屿为期30天
*/ */
$('div[class="confirm-text"] span.question').each((i,e)=>{ $('div[class="confirm-text"] span.question').each((i, e) => {
console.log($(e).text()); 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; return;
} }
@ -964,16 +984,16 @@
*/ */
if ($(e).text().indexOf('position') >= 0) { if ($(e).text().indexOf('position') >= 0) {
let prePos, curPos; let prePos, curPos;
const node3Spl=e.childNodes[2].nodeValue.split(' to '); const node3Spl = e.childNodes[2].nodeValue.split(' to ');
if(node3Spl.length===2){ if (node3Spl.length === 2) {
prePos=node3Spl[0].slice(14,node3Spl[0].length); prePos = node3Spl[0].slice(14, node3Spl[0].length);
curPos=node3Spl[1].slice(0,node3Spl[1].length-2); curPos = node3Spl[1].slice(0, node3Spl[1].length - 2);
}else{ } else {
console.log('职位出现" to "');// todo console.log('职位出现" to "');// todo
return; return;
} }
e.firstChild.nodeValue='你在 '; e.firstChild.nodeValue = '你在 ';
e.childNodes[2].nodeValue=' 的职位从 '+prePos+' 变为 '+curPos+'。'; e.childNodes[2].nodeValue = ' 的职位从 ' + prePos + ' 变为 ' + curPos + '。';
return; return;
} }
@ -1003,9 +1023,9 @@
/** /**
* 页标题翻译 * 页标题翻译
*/ */
function titleTrans(){ function titleTrans() {
if($('h4#skip-to-content').length===1) if ($('h4#skip-to-content').length === 1)
if(titleDict[$('h4#skip-to-content').text().trim()]) if (titleDict[$('h4#skip-to-content').text().trim()])
$('h4#skip-to-content').text(titleDict[$('h4#skip-to-content').text().trim()]); $('h4#skip-to-content').text(titleDict[$('h4#skip-to-content').text().trim()]);
} }