2018-06-18 22:13:49 -04:00
|
|
|
{% extends "base.html" %}
|
|
|
|
{% block title %}{{ quest_title }}{% endblock %}
|
|
|
|
{% block head %}
|
2018-06-14 19:15:51 -04:00
|
|
|
<script type="text/javascript" src="/static/socket.io.slim.js"></script>
|
2018-07-26 09:15:28 -04:00
|
|
|
<script>var room_id = {{ room_id }}; var page_num = {{ page_num }};</script>
|
2018-07-26 20:37:29 -04:00
|
|
|
<script type="text/javascript" src="/static/anonkunUser.js"></script>
|
2018-06-20 13:07:11 -04:00
|
|
|
{% if session.get("user_id") == owner_id %}
|
2018-07-20 16:37:55 -04:00
|
|
|
<script type="text/javascript" src="/static/anonkunQM.js"></script>
|
2018-06-20 13:07:11 -04:00
|
|
|
{% endif %}
|
2018-07-26 20:37:29 -04:00
|
|
|
<script>window.onload = load;</script>
|
2018-06-20 13:07:11 -04:00
|
|
|
{% endblock %}
|
|
|
|
{% block header %}
|
|
|
|
{% if session.get("user_id") == owner_id %}
|
2018-07-26 09:15:28 -04:00
|
|
|
<li><a href="{{ url_for('.edit_quest', quest_id=quest_id) }}">Edit Quest</a></li>
|
2018-07-26 20:37:29 -04:00
|
|
|
{% endif %}
|
2018-07-26 09:15:28 -04:00
|
|
|
<li>
|
|
|
|
<select onChange="window.location.href=this.value">
|
2018-07-26 11:38:02 -04:00
|
|
|
{% for page in pages %}
|
|
|
|
<option value="{{ url_for('.quest', quest_id=quest_id, page_num=page[1]) }}"{% if page[1] == page_num %} selected="yes"{% endif %}>{{ page[2] }}</option>
|
|
|
|
{% endfor %}
|
2018-07-26 09:15:28 -04:00
|
|
|
</select>
|
|
|
|
</li>
|
2018-06-18 22:13:49 -04:00
|
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<div id="questContainer">
|
2018-06-26 00:29:10 -04:00
|
|
|
<div id="questPane">
|
|
|
|
<center><h1>{{ quest_title }}</h1></center>
|
2018-06-27 08:43:00 -04:00
|
|
|
<div id="questPosts">
|
|
|
|
{% for quest_post in quest_posts %}
|
2018-07-26 09:15:28 -04:00
|
|
|
{% if quest_post[3] == "text" %}
|
2018-07-08 20:19:19 -04:00
|
|
|
<div class="questPost textPost">
|
2018-07-26 09:15:28 -04:00
|
|
|
{% elif quest_post[3] == "dice" %}
|
2018-07-08 20:19:19 -04:00
|
|
|
<div class="questPost dicePost{% if quest_post == quest_posts|last %} active_post{% endif %}">
|
2018-07-26 09:15:28 -04:00
|
|
|
{% elif quest_post[3] == "poll" %}
|
2018-07-11 18:25:10 -04:00
|
|
|
<div class="questPost pollPost{% if quest_post == quest_posts|last %} active_post{% endif %}">
|
2018-07-08 20:19:19 -04:00
|
|
|
{% endif %}
|
2018-06-27 08:43:00 -04:00
|
|
|
<div class="questPostMeta">
|
2018-07-26 09:15:28 -04:00
|
|
|
{{ quest_post[5] | strftime }}
|
2018-06-27 08:43:00 -04:00
|
|
|
{% if session.get("user_id") == owner_id %}
|
2018-07-26 09:15:28 -04:00
|
|
|
{% if quest_post[3] == "text" %}
|
2018-07-08 17:50:54 -04:00
|
|
|
<br /><a href="javascript:void(0);" id="editPost-{{ quest_post[0] }}" onclick="edit_post({{ quest_post[0] }})">Edit</a>
|
2018-06-27 08:43:00 -04:00
|
|
|
<a href="javascript:void(0);" id="savePost-{{ quest_post[0] }}" onclick="save_post('{{ quest_post[0] }}')" style="display:none;">Save</a>
|
2018-07-31 17:12:15 -04:00
|
|
|
{% elif (quest_post[3] == "dice" or quest_post[3] == "poll") and quest_post == quest_posts|last %}
|
|
|
|
<br /><a href="javascript:void(0);" id="close_post_id-{{ quest_post[0] }}" onclick="close_post({{ quest_post[0] }})"{% if quest_post[0] != open_post_id %} style="display:none;"{% endif %}>Close</a>
|
|
|
|
<a href="javascript:void(0);" id="open_post_id-{{ quest_post[0] }}" onclick="open_post({{ quest_post[0] }})"{% if quest_post[0] == open_post_id %} style="display:none;"{% endif %}>Open</a>
|
2018-06-27 08:43:00 -04:00
|
|
|
{% endif %}
|
2018-07-07 13:43:58 -04:00
|
|
|
{% endif %}
|
2018-06-27 08:43:00 -04:00
|
|
|
</div>
|
|
|
|
<div class="questPostData" id="questPostData-{{ quest_post[0] }}">
|
2018-07-26 09:15:28 -04:00
|
|
|
{% if quest_post[3] == "text" %}
|
2018-06-27 08:43:00 -04:00
|
|
|
{% autoescape false %}
|
2018-07-26 09:15:28 -04:00
|
|
|
{{ quest_post[4] }}
|
2018-06-27 08:43:00 -04:00
|
|
|
{% endautoescape %}
|
2018-07-26 09:15:28 -04:00
|
|
|
{% elif quest_post[3] == "dice" %}
|
|
|
|
<h3>{{ quest_post[4] }} - {% if quest_post[0] == open_post_id %}Open{% else %}Closed{% endif %}</h3>
|
2018-07-26 20:37:29 -04:00
|
|
|
{% for dice_roll in dice_rolls.get(quest_post[0], []) %}
|
2018-07-11 18:25:10 -04:00
|
|
|
<div id="questRollId-{{ dice_roll[0] }}">
|
|
|
|
<b>Rolled {{ dice_roll[4] }} = {{ dice_roll[5] }} ({{ dice_roll[3] }}){% if quest_post[0]|dice_chal != 0 %} - {% if dice_roll[5] >= quest_post[0]|dice_chal %}Pass{% else %} Fail{% endif %}{% endif %}</b>
|
2018-07-08 17:50:54 -04:00
|
|
|
</div>
|
2018-07-07 19:18:08 -04:00
|
|
|
{% endfor %}
|
2018-07-26 09:15:28 -04:00
|
|
|
{% elif quest_post[3] == "poll" %}
|
|
|
|
<h3>{{ quest_post[4] }} - {% if quest_post[0] == open_post_id %}Open{% else %}Closed{% endif %}</h3>
|
2018-07-13 08:17:29 -04:00
|
|
|
<table class="poll" id="poll-{{ quest_post[0] }}">
|
2018-07-26 15:14:04 -04:00
|
|
|
{% for option in options.get(quest_post[0], []) %}
|
2018-07-18 19:09:54 -04:00
|
|
|
<tr id="optionRow-{{ option[0] }}">
|
2018-07-13 08:17:29 -04:00
|
|
|
<td class="pollCheckBox">
|
2018-07-27 13:29:42 -04:00
|
|
|
<input type="checkbox" {% if ip_address in poll_votes.get(option[0], []) %}checked="true"{% endif %} id="pollInput-{{ option[0] }}" onchange="pollVote({{ quest_post[0] }}, {{ option[0] }})"{% if quest_post[0] != open_post_id %} disabled{% endif %}/>
|
2018-07-13 08:17:29 -04:00
|
|
|
<label for="pollInput-{{ option[0] }}"></label>
|
|
|
|
</td>
|
|
|
|
<td class="option_text">{{ option[2] }}</td>
|
2018-07-26 15:14:04 -04:00
|
|
|
<td class="optionVotes">{{ poll_votes.get(option[0], [])|length }}</td>
|
2018-07-11 18:25:10 -04:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
2018-07-20 16:37:55 -04:00
|
|
|
{% if quest_post[0] == open_post_id and quest_post[0]|is_write_in %}
|
|
|
|
<div id="writeinContainer">
|
2018-07-20 20:20:14 -04:00
|
|
|
Write-in: <input type="text" id="writeinInput" placeholder="Custom choice..." maxlength="200" /><br />
|
|
|
|
<input type="submit" id="writeinSubmit" value="Submit" onclick="submitWritein({{ quest_post[0] }});"/>
|
2018-07-20 16:37:55 -04:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-07-07 19:18:08 -04:00
|
|
|
{% endif %}
|
2018-06-27 08:43:00 -04:00
|
|
|
</div>
|
|
|
|
</div><br />
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% if session.get("user_id") == owner_id %}
|
|
|
|
<div id="QMPostPane">
|
|
|
|
<div>
|
|
|
|
<ul id="QMPostTabs">
|
|
|
|
<li><a class="QMPostTab active" href="javascript:void(0);" onclick="openPostTab(event, 'QMPostText')">Text</a></li>
|
|
|
|
<li><a class="QMPostTab" href="javascript:void(0);" onclick="openPostTab(event, 'QMPostDice')">Dice</a></li>
|
|
|
|
<li><a class="QMPostTab" href="javascript:void(0);" onclick="openPostTab(event, 'QMPostPoll')">Poll</a></li>
|
|
|
|
</ul>
|
2018-06-26 00:29:10 -04:00
|
|
|
</div>
|
2018-06-27 08:43:00 -04:00
|
|
|
<div id="QMPostText" class="QMPostTabContent" style="display:initial;">
|
|
|
|
<textarea id="postTextArea"></textarea><br />
|
|
|
|
<input type="submit" name="newPost" value="Post" onclick="makePost();"/>
|
|
|
|
</div>
|
|
|
|
<div id="QMPostDice" class="QMPostTabContent" style="display:none;">
|
2018-07-02 16:10:50 -04:00
|
|
|
Dice for the dice god.<br />
|
2018-07-11 18:25:10 -04:00
|
|
|
<form id="QMDicePostForm" action="javascript:void(0);" onsubmit="form_post('QMDicePostForm', 'dice_post');">
|
2018-07-06 02:09:55 -04:00
|
|
|
Dice: <input type="number" name="diceNum" min="1" max="99" required/>
|
|
|
|
d <input type="number" name="diceSides" min="1" max="99" required/>
|
2018-07-02 16:10:50 -04:00
|
|
|
±<input type="number" name="diceMod" min="-999" max="999"/>
|
|
|
|
<input type="checkbox" name="diceStrict"/>
|
|
|
|
<span class="tooltip" title="Only take matching rolls.">Strict</span><br />
|
|
|
|
<input type="checkbox" onclick="document.getElementById('diceChal').disabled=!this.checked;"/>
|
|
|
|
<span class="tooltip" title="Dice challenge">DC:</span>
|
|
|
|
<input type="number" name="diceChal" id="diceChal" min="1" max="99" disabled/><br />
|
2018-07-11 18:25:10 -04:00
|
|
|
<input type="checkbox" onclick="document.getElementById('diceRollsTaken').disabled=!this.checked;"/>
|
2018-07-02 16:10:50 -04:00
|
|
|
<span class="tooltip" title="Automatically close the dice call after this many rolls have been made.">Rolls Taken:</span>
|
2018-07-11 18:25:10 -04:00
|
|
|
<input type="number" name="diceRollsTaken" id="diceRollsTaken" min="1" max="99" disabled/><br />
|
2018-07-02 16:10:50 -04:00
|
|
|
<input type="submit" name="submit" value="Roll 'em"/>
|
|
|
|
</form>
|
2018-06-27 08:43:00 -04:00
|
|
|
</div>
|
|
|
|
<div id="QMPostPoll" class="QMPostTabContent" style="display:none;">
|
|
|
|
The polls are rigged.
|
2018-07-11 18:25:10 -04:00
|
|
|
<form id="QMPollPostForm" action="javascript:void(0);" onsubmit="form_post('QMPollPostForm', 'poll_post');">
|
2018-07-09 18:59:16 -04:00
|
|
|
<a href="javascript:void(0);" id="pollInsertNewOption" onclick="insertPollOption()">[+]</a>
|
|
|
|
<a href="javascript:void(0);" onclick="removePollOption()">[-]</a>
|
|
|
|
<div id="pollOptions">
|
2018-07-13 08:17:29 -04:00
|
|
|
<div><input type="text" name="pollOption-1" class="pollOption" placeholder="Option 1" maxlength="200" /></div>
|
|
|
|
<div><input type="text" name="pollOption-2" class="pollOption" placeholder="Option 2" maxlength="200" /></div>
|
2018-07-09 18:59:16 -04:00
|
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<input type="checkbox" name="pollAllowMultipleChoices" />Allow multiple choices<br />
|
|
|
|
<input type="checkbox" name="pollAllowUserOptions" />Allow user-created options<br />
|
|
|
|
<input type="submit" name="submit" value="Submit" />
|
|
|
|
</form>
|
2018-06-26 00:29:10 -04:00
|
|
|
</div>
|
2018-06-20 13:07:11 -04:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-06-14 22:09:14 -04:00
|
|
|
</div>
|
2018-06-27 08:43:00 -04:00
|
|
|
<br />
|
|
|
|
<br />
|
2018-06-18 22:13:49 -04:00
|
|
|
<div id="chatPane">
|
|
|
|
<h1>Chat</h1>
|
|
|
|
<div id="chatWindow">
|
|
|
|
{% autoescape false %}
|
|
|
|
{% for message in messages %}
|
2018-07-21 23:00:08 -04:00
|
|
|
<div id="msg-{{ message[0] }}" class="message">
|
2018-06-18 22:13:49 -04:00
|
|
|
<div class="messageHeader">
|
2018-07-21 23:00:08 -04:00
|
|
|
<span class="messageName">Anonymous</span>
|
|
|
|
<span class="messageDate">{{ message[3] | strftime }}</span>
|
|
|
|
<span class="messageID">No.<a href="javascript:quote('{{ message[0] }}')">{{ message[0] }}</a></span>
|
2018-06-18 22:13:49 -04:00
|
|
|
</div>
|
2018-07-21 23:00:08 -04:00
|
|
|
<div class="messageContent">{{ message[4] }}</div>
|
2018-06-18 22:13:49 -04:00
|
|
|
</div>
|
2018-07-02 16:10:50 -04:00
|
|
|
<hr>
|
2018-06-18 22:13:49 -04:00
|
|
|
{% endfor %}
|
|
|
|
{% endautoescape %}
|
|
|
|
</div>
|
2018-06-20 13:07:11 -04:00
|
|
|
<div id="messageTextDiv"><textarea id="messageTextArea"></textarea></div>
|
2018-06-14 19:15:51 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-07-26 11:38:02 -04:00
|
|
|
<div id="preview" style="display:none;"></div>
|
2018-06-18 22:13:49 -04:00
|
|
|
{% endblock %}
|