您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Press Shift+Space to play sentence audio
当前为
// ==UserScript== // @name Duolingo audio keyboard shortcut // @description Press Shift+Space to play sentence audio // @version 1 // @match https://www.duolingo.com/* // @grant none // @author szupie [email protected] // @namespace szupie // ==/UserScript== (function () { 'use strict'; const classNames = [ "_1KXUd", // listen with text "_3nOBS", // listen only, 2 buttons (level 1–2, no mascot) "_1oX8u", // listen only, 2 buttons (level 3–5) ]; const selector = classNames.map(className=>`button.${className}`).join(', '); function handleKeyboard(e) { if (e.shiftKey === true && e.key === ' ') { const speakButton = document.querySelector(selector); if (speakButton) { speakButton.click(); } e.preventDefault(); } } document.addEventListener('keypress', handleKeyboard, false); document.addEventListener('keyup', handleKeyboard, false); })();