您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
// ==UserScript== // @name Youdao-Translate-Auto-Input // @namespace http://tampermonkey.net/ // @version 0.2 // @description try to take over the world! // @author Tebayaki // @match https://fanyi.youdao.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=youdao.com // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // 从URL中获取参数t的值 function getQueryParam(name) { const url = window.location.href; const regex = new RegExp(`[?&]${name}(=([^&#]*)|&|#|$)`); const results = regex.exec(url); if (!results || !results[2]) return null; return decodeURIComponent(results[2].replace(/\+/g, ' ')); } function fillInput(input, text) { input.textContent = text; // 触发输入事件以确保翻译 const event = new Event('input', { bubbles: true }); input.dispatchEvent(event); } // 等待输入框出现并填充文本 function waitAndFillInput() { const text = getQueryParam('t'); if (!text) return; // 观察DOM变化,等待输入框加载 const observer = new MutationObserver(function(mutations, obs) { const input = document.querySelector('#js_fanyi_input'); if (input) { // 停止观察 fillInput(input, text); obs.disconnect(); } }); // 开始观察整个body的子元素变化 observer.observe(document.body, { childList: true, subtree: true }); // 设置超时,防止无限等待 setTimeout(() => observer.disconnect(), 10000); } waitAndFillInput(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址