From 29a673cd92efc8981ec4375fb9901b838a9de92d Mon Sep 17 00:00:00 2001 From: "1994836463@qq.com" Date: Sat, 25 May 2024 11:59:38 +0800 Subject: [PATCH] change --- app/static/js/fillword.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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(); +} +