更新主页部分
更新版本号,发布
This commit is contained in:
parent
810f8b070b
commit
f01b969c08
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Torn翻译
|
// @name Torn翻译
|
||||||
// @namespace WOOH
|
// @namespace WOOH
|
||||||
// @version 0.1.1104a
|
// @version 0.1.1104b
|
||||||
// @description UI翻译
|
// @description UI翻译
|
||||||
// @author Woohoo-
|
// @author Woohoo-
|
||||||
// @match https://www.torn.com/*
|
// @match https://www.torn.com/*
|
||||||
@ -20,18 +20,58 @@
|
|||||||
$('.travelling h4').length !== 0) {
|
$('.travelling h4').length !== 0) {
|
||||||
const travelingDict = { // todo jsonify
|
const travelingDict = { // todo jsonify
|
||||||
'Recruit Citizens': '招募玩家',
|
'Recruit Citizens': '招募玩家',
|
||||||
|
'Events': '事件',
|
||||||
'Torn to London.': '正在飞往英国伦敦(London)。',
|
'Torn to London.': '正在飞往英国伦敦(London)。',
|
||||||
'London to Torn.': '正从英国伦敦(London)回城。', // todo 所有目的地
|
'London to Torn.': '正从英国伦敦(London)回城。', // todo 所有目的地
|
||||||
'\nRemaining Flight Time -\n': ' 剩余时间 - ',
|
'\nRemaining Flight Time -\n': ' 剩余时间 - ',
|
||||||
|
'Travel Home': "回国",
|
||||||
|
'Rehabilitation': "戒毒康复",
|
||||||
|
'People': "用户列表"
|
||||||
};
|
};
|
||||||
|
//界面tips
|
||||||
|
const tipsDict = {
|
||||||
|
'\nAccording to the Economist Intelligence Unit\'s Quality of Life Index, Switzerland is the second best place in the world to be born, after Denmark. Torn ranked 224th, despite there being only 194 recognised nations in the world.\t': "根据经济学人信息部提供的生活质量指数,瑞士是世界上第二个最适合出生的地方,仅次于丹麦。尽管世界上只有194个公认的国家,但托恩却排名第224位。",
|
||||||
|
|
||||||
|
'\nThe opportunities for employment in Torn are wide and varied, from jobs in the zoo and the meat warehouse through to fantastic openings at the strip club - a description rarely used to refer to those who work there.\t':
|
||||||
|
"托恩的就业机会广泛而多样,从动物园和肉类仓库的工作,到脱衣舞俱乐部的奇妙开场--这是一个很少用来形容在那里工作的人的描述。",
|
||||||
|
|
||||||
|
'\nOne of the main requirements for a wedding to take place in Torn is the procurement of a ring. You may either purchase one from the Jewellery Store, or you can choose the more romantic option of stealing one, which requires far more effort if you think about it.\t': "在托恩举行婚礼的主要要求之一就是购买一枚戒指。你可以从珠宝店购买,也可以选择在偷窃戒指中选择一种很浪漫的方式,但是你冷静下来想想的话,这也是需要付出更大代价的。",
|
||||||
|
|
||||||
|
"\nDespite having no discernible court system Torn still employs several thousand people within its Judicial Services department. Nobody knows what the hell these people do all day, but if we had to guess, we'd say Solitaire.\t": "尽管没有明显的法院系统,托恩仍然在其司法服务部门雇用了几千人。没有人知道这些人整天都在做什么,但如果我们必须猜测,我们会说是接龙。",
|
||||||
|
|
||||||
|
"\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美元,但当托恩的市民意识到他们实际上是在花钱学习如何同时持有两样东西时,这个课程就停止了。"
|
||||||
|
};
|
||||||
|
|
||||||
|
//如果在飞行页面
|
||||||
|
if ($('span.remaining-time')[0] != null) {
|
||||||
$('#skip-to-content')[0].firstChild.nodeValue += '飞行中';
|
$('#skip-to-content')[0].firstChild.nodeValue += '飞行中';
|
||||||
|
|
||||||
|
//飞行提示小文章
|
||||||
|
//document.querySelector("#mainContainer > div.content-wrapper.logged-out.left.autumn.travelling > div.travel-agency-travelling > div.popup-info > div.inner-popup").textContent = '\nOne of the main requirements for a wedding to take place in Torn is the procurement of a ring. You may either purchase one from the Jewellery Store, or you can choose the more romantic option of stealing one, which requires far more effort if you think about it.\t'
|
||||||
|
|
||||||
|
document.querySelector("#mainContainer > div.content-wrapper.logged-out.left.autumn.travelling > div.travel-agency-travelling > div.popup-info > div.inner-popup").textContent =
|
||||||
|
tipsDict[document.querySelector("#mainContainer > div.content-wrapper.logged-out.left.autumn.travelling > div.travel-agency-travelling > div.popup-info > div.inner-popup").textContent];
|
||||||
|
|
||||||
// eg. Remaining Flight Time -
|
// eg. Remaining Flight Time -
|
||||||
$('span.remaining-time')[0].firstChild.nodeValue = travelingDict[$('span.remaining-time')[0].firstChild.nodeValue];
|
$('span.remaining-time')[0].firstChild.nodeValue = travelingDict[$('span.remaining-time')[0].firstChild.nodeValue];
|
||||||
|
|
||||||
$("#recruit-citizens")[0].firstChild.nodeValue = travelingDict[$("#recruit-citizens")[0].firstChild.nodeValue];
|
$("#recruit-citizens")[0].firstChild.nodeValue = travelingDict[$("#recruit-citizens")[0].firstChild.nodeValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Events
|
||||||
|
$("#events")[0].firstChild.nodeValue = travelingDict[$("#events")[0].firstChild.nodeValue]
|
||||||
|
|
||||||
// eg. Torn to London.
|
// eg. Torn to London.
|
||||||
|
if ($("#travel-home")[0] != null) {
|
||||||
|
$("#travel-home")[0].firstChild.nodeValue = travelingDict[$("#travel-home")[0].firstChild.nodeValue];
|
||||||
|
$("#rehab")[0].firstChild.nodeValue = travelingDict[$("#rehab")[0].firstChild.nodeValue];//todo 在瑞士就加rehab
|
||||||
|
$("#people")[0].firstChild.nodeValue = travelingDict[$("#people")[0].firstChild.nodeValue];
|
||||||
|
}
|
||||||
|
|
||||||
new MutationObserver(mutations => {
|
new MutationObserver(mutations => {
|
||||||
$('span.description')[0].firstChild.nodeValue = travelingDict[$('span.description')[0].firstChild.nodeValue];
|
$('span.description')[0].firstChild.nodeValue = travelingDict[$('span.description')[0].firstChild.nodeValue];
|
||||||
}).observe($('span.description')[0], {attributes: true, childList: true, subtree: true});
|
}).observe($('span.description')[0], {attributes: true, childList: true, subtree: true});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +136,8 @@
|
|||||||
$('#pointsMerits')[0].firstChild.nodeValue = '[使用]';
|
$('#pointsMerits')[0].firstChild.nodeValue = '[使用]';
|
||||||
if ($('#pointsPoints').length !== 0)
|
if ($('#pointsPoints').length !== 0)
|
||||||
$('#pointsPoints')[0].firstChild.nodeValue = '[使用]';
|
$('#pointsPoints')[0].firstChild.nodeValue = '[使用]';
|
||||||
|
if ($('#pointsLevel').length !== 0)
|
||||||
|
$('#pointsLevel')[0].firstChild.nodeValue = '[升级]';
|
||||||
|
|
||||||
clearInterval(sidebarInterval);
|
clearInterval(sidebarInterval);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@ -139,11 +181,39 @@
|
|||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主页
|
* 主页 todo
|
||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
const homeDict = {
|
||||||
|
'General Information': '基本信息',
|
||||||
|
'Property Information': '房产信息',
|
||||||
|
'Battle Stats': '战斗能力(BS)',
|
||||||
|
'Working Stats': '工作能力(WS)',
|
||||||
|
'Equipped Armor': '已装防具',
|
||||||
|
'Equipped Weapons': '已装武器',
|
||||||
|
'Skill Levels': '技能等级',
|
||||||
|
'Latest Messages': '近期信息',
|
||||||
|
'Job Information': '工作信息',
|
||||||
|
'Latest Events': '近期通知',
|
||||||
|
'Latest Attacks': '近期攻击',
|
||||||
|
'Faction Information': '帮派信息',
|
||||||
|
'Criminal Record': '犯罪记录',
|
||||||
|
'Personal Perks': '个人加成',
|
||||||
|
};
|
||||||
|
let homeEvents=null;
|
||||||
|
|
||||||
|
$('h5.box-title').each((i, e) => {
|
||||||
|
if (!homeDict[e.firstChild.nodeValue]) return;
|
||||||
|
if(e.firstChild.nodeValue==='Latest Events') {
|
||||||
|
homeEvents = $(e).parent().next().find('span');
|
||||||
|
//console.log($(e).parent().next().children().children().children().find('span'));
|
||||||
|
//console.log($(e).parent().next().find('span'));
|
||||||
|
}
|
||||||
|
e.firstChild.nodeValue = homeDict[e.firstChild.nodeValue];
|
||||||
|
});
|
||||||
|
|
||||||
|
eventsTrans(homeEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -151,10 +221,10 @@
|
|||||||
* 通知
|
* 通知
|
||||||
*/
|
*/
|
||||||
if (window.location.href.indexOf('events.php') >= 0) {
|
if (window.location.href.indexOf('events.php') >= 0) {
|
||||||
let events;// = $('span.mail-link');
|
let events;
|
||||||
const eventMutation = new MutationObserver(() => {
|
const eventMutation = new MutationObserver(() => {
|
||||||
events = $('span.mail-link');
|
events = $('span.mail-link');
|
||||||
eventsTrans();
|
eventsTrans(events);
|
||||||
});
|
});
|
||||||
|
|
||||||
//初始化中内容未加载
|
//初始化中内容未加载
|
||||||
@ -165,12 +235,14 @@
|
|||||||
}
|
}
|
||||||
clearInterval(eventInterval);
|
clearInterval(eventInterval);
|
||||||
eventMutation.observe($('div#events-main-wrapper')[0], {childList: true, subtree: true});
|
eventMutation.observe($('div#events-main-wrapper')[0], {childList: true, subtree: true});
|
||||||
eventsTrans();
|
eventsTrans(events);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
function eventsTrans() {
|
function eventsTrans(events) {
|
||||||
if (events.length === 0) return;
|
if (events.length === 0) return;
|
||||||
events.each((i, e) => {
|
events.each((i, e) => {
|
||||||
|
//console.log($(e).text());
|
||||||
/**
|
/**
|
||||||
* 赛车
|
* 赛车
|
||||||
* You finished 5th in the Hammerhead race. Your best lap was 01:14.87.
|
* You finished 5th in the Hammerhead race. Your best lap was 01:14.87.
|
||||||
@ -259,11 +331,10 @@
|
|||||||
* You were sent a Diamond Bladed Knife from charapower
|
* You were sent a Diamond Bladed Knife from charapower
|
||||||
*/
|
*/
|
||||||
if ($(e).text().indexOf('sent') >= 0) {
|
if ($(e).text().indexOf('sent') >= 0) {
|
||||||
|
if ($(e).text().indexOf('someone') >= 0) return; // todo 收到匿名发来的物资
|
||||||
const isWithMsg = $(e).text().indexOf('message') >= 0;
|
const isWithMsg = $(e).text().indexOf('message') >= 0;
|
||||||
const msg = isWithMsg ? $(e).text().split(' with the message: ')[1] : null;
|
const msg = isWithMsg ? $(e).text().split(' with the message: ')[1] : null;
|
||||||
const wordsList = e.firstChild.nodeValue.split(' ');
|
const wordsList = e.firstChild.nodeValue.split(' ');
|
||||||
console.log(wordsList);
|
|
||||||
// 发送的数量
|
// 发送的数量
|
||||||
let number;
|
let number;
|
||||||
if (wordsList[3] === 'some' || wordsList[3] === 'a') // 收到一个可数的不可堆叠或不可数的东西
|
if (wordsList[3] === 'some' || wordsList[3] === 'a') // 收到一个可数的不可堆叠或不可数的东西
|
||||||
@ -273,7 +344,6 @@
|
|||||||
else
|
else
|
||||||
number = null;
|
number = null;
|
||||||
const item = number === null ? wordsList.slice(3, wordsList.length - 2) : wordsList.slice(4, wordsList.length - 2);
|
const item = number === null ? wordsList.slice(3, wordsList.length - 2) : wordsList.slice(4, wordsList.length - 2);
|
||||||
console.log(item);
|
|
||||||
|
|
||||||
// 你收到了来自someone的【数量】物品,附带信息:xxx。
|
// 你收到了来自someone的【数量】物品,附带信息:xxx。
|
||||||
e.firstChild.nodeValue = '你收到了来自 ';
|
e.firstChild.nodeValue = '你收到了来自 ';
|
||||||
@ -392,7 +462,7 @@
|
|||||||
*/
|
*/
|
||||||
if ($(e).text().indexOf('mugged') >= 0) {
|
if ($(e).text().indexOf('mugged') >= 0) {
|
||||||
const spl = $(e).text().trim().split(' ');
|
const spl = $(e).text().trim().split(' ');
|
||||||
if (spl.length > 7) return; // 多人运动暂时跳过
|
if (spl.length > 7) return; // todo 多人运动暂时跳过
|
||||||
const money = spl[spl.length - 2];
|
const money = spl[spl.length - 2];
|
||||||
if (spl[0] === 'Someone') { // 被匿名mug
|
if (spl[0] === 'Someone') { // 被匿名mug
|
||||||
e.firstChild.nodeValue = '有人打劫了你 ' + money + ' [';
|
e.firstChild.nodeValue = '有人打劫了你 ' + money + ' [';
|
||||||
@ -506,12 +576,47 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(e).text().indexOf('organized crime') >= 0) { // oc开启
|
/**
|
||||||
|
* oc开启
|
||||||
|
* You have been selected by
|
||||||
|
* <a href="profiles.php?XID=2537542" class="h" i-data="i_346_233_63_14">endlessway</a>
|
||||||
|
* to participate in an organized crime. You, along with 2 others will make up the team to
|
||||||
|
* <a href="organisedcrimes.php" i-data="i_312_248_107_14">make a bomb threat</a>
|
||||||
|
* in 72 hours.
|
||||||
|
*
|
||||||
|
* 你被endlessway选中参与一项有组织的犯罪活动。你和另外两个人将组成一个团队,在72小时内进行炸弹威胁。
|
||||||
|
*/
|
||||||
|
if ($(e).text().indexOf('organized crime') >= 0) {
|
||||||
|
const time = e.childNodes[4].nodeValue.split(' ')[2];
|
||||||
|
const OCName = e.childNodes[3].firstChild.nodeValue; // todo 汉化
|
||||||
|
let others = e.childNodes[2].nodeValue.split(' ')[10];
|
||||||
|
others = others === 'one' ? '1' : others;
|
||||||
|
e.firstChild.nodeValue = '你被 ';
|
||||||
|
e.childNodes[2].nodeValue = ' 选中参与一项组织犯罪(OC)。你和另外' + others + '人将组成一个团队,在' + time + '小时后进行';
|
||||||
|
e.childNodes[4].nodeValue = '。';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($(e).text().indexOf('You and your team') >= 0) { // oc结束
|
|
||||||
|
/**
|
||||||
|
* oc结束
|
||||||
|
* - You and your team tried to make a bomb threat but failed! View the details
|
||||||
|
* - You and your team successfully blackmailed someone! View the details
|
||||||
|
* <a href="organisedcrimes.php?step=log&ID=9404419" i-data="i_595_234_24_14">here</a>
|
||||||
|
* !
|
||||||
|
*/
|
||||||
|
if ($(e).text().indexOf('You and your team') >= 0) {
|
||||||
|
let rs = '成功';
|
||||||
|
let OCName = e.firstChild.nodeValue.slice(31, -19);
|
||||||
|
if ($(e).text().indexOf('fail') >= 0) {
|
||||||
|
rs = '失败';
|
||||||
|
OCName = e.firstChild.nodeValue.slice(27, -30);
|
||||||
|
}
|
||||||
|
e.firstChild.nodeValue = '你和团队的组织犯罪(OC)' + OCName + ' ' + rs + '了!';
|
||||||
|
e.childNodes[1].firstChild.nodeValue = '点此查看详情';
|
||||||
|
e.childNodes[2].nodeValue = '!';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bust 捞人
|
* bust 捞人
|
||||||
* <a href="profiles.php?XID=2208715">Spookyt</a>
|
* <a href="profiles.php?XID=2208715">Spookyt</a>
|
||||||
@ -526,6 +631,37 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保释
|
||||||
|
*/
|
||||||
|
if ($(e).text().indexOf('bailed') >= 0) {
|
||||||
|
const cost = e.childNodes[1].nodeValue.trim().slice(27, -1);
|
||||||
|
e.childNodes[1].nodeValue = ' 花费 ' + cost + ' 保释了你。';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人物升级
|
||||||
|
* <span class="mail-link" id="event-865162632">Congratulations! You upgraded your level to 31!
|
||||||
|
</span>
|
||||||
|
*/
|
||||||
|
if ($(e).text().indexOf('upgraded') >= 0) {
|
||||||
|
const level = e.firstChild.nodeValue.slice(44, -2);
|
||||||
|
e.firstChild.nodeValue = '恭喜!你已升至' + level + '级!';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开新健身房
|
||||||
|
* <span class="mail-link" id="event-855834754">You have successfully purchased membership in Deep Burn.</span>
|
||||||
|
* 你已成功购买Deep Burn的健身房会员卡。
|
||||||
|
*/
|
||||||
|
if ($(e).text().indexOf('membership') >= 0) {
|
||||||
|
const gymName = e.firstChild.nodeValue.slice(46, -2);
|
||||||
|
e.firstChild.nodeValue = '你已成功购买 ' + gymName + ' 的健身房会员卡。';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* new virus病毒
|
* new virus病毒
|
||||||
* You completed the Simple Virus which is now in your inventory. You can begin programming a new virus
|
* You completed the Simple Virus which is now in your inventory. You can begin programming a new virus
|
||||||
@ -545,8 +681,25 @@
|
|||||||
if ($(e).text().indexOf('doorstep') >= 0) { // 蓝星奖励
|
if ($(e).text().indexOf('doorstep') >= 0) { // 蓝星奖励
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加入帮派结果
|
||||||
|
*/
|
||||||
|
if ($(e).text().indexOf('join the faction') >= 0) {
|
||||||
|
const virusName = e.childNodes[2].nodeValue.trim().split(' ')[2];
|
||||||
|
const rsDict = {'accepted': '通过', 'declined': '拒绝',};
|
||||||
|
e.firstChild.nodeValue = '加入帮派 ';
|
||||||
|
e.childNodes[2].nodeValue = ' 的申请已' + rsDict[virusName] + '。';
|
||||||
|
return;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 升级页面
|
||||||
|
*/
|
||||||
|
if (window.location.href.indexOf('level2.php') >= 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Torn翻译
|
// @name Torn翻译
|
||||||
// @namespace WOOH
|
// @namespace WOOH
|
||||||
// @version 0.1.1104a
|
// @version 0.1.1104b
|
||||||
// @description UI翻译
|
// @description UI翻译
|
||||||
// @author Woohoo-
|
// @author Woohoo-
|
||||||
// @match https://www.torn.com/*
|
// @match https://www.torn.com/*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user