Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
AshleyLiuuuuu 2021-11-08 18:08:30 +08:00
commit ade9757b37

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': '归档',
@ -153,28 +163,21 @@
'properties': '房产', 'properties': '房产',
'freebies': '赠品', 'freebies': '赠品',
'classified ads': '广告', 'classified ads': '广告',
'personals': '情感', 'personals': '交友',
'bounties': '悬赏', 'bounties': '悬赏',
'comics': '漫画', 'comics': '漫画',
'chronicles': '纪事档案馆', 'chronicles': '纪事档案馆',
'TCSE Market Index':'TCSE 股票指数', 'TCSE Market Index': 'TCSE 股票指数',
'Weekly bazaars':'每周小店', 'Weekly bazaars': '每周小店',
'LOTTERY':'幸运彩票', 'LOTTERY': '幸运彩票',
'BOUNTIES':'精选悬赏', 'BOUNTIES': '精选悬赏',
'TC PERSONALS':'托恩情感', 'TC PERSONALS': '托恩交友',
'Why not visit our sponsor?':'为什么不访问我们的赞助商呢?', 'Why not visit our sponsor?': '为什么不访问我们的赞助商呢?',
'View all':'查看所有', 'View all': '查看所有',
'Advertise here':'在此刊登广告', 'Advertise here': '在此刊登广告',
};
const titleDict = {
'Home': '主页',
'Estate Agents': '地产中介',
'Newspaper':'报纸',
'Job Listing':'工作列表',
'Freebies':'赠品',
'Classified Ads':'分类广告',
}; };
const propertyDict = { const propertyDict = {
'Shack': '棚屋',
'Trailer': '拖车', 'Trailer': '拖车',
'Apartment': '公寓', 'Apartment': '公寓',
'Semi - Detached': '半独立式住宅', 'Semi - Detached': '半独立式住宅',
@ -197,11 +200,14 @@
'Cost:': '花费:', 'Cost:': '花费:',
'Cost per Day': '平均日花费', 'Cost per Day': '平均日花费',
'Rental Period': '租期', 'Rental Period': '租期',
'Rental period:': '租期',
'Rent': '租赁', 'Rent': '租赁',
'Info': '信息', 'Info': '信息',
'Buy': '购买', 'Buy': '购买',
'Property:': '房屋:', 'Property:': '房屋:',
'Modifications': '改造设施', 'Modifications': '改造设施',
'Upkeep:': '维护费:',
'Staff:': '雇员费用:',
}; };
const travelingDict = { // todo jsonify const travelingDict = { // todo jsonify
'Recruit Citizens': '招募玩家', 'Recruit Citizens': '招募玩家',
@ -228,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 +389,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;
@ -408,12 +429,81 @@
$(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;
}
/** /**
* 报纸菜单 * 报纸菜单
*/ */
@ -422,12 +512,14 @@
window.location.href.indexOf('personals.php') >= 0 || window.location.href.indexOf('bounties.php') >= 0 || window.location.href.indexOf('personals.php') >= 0 || window.location.href.indexOf('bounties.php') >= 0 ||
window.location.href.indexOf('comics.php') >= 0) { window.location.href.indexOf('comics.php') >= 0) {
const newspaperOB = new MutationObserver(newspaperOBInit); const newspaperOB = new MutationObserver(newspaperOBInit);
function newspaperOBInit(){
function newspaperOBInit() {
newspaperOB.disconnect(); newspaperOB.disconnect();
newspaperTrans(); newspaperTrans();
newspaperOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); newspaperOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
} }
function newspaperTrans(){
function newspaperTrans() {
titleTrans(); titleTrans();
contentTitleLinksTrans(); contentTitleLinksTrans();
if ($('a.newspaper-link').length === 0) return; if ($('a.newspaper-link').length === 0) return;
@ -440,25 +532,27 @@
$('div.price.left').contents()[2].nodeValue = '文章翻译请关注中文公众号Torncity'; $('div.price.left').contents()[2].nodeValue = '文章翻译请关注中文公众号Torncity';
// 日期翻译 // 日期翻译
const date = new Date($('span.date-label').text()); const date = new Date($('span.date-label').text());
if(date.format('yyyy')!=='NaN') if (date.format('yyyy') !== 'NaN')
$('span.date-label').text(date.format('yyyy年MM月dd日')); $('span.date-label').text(date.format('yyyy年MM月dd日'));
// 右边栏 // 右边栏
$('div[class^="sideCont"] [class^="title"]').contents().each((i, e) => { $('div[class^="sideCont"] [class^="title"]').contents().each((i, e) => {
if(newspaperDict[e.nodeValue]) if (newspaperDict[e.nodeValue])
e.nodeValue=newspaperDict[e.nodeValue]; e.nodeValue = newspaperDict[e.nodeValue];
}); });
// 彩票信息 // 彩票信息
$('span[class^="winner"]').each((i,e)=>{}); $('span[class^="winner"]').each((i, e) => {
});
// 底部链接 // 底部链接
// Why not visit our sponsor? // Why not visit our sponsor?
if(newspaperDict[$('div.link-left').text().trim()]) if (newspaperDict[$('div.link-left').text().trim()])
$('div.link-left').text(newspaperDict[$('div.link-left').text().trim()]); $('div.link-left').text(newspaperDict[$('div.link-left').text().trim()]);
// View all | Advertise here // View all | Advertise here
$('div.link-right a').contents().each((i,e)=>{ $('div.link-right a').contents().each((i, e) => {
if(newspaperDict[e.nodeValue.trim()]) if (newspaperDict[e.nodeValue.trim()])
e.nodeValue=newspaperDict[e.nodeValue.trim()]; e.nodeValue = newspaperDict[e.nodeValue.trim()];
}) })
} }
newspaperTrans(); newspaperTrans();
newspaperOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); newspaperOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
return; return;
@ -544,8 +638,7 @@
// 房屋详情表格 // 房屋详情表格
$('div.info-block span.bold').each((i, e) => { $('div.info-block span.bold').each((i, e) => {
// 2 6 10 14 18 22 26 30 ... if (e.childElementCount === 2) {
if (i % 4 === 2) {
/** /**
* <span class="bold"> * <span class="bold">
<span class="title-laptop">On </span> <span class="title-laptop">On </span>
@ -563,6 +656,10 @@
e.firstChild.nodeValue = propertyDict[e.firstChild.nodeValue.trim()]; e.firstChild.nodeValue = propertyDict[e.firstChild.nodeValue.trim()];
} }
}); });
$('div.rental-period span.bold').each((i, e) => {
if (propertyDict[e.firstChild.nodeValue.trim()])
e.firstChild.nodeValue = propertyDict[e.firstChild.nodeValue.trim()];
});
// 窄边 cost happy // 窄边 cost happy
$('span.title-laptop.bold').each((i, e) => { $('span.title-laptop.bold').each((i, e) => {
if (propertyDict[$(e).text().trim()]) if (propertyDict[$(e).text().trim()])