diff --git a/app/static/js/fillword.js b/app/static/js/fillword.js index d851123..04f2d7e 100644 --- a/app/static/js/fillword.js +++ b/app/static/js/fillword.js @@ -1,5 +1,5 @@ let isRead = true; -let isChoose = true; +let isChoose = localStorage.getItem('chooseChecked') !== 'false'; function getWord() { return window.getSelection ? window.getSelection() : document.selection.createRange().text; @@ -12,6 +12,7 @@ function fillInWord() { const element = document.getElementById("selected-words"); let index = (String)(element.value).indexOf(word); localStorage.setItem("nowWord",element.value); + localStorage.setItem('selectedWords', element.value); if(index === -1){ element.value = element.value + " " + word; } @@ -28,8 +29,16 @@ inputSlider.oninput = () => { function onReadClick() { isRead = !isRead; + localStorage.setItem('readChecked', isRead); } function onChooseClick() { isChoose = !isChoose; + localStorage.setItem('chooseChecked', isChoose); } + +// 如果网页刷新,停止播放声音 +if (performance.getEntriesByType("navigation")[0].type == "reload") { + Reader.stopRead(); +} +