1
0
Fork 0
Bug545-HuangHuiLing
1994836463@qq.com 2024-05-25 11:59:38 +08:00
parent 1bec0bd107
commit 29a673cd92
1 changed files with 10 additions and 1 deletions

View File

@ -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();
}