Google Translate - 2022

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

目前為 2022-04-24 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Google Translate - 2022
// @namespace   https://gf.qytechs.cn/users/906463-coffeegrind123
// @homepageURL https://gist.github.com/coffeegrind123/
// @supportURL  https://gf.qytechs.cn/scripts/
// @match       http*://*/*
// @exclude     http*://*.google.*/*
// @grant       GM_registerMenuCommand
// @noframes
// @version     1.0
// @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.hostname.replace(/\./g, '-');
		var translateParams = '?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en';
		var redirect = window.location.protocol + '//' + website + '.translate.goog' + window.location.pathname + translateParams;

		window.location.replace(redirect);

	}

	GM_registerMenuCommand('Translate page', translateRedirect);
}());

QingJ © 2025

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