更新版本号,发布更新
This commit is contained in:
parent
c8c97ee75d
commit
a1acb729bc
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Torn翻译
|
// @name Torn翻译
|
||||||
// @namespace WOOH
|
// @namespace WOOH
|
||||||
// @version 0.1
|
// @version 0.1.1104a
|
||||||
// @description UI翻译
|
// @description UI翻译
|
||||||
// @author Woohoo-
|
// @author Woohoo-
|
||||||
// @match https://www.torn.com/*
|
// @match https://www.torn.com/*
|
||||||
@ -12,7 +12,6 @@
|
|||||||
!(function () {
|
!(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
const $ = window.jQuery;
|
const $ = window.jQuery;
|
||||||
let invervalID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 飞行
|
* 飞行
|
||||||
@ -261,30 +260,30 @@
|
|||||||
*/
|
*/
|
||||||
if ($(e).text().indexOf('sent') >= 0) {
|
if ($(e).text().indexOf('sent') >= 0) {
|
||||||
|
|
||||||
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);
|
console.log(wordsList);
|
||||||
// 发送的数量
|
// 发送的数量
|
||||||
let number;
|
let number;
|
||||||
if(wordsList[3]==='some'||wordsList[3]==='a') // 收到一个可数的不可堆叠或不可数的东西
|
if (wordsList[3] === 'some' || wordsList[3] === 'a') // 收到一个可数的不可堆叠或不可数的东西
|
||||||
number='1x';
|
number = '1x';
|
||||||
else if(wordsList[3][wordsList[3].length-1]==='x') // 收到可数的可堆叠东西
|
else if (wordsList[3][wordsList[3].length - 1] === 'x') // 收到可数的可堆叠东西
|
||||||
number=wordsList[3];
|
number = wordsList[3];
|
||||||
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);
|
console.log(item);
|
||||||
|
|
||||||
// 你收到了来自someone的【数量】物品,附带信息:xxx。
|
// 你收到了来自someone的【数量】物品,附带信息:xxx。
|
||||||
e.firstChild.nodeValue='你收到了来自 ';
|
e.firstChild.nodeValue = '你收到了来自 ';
|
||||||
e.childNodes[2].nodeValue=' 的 ';
|
e.childNodes[2].nodeValue = ' 的 ';
|
||||||
if(number)
|
if (number)
|
||||||
e.childNodes[2].nodeValue+=number
|
e.childNodes[2].nodeValue += number
|
||||||
e.childNodes[2].nodeValue+=' '+item;
|
e.childNodes[2].nodeValue += ' ' + item;
|
||||||
if(isWithMsg)
|
if (isWithMsg)
|
||||||
e.childNodes[2].nodeValue+=',附带信息:'+msg;
|
e.childNodes[2].nodeValue += ',附带信息:' + msg;
|
||||||
e.childNodes[2].nodeValue+='。';
|
e.childNodes[2].nodeValue += '。';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -296,49 +295,202 @@
|
|||||||
* e.childNodes[1].nodeValue
|
* e.childNodes[1].nodeValue
|
||||||
*/
|
*/
|
||||||
if ($(e).text().indexOf('bazaar') >= 0) {
|
if ($(e).text().indexOf('bazaar') >= 0) {
|
||||||
const bazEN=e.childNodes[1].nodeValue;
|
const bazEN = e.childNodes[1].nodeValue;
|
||||||
const spl=bazEN.split(' ');
|
const spl = bazEN.split(' ');
|
||||||
|
|
||||||
const num=spl[2];
|
const num = spl[2];
|
||||||
const item=spl.slice(4,spl.indexOf('from')).join(' ');
|
const item = spl.slice(4, spl.indexOf('from')).join(' ');
|
||||||
const money=spl[spl.length-1].replace('.','');
|
const money = spl[spl.length - 1].replace('.', '');
|
||||||
|
|
||||||
e.childNodes[1].nodeValue=' 花费 '+money+' 从你的 bazaar 买了 '+num+' 个 '+' '+item+'。';
|
e.childNodes[1].nodeValue = ' 花费 ' + money + ' 从你的 bazaar 买了 ' + num + ' 个 ' + ' ' + item + '。';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(e).text().indexOf('trade') >= 0) { // 交易
|
/**
|
||||||
if ($(e).text().indexOf('You must now accept') >= 0) { // 接受交易
|
* 交易
|
||||||
|
*/
|
||||||
|
if ($(e).text().indexOf('trade') >= 0) {
|
||||||
|
const PCHC = '点此继续';
|
||||||
|
if ($(e).text().indexOf('You must now accept') >= 0) {
|
||||||
|
/**
|
||||||
|
* 接受交易
|
||||||
|
* <a href="profiles.php?XID=2703642">JNZR</a>
|
||||||
|
* has accepted the trade titled "g't". You must now accept to finalize it.
|
||||||
|
* <a href="trade.php#step=view&ID=6567058" i-data="i_598_654_156_14">Please click here to continue.</a>
|
||||||
|
* JNZR已经接受了名为 "g't "的交易。你现在必须接受以完成它。
|
||||||
|
*/
|
||||||
|
const firstWords = e.childNodes[1].nodeValue.split('. You must')[0];
|
||||||
|
const tradeName = firstWords.slice(31, firstWords.length);
|
||||||
|
e.childNodes[1].nodeValue = ' 已经接受了名为 ' + tradeName + ' 的交易。你现在必须接受以完成它。';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = PCHC;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($(e).text().indexOf('expired') >= 0) { // 交易过期
|
if ($(e).text().indexOf('expired') >= 0) {
|
||||||
|
/**
|
||||||
|
* 交易过期
|
||||||
|
* The trade with
|
||||||
|
* <a href="profiles.php?XID=2696209" i-data="i_278_269_71_14">sabrina_devil</a>
|
||||||
|
* has expired
|
||||||
|
* 与sabrina_devil的交易已经过期。
|
||||||
|
*/
|
||||||
|
e.firstChild.nodeValue = '与 ';
|
||||||
|
e.childNodes[2].nodeValue = ' 的交易已过期。';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($(e).text().indexOf('initiated') >= 0) { // 交易发起
|
if ($(e).text().indexOf('initiated') >= 0) {
|
||||||
|
/**
|
||||||
|
* 交易发起
|
||||||
|
* <a href="profiles.php?XID=2696209" i-data="i_199_374_71_14">sabrina_devil</a>
|
||||||
|
* has initiated a trade titled "gt".
|
||||||
|
* <a href="trade.php#step=view&ID=6563577" i-data="i_435_374_156_14">Please click here to continue.</a>
|
||||||
|
* sabrina_devil发起了一项名为 "gt "的交易。
|
||||||
|
*/
|
||||||
|
const node2 = e.childNodes[1].nodeValue;
|
||||||
|
const tradeName = node2.slice(30, node2.length - 2);
|
||||||
|
e.childNodes[1].nodeValue = ' 发起了标题为 ' + tradeName + ' 的交易。';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = PCHC;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($(e).text().indexOf('now complete') >= 0) {
|
||||||
|
/**
|
||||||
|
* 交易完成
|
||||||
|
* <a href="profiles.php?XID=2692672" i-data="i_199_829_51_14">Tmipimlie</a>
|
||||||
|
* has accepted the trade. The trade is now complete.
|
||||||
|
* Tmipimlie已经接受交易。现在交易已经完成。
|
||||||
|
*/
|
||||||
|
e.childNodes[1].nodeValue = ' 已经接受交易。该交易现已完成。';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($(e).text().indexOf('canceled') >= 0) {
|
||||||
|
/**
|
||||||
|
* 交易完成
|
||||||
|
* <a href="profiles.php?XID=2431991">WOW</a>
|
||||||
|
* has canceled the trade.
|
||||||
|
* WOW已经取消了这项交易。
|
||||||
|
*/
|
||||||
|
e.childNodes[1].nodeValue = ' 已经取消了这个交易。';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($(e).text().indexOf('commented') >= 0) {
|
||||||
|
/**
|
||||||
|
* 交易评论
|
||||||
|
* <a href="profiles.php?XID=2567772">QIJI</a>
|
||||||
|
* commented on your
|
||||||
|
* <a href="/trade.php#step=view&ID=6405880" i-data="i_334_968_73_14">pending trade</a>
|
||||||
|
* : "Thank you for trading with me! The total is $19,461,755 and you can view your receipt here: https://www.tornexchange.com/receipt/mhWuuL7hrE"
|
||||||
|
*/
|
||||||
|
e.childNodes[1].nodeValue = ' 对';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = '进行中的交易';
|
||||||
|
e.childNodes[3].nodeValue = '添加了一条评论' + e.childNodes[3].nodeValue;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($(e).text().indexOf('mugged') >= 0) { // 被mug
|
|
||||||
if ($(e).text().indexOf('Someone') >= 0) { // 被匿名mug
|
/**
|
||||||
return;
|
* 被mug
|
||||||
|
*/
|
||||||
|
if ($(e).text().indexOf('mugged') >= 0) {
|
||||||
|
const spl = $(e).text().trim().split(' ');
|
||||||
|
if (spl.length > 7) return; // 多人运动暂时跳过
|
||||||
|
const money = spl[spl.length - 2];
|
||||||
|
if (spl[0] === 'Someone') { // 被匿名mug
|
||||||
|
e.firstChild.nodeValue = '有人打劫了你 ' + money + ' [';
|
||||||
|
e.childNodes[1].firstChild.nodeValue = '查看';
|
||||||
} else {
|
} else {
|
||||||
return;
|
e.childNodes[1].nodeValue = ' 打劫了你 ' + money + ' [';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = '查看';
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被打
|
||||||
|
*/
|
||||||
if ($(e).text().indexOf('attacked') >= 0) { // 被打
|
if ($(e).text().indexOf('attacked') >= 0) { // 被打
|
||||||
if ($(e).text().indexOf('Someone') >= 0) { // 被匿名
|
/**
|
||||||
if ($(e).text().indexOf('hospitalized') >= 0) { // 被打住院
|
* 攻击方式 词数=spl.length
|
||||||
|
* 匿名 4 Someone attacked you [view]
|
||||||
|
* - hosp 6 Someone attacked and hospitalized you [view]
|
||||||
|
* -- 有人袭击了你并安排你住院
|
||||||
|
* 实名 4 EternalSoulFire attacked you [view]
|
||||||
|
* - lost 6 EternalSoulFire attacked you but lost [view]
|
||||||
|
* - hosp 6
|
||||||
|
* - 逃跑esc 6 Dr_Bugsy_Siegel attacked you but escaped [view]
|
||||||
|
* - 25回合平手stale 6 Tharizdun attacked you but stalemated [view]
|
||||||
|
* - 起飞或bug 6 Mrew tried to attack you [view]
|
||||||
|
*
|
||||||
|
* You attacked Cherreh but timed out [view]
|
||||||
|
*
|
||||||
|
* 多人运动 todo
|
||||||
|
* 10 Pual (and 2 others) attached you and hospitalized you [view]
|
||||||
|
* 9 Argozdoc attacked you but Norm fought him off [view]
|
||||||
|
*/
|
||||||
|
const spl = $(e).text().trim().split(' ');
|
||||||
|
|
||||||
|
if (spl.length > 6) { // 多人运动暂时跳过
|
||||||
|
/**
|
||||||
|
* 超时自动失败
|
||||||
|
*/
|
||||||
|
if (spl[4] === 'timed') {
|
||||||
|
if (e.firstChild.firstChild) { // 由第一个节点是否有子节点判断 被攻击
|
||||||
|
e.childNodes[1].nodeValue = ' 袭击你但是超时了 [';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = '查看';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.firstChild.nodeValue = '你袭击 ';
|
||||||
|
e.childNodes[2].nodeValue = ' 但是超时了 [';
|
||||||
|
e.childNodes[3].firstChild.nodeValue = '查看';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
;
|
||||||
}
|
}
|
||||||
if ($(e).text().indexOf('but lost') >= 0) { // 收lost
|
|
||||||
|
if (spl[0] === 'Someone') { // 被匿名
|
||||||
|
if (spl.length === 6 && spl[3] === 'hospitalized') { // 匿名hos
|
||||||
|
e.firstChild.nodeValue = '有人袭击你并安排你住院 [';
|
||||||
|
e.childNodes[1].firstChild.nodeValue = '查看';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.firstChild.nodeValue = '有人袭击了你 [';
|
||||||
|
e.childNodes[1].firstChild.nodeValue = '查看';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($(e).text().indexOf('hospitalized') >= 0) { // 被实名打住院
|
|
||||||
|
if (spl.length === 4) { // 实名leave
|
||||||
|
e.childNodes[1].nodeValue = ' 袭击了你 [';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = '查看';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (spl.length === 6) { // 实名的情况
|
||||||
|
switch (spl[4]) {
|
||||||
|
case 'lost':
|
||||||
|
e.childNodes[1].nodeValue = ' 袭击你但输了 [';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = '查看';
|
||||||
|
return;
|
||||||
|
case 'escaped':
|
||||||
|
e.childNodes[1].nodeValue = ' 袭击你但逃跑了 [';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = '查看';
|
||||||
|
return;
|
||||||
|
case 'stalemated':
|
||||||
|
e.childNodes[1].nodeValue = ' 袭击你但打成了平手 [';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = '查看';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (spl[3]) {
|
||||||
|
case 'attack': // Mrew tried to attack you [view]
|
||||||
|
e.childNodes[1].nodeValue = ' 尝试袭击你 [';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = '查看';
|
||||||
|
return;
|
||||||
|
case 'hospitalized':
|
||||||
|
e.childNodes[1].nodeValue = ' 袭击你并安排你住院 [';
|
||||||
|
e.childNodes[2].firstChild.nodeValue = '查看';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -347,11 +499,10 @@
|
|||||||
* zstorm won $5,574,200 in the Daily Dime lottery!
|
* zstorm won $5,574,200 in the Daily Dime lottery!
|
||||||
*/
|
*/
|
||||||
if ($(e).text().indexOf('lottery') >= 0) {
|
if ($(e).text().indexOf('lottery') >= 0) {
|
||||||
console.log('彩票')
|
const split = e.childNodes[1].nodeValue.split(' ');
|
||||||
const split=e.childNodes[1].nodeValue.split(' ');
|
const type = split[split.length - 3] + ' ' + split[split.length - 2];
|
||||||
const type=split[split.length-3]+' '+split[split.length-2];
|
const money = split[2];
|
||||||
const money=split[2];
|
e.childNodes[1].nodeValue = ' 在 ' + type + ' 彩票中赢得了 ' + money + '!';
|
||||||
e.childNodes[1].nodeValue=' 在 '+type+' 彩票中赢得了 '+money+'!';
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,10 +519,26 @@
|
|||||||
*/
|
*/
|
||||||
if ($(e).text().indexOf('bust') >= 0) { // 劫狱成功
|
if ($(e).text().indexOf('bust') >= 0) { // 劫狱成功
|
||||||
if ($(e).text().indexOf('to bust') >= 0) { // 劫狱失败
|
if ($(e).text().indexOf('to bust') >= 0) { // 劫狱失败
|
||||||
e.childNodes[1].nodeValue=' 想捞你出来但是把自己搭进去了。';
|
e.childNodes[1].nodeValue = ' 想捞你出来但是把自己搭了进去。';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.childNodes[1].nodeValue=' 成功把你捞了出来。';
|
e.childNodes[1].nodeValue = ' 成功把你捞了出来。';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* new virus病毒
|
||||||
|
* You completed the Simple Virus which is now in your inventory. You can begin programming a new virus
|
||||||
|
* <a href="pc.php">here</a>
|
||||||
|
* .
|
||||||
|
*
|
||||||
|
* 你完成了 "简单病毒",它现在在你的库存中。你可以【点此】开始编程一个新的病毒。
|
||||||
|
*/
|
||||||
|
if ($(e).text().indexOf('new virus') >= 0) {
|
||||||
|
const virusName = e.firstChild.nodeValue.split(' ').slice(3, 5).join(' ');
|
||||||
|
e.firstChild.nodeValue = '你完成了 ' + virusName + ' ,它现在在你的物品库存中。你可以';
|
||||||
|
e.childNodes[1].firstChild.nodeValue = '点此';
|
||||||
|
e.childNodes[2].nodeValue = '开始编程一个新的病毒。';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Torn翻译
|
// @name Torn翻译
|
||||||
// @namespace WOOH
|
// @namespace WOOH
|
||||||
// @version 0.1
|
// @version 0.1.1104a
|
||||||
// @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