Translate Helper

翻译去换行

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Translate Helper
// @namespace    http://tampermonkey.net/
// @version      3.2
// @description  翻译去换行
// @author       o1hy
// @match        https://translate.google.com/*
// @match        https://translate.google.cn/*
// @match        https://www.deepl.com/*
// @match        https://fanyi.sogou.com/*
// @match        http://fanyi.youdao.com/*
// @grant        none
// ==/UserScript==

function new_version(){
    var url = window.location.href

    if(url.includes("deepl.com")){
        var a = document.querySelector("#dl_translator > div > div > div > div > div > textarea");
    }else if(url.includes("translate.google")){
        var a = document.querySelector("body > c-wiz > div > div > c-wiz > div > c-wiz > div > div > div > c-wiz > span > span > div > textarea");
    }else if(url.includes("sogou.com")){
        var a = document.querySelector("#trans-input");
    }else if(url.includes("fanyi.youdao.com")){
        var a = document.querySelector("#inputOriginal");
    }

    a.addEventListener("paste",function(event){

        let paste = (event.clipboardData || window.clipboardData).getData('text');

        paste = paste.replaceAll("\n"," ")
        paste = paste.replaceAll("\r"," ")

        document.execCommand("insertText",false,paste)
        event.preventDefault();
    })
}



(function() {
   'use strict';
   new_version();
})();