hide_chat setting is remembered and used by session cookie

This commit is contained in:
iou1name 2018-09-21 09:30:40 -04:00
parent 708513039a
commit 4d0624324e
2 changed files with 5 additions and 3 deletions

View File

@ -27,10 +27,10 @@
{% endfor %}
</select>
</li>
<li id="toggleChat"><a onclick="toggle_chat()" href="javascript:void(0);"></a></li>
<li id="toggleChat"><a onclick="toggle_chat()" href="javascript:void(0);">{% if request.session.get("hide_chat") == True %}←{% else %}{% endif %}</a></li>
{% endblock %}
{% block content %}
<div id="questPane">
<div id="questPane" style="width:{% if request.session.get("hide_chat") == True %}100%{% else %}70%{% endif %};">
<center><h1>{{ quest.title }}</h1></center>
<div id="questPosts">
{% for post in posts %}
@ -141,7 +141,7 @@
</div>
{% endif %}
</div>
<div id="chatPane" style="display:flex;">
<div id="chatPane" style="display:{% if request.session.get("hide_chat") == True %}none{% else %}flex{% endif %};">
<h1>Chat</h1>
<div id="chatWindow">
{% autoescape false %}

View File

@ -251,11 +251,13 @@ function toggle_chat() {
if (document.getElementById('chatPane').style.display == 'flex') {
document.getElementById('chatPane').style.display = 'none';
document.getElementById('questPane').style.width = '100%';
document.getElementById('toggleChat').firstChild.innerText = '←';
toggle_cookie('hide_chat', 'on');
}
else {
document.getElementById('chatPane').style.display = 'flex';
document.getElementById('questPane').style.width = '70%';
document.getElementById('toggleChat').firstChild.innerText = '→';
toggle_cookie('hide_chat', 'off');
}
}