Highlight user difficulty level too.

Bug511-Bosh
Lan Hui 2023-08-10 19:12:30 +08:00
parent 6d15b65e3c
commit 10c291bed2
1 changed files with 4 additions and 2 deletions

View File

@ -65,7 +65,7 @@
<p><b>阅读文章并回答问题</b></p> <p><b>阅读文章并回答问题</b></p>
<div id="text-content"> <div id="text-content">
<div id="found"> <div id="found">
<div class="alert alert-success" role="alert">According to your word list, your level is <span class="text-decoration-underline" id="user-level">{{ today_article["user_level"] }}</span> and we have chosen an article with a difficulty level of <span class="text-decoration-underline" id="text_level">{{ today_article["text_level"] }}</span> for you.</div> <div class="alert alert-success" role="alert">According to your word list, your level is <span class="text-decoration-underline" id="user_level">{{ today_article["user_level"] }}</span> and we have chosen an article with a difficulty level of <span class="text-decoration-underline" id="text_level">{{ today_article["text_level"] }}</span> for you.</div>
<p class="text-muted" id="date">Article added on: {{ today_article["date"] }}</p><br/> <p class="text-muted" id="date">Article added on: {{ today_article["date"] }}</p><br/>
<div class="p-3 mb-2 bg-light text-dark" style="margin: 0 0.5%;"><br/> <div class="p-3 mb-2 bg-light text-dark" style="margin: 0 0.5%;"><br/>
<p class="display-6" id="article_title">{{ today_article["article_title"] }}</p><br/> <p class="display-6" id="article_title">{{ today_article["article_title"] }}</p><br/>
@ -194,7 +194,7 @@
}); });
} }
function update(today_article){ function update(today_article){
$('#user-level').html(today_article['user_level']); $('#user_level').html(today_article['user_level']);
$('#text_level').html(today_article["text_level"]); $('#text_level').html(today_article["text_level"]);
$('#date').html('Article added on: '+today_article["date"]); $('#date').html('Article added on: '+today_article["date"]);
$('#article_title').html(today_article["article_title"]); $('#article_title').html(today_article["article_title"]);
@ -204,6 +204,8 @@
$('#answer').html(today_article["answer"]); $('#answer').html(today_article["answer"]);
document.querySelector('#text_level').classList.add('mark'); // highlight text difficult level for 2 seconds document.querySelector('#text_level').classList.add('mark'); // highlight text difficult level for 2 seconds
setTimeout(() => {document.querySelector('#text_level').classList.remove('mark');}, 2000); setTimeout(() => {document.querySelector('#text_level').classList.remove('mark');}, 2000);
document.querySelector('#user_level').classList.add('mark'); // do the same thing for user difficulty level
setTimeout(() => {document.querySelector('#user_level').classList.remove('mark');}, 2000);
} }
<!-- 检查是否存在上一篇或下一篇,不存在则对应按钮隐藏--> <!-- 检查是否存在上一篇或下一篇,不存在则对应按钮隐藏-->
function check_pre(visited_articles){ function check_pre(visited_articles){