diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js index 6a535bc..527254a 100644 --- a/torn-trans-zhcn.user.js +++ b/torn-trans-zhcn.user.js @@ -244,6 +244,8 @@ 'London to Torn.': '正从英国伦敦(London)回城。', 'Torn to Zurich.': '正在飞往瑞士苏黎世(Zurich)。', 'Zurich to Torn.': '正从瑞士苏黎世(Zurich)回城。', + 'Torn to Buenos Aires.':'正在飞往阿根廷布宜诺斯艾利斯(Buenos Aires)。', + 'Buenos Aires to Torn.': '正从阿根廷布宜诺斯艾利斯(Buenos Aires)回城。', }; // 界面tips todo 全收集、翻译 const tipsDict = { @@ -251,7 +253,8 @@ 'The 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.': "托恩的就业机会广泛而多样,从动物园和肉类仓库的工作,到脱衣舞俱乐部的奇妙开场--这是一个很少用来形容在那里工作的人的描述。", 'One 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.': "在托恩举行婚礼的主要要求之一就是购买一枚戒指。你可以从珠宝店购买,也可以选择在偷窃戒指中选择一种很浪漫的方式,但是你冷静下来想想的话,这也是需要付出更大代价的。", "Despite 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.": "尽管没有明显的法院系统,托恩仍然在其司法服务部门雇用了几千人。没有人知道这些人整天都在做什么,但如果我们必须猜测,我们会说是接龙。", - "At 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.": "托恩城市学院一度开设了双持近战课程,收费50,000,000美元,但当托恩的市民意识到他们实际上是在花钱学习如何同时持有两样东西时,这个课程就停止了。" + "At 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.": "托恩城市学院一度开设了双持近战课程,收费50,000,000美元,但当托恩的市民意识到他们实际上是在花钱学习如何同时持有两样东西时,这个课程就停止了。", + }; const cityDict = {//todo 'Map': '地图', @@ -340,7 +343,10 @@ "Damage on impact": "攻击造成的伤害", 'Ability to evade an attack': '躲避攻击的能力', 'Chance of hitting': '躲避攻击的能力', - '{$} energy per train': '每次锻炼花费{$}能量', + // '{$} energy per train': '每次锻炼花费{$}能量', + 'energy per train': '能量/次锻炼', + // 'energy per train': '每次锻炼花费5能量', + // 'energy per train': '每次锻炼花费50能量', 'Class:': '健身房类别:', "Membership cost:": "会员价格: ", "Energy usage:": "能量消耗: ", @@ -355,7 +361,10 @@ 'Unavailable': '不可用', "Middleweight": "中量级", "Lightweight": "轻量级", - 'per train': '能量/次' + 'per train': '能量/次', + '5 per train': '5能量/次', + '10 per train': '10能量/次', + '50 per train': '50能量/次', }; const eduDict = { @@ -386,45 +395,6 @@ }; - /** - * 飞行页面 - */ - if (window.location.href.indexOf('index.php') >= 0 && - $('div.travelling h4').length !== 0) { - const travelOB = new MutationObserver(travelOBInit); - - function travelOBInit() { - travelOB.disconnect(); - travelTrans(); - travelOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); - } - - function travelTrans() { - titleTrans(); - contentTitleLinksTrans(); - - // 气泡 - if (tipsDict[$('div.inner-popup').text().trim()]) - $('div.inner-popup').text(tipsDict[$('div.inner-popup').text().trim()]); - // Remaining Flight Time - - $('div.destination-title span').contents().each((i, e) => { - if (e.childNodes.length !== 0) return; - if (!e.nodeValue) return; - if (travelingDict[e.nodeValue.trim()]) - e.nodeValue = travelingDict[e.nodeValue.trim()]; - }); - // torntools扩展插件落地时间 - if ($('div.tt-landing-time span.description').text().split(' ')[0] === 'Landing') { - const landingTime = $('div.tt-landing-time span.description').text().slice(11, 19); - $('div.tt-landing-time span.description').text('于 ' + landingTime + ' 降落'); - } - } - - travelTrans(); - travelOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); - return; - } - /** * 边栏 * 目前默认所有页面调用边栏翻译 @@ -503,7 +473,55 @@ } }).observe(tooltip, {attributes: true, childList: true, subtree: true}); } - }, 500); + }, 1000); + + /** + * header + */ + if($('div#header-root').length>0){} + + /** + * chatbox + */ + + /** + * 飞行页面 + */ + if (window.location.href.indexOf('index.php') >= 0 && + $('div.travelling h4').length !== 0) { + const travelOB = new MutationObserver(travelOBInit); + + function travelOBInit() { + travelOB.disconnect(); + travelTrans(); + travelOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); + } + + function travelTrans() { + titleTrans(); + contentTitleLinksTrans(); + + // 气泡 + if (tipsDict[$('div.inner-popup').text().trim()]) + $('div.inner-popup').text(tipsDict[$('div.inner-popup').text().trim()]); + // Remaining Flight Time - + $('div.destination-title span').contents().each((i, e) => { + if (e.childNodes.length !== 0) return; + if (!e.nodeValue) return; + if (travelingDict[e.nodeValue.trim()]) + e.nodeValue = travelingDict[e.nodeValue.trim()]; + }); + // torntools扩展插件落地时间 + if ($('div.tt-landing-time span.description').text().split(' ')[0] === 'Landing') { + const landingTime = $('div.tt-landing-time span.description').text().slice(11, 19); + $('div.tt-landing-time span.description').text('于 ' + landingTime + ' 降落'); + } + } + + travelTrans(); + travelOB.observe($('div.content-wrapper')[0], {childList: true, subtree: true}); + return; + } /** * 主页 todo @@ -626,7 +644,7 @@ } /** - * 健身房页面 + * gym健身房页面 */ if (window.location.href.indexOf('gym.php') >= 0) { const gymOB = new MutationObserver(gymOBInit); @@ -659,15 +677,13 @@ }); // 每次锻炼的花销 $('div[class^="description"] p:nth-child(2)').each((i, e) => { - if ($(e).text().split(' ').length === 1) { + if (e.childNodes.length === 1) { if (gymDict[$(e).text().trim()]) $(e).text(gymDict[$(e).text().trim()]); - return; - } - const energyPerTrain = $(e).text().split(' ')[0]; - if (gymDict[$(e).text().replace(energyPerTrain, `{$}`)]) { - e.firstChild.nodeValue = gymDict[$(e).text().replace(energyPerTrain, `{$}`)].replace(`{$}`, energyPerTrain); - e.lastChild.nodeValue = ''; + }else if (e.childNodes.length === 2){ + if(gymDict[e.lastChild.nodeValue.trim()]) { + e.lastChild.nodeValue = gymDict[e.lastChild.nodeValue.trim()]; + } } }); // 锻炼页面所有按钮