From 75a62ea7e8e0fa71cda15ea86776349e536e0b4c Mon Sep 17 00:00:00 2001 From: iou1name Date: Thu, 5 Jul 2018 18:17:36 -0400 Subject: [PATCH] roll results get added to the poster's message instead of sent in new message --- events.py | 17 ++++++++--------- static/anonkun.css | 25 ++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/events.py b/events.py index 08ec4d4..97f635f 100644 --- a/events.py +++ b/events.py @@ -47,21 +47,24 @@ def message(data): lines.append(line) message = "
".join(lines) message = tools.handle_img(message) + if message.startswith("/dice") or message.startswith("/roll"): + roll_msg = handle_dice(data) + message += '
' + roll_msg + data["message"] = message db.log_chat_message(data) emit("message", data, room=room) - if message.startswith("/dice") or message.startswith("/roll"): - handle_dice(data) + -def handle_dice(data): +def handle_dice(message): """ Handle /dice or /roll messages. """ room = data["room"] - reg = re.search(r"(\d+)d(\d+)([+-]\d+)?", data['message']) + reg = re.search(r"(\d+)d(\d+)([+-]\d+)?", message) if not reg: return try: @@ -81,11 +84,7 @@ def handle_dice(data): msg += " +" msg += " " + str(diceMod) msg += " = " + str(total) + "" - date = int(time.time()) - name = "Server" - data = {"message": msg, "name": name, "date": date, "room": room} - #emit("message", data, room=room) - message(data) + return msg @socketio.on("new_post") diff --git a/static/anonkun.css b/static/anonkun.css index e2d1aa5..98cde1f 100644 --- a/static/anonkun.css +++ b/static/anonkun.css @@ -3,6 +3,10 @@ img { max-height:100%; } +h3 { + margin: 0px; +} + .header { position: fixed; top: 0; @@ -18,6 +22,10 @@ img { display: inline; } +.header a { + text-decoration: none; +} + #headerHidden { width: auto; } @@ -57,7 +65,7 @@ img { padding: 0; margin: 0; background-color: #f1f1f1; - height: 200px; + height: 100%; } .QMPostTab { @@ -88,6 +96,10 @@ img { max-width: 100%; } +.tooltip { + border-bottom: 1px dotted black; +} + #chatPane { height: 100%; width: 30%; @@ -99,6 +111,7 @@ img { #chatWindow { border: 1px solid #ccc; + padding: 0.25em; overflow: auto; flex: 1; } @@ -108,6 +121,16 @@ img { word-wrap: break-word; } +.msgSrvHr { + width: 95%; + margin-top: 0.2em; + margin-bottom: 0.2em; + margin-left: auto; + margin-right: auto; + border: 0; + border-bottom: 1px solid #ccc; +} + #messageTextDiv { padding-bottom: 10px; width: 100%;