更新city页面

This commit is contained in:
woohoo 2021-11-08 17:31:20 +08:00
parent fe7c4012f2
commit 2ecc87e4fb

View File

@ -16,6 +16,26 @@
___win_WHTRANS.WHTRANS = true; ___win_WHTRANS.WHTRANS = true;
const $ = window.jQuery; const $ = window.jQuery;
const titleDict = {
'Home': '主页',
'Estate Agents': '地产中介',
'Newspaper':'报纸',
'Job Listing':'工作列表',
'Freebies':'赠品',
'Classified Ads':'分类广告',
'Properties':'房产',
'City':'城市',
};
const titleLinksDict = {
'Personal stats': '个人统计信息',
'Log': '日志',
'Tell your story': '说出你的故事',
'Rental Market': '租赁市场',
'Selling Market': '销售市场',
'City': '城市',
'Back to Estate Agents': '返回地产中介',
'Tutorial': '教程',
};
const sidebarDict = { // todo 从json加载 const sidebarDict = { // todo 从json加载
'Money': '现金', 'Money': '现金',
'Level': '等级', 'Level': '等级',
@ -136,16 +156,6 @@
'Intelligence': '智力 INT', 'Intelligence': '智力 INT',
'Endurance': '耐心 END', 'Endurance': '耐心 END',
}; };
const titleLinksDict = {
'Personal stats': '个人统计信息',
'Log': '日志',
'Tell your story': '说出你的故事',
'Rental Market': '租赁市场',
'Selling Market': '销售市场',
'City': '城市',
'Back to Estate Agents': '返回地产中介',
'Tutorial': '教程',
};
const newspaperDict = { const newspaperDict = {
'front page': '头版', 'front page': '头版',
'archive': '归档', 'archive': '归档',
@ -166,15 +176,6 @@
'View all':'查看所有', 'View all':'查看所有',
'Advertise here':'在此刊登广告', 'Advertise here':'在此刊登广告',
}; };
const titleDict = {
'Home': '主页',
'Estate Agents': '地产中介',
'Newspaper':'报纸',
'Job Listing':'工作列表',
'Freebies':'赠品',
'Classified Ads':'分类广告',
'Properties':'房产',
};
const propertyDict = { const propertyDict = {
'Shack':'棚屋', 'Shack':'棚屋',
'Trailer': '拖车', 'Trailer': '拖车',
@ -233,6 +234,20 @@
"\nAt one point a Dual Wield Melee course was available at Torn City College for a fee of $50,000,000, but this was discontinued when Torn's citizens realized they were effectively paying to learn how to hold two things at once.\t": "托恩城市学院一度开设了双持近战课程收费50,000,000美元但当托恩的市民意识到他们实际上是在花钱学习如何同时持有两样东西时这个课程就停止了。" "\nAt one point a Dual Wield Melee course was available at Torn City College for a fee of $50,000,000, but this was discontinued when Torn's citizens realized they were effectively paying to learn how to hold two things at once.\t": "托恩城市学院一度开设了双持近战课程收费50,000,000美元但当托恩的市民意识到他们实际上是在花钱学习如何同时持有两样东西时这个课程就停止了。"
}; };
const cityDict={//todo
'Map':'地图',
'Quick Links':'快速链接',
'Key of Symbols':'标志建筑',
'Financial':'金融',
'Administrative':'行政',
'inactive-mode1': '地图上只显示你的帮派的和临近的地盘。',
'inactive-mode2':'启用全部地盘将下载完整地图大约2.75mb。',
'active-mode':'全地盘视图已启用。',
'ADMINISTRATIVE':'行政',
'City Hall':'市政厅',
'Sort by:':'分类排序方式:',
'Area':'地区',
};
/** /**
@ -369,6 +384,7 @@
if (window.location.href.indexOf('index.php') >= 0 && if (window.location.href.indexOf('index.php') >= 0 &&
$('h4#skip-to-content').text().indexOf('Home') >= 0) { $('h4#skip-to-content').text().indexOf('Home') >= 0) {
titleTrans(); titleTrans();
contentTitleLinksTrans();
let homeEvents = null; let homeEvents = null;
@ -385,12 +401,79 @@
$(e).text(homeDict[$(e).text()]); $(e).text(homeDict[$(e).text()]);
}); });
contentTitleLinksTrans();
eventsTrans(homeEvents); eventsTrans(homeEvents);
return; return;
} }
/**
* city
*/
if (window.location.href.indexOf('city.php') >= 0){
const cityOB=new MutationObserver(cityOBInit);
function cityOBInit(){
cityOB.disconnect();
cityTrans();
cityOB.observe($('div.content-wrapper')[0],{childList: true, subtree: true});
}
function cityTrans(){
titleTrans();
contentTitleLinksTrans();
// Map or Quick Links
$('a.ui-tabs-anchor span').each((i,e)=>{
if(cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]);
});
// 标志建筑 标题
if (cityDict[$('div.title-black').text()])
$('div.title-black').text(cityDict[$('div.title-black').text()]);
// 标志建筑 6个分类
$('ul.map-symbols span').each((i,e)=>{
if(cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]);
});
// 地图显示模式
// 不完全显示 文字
$('span.inactive-mode').html(cityDict['inactive-mode1']+`<br>`+cityDict['inactive-mode2']);
// 完全显示 文字
$('span.active-mode').text(cityDict['active-mode']);
// 开关
$('div.on-label').text('已开启');
$('div.off-label').text('已关闭');
// 快速链接中的分类标题
$('li.title').each((i,e)=>{
if(cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]);
});
// 快速链接中的区域
$('li a[class^="font-num-"] span').each((i,e)=>{
if(cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]);
});
// 快速链接中的分类选择
$('div.sort-by label.marker-css').each((i,e)=>{
if(cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]);
});
// 快速链接中的sort by
$('span#wai-sort-by').each((i,e)=>{
if(cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]);
});
}
cityTrans();
cityOB.observe($('div.content-wrapper')[0],{childList: true, subtree: true});
return;
}
/** /**
* 报纸菜单 * 报纸菜单
*/ */