Google Translate - 2022

This script displays a menu option in your userscript manager to translate the current page using Google Translate

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Google Translate - 2022
// @namespace   https://greasyfork.org/users/906463-coffeegrind123
// @homepageURL https://gist.github.com/coffeegrind123/8ca2c7e700aca3341c71da8d612f6130
// @supportURL  https://greasyfork.org/scripts/443947-google-translate-2022
// @include     https://*/*
// @include     http://*/*
// @exclude     http*://*.google.*/*
// @grant       GM_registerMenuCommand
// @noframes
// @version     2.5
// @license     WTFPL
// @icon        https://translate.google.com/favicon.ico
// @author      coffeegrind123
// @description This script displays a menu option in your userscript manager to translate the current page using Google Translate
// ==/UserScript==

(function () {
    'use strict';
    if (window.top != window.self)
        return;
    function translateRedirect() {
        var website = window.location;
        var redirect = 'https://translate.google.com/translate?sl=auto&tl=en&hl=en-US&u=' + website + '&client=webapp';
        window.location = redirect;
    }
    GM_registerMenuCommand('Translate page', translateRedirect);
}());