GT AccessKeys

Hotkeys for Google Translator

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name            GT AccessKeys
// @version         2020.04.25.1
// @description     Hotkeys for Google Translator
// @include         http*://translate.google.com*
// @author          Rainbow-Spike
// @namespace       https://greasyfork.org/users/7568
// @homepage        https://greasyfork.org/ru/users/7568-dr-yukon
// @icon            https://www.google.com/s2/favicons?domain=translate.google.com
// @grant           none
// ==/UserScript==

var pars = [ ".clear", ".src-tts", ".starbutton", ".share-translation-button", ".suggest-edit-button", ".copybutton", ".res-tts", "gt-ct-tts" ],
	keys = [ "D", "O", "F", "H", "E", "C", "T", "B" ],
	attr = "data-tooltip",
	i, node, setter;

function AccessKeys() {
	for ( i = 0; i < pars.length; i++ ) {
		node = document.querySelector ( pars[i] );
		if ( node != null ) {
			node.accessKey = keys[i];
			setter = node.getAttribute ( attr );
			node.setAttribute ( attr, ( setter ? setter + " " : "" ) + "[" + keys[i] + "]");
		};
	};
};

setTimeout ( AccessKeys, 2000 );