格式调整

This commit is contained in:
woohoo 2021-11-08 17:34:35 +08:00
parent 2ecc87e4fb
commit 213ad75f97

View File

@ -19,12 +19,12 @@
const titleDict = { const titleDict = {
'Home': '主页', 'Home': '主页',
'Estate Agents': '地产中介', 'Estate Agents': '地产中介',
'Newspaper':'报纸', 'Newspaper': '报纸',
'Job Listing':'工作列表', 'Job Listing': '工作列表',
'Freebies':'赠品', 'Freebies': '赠品',
'Classified Ads':'分类广告', 'Classified Ads': '分类广告',
'Properties':'房产', 'Properties': '房产',
'City':'城市', 'City': '城市',
}; };
const titleLinksDict = { const titleLinksDict = {
'Personal stats': '个人统计信息', 'Personal stats': '个人统计信息',
@ -167,17 +167,17 @@
'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 propertyDict = { const propertyDict = {
'Shack':'棚屋', 'Shack': '棚屋',
'Trailer': '拖车', 'Trailer': '拖车',
'Apartment': '公寓', 'Apartment': '公寓',
'Semi - Detached': '半独立式住宅', 'Semi - Detached': '半独立式住宅',
@ -206,8 +206,8 @@
'Buy': '购买', 'Buy': '购买',
'Property:': '房屋:', 'Property:': '房屋:',
'Modifications': '改造设施', 'Modifications': '改造设施',
'Upkeep:':'维护费:', 'Upkeep:': '维护费:',
'Staff:':'雇员费用:', 'Staff:': '雇员费用:',
}; };
const travelingDict = { // todo jsonify const travelingDict = { // todo jsonify
'Recruit Citizens': '招募玩家', 'Recruit Citizens': '招募玩家',
@ -234,19 +234,19 @@
"\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 const cityDict = {//todo
'Map':'地图', 'Map': '地图',
'Quick Links':'快速链接', 'Quick Links': '快速链接',
'Key of Symbols':'标志建筑', 'Key of Symbols': '标志建筑',
'Financial':'金融', 'Financial': '金融',
'Administrative':'行政', 'Administrative': '行政',
'inactive-mode1': '地图上只显示你的帮派的和临近的地盘。', 'inactive-mode1': '地图上只显示你的帮派的和临近的地盘。',
'inactive-mode2':'启用地盘将下载完整地图大约2.75mb。', 'inactive-mode2': '启用全地盘视图】将下载完整地图大约2.75mb。',
'active-mode':'全地盘视图已启用。', 'active-mode': '全地盘视图已启用。',
'ADMINISTRATIVE':'行政', 'ADMINISTRATIVE': '行政',
'City Hall':'市政厅', 'City Hall': '市政厅',
'Sort by:':'分类排序方式:', 'Sort by:': '分类排序方式:',
'Area':'地区', 'Area': '地区',
}; };
@ -409,20 +409,22 @@
/** /**
* city * city
*/ */
if (window.location.href.indexOf('city.php') >= 0){ if (window.location.href.indexOf('city.php') >= 0) {
const cityOB=new MutationObserver(cityOBInit); const cityOB = new MutationObserver(cityOBInit);
function cityOBInit(){
function cityOBInit() {
cityOB.disconnect(); cityOB.disconnect();
cityTrans(); cityTrans();
cityOB.observe($('div.content-wrapper')[0],{childList: true, subtree: true}); cityOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
} }
function cityTrans(){
function cityTrans() {
titleTrans(); titleTrans();
contentTitleLinksTrans(); contentTitleLinksTrans();
// Map or Quick Links // Map or Quick Links
$('a.ui-tabs-anchor span').each((i,e)=>{ $('a.ui-tabs-anchor span').each((i, e) => {
if(cityDict[$(e).text()]) if (cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]); $(e).text(cityDict[$(e).text()]);
}); });
@ -430,14 +432,14 @@
if (cityDict[$('div.title-black').text()]) if (cityDict[$('div.title-black').text()])
$('div.title-black').text(cityDict[$('div.title-black').text()]); $('div.title-black').text(cityDict[$('div.title-black').text()]);
// 标志建筑 6个分类 // 标志建筑 6个分类
$('ul.map-symbols span').each((i,e)=>{ $('ul.map-symbols span').each((i, e) => {
if(cityDict[$(e).text()]) if (cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]); $(e).text(cityDict[$(e).text()]);
}); });
// 地图显示模式 // 地图显示模式
// 不完全显示 文字 // 不完全显示 文字
$('span.inactive-mode').html(cityDict['inactive-mode1']+`<br>`+cityDict['inactive-mode2']); $('span.inactive-mode').html(cityDict['inactive-mode1'] + `<br>` + cityDict['inactive-mode2']);
// 完全显示 文字 // 完全显示 文字
$('span.active-mode').text(cityDict['active-mode']); $('span.active-mode').text(cityDict['active-mode']);
// 开关 // 开关
@ -445,32 +447,32 @@
$('div.off-label').text('已关闭'); $('div.off-label').text('已关闭');
// 快速链接中的分类标题 // 快速链接中的分类标题
$('li.title').each((i,e)=>{ $('li.title').each((i, e) => {
if(cityDict[$(e).text()]) if (cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]); $(e).text(cityDict[$(e).text()]);
}); });
// 快速链接中的区域 // 快速链接中的区域
$('li a[class^="font-num-"] span').each((i,e)=>{ $('li a[class^="font-num-"] span').each((i, e) => {
if(cityDict[$(e).text()]) if (cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]); $(e).text(cityDict[$(e).text()]);
}); });
// 快速链接中的分类选择 // 快速链接中的分类选择
$('div.sort-by label.marker-css').each((i,e)=>{ $('div.sort-by label.marker-css').each((i, e) => {
if(cityDict[$(e).text()]) if (cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]); $(e).text(cityDict[$(e).text()]);
}); });
// 快速链接中的sort by // 快速链接中的sort by
$('span#wai-sort-by').each((i,e)=>{ $('span#wai-sort-by').each((i, e) => {
if(cityDict[$(e).text()]) if (cityDict[$(e).text()])
$(e).text(cityDict[$(e).text()]); $(e).text(cityDict[$(e).text()]);
}); });
} }
cityTrans(); cityTrans();
cityOB.observe($('div.content-wrapper')[0],{childList: true, subtree: true}); cityOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true});
return; return;
} }
@ -482,12 +484,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;
@ -500,25 +504,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;
@ -604,7 +610,7 @@
// 房屋详情表格 // 房屋详情表格
$('div.info-block span.bold').each((i, e) => { $('div.info-block span.bold').each((i, e) => {
if (e.childElementCount===2) { if (e.childElementCount === 2) {
/** /**
* <span class="bold"> * <span class="bold">
<span class="title-laptop">On </span> <span class="title-laptop">On </span>