qm poll post ui added
This commit is contained in:
parent
7f24914046
commit
b35883146d
13
anonkun.py
13
anonkun.py
|
@ -54,6 +54,8 @@ app.wsgi_app = ReverseProxied(app.wsgi_app)
|
|||
app.register_blueprint(views)
|
||||
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024
|
||||
app.config['SESSION_TYPE'] = 'filesystem'
|
||||
app.jinja_env.trim_blocks = True
|
||||
app.jinja_env.lstrip_blocks = True
|
||||
Session(app)
|
||||
socketio.init_app(app)
|
||||
paranoid = Paranoid(app)
|
||||
|
@ -93,6 +95,17 @@ def get_dice_challenge(post_id):
|
|||
return db.get_dice_call(post_id)[3]
|
||||
|
||||
|
||||
@app.after_request
|
||||
def minify(res):
|
||||
"""
|
||||
Minify the HTML response to decrease bandwidth usage.
|
||||
"""
|
||||
if res.content_type == "text/html; charset=utf-8" and False:
|
||||
res.set_data(
|
||||
res.get_data(as_text=True).replace("\n", "").replace("\t", ""))
|
||||
return res
|
||||
|
||||
|
||||
init()
|
||||
if __name__ == "__main__":
|
||||
app.run(host='0.0.0.0', port=5050)
|
||||
|
|
|
@ -101,6 +101,15 @@ h3 {
|
|||
border-bottom: 1px dotted black;
|
||||
}
|
||||
|
||||
#QMPollPostForm a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.pollOption {
|
||||
width: 70%;
|
||||
margin: 0.1em;
|
||||
}
|
||||
|
||||
#chatPane {
|
||||
height: 100%;
|
||||
width: 30%;
|
||||
|
|
|
@ -147,6 +147,18 @@
|
|||
post.children[0].children[1].outerHTML = "";
|
||||
}
|
||||
}
|
||||
function insertPollOption() {
|
||||
let opts = document.getElementById('pollOptions');
|
||||
let num = opts.children.length+1;
|
||||
let temp = document.createElement('template');
|
||||
temp.innerHTML = '<div><input type="text" name="pollOption-' + num + '" class="pollOption" placeholder="Option ' + num + '" /></div>';
|
||||
opts.appendChild(temp.content);
|
||||
}
|
||||
function removePollOption() {
|
||||
let opts = document.getElementById('pollOptions');
|
||||
if (opts.children.length == 0) { return; }
|
||||
opts.children[opts.children.length-1].outerHTML = '';
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function openPostTab(event, modeName) {
|
||||
|
@ -252,6 +264,18 @@
|
|||
</div>
|
||||
<div id="QMPostPoll" class="QMPostTabContent" style="display:none;">
|
||||
The polls are rigged.
|
||||
<form id="QMPollPostForm" action="javascript:void(0);" onsubmit="poll_post();">
|
||||
<a href="javascript:void(0);" id="pollInsertNewOption" onclick="insertPollOption()">[+]</a>
|
||||
<a href="javascript:void(0);" onclick="removePollOption()">[-]</a>
|
||||
<div id="pollOptions">
|
||||
<div><input type="text" name="pollOption-1" class="pollOption" placeholder="Option 1" /></div>
|
||||
<div><input type="text" name="pollOption-2" class="pollOption" placeholder="Option 2" /></div>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user