Mirror site is read only www.netnr.com
netnr/ wsa.js 2019-12-08 15:21
Web Speech API ,朗读页面选中的内容
var ssu = {
    init: function () {
        var txt = window.getSelection().toString();
        ssu.speech(txt);
    },
    speech: function (txt) {
        if (!txt || txt.trim() == "") {
            txt = "未选择文字";
        }
        var ws = new window.SpeechSynthesisUtterance(txt);
        window.speechSynthesis.speak(ws);
    }
}
ssu.init();