更新crime快速操作

This commit is contained in:
woohoo 2021-12-03 17:25:08 +08:00
parent 3082449508
commit bcca17112a

View File

@ -1,8 +1,8 @@
// ==UserScript== // ==UserScript==
// @lastmodified 202112022039 // @lastmodified 202112031724
// @name Torn翻译 // @name Torn翻译
// @namespace WOOH // @namespace WOOH
// @version 0.1.1202a // @version 0.1.1203a
// @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/*
@ -2935,16 +2935,26 @@
* 搜索玩家的4个分类按钮 * 搜索玩家的4个分类按钮
*/ */
const playerSearchBoxTrans = function playerSearchBoxTrans() { const playerSearchBoxTrans = function playerSearchBoxTrans() {
const psbtOB = new MutationObserver(_ => { const opt = {
if ($('div.ac-wrapper').length === 0) return; childList: true,
subtree: true,
// attributes: true,
// attributeFilter: ['class']
};
const psbtOB = new MutationObserver(mutation => {
const $people_cat = $('ul.ac-options li a');
psbtOB.disconnect(); psbtOB.disconnect();
$('div.ac-wrapper li a').each((i, e) => { mutation.forEach((e) => {
if (e.target.className === 'ac-wrapper') {
$people_cat.each((i, e) => {
if (chatDict[$(e).text().trim()]) if (chatDict[$(e).text().trim()])
$(e).text(chatDict[$(e).text().trim()]); $(e).text(chatDict[$(e).text().trim()]);
}); });
psbtOB.observe(document, {childList: false, subtree: true, attributes: true}); }
})
psbtOB.observe(document.body, opt);
}); });
psbtOB.observe(document, {childList: false, subtree: true, attributes: true}); psbtOB.observe(document.body, opt);
} }
playerSearchBoxTrans(); playerSearchBoxTrans();
@ -3316,23 +3326,22 @@
const trans = () => { const trans = () => {
if ($('.wh-translate').length === 0 && $('div#tab-menu.captcha').length === 0) { if ($('.wh-translate').length === 0 && $('div#tab-menu.captcha').length === 0) {
$('div.content-title').before( $('div.content-title').before(
`<div class="wh-translate title-black" style="border-radius: 5px"><span>快捷操作:</span> `<div class="wh-translate"><div class="title-black" style="border-radius: 5px 5px 0 0;"><span>快捷操作:</span></div><div class="cont-gray" style="padding: 6px 0;border-radius: 0 0 5px 5px;">
<form id="wh-translate-quick" action="crimes.php?step=docrime4" method="post" style="display: inline-block;margin: 0 5px"> <form id="wh-translate-quick" action="crimes.php?step=docrime4" method="post" style="display: inline-block;margin: 0 5px">
<input name="nervetake" type="hidden" value="18"> <input name="nervetake" type="hidden" value="18">
<input name="crime" type="hidden" value="hackbank"> <input name="crime" type="hidden" value="hackbank">
<input type="submit" value="18-1" style="padding: 0 2px" /> <input style="padding: 4px;background: #e91e63;border-radius: 5px;color: white;" type="submit" value="18-1" style="padding: 0 2px" />
</form> </form>
<form id="wh-translate-quick" action="crimes.php?step=docrime4" method="post" style="display: inline-block;margin: 0 5px"> <form id="wh-translate-quick" action="crimes.php?step=docrime4" method="post" style="display: inline-block;margin: 0 5px">
<input name="nervetake" type="hidden" value="11"> <input name="nervetake" type="hidden" value="11">
<input name="crime" type="hidden" value="warehouse"> <input name="crime" type="hidden" value="warehouse">
<input type="submit" value="烧仓库" style="padding: 0 2px" /> <input style="padding: 4px;background: #2196f3;border-radius: 5px;color: white;" type="submit" value="烧仓库" style="padding: 0 2px" />
</form> </form>
<form id="wh-translate-quick" action="crimes.php?step=docrime4" method="post" style="display: inline-block;margin: 0 5px"> <form id="wh-translate-quick" action="crimes.php?step=docrime4" method="post" style="display: inline-block;margin: 0 5px">
<input name="nervetake" type="hidden" value="4"> <input name="nervetake" type="hidden" value="4">
<input name="crime" type="hidden" value="jacket"> <input name="crime" type="hidden" value="jacket">
<input type="submit" value="偷夹克" style="padding: 0 2px" /> <input style="padding: 4px;background: #009688;border-radius: 5px;color: white;" type="submit" value="偷夹克" style="padding: 0 2px" />
</form> </form></div><hr class="page-head-delimiter m-top10 m-bottom10 r1854"></div>`);
</div>`);
} }
}; };
trans(); trans();