更新header

This commit is contained in:
woohoo 2021-11-11 19:27:53 +08:00
parent ad36146166
commit 688f7244e0

View File

@ -211,6 +211,7 @@
'Apartment': '公寓',
'Semi - Detached': '半独立式住宅',
'Semi-Detached House': '半独立式住宅',
'Semi Detached house': '半独立式住宅',
'Detached House': '独立式住宅',
'Beach House': '海滩小屋',
'Chalet': '小别墅',
@ -405,42 +406,68 @@
'The current progress will be canceled and you\'ll have to start all over again.': '目前的进度将被取消,你将需要重新开始。',
};
const gymList = {
'Premier Fitness':'首席健身中心',
'Average Joes':'普通的乔伊',
"Woody's Workout Club":'伍迪的健身俱乐部',
'Premier Fitness': '首席健身',
'Average Joes': '平衡乔伊',
"Woody's Workout Club": '无敌健身',
'Beach Bods': '沙滩之恋',
'Silver Gym':'健身',
'Pour Femme':'女士专用',
'Silver Gym': '银健身',
'Pour Femme': '女士健身',
'Davies Den': '戴维斯之家',
'Global Gym': '全球健身房',
'Knuckle Heads': '手指头',
'Pioneer Fitness': '先锋健身',
'Anabolic Anomalies':'合成代谢异常',
'Anabolic Anomalies': '代谢异常',
'Core': '主干力量',
'Racing Fitness': '竞速健身',
'Complete Cardio': '完全有氧',
'Legs, Bums and Tums':'腿部、臀部和牙龈',
// 'Legs, Bums and Tums': '腿,臀和腹部',
'Legs, Bums and Tums': '下盘健身',
'Deep Burn': '深度烧伤',
'Apollo Gym':'阿波罗健身',
'Gun Shop':'枪店健身',
'Apollo Gym': '阿波罗健身',
'Gun Shop': '枪支健身',
'Force Training': '暴力训练',
"Cha Cha's":'茶茶健身',
"Cha Cha's": '茶茶健身',
'Atlas': '阿特拉斯健身房',
'Last Round': '最后一轮',
'The Edge': '临界点',
"George's":'乔治健身',
"George's": '乔治健身',
'Balboas Gym': '巴尔博斯健身房',
'Frontline Fitness': '前线健身',
'Gym 3000':'健身3000',
'Gym 3000': '健身3000',
'Mr. Isoyamas': '伊索亚玛斯先生',
'Total Rebound': '全面反弹',
'Elites': '精英健身',
'The Sports Science Lab': '运动科学实验室',
'The Jail Gym': '监狱健身房',
};
const headerDict={
"User's Name / ID":'用户名或ID',
'Faction':'帮派',
'Company':'帮派',
'Places':'地点',
'Item Market':'交易市场',
'Forum posts':'论坛',
'Help':'帮助',
'search...':'搜索',
'Search users by...':'高级用户搜索',
'Property':'住房',
'Male':'男性',
'to':'到',
'Reset':'重置',
'Search':'搜索',
'0 - 15 min':'0 - 15 分钟',
'Not':'不',
'View Log':'查看日志',
'View Profile':'查看个人资料',
'Settings':'设置',
'Server:':'服务器 ',
'Dark Mode':'',
'News Ticker':'',
'Logout':'',
};
/**
* 边栏
@ -525,12 +552,95 @@
/**
* header
*/
if($('div#header-root').length>0){}
// $('div#header-root').each((i,e)=>{
if($('div#header-root').length>0){
const headerOB=new MutationObserver(_=>{
headerOB.disconnect();
headerTrans();
headerOB.observe($('div#header-root')[0], {childList: true, subtree: true, attributes:true});
});
const headerTrans=function headerTrans() {
// 搜索内容下拉框中的文字 已选中
if (headerDict[$('div.find button.toggler.down').text()])
$('div.find button.toggler.down').text(headerDict[$('div.find button.toggler.down').text()]);
// pc端 搜索下拉框点击后的搜索类型文字
$('div.find li.item').each((i,e)=>{
if (headerDict[$(e).text()])
$(e).text(headerDict[$(e).text()]);
});
// 手机端 搜索下拉框点击后的搜索类型文字
$('li[class^="search-type-"] label').each((i,e)=>{
if (headerDict[$(e).text()])
$(e).text(headerDict[$(e).text()]);
});
// 搜索框placeholder
if(headerDict[$('input[class^="searchInput"]').attr('placeholder')])
$('input[class^="searchInput"]').attr('placeholder',
headerDict[$('input[class^="searchInput"]').attr('placeholder')]);
// 高级搜索框 search by
if (headerDict[$('div#header-root legend.title').text()])
$('div#header-root legend.title').text(headerDict[$('div#header-root legend.title').text()]);
// 高级搜索框的条件 左 键
$('ul.advancedSearchFormBody label.label').each((i,e)=>{
if(headerDict[$(e).text()])
$(e).text(headerDict[$(e).text()]);
});
// 高级搜索框的已选中
$('ul.advancedSearchFormBody div.select-wrapper button.toggler.down').each((i,e)=>{
if(headerDict[$(e).text()])
$(e).text(headerDict[$(e).text()]);
});
// 高级搜索的下拉选项
$('ul.advancedSearchFormBody li.item').each((i,e)=>{
if (headerDict[$(e).text()])
$(e).text(headerDict[$(e).text()]);
else if(propertyDict[$(e).text()])
$(e).text(propertyDict[$(e).text()]);
});
// 高级搜索的"Not"
$('ul.advancedSearchFormBody label.search-condition-not').each((i,e)=>{
if (headerDict[$(e).text()])
$(e).text(headerDict[$(e).text()]);
});
// 高级搜索的"to"
$('ul.advancedSearchFormBody label[for*="To"]').each((i,e)=>{
if (headerDict[$(e).text()])
$(e).text(headerDict[$(e).text()]);
});
// 高级搜索的reset search按钮
$('form.form-search-extend div.bottom button').each((i,e)=>{
if (headerDict[$(e).text()])
$(e).text(headerDict[$(e).text()]);
});
// 服务器时间
$('span.server-date-time').each((i,e)=>{
const d=new Date($(e).text());
if(d.format('yyyy')!=='NaN')
$(e).text()
});
// log按钮“view log”
if(headerDict[$('div.recentHistory a[class^="link"] span[class^="text"]').text().trim()])
$('div.recentHistory a[class^="link"] span[class^="text"]')
.text(headerDict[$('div.recentHistory a[class^="link"] span[class^="text"]').text().trim()]);
// 点击头像打开的菜单
$('ul.settings-menu span').each((i,e)=>{
if (headerDict[$(e).text()] && e.childNodes.length===1)
$(e).text(headerDict[$(e).text()]);
else if(e.childNodes.length===3)
if(headerDict[e.firstChild.nodeValue])
e.firstChild.nodeValue=headerDict[e.firstChild.nodeValue];
});
};
headerTrans();
headerOB.observe($('div#header-root')[0], {childList: true, subtree: true, attributes:true});
}
/**
* chatbox
*/
if($('div#chatRoot').length>0){}
if ($('div#chatRoot').length > 0) {
}
/**
* 飞行页面
@ -671,13 +781,11 @@
// console.log($(e).prev().attr('class')==='cql-gym')
if (cityDict[$(e).text()]) {
$(e).text(cityDict[$(e).text()]);
}
else if($(e).prev().attr('class')==='cql-your-property') {
} else if ($(e).prev().attr('class') === 'cql-your-property') {
if (propertyDict[$(e).text().trim().slice(5)]) {
$(e).text('你的' + propertyDict[$(e).text().trim().slice(5)]);
}
}
else if($(e).prev().attr('class')==='cql-gym') {
} else if ($(e).prev().attr('class') === 'cql-gym') {
if (gymList[$(e).text()]) {
$(e).text(gymList[$(e).text()]);
}
@ -925,7 +1033,7 @@
}
/**
* 报纸菜单
* 报纸
*/
if (window.location.href.indexOf('newspaper.php') >= 0 || window.location.href.indexOf('joblist.php') >= 0 ||
window.location.href.indexOf('freebies.php') >= 0 || window.location.href.indexOf('newspaper_class.php') >= 0 ||