修复逻辑错误

This commit is contained in:
woohoo 2021-11-06 01:22:29 +08:00
parent 4010b3e9db
commit f72f2cbf06

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Torn翻译 // @name Torn翻译
// @namespace WOOH // @namespace WOOH
// @version 0.1.1105a // @version 0.1.1106a
// @description UI翻译 // @description UI翻译
// @author Woohoo-[2687093] sabrina_devil[2696209] // @author Woohoo-[2687093] sabrina_devil[2696209]
// @match https://www.torn.com/* // @match https://www.torn.com/*
@ -180,14 +180,6 @@
'Info':'信息', 'Info':'信息',
'Buy':'购买', 'Buy':'购买',
}; };
titleTrans();
/**
* 飞行
*/
if (window.location.href.indexOf('index.php') >= 0 &&
$('.travelling h4').length !== 0) {
const travelingDict = { // todo jsonify const travelingDict = { // todo jsonify
'Recruit Citizens': '招募玩家', 'Recruit Citizens': '招募玩家',
'Events': '事件', 'Events': '事件',
@ -214,6 +206,14 @@
"\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美元但当托恩的市民意识到他们实际上是在花钱学习如何同时持有两样东西时这个课程就停止了。"
}; };
/**
* 飞行
*/
if (window.location.href.indexOf('index.php') >= 0 &&
$('.travelling h4').length !== 0) {
titleTrans();
//如果在飞行页面 //如果在飞行页面
if ($('span.remaining-time').length !== 0) { if ($('span.remaining-time').length !== 0) {
$('#skip-to-content')[0].firstChild.nodeValue = '飞行中'; $('#skip-to-content')[0].firstChild.nodeValue = '飞行中';
@ -340,6 +340,8 @@
*/ */
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) {
titleTrans();
let homeEvents = null; let homeEvents = null;
$('h5.box-title').each((i, e) => { $('h5.box-title').each((i, e) => {
@ -371,6 +373,7 @@
window.location.href.indexOf('personals.php') >= 0 || window.location.href.indexOf('personals.php') >= 0 ||
window.location.href.indexOf('bounties.php') >= 0 || window.location.href.indexOf('bounties.php') >= 0 ||
window.location.href.indexOf('comics.php') >= 0) { window.location.href.indexOf('comics.php') >= 0) {
titleTrans();
let newspaperMenuOB = new MutationObserver(newspaperFunc); let newspaperMenuOB = new MutationObserver(newspaperFunc);
const isOnBountyPage = window.location.href.indexOf('bounties.php') >= 0; const isOnBountyPage = window.location.href.indexOf('bounties.php') >= 0;
@ -408,6 +411,7 @@
* npc买房 * npc买房
*/ */
if (window.location.href.indexOf('estateagents.php') >= 0) { if (window.location.href.indexOf('estateagents.php') >= 0) {
titleTrans();
contentTitleLinksTrans(); contentTitleLinksTrans();
return; return;
@ -420,6 +424,7 @@
const propertyOB=new MutationObserver(()=>{ const propertyOB=new MutationObserver(()=>{
propertyOB.disconnect(); propertyOB.disconnect();
titleTrans();
contentTitleLinksTrans(); contentTitleLinksTrans();
// 黑框标题 // 黑框标题
@ -468,6 +473,7 @@
* 通知 * 通知
*/ */
if (window.location.href.indexOf('events.php') >= 0) { if (window.location.href.indexOf('events.php') >= 0) {
titleTrans();
let events; let events;
const eventMutation = new MutationObserver(() => { const eventMutation = new MutationObserver(() => {
eventMutation.disconnect(); eventMutation.disconnect();