Titivillus/quest/jinja2/quest/quest_homepage.html
2018-10-02 11:35:39 -04:00

91 lines
3.5 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ quest.title }}{% endblock %}
{% block head %}
<link rel="stylesheet" type="text/css" href="{{ static('quest.css') }}">
{% endblock %}
{% block header %}
{% if request.user == quest.owner %}
<span><a href="{{ url('quest:edit_quest', args=[quest_id, page_num]) }}">Edit Quest</a></span>
<script>
const quest_id = {{ quest.id }};
const page_num = '{{ page_num }}';
const SCRIPT_NAME = '{{ request.META["SCRIPT_NAME"] }}';
const anon_name = '{{ quest.anon_name }}';
</script>
<script type="text/javascript" src="{{ static('quest.js') }}"></script>
<script>window.onload = load;</script>
{% endif %}
<span>
<select onChange="window.location.href=this.value">
<optgroup label="Pages">
{% for page in pages %}
<option value="{{ url('quest:quest', args=[quest_id, page.page_num]) }}"{% if page.page_num == page_num %} selected="yes" {% if vars.update({'next_page': loop.nextitem}) %}{% endif %}{% endif %}>{{ page.title }}</option>
{% endfor %}
</optgroup>
{% if appendices %}
<optgroup label="Appendices">
{% for appendix in appendices %}
<option value="{{ url('quest:quest', args=[quest_id, appendix.page_num]) }}"{% if appendix.page_num == page_num %} selected="yes"{% endif %}>{{ appendix.title }}</option>
{% endfor %}
</optgroup>
{% endif %}
</select>
</span>
{% if quest.live %}
<span id="live">
LIVE
</span>
{% else %}
{% if quest.live_time %}
<span id="liveIn">
Live in: <span id="liveCountdown"></span> (<span id="liveTime">{{ localtime(quest.live_time).strftime('%Y-%m-%d %H:%M') }}</span>)
</span>
{% endif %}
{% endif %}
<span id="toggleChat"><a onclick="toggle_chat()" href="javascript:void(0);">{% if request.session.get("hide_chat") == True %}←{% else %}→{% endif %}</a></span>
{% endblock %}
{% block content %}
<div id="questPane" style="width:{% if request.session.get("hide_chat") == True %}100%{% else %}70%{% endif %};">
<center><h1>{{ quest.title }}</h1></center>
<h3>Pages</h3>
<ul>
{% for page in pages %}
<li><a href="{{ url('quest:quest', args=[quest_id, page.page_num]) }}">{{ page.title }}</a></li>
{% endfor %}
</ul>
{% if appendices %}
<h3>Appendices</h3>
<ul>
{% for appendix in appendices %}
<li><a href="{{ url('quest:quest', args=[quest_id, appendix.page_num]) }}">{{ appendix.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% if vars['next_page'] %}
<div id="nextPageContainer">
<input type="button" id="nextPage" value="Next Page: {{ vars['next_page'].title }}" onclick="window.location.href='{{ url('quest:quest', args=[quest_id, vars['next_page'].page_num]) }}'">
</div>
{% endif %}
</div>
<div id="chatPane" style="display:{% if request.session.get("hide_chat") == True %}none{% else %}flex{% endif %};">
<h1>Chat</h1>
<div id="chatWindow">
{% autoescape false %}
{% for message in chat_messages %}
<div id="msg-{{ message.id }}" class="message">
<div class="messageHeader">
<span class="messageName">{{ message.user.username or quest.anon_name }}</span>
<span class="messageDate">{{ localtime(message.timestamp).strftime('%Y-%m-%d %H:%M:%S') }}</span>
<span class="messageID">No.<a href="javascript:quote('{{ message.id }}')">{{ message.id }}</a></span>
</div>
<div class="messageContent">{{ message.message }}</div>
</div>
<hr>
{% endfor %}
{% endautoescape %}
</div>
<div id="messageTextDiv"><textarea id="messageTextArea" maxlength="512"></textarea></div>
</div>
<div id="preview" style="display:none;"></div>
{% endblock %}