添加crimes页面快速操作
This commit is contained in:
parent
18796e8614
commit
85ade8a6c1
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Torn翻译
|
// @name Torn翻译
|
||||||
// @namespace WOOH
|
// @namespace WOOH
|
||||||
// @version 0.1.1129b
|
// @version 0.1.1130a
|
||||||
// @description Torn UI翻译
|
// @description Torn UI翻译
|
||||||
// @author Woohoo-[2687093] sabrina_devil[2696209]
|
// @author Woohoo-[2687093] sabrina_devil[2696209]
|
||||||
// @match https://www.torn.com/*
|
// @match https://www.torn.com/*
|
||||||
@ -43,6 +43,7 @@
|
|||||||
'Preferences': '首选项',
|
'Preferences': '首选项',
|
||||||
'Missions': '任务',
|
'Missions': '任务',
|
||||||
'Spouse\'s Properties': '配偶的房产',
|
'Spouse\'s Properties': '配偶的房产',
|
||||||
|
'Items': '物品仓库',
|
||||||
};
|
};
|
||||||
const titleLinksDict = {
|
const titleLinksDict = {
|
||||||
'Personal stats': '个人统计信息',
|
'Personal stats': '个人统计信息',
|
||||||
@ -71,6 +72,10 @@
|
|||||||
'Properties': '所有房产',
|
'Properties': '所有房产',
|
||||||
'Back to Properties': '返回所有房产',
|
'Back to Properties': '返回所有房产',
|
||||||
'Your Profile': '你的个人资料',
|
'Your Profile': '你的个人资料',
|
||||||
|
'Ammo': '子弹',
|
||||||
|
'Trades': '交易',
|
||||||
|
'Bazaar': '店铺',
|
||||||
|
'Display': '展示柜',
|
||||||
};
|
};
|
||||||
const sidebarDict = { // todo 从json加载
|
const sidebarDict = { // todo 从json加载
|
||||||
'Money': '现金',
|
'Money': '现金',
|
||||||
@ -1328,15 +1333,10 @@
|
|||||||
"Clothing Cache": '服饰箱',
|
"Clothing Cache": '服饰箱',
|
||||||
"Box of Medical Supplies": '医疗补给包',
|
"Box of Medical Supplies": '医疗补给包',
|
||||||
"Old Lady Mask": '老妇人面具',
|
"Old Lady Mask": '老妇人面具',
|
||||||
"Chainsaw": '电锯',
|
|
||||||
"Plastic Sword": '塑料剑',
|
|
||||||
"Combat Gloves": '战斗手套',
|
"Combat Gloves": '战斗手套',
|
||||||
"Combat Helmet": '战斗头盔',
|
"Combat Helmet": '战斗头盔',
|
||||||
"Combat Pants": '战斗裤',
|
"Combat Pants": '战斗裤',
|
||||||
"Diamond Bladed Knife": '钻石刀',
|
|
||||||
"Flamethrower": '喷火器',
|
"Flamethrower": '喷火器',
|
||||||
"Axe": '斧头',
|
|
||||||
"Rusty Sword": '锈剑',
|
|
||||||
"Scarred Man Mask": '刀疤男面具',
|
"Scarred Man Mask": '刀疤男面具',
|
||||||
"Cannabis": '大麻',
|
"Cannabis": '大麻',
|
||||||
"Opium": '罂粟',
|
"Opium": '罂粟',
|
||||||
@ -1363,6 +1363,69 @@
|
|||||||
"Morphine": '吗啡',
|
"Morphine": '吗啡',
|
||||||
"Neumune Tablet": '雄烯二醇抗辐射药品',
|
"Neumune Tablet": '雄烯二醇抗辐射药品',
|
||||||
"Antidote": '抗生素',
|
"Antidote": '抗生素',
|
||||||
|
"Minigun": '加特林式旋管机枪',
|
||||||
|
// 近战武器
|
||||||
|
"Hammer": '锤子',
|
||||||
|
"Lead Pipe": '铅管',
|
||||||
|
"Baseball Bat": '棒球棒',
|
||||||
|
"Crowbar": '撬棍',
|
||||||
|
"Bo Staff": '玻之武杖',
|
||||||
|
"Knuckle Dusters": '',
|
||||||
|
"Pen Knife": '',
|
||||||
|
"Leather Bullwhip": '',
|
||||||
|
"Kitchen Knife": '',
|
||||||
|
"Frying Pan": '',
|
||||||
|
"Sai": '',
|
||||||
|
"Plastic Sword": '塑料剑',
|
||||||
|
"Butterfly Knife": '',
|
||||||
|
"Dagger": '',
|
||||||
|
"Swiss Army Knife": '',
|
||||||
|
"Chain Whip": '',
|
||||||
|
"Axe": '斧头',
|
||||||
|
"Wooden Nunchakus": '',
|
||||||
|
"Taser": '',
|
||||||
|
"Ninja Claws": '',
|
||||||
|
"Scimitar": '',
|
||||||
|
"Chainsaw": '电锯',
|
||||||
|
"Cricket Bat": '',
|
||||||
|
"Ice Pick": '',
|
||||||
|
"Katana": '',
|
||||||
|
"Spear": '',
|
||||||
|
"Kama": '',
|
||||||
|
"Twin Tiger Hooks": '',
|
||||||
|
"Samurai Sword": '',
|
||||||
|
"Claymore Sword": '',
|
||||||
|
"Rusty Sword": '锈剑',
|
||||||
|
"Macana": '美洲黑曜石匕首',
|
||||||
|
"Kodachi": '',
|
||||||
|
"Wushu Double Axes": '',
|
||||||
|
"Guandao": '',
|
||||||
|
"Metal Nunchakus": '',
|
||||||
|
"Pillow": '',
|
||||||
|
"Diamond Icicle": '',
|
||||||
|
"Diamond Bladed Knife": '钻石刀',
|
||||||
|
"Pair of Ice Skates": '',
|
||||||
|
"Fine Chisel": '',
|
||||||
|
"Flail": '',
|
||||||
|
"Ivory Walking Cane": '',
|
||||||
|
"Pair of High Heels": '',
|
||||||
|
"Madball": '',
|
||||||
|
"Yasukuni Sword": '',
|
||||||
|
"Naval Cutlass": '',
|
||||||
|
"Meat Hook": '',
|
||||||
|
"Petrified Humerus": '',
|
||||||
|
"Blood Spattered Sickle": '',
|
||||||
|
"Cleaver": '',
|
||||||
|
"Golden Broomstick": '',
|
||||||
|
"Riding Crop": '',
|
||||||
|
"Devil's Pitchfork": '',
|
||||||
|
"Dual Hammers": '',
|
||||||
|
"Dual Axes": '',
|
||||||
|
"Dual Scimitars": '',
|
||||||
|
"Dual Samurai Swords": '',
|
||||||
|
"Sledgehammer": '',
|
||||||
|
"Bread Knife": '',
|
||||||
|
"Poison Umbrella": '',
|
||||||
};
|
};
|
||||||
const itemDescDict = {
|
const itemDescDict = {
|
||||||
'A lottery voucher which can be traded in for 100 lottery tickets for the weekly draw, courtesy of the Lucky Shot Casino.':
|
'A lottery voucher which can be traded in for 100 lottery tickets for the weekly draw, courtesy of the Lucky Shot Casino.':
|
||||||
@ -2361,10 +2424,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物品页面
|
* crime
|
||||||
*/
|
*/
|
||||||
if (window.location.href.contains(/item\.php/)) {
|
if (window.location.href.contains(/crimes\.php/)) {
|
||||||
// let count = 0;
|
|
||||||
const $$ = $('.content-wrapper');
|
const $$ = $('.content-wrapper');
|
||||||
const OB = new MutationObserver(() => {
|
const OB = new MutationObserver(() => {
|
||||||
OB.disconnect();
|
OB.disconnect();
|
||||||
@ -2379,10 +2441,62 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
const trans = () => {
|
const trans = () => {
|
||||||
// console.log(count++)
|
if ($('.wh-translate').length === 0) {
|
||||||
|
$('div.content-title').before(
|
||||||
|
`<div class="wh-translate title-black" style="border-radius: 5px"><span>快捷操作:</span>
|
||||||
|
<form id="wh-translate-quick" action="crimes.php?step=docrime4" method="post" style="display: inline-block">
|
||||||
|
<input name="nervetake" type="hidden" value="18">
|
||||||
|
<input name="crime" type="hidden" value="hackbank">
|
||||||
|
<input type="submit" value="18-1" />
|
||||||
|
</form>
|
||||||
|
<form id="wh-translate-quick" action="crimes.php?step=docrime4" method="post" style="display: inline-block">
|
||||||
|
<input name="nervetake" type="hidden" value="11">
|
||||||
|
<input name="crime" type="hidden" value="warehouse">
|
||||||
|
<input type="submit" value="烧仓库" />
|
||||||
|
</form>
|
||||||
|
<form id="wh-translate-quick" action="crimes.php?step=docrime4" method="post" style="display: inline-block">
|
||||||
|
<input name="nervetake" type="hidden" value="4">
|
||||||
|
<input name="crime" type="hidden" value="jacket">
|
||||||
|
<input type="submit" value="偷夹克" />
|
||||||
|
</form>
|
||||||
|
</div>`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
trans();
|
||||||
|
OB.observe($$.get(0), {
|
||||||
|
characterData: true,
|
||||||
|
attributes: true,
|
||||||
|
subtree: true,
|
||||||
|
childList: true
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物品页面
|
||||||
|
*/
|
||||||
|
if (window.location.href.contains(/item\.php/)) {
|
||||||
|
// let count = 0;
|
||||||
|
const $$ = $('.content-wrapper');
|
||||||
|
const options = {
|
||||||
|
characterData: false,
|
||||||
|
attributes: false,
|
||||||
|
subtree: true,
|
||||||
|
childList: true,
|
||||||
|
};
|
||||||
|
const OB = new MutationObserver(() => {
|
||||||
|
OB.disconnect();
|
||||||
|
titleTrans();
|
||||||
|
contentTitleLinksTrans();
|
||||||
|
trans();
|
||||||
|
OB.observe($$.get(0), options);
|
||||||
|
});
|
||||||
|
const trans = () => {
|
||||||
// 物品名翻译
|
// 物品名翻译
|
||||||
const $item_name = $('ul.current-cont').length === 0
|
const $item_name = $('ul.current-cont').length === 0
|
||||||
|
? $('ul#items-search-tab').children().length === 0
|
||||||
? $('ul#all-items span.name')
|
? $('ul#all-items span.name')
|
||||||
|
: $('ul#items-search-tab span.name')
|
||||||
: $('ul.current-cont span.name');
|
: $('ul.current-cont span.name');
|
||||||
$item_name.each((i, e) => {
|
$item_name.each((i, e) => {
|
||||||
if (!$(e).hasClass('wh-translated')) {
|
if (!$(e).hasClass('wh-translated')) {
|
||||||
@ -2409,18 +2523,13 @@
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(e.nodeValue.trim())
|
//console.log(e.nodeValue.trim())
|
||||||
if (itemTypeDict[e.nodeValue.trim()]) e.nodeValue = itemTypeDict[e.nodeValue.trim()];
|
if (itemTypeDict[e.nodeValue.trim()]) e.nodeValue = itemTypeDict[e.nodeValue.trim()];
|
||||||
else if (itemEffectDict[e.nodeValue.trim()]) e.nodeValue = itemEffectDict[e.nodeValue.trim()];
|
else if (itemEffectDict[e.nodeValue.trim()]) e.nodeValue = itemEffectDict[e.nodeValue.trim()];
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
trans();
|
trans();
|
||||||
OB.observe($$.get(0), {
|
OB.observe($$.get(0), options);
|
||||||
characterData: true,
|
|
||||||
attributes: true,
|
|
||||||
subtree: true,
|
|
||||||
childList: true
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user