谷歌在线翻译替换%0A为%20

在谷歌翻译文本框中,自动替换掉换行符

目前為 2016-11-13 提交的版本,檢視 最新版本

// ==UserScript==
// @name         谷歌在线翻译替换%0A为%20
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  在谷歌翻译文本框中,自动替换掉换行符   
// @include      https://translate.google.com/*
// @author       wxj
// @grant        none
// ==/UserScript==



//window.alert(input);
var preinput="";
window.setInterval(comp,2000);
function comp(){
    var input=window.location.href;
    if(preinput!==input){ //说明改变了输入
        preinput=input;
        rep(input);
    }
    else{
    }
}
//替换函数
function rep(input){
    if(input.indexOf("%0A")!=-1){ //含有%0A
        var newinput=input.replace(/\%0A/g,"\%20");
        //window.alert(newinput);
        location.href= newinput;
        //alert("包含");
    }
    else{
        //alert("不包含");
    }
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址