您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
OGARio-chat with voice
当前为
// ==UserScript== // @name VoiceDeOChat // @namespace VoiceDeOChat.v0 // @version 0.1.2 // @description OGARio-chat with voice // @description:ja OGARio のチャットを音声入力で行えるようにします // @author tannichi // @match http://agar.io/* // ==/UserScript== (function() { 'use strict'; function pre_loop(){ // この時点では jQuery は使えない if(! document.getElementById("message-box")){ setTimeout(pre_loop, 1000); console.log("VoiceDeOChat:wait for OGARio load"); return; } return initialize(); } return pre_loop(); function initialize(){ $("#message-box").click(function(){return false;}); $("#message-menu").append('<a href="#" class="chatbox-hide icon-close" style="float:right;">X</a>'); $(".chatbox-hide").click(function(){ $("#message-box").css("display", "none"); return false; }); $("#message-menu").append('<a href="#" class="chatbox-clear icon-clear" style="float:right;">C</a>'); $(".chatbox-clear").click(function(){ $("#message").val(""); return false; }); window.SpeechRecognition = window.SpeechRecognition || webkitSpeechRecognition; var recognition = new window.SpeechRecognition(); recognition.addEventListener('result', function(event){ var text_to = event.results.item(0).item(0).transcript; var text_pre = $("#message").val(); if(text_pre === ""){ text_to = "?" + text_to; }else{ text_to = text_pre + " " + text_to; } $("#message").val(text_to); }, false); $("#message-menu").append('<a href="#" class="voice-start icon-mic" style="float:right;">?</a>'); $(".voice-start").click(function(){ recognition.start(); return false; }); } // Your code here... })();