您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Supports bing translator,Can be used to pretend to be a robot in online classes. (Alt+Shift+S to speak translated text)
// ==UserScript== // @name Alt+S to Speak from TTS engines // @name:zh Alt+S 翻译TTS自动发声 // @name:ja Alt+S Alt + SでTTSエンジンから読み上げる // @description Supports bing translator,Can be used to pretend to be a robot in online classes. (Alt+Shift+S to speak translated text) // @description:zh 现支持:必应翻译,可用于在网课中假装机器人讲话(Alt + Shift + S 读翻译后的声音) // @description:ja Bingトランスレータをサポートします。オンラインクラスのロボットのふりをするために使用できます。(Alt + Shift + Sで翻訳されたテキストを読み上げる) // @namespace https://userscript.snomiao.com/ // @version 0.1 // @author [email protected] // @run-at document-start // @match https://*.bing.com/translator* // @match https://translate.google.com* // @grant none // ==/UserScript== (function () { 'use strict'; var clickNode = (e) => { ['mouseover', 'mousedown', 'mouseup', 'click'].map((eventType) => { var clickEvent = document.createEvent('MouseEvents'); clickEvent.initEvent(eventType, true, true); e.dispatchEvent(clickEvent); }); }; var ClickAndSelectAll = (selBTN, selINPUT) => { var btnTTS = document.querySelector(selBTN); var textArea = document.querySelector(selINPUT); clickNode(btnTTS); textArea.focus(); textArea.select(); }; // Bing location.href.match(/^https\:\/\/\w*\.bing\.com\/translator/) && window.addEventListener('keydown', (e) => { if (e.altKey && !e.shiftKey && !e.ctrlKey && e.code == 'KeyS') ClickAndSelectAll('#tta_playiconsrc', '#tta_input_ta'); if (e.altKey && e.shiftKey && !e.ctrlKey && e.code == 'KeyS') ClickAndSelectAll('#tta_playicontgt', '#tta_input_ta'); }); // Google location.href.startsWith('https://translate.google.com') && window.addEventListener('keydown', (e) => { if (e.altKey && !e.shiftKey && !e.ctrlKey && e.code == 'KeyS') ClickAndSelectAll('.ttsbutton', '#source'); if (e.altKey && e.shiftKey && !e.ctrlKey && e.code == 'KeyS') ClickAndSelectAll('.ttsbutton-res', '#source'); }); })();