您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Press ctrl-s to swap active languages
当前为
- // ==UserScript==
- // @name Google Translate Keyboard Shortcut
- // @namespace https://github.com/Greenek
- // @version 1.1
- // @description Press ctrl-s to swap active languages
- // @author Paweł Golonko
- // @license MIT; https://opensource.org/licenses/MIT
- // @copyright 2017, Paweł Golonko (http://greenek.com)
- // @homepageURL https://github.com/Greenek/google-translate-keyboard-shortcut-userscript
- // @supportURL https://github.com/Greenek/google-translate-keyboard-shortcut-userscript/issues
- // @icon https://raw.githubusercontent.com/Greenek/google-translate-keyboard-shortcut-userscript/master/icon.png
- // @grant none
- // @run-at document-end
- // @include http://translate.google.tld/*
- // @include https://translate.google.tld/*
- // ==/UserScript==
- (() => {
- 'use strict';
- // Get swap button element
- const swapBtn = document.getElementById('gt-swap');
- /**
- * Swap languages by emulating mouse click events on UI button.
- */
- function swapLanguages() {
- ['mouseover', 'mousedown', 'mouseup'].forEach(type =>
- swapBtn.dispatchEvent(new MouseEvent(type))
- );
- }
- /**
- * Set listeners for shortcut event.
- */
- window.addEventListener(
- 'keypress',
- event => {
- if (event.key === 's' && event.ctrlKey) {
- swapLanguages();
- }
- },
- true
- );
- })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址