forked from mrlan/EnglishPal
change
parent
1bec0bd107
commit
29a673cd92
|
@ -1,5 +1,5 @@
|
||||||
let isRead = true;
|
let isRead = true;
|
||||||
let isChoose = true;
|
let isChoose = localStorage.getItem('chooseChecked') !== 'false';
|
||||||
|
|
||||||
function getWord() {
|
function getWord() {
|
||||||
return window.getSelection ? window.getSelection() : document.selection.createRange().text;
|
return window.getSelection ? window.getSelection() : document.selection.createRange().text;
|
||||||
|
@ -12,6 +12,7 @@ function fillInWord() {
|
||||||
const element = document.getElementById("selected-words");
|
const element = document.getElementById("selected-words");
|
||||||
let index = (String)(element.value).indexOf(word);
|
let index = (String)(element.value).indexOf(word);
|
||||||
localStorage.setItem("nowWord",element.value);
|
localStorage.setItem("nowWord",element.value);
|
||||||
|
localStorage.setItem('selectedWords', element.value);
|
||||||
if(index === -1){
|
if(index === -1){
|
||||||
element.value = element.value + " " + word;
|
element.value = element.value + " " + word;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +29,16 @@ inputSlider.oninput = () => {
|
||||||
|
|
||||||
function onReadClick() {
|
function onReadClick() {
|
||||||
isRead = !isRead;
|
isRead = !isRead;
|
||||||
|
localStorage.setItem('readChecked', isRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChooseClick() {
|
function onChooseClick() {
|
||||||
isChoose = !isChoose;
|
isChoose = !isChoose;
|
||||||
|
localStorage.setItem('chooseChecked', isChoose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果网页刷新,停止播放声音
|
||||||
|
if (performance.getEntriesByType("navigation")[0].type == "reload") {
|
||||||
|
Reader.stopRead();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue