From b35883146d19c56b4d6d738a15655ace6d135291 Mon Sep 17 00:00:00 2001 From: iou1name Date: Mon, 9 Jul 2018 18:59:16 -0400 Subject: [PATCH] qm poll post ui added --- anonkun.py | 13 +++++++++++++ static/anonkun.css | 9 +++++++++ templates/quest.html | 24 ++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/anonkun.py b/anonkun.py index c12d072..6e16c7d 100644 --- a/anonkun.py +++ b/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) diff --git a/static/anonkun.css b/static/anonkun.css index adad0ac..d8a46bd 100644 --- a/static/anonkun.css +++ b/static/anonkun.css @@ -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%; diff --git a/templates/quest.html b/templates/quest.html index a3981d4..fefb014 100644 --- a/templates/quest.html +++ b/templates/quest.html @@ -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 = '
'; + opts.appendChild(temp.content); + } + function removePollOption() { + let opts = document.getElementById('pollOptions'); + if (opts.children.length == 0) { return; } + opts.children[opts.children.length-1].outerHTML = ''; + }