小窗口快速crime手机版错误修复

This commit is contained in:
Liwanyi 2022-01-16 18:43:52 +08:00
parent 7a230deadc
commit 19a37715e0

View File

@ -1,8 +1,8 @@
// ==UserScript== // ==UserScript==
// @lastmodified 202201161732 // @lastmodified 202201161843
// @name Torn翻译 // @name Torn翻译
// @namespace WOOH // @namespace WOOH
// @version 0.2.0116a // @version 0.2.0116b
// @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/*
@ -15,13 +15,18 @@
___window___.WHTRANS = true; ___window___.WHTRANS = true;
const CC_set = /[\u4e00-\u9fa5]/; const CC_set = /[\u4e00-\u9fa5]/;
const version = '0.2.0116a'; const version = '0.2.0116b';
const changelist = [ const changelist = [
{ {
todo: true, todo: true,
cont: `翻译baza npc商店、imarket、imarket搜索结果`, cont: `翻译baza npc商店、imarket、imarket搜索结果`,
}, },
{
ver: '0.2.0116b',
date: '20220116',
cont: `小窗口快速crime手机版错误修复`,
},
{ {
ver: '0.2.0116a', ver: '0.2.0116a',
date: '20220116', date: '20220116',
@ -3343,7 +3348,9 @@
const cIframe = $popup.querySelector('iframe'); const cIframe = $popup.querySelector('iframe');
const dom = `<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;"> const mobile_prepend_node = document.createElement('div');
mobile_prepend_node.classList.add('wh-translate');
mobile_prepend_node.innerHTML = `<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">
@ -3358,7 +3365,7 @@
<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 style="-webkit-appearance:none;padding: 4px;background: #009688;border-radius: 5px;color: white;" type="submit" value="偷夹克" /> <input style="-webkit-appearance:none;padding: 4px;background: #009688;border-radius: 5px;color: white;" type="submit" value="偷夹克" />
</form></div><hr class="page-head-delimiter m-top10 m-bottom10 r1854"></div>` </form></div><hr class="page-head-delimiter m-top10 m-bottom10 r1854">`;
cIframe.onload = () => { cIframe.onload = () => {
const ifDocu = cIframe.contentWindow.document; const ifDocu = cIframe.contentWindow.document;
@ -3366,8 +3373,8 @@
const loading_node = $popup.querySelector('p'); const loading_node = $popup.querySelector('p');
window.whifdocu = ifDocu; window.whifdocu = ifDocu;
if (!!loading_node) loading_node.remove(); if (!!loading_node) loading_node.remove();
// console.log(ifDocu)
cIframe.style.display = 'block'; cIframe.style.display = 'block';
// 如果iframe内部未运行脚本
if (ifWH === undefined) { if (ifWH === undefined) {
// 隐藏顶部 // 隐藏顶部
elementReady('#header-root', ifDocu).then(e => e.style.display = 'none'); elementReady('#header-root', ifDocu).then(e => e.style.display = 'none');
@ -3380,7 +3387,7 @@
// 调整容器位置 // 调整容器位置
elementReady('.content-wrapper', ifDocu).then(e => { elementReady('.content-wrapper', ifDocu).then(e => {
// 加入 // 加入
e.prepend(dom); e.prepend(mobile_prepend_node);
e.style.margin = '0px'; e.style.margin = '0px';
e.style.position = 'absolute'; e.style.position = 'absolute';
e.style.top = '-35px'; e.style.top = '-35px';