1
0
Fork 0

Bug537 and Bug538

Bug511-Bosh
张艺腾 2023-06-21 16:48:45 +08:00
parent 4d2535a6e8
commit 582f399f73
2 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,7 @@
{% block body %} {% block body %}
{% if session['logged_in'] %} {% if session['logged_in'] %}
你已登录 <a href="/{{ session['username'] }}">{{ session['username'] }}</a>。 登出点击<a href="/logout">这里</a> 你已登录 <a href="/{{ session['username'] }}/userpage">{{ session['username'] }}</a>。 登出点击<a href="/logout">这里</a>
{% else %} {% else %}
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, user-scalable=yes" /> <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, user-scalable=yes" />

View File

@ -61,7 +61,7 @@
{# {% endfor %}#} {# {% endfor %}#}
<button class="btn btn-success" id="load_next_article" onclick="load_next_article();Reader.stopRead()"> 下一篇 Next Article </button> <button class="btn btn-success" id="load_next_article" onclick="load_next_article();Reader.stopRead()"> 下一篇 Next Article </button>
<button class="btn btn-success" id="load_pre_article" onclick="load_pre_article();Reader.stopRead()" > 上一篇 Previous Article </button> <button class="btn btn-success" id="load_pre_article" onclick="load_pre_article();Reader.stopRead()" style="display: none"> 上一篇 Previous Article </button>
<p><b>阅读文章并回答问题</b></p> <p><b>阅读文章并回答问题</b></p>
<div id="text-content"> <div id="text-content">
@ -162,6 +162,12 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
<script type="text/javascript"> <script type="text/javascript">
window.onload = function () { // 页面加载时执行
// 刷新页面或进入页面时判断,若不是首篇文章,则上一篇按钮可见
if(sessionStorage.getItem('pre_page_button')!="display" && sessionStorage.getItem('pre_page_button')){
$('#load_pre_article').show();
}
};
function load_next_article(){ function load_next_article(){
$.ajax({ $.ajax({
url: '/get_next_article/{{username}}', url: '/get_next_article/{{username}}',
@ -203,8 +209,10 @@
function check_pre(visited_articles){ function check_pre(visited_articles){
if((visited_articles=='')||(visited_articles['index']<=0)){ if((visited_articles=='')||(visited_articles['index']<=0)){
$('#load_pre_article').hide(); $('#load_pre_article').hide();
sessionStorage.setItem('pre_page_button', 'display')
}else{ }else{
$('#load_pre_article').show(); $('#load_pre_article').show();
sessionStorage.setItem('pre_page_button', 'show')
} }
} }
function check_next(result_of_generate_article){ function check_next(result_of_generate_article){