您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
TL;DR
当前为
// ==UserScript== // @name RPGEN - Read out Sasayaki-Chat // @namespace https://tampermonkey.net/ // @version 0.8 // @description TL;DR // @author You // @match https://rpgen.site/dq/?map=* // @icon https://www.google.com/s2/favicons?sz=64&domain=rpgen.site // @license MIT // @grant GM.registerMenuCommand // @grant GM.getValue // @grant GM.setValue // ==/UserScript== (async window => { const isEnable = (() => { let flag = false; const name = 'I/O'; GM.getValue(name, true).then(value => { flag = Boolean(value); }); GM.registerMenuCommand(name, () => { flag = !flag; GM.setValue(name, flag); }); return () => flag; })(); const removeNonVerbal = str => str .replace(/\[.+?\]/g, ' Urawaza ') .replace(/h?ttps?:\/\/.+$/g, ' URL '); const id = setInterval(() => { if (window.dqSock && window.dqSock.socket) { clearInterval(id); window.dqSock.socket.on("uNC_s", (async function({g, t}) { if (isEnable()) { const [a, b] = new Uint8Array(await window.crypto.subtle.digest('SHA-1', (new TextEncoder()).encode(g))); const unique = (a << 8) + b; const uttr = new SpeechSynthesisUtterance(removeNonVerbal(t)); const voices = window.speechSynthesis.getVoices().filter(v => v.lang === 'ja-JP'); uttr.voice = voices[voices.length * unique / 0xFFFF | 0]; window.speechSynthesis.speak(uttr); } })); } }, 500); })(window.unsafeWindow || window);