Reset Default Translation

Resets the language to auto because Google is always setting it to different unused languages

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

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

(I already have a user script manager, let me install it!)

Advertisement:

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.

(I already have a user style manager, let me install it!)

Advertisement:

// ==UserScript==
// @name         Reset Default Translation
// @namespace    https://greasyfork.org/users/21515
// @version      0.1.0
// @description  Resets the language to auto because Google is always setting it to different unused languages
// @author       CennoxX
// @homepage     https://github.com/CennoxX/userscripts
// @supportURL   https://github.com/CennoxX/userscripts/issues/new?title=[Reset%20Default%20Translation]%20
// @include      https://translate.google.tld/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=translate.google.de
// @grant        none
// @license      MIT
// ==/UserScript==
/* jshint esversion: 10 */
/* eslint quotes: ["warn", "double", "avoid-escape"]*/
/* eslint curly: "off" */

(function() {
    "use strict";
    var i = setInterval(()=>{
        var buttonSelection = "c-wiz c-wiz c-wiz button";
        var firstButton = document.querySelector(buttonSelection);
        var firstSelectedButton = document.querySelector(buttonSelection + "[aria-selected=true]");
        var firstUnselectedButton = document.querySelector(buttonSelection + "[aria-selected=false]");
        if (firstButton == firstUnselectedButton)
            firstUnselectedButton.click();
        if (firstButton == firstSelectedButton)
            clearInterval(i);
    },50);
})();