上传文件至 /
parent
8fb52915ca
commit
1929c5509a
|
@ -0,0 +1,43 @@
|
||||||
|
let isRead = true;
|
||||||
|
let isChoose = true;
|
||||||
|
let highlightWords = "";
|
||||||
|
|
||||||
|
function getWord() {
|
||||||
|
return window.getSelection ? window.getSelection() : document.selection.createRange().text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillInWord() {
|
||||||
|
let word = getWord();
|
||||||
|
if (isRead) Reader.read(word, inputSlider.value);
|
||||||
|
if (!isChoose) {
|
||||||
|
if(isHighlight){
|
||||||
|
const element = document.getElementById("selected-words3");
|
||||||
|
element.value = element.value + " " + word;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const element = document.getElementById("selected-words");
|
||||||
|
element.value = element.value + " " + word;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById("text-content").addEventListener("click", fillInWord, false);
|
||||||
|
|
||||||
|
const sliderValue = document.getElementById("rangeValue");
|
||||||
|
const inputSlider = document.getElementById("rangeComponent");
|
||||||
|
inputSlider.oninput = () => {
|
||||||
|
let value = inputSlider.value;
|
||||||
|
sliderValue.textContent = value + '×';
|
||||||
|
};
|
||||||
|
|
||||||
|
function onReadClick() {
|
||||||
|
isRead = !isRead;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onChooseClick() {
|
||||||
|
isChoose = !isChoose;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果网页刷新,停止播放声音
|
||||||
|
if (performance.getEntriesByType("navigation")[0].type == "reload") {
|
||||||
|
Reader.stopRead();
|
||||||
|
}
|
Loading…
Reference in New Issue