From 83491ce28cca11f14c229d341f02a2d88952d07b Mon Sep 17 00:00:00 2001 From: AliasJeff <2022248374@qq.com> Date: Tue, 9 Apr 2024 21:21:19 +0800 Subject: [PATCH] refactor: Add comments & optimize code --- app/static/js/fillword.js | 3 +- app/static/js/highlight.js | 2 +- app/templates/mainpage_get.html | 22 ++++++------ app/templates/userpage_get.html | 61 ++++++++++++++++++++------------- 4 files changed, 52 insertions(+), 36 deletions(-) diff --git a/app/static/js/fillword.js b/app/static/js/fillword.js index 82f00ea..18461f0 100644 --- a/app/static/js/fillword.js +++ b/app/static/js/fillword.js @@ -1,4 +1,5 @@ -let isRead = localStorage.getItem('readChecked') !== 'false'; +// initialize from localStorage +let isRead = localStorage.getItem('readChecked') !== 'false'; // default to true let isChoose = localStorage.getItem('chooseChecked') !== 'false'; function getWord() { diff --git a/app/static/js/highlight.js b/app/static/js/highlight.js index 42d3aaf..e8a3cf8 100644 --- a/app/static/js/highlight.js +++ b/app/static/js/highlight.js @@ -1,4 +1,4 @@ -let isHighlight = localStorage.getItem('highlightChecked') !== 'false'; +let isHighlight = localStorage.getItem('highlightChecked') !== 'false'; // default to true function cancelBtnHandler() { cancelHighlighting(); diff --git a/app/templates/mainpage_get.html b/app/templates/mainpage_get.html index 5c57c91..3ba0ece 100644 --- a/app/templates/mainpage_get.html +++ b/app/templates/mainpage_get.html @@ -54,18 +54,20 @@ {% endfor %} {% endif %} diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index adadd58..edb8bf2 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -117,7 +117,7 @@
- +

收集生词吧 (可以在正文中划词,也可以复制黏贴)

@@ -174,40 +174,53 @@ {% endif %}