DeepL号称翻译中文比谷歌更好,在无法使用谷歌翻译时可以作为一个很好的替代。
我在一无是处的基础上,制作了加入DeepL的格式自动整理油猴脚本
(function() {
var txt = "";
var id = "";
var host = window.location.host;
var mclass="";
if(host=="www.deepl.com")
{
mclass="lmt__source_textarea";
txt = document.getElementsByClassName(mclass)[0].value;
for (var i=0;i<txt.length;i++)
{
if(txt.indexOf("\n"))txt = txt.replace("\n"," ");
}
document.getElementsByClassName(mclass)[0].value = txt;
}else{
if( host == "fanyi.youdao.com" )
{
id = "inputOriginal";
}
if( host == "fanyi.baidu.com" )
{
id = "baidu_translate_input";
}
if( host == "translate.google.cn" || host == "translate.google.com" )
{
id = "source";
}
txt = document.getElementById(id).value;
for (i=0;i<txt.length;i++)
{
if(txt.indexOf("\n"))txt = txt.replace("\n"," ");
}
document.getElementById(id).value = txt;
}
})();
//setTimeout("self.location.reload();",15000);//15s
在设置中的用户匹配中加入https://www.deep.com/*以启用脚本
网友评论