您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
fanyi
// ==UserScript== // @name fanyi自动 // @license MIT // @version 0.2 // @description fanyi // @author liuzihaohao // @match https://fanyi.baidu.com/ // @grant none // @namespace http://greasyfork.icu/users/937290 // ==/UserScript== (function() { $('document').ready(function(){setTimeout(function () { document.getElementsByClassName("strong")[0].onclick = function(){ var a=""; a+="<text><br/>"; a+=document.getElementsByClassName("strong")[0].innerText; a+="<br/>"; a+=document.getElementsByClassName("phonetic-transcription")[0].children[1].innerText; for(var i=0;i<document.getElementsByClassName("dictionary-comment")[0].childElementCount;i++){ a+="<br/>"; a+=document.getElementsByClassName("dictionary-comment")[0].children[i].children[0].innerText; a+=" "; a+=document.getElementsByClassName("dictionary-comment")[0].children[i].children[1].children[0].innerText; } a+="</text>"; document.getElementById("transOtherRight").innerHTML+=a; const selection = window.getSelection(); selection.removeAllRanges(); const range = document.createRange(); const node = document.getElementById("transOtherRight").children[document.getElementById("transOtherRight").childElementCount-1]; range.selectNodeContents(node); selection.addRange(range); console.log(document.execCommand("Copy")); } },2000)}) })();