forked from mrlan/EnglishPal
删除 'app/static/js/tanyanmei-fillword.js'
parent
682247bff1
commit
9816596cf8
|
@ -1,33 +0,0 @@
|
||||||
isRead = true;
|
|
||||||
isChoose = true;
|
|
||||||
var reader = window.speechSynthesis; // 全局定义朗读者,以便朗读和暂停
|
|
||||||
reader.cancel();// 初始化时清空reader列表
|
|
||||||
function getWord(){
|
|
||||||
var word = window.getSelection?window.getSelection():document.selection.createRange().text;
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
function fillinWord(){
|
|
||||||
var word = getWord();
|
|
||||||
if (isRead) read(word);
|
|
||||||
if (!isChoose) return;
|
|
||||||
var element = document.getElementById("selected-words");
|
|
||||||
element.value = element.value + " " + word;
|
|
||||||
}
|
|
||||||
document.getElementById("text-content").addEventListener("click", fillinWord, false);
|
|
||||||
function read(s){
|
|
||||||
var msg = new SpeechSynthesisUtterance(s);
|
|
||||||
reader.speak(msg);
|
|
||||||
console.log("+++++++++++++");
|
|
||||||
}
|
|
||||||
|
|
||||||
function onReadClick(){
|
|
||||||
isRead = !isRead;
|
|
||||||
if(!isRead){
|
|
||||||
reader.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function onChooseClick(){
|
|
||||||
isChoose = !isChoose;
|
|
||||||
}
|
|
||||||
|
|
||||||
∑∑
|
|
Loading…
Reference in New Issue