// ==UserScript== // @name 彩云小译脚本修复版 // @description 双语翻译 // @namespace Violentmonkey Scripts // @match *://*/* // @version 1.2 // @author guzz // @description 2022/2/19 下午2:46:37 // @include https://* // @include http://* // @exclude *://*.google*/* // @exclude *://*.cn/* // @exclude *://*.baidu.com/* // @exclude *://*.qq.com/* // @exclude *://*.bilibili.com/* // @exclude *://*.jianshu.com/* // @exclude *://*sspai.com/* // @exclude *://*zhihu/* // @exclude *://*acfun/* // @exclude *://*csdn/* // @exclude *://*china/* // @grant GM_registerMenuCommand // @license MIT // @note 2022年2月19日 更改自 彩云小译脚本 修复某些网站不能翻译 // @downloadURL none // ==/UserScript== document.addEventListener('keydown', keydownEvent); function keydownEvent(e) { if(e.key==';'&&!(e.metaKey || e.ctrlKey) && e.altKey ){ if(['input','text','textarea'].includes(e.target.tagName.toLowerCase())){ return } translation(); } } GM_registerMenuCommand("翻译当前网页",translation); function translation() { var cyfy = document.createElement("script"); cyfy.type = "text/javascript"; cyfy.charset = "UTF-8"; cyfy.src = ("https:" == document.location.protocol ? "https://" : "http://") + "caiyunapp.com/dest/trs.js"; document.body.appendChild(cyfy); var c='.cyxy-personal{display:none}.cyxy-favorite{display:none}.cyxy-function{display:none}#asdazcasdiovb{position:fixed;bottom:0;right:0;width:auto;font-size:0.8em}'; var ele1=document.createElement("style"); ele1.innerHTML=c; document.getElementsByTagName('head')[0].appendChild(ele1) var p = document.createElement("div"); p.innerHTML='

脚本已执行,3秒后自动关闭

' p.id='asdazcasdiovb'; document.body.appendChild(p); setTimeout(()=>{ document.querySelector('#asdazcasdiovb').hidden=true; },3000) }