User:小躍/tools/SpeechSynthesisUtterance/ListenAssistance.js

//start First function mw.loader.using(['jquery.ui'], function { var optiontext=""; var Listentext="";

if (wgAction == 'view' && wgNamespaceNumber ===0){$('#firstHeading').after(''); $('#wpListenButton').click(ListenShow);} function ListenShow(event) { event.preventDefault; Listentext='Welcome to listen the title of page:'+wgPageName+', by English Wikipedia.I am Wikipedia AutoSpeak, I will start speaking:'+$('p').text.toString.replace(/\[\d\]/g,).replace(/\[\w\w\]/g,).replace(/\[\w\w\]/g,).replace(/\[\w\w\w\]/g,)+'Thanks for your listening, you can find online or near assistant or editor if you have any additional content.'; var Voice2 = new SpeechSynthesisUtterance(Listentext); Voice2.lang='en-US'; window.speechSynthesis.speak(Voice2); }

var Voice = new SpeechSynthesisUtterance(optiontext); Voice.lang='en-US'; window.speechSynthesis.speak(Voice);

});//end