// ==UserScript== // @name 选中自动朗读 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 任意网页选中自动朗读 // @license 选中自动朗读 // @author lgldlk // @match *://*/* // @icon https://www.google.com/s2/favicons?sz=64&domain=chrome.com // @grant none // @downloadURL none // ==/UserScript== (function () { 'use strict'; document.addEventListener('selectionchange', function () { let text = String(document.getSelection()); if (!text.length) return; speechSynthesis.cancel(); speechSynthesis.speak(new SpeechSynthesisUtterance(text)); }); })();