From f3f2aa3935af820933d4ed110ea5d059559678f6 Mon Sep 17 00:00:00 2001 From: Michael House Date: Sat, 4 Jun 2022 07:48:26 -0500 Subject: [PATCH] Made a lot of small changes in the frontend --- files/assets/css/TheMotte.css | 29 +++++- files/assets/css/main.css | 11 +- files/assets/js/marked.custom.js | 8 +- files/routes/front.py | 2 - files/routes/static.py | 16 +-- files/routes/users.py | 8 +- files/templates/comments.html | 4 +- files/templates/contact.html | 11 +- files/templates/header.html | 8 +- files/templates/mobile_navigation_bar.html | 21 +--- files/templates/settings_profile.html | 113 +-------------------- files/templates/settings_security.html | 2 - files/templates/userpage.html | 20 ++-- 13 files changed, 75 insertions(+), 178 deletions(-) diff --git a/files/assets/css/TheMotte.css b/files/assets/css/TheMotte.css index 6d0ae9b54..d024b6d07 100644 --- a/files/assets/css/TheMotte.css +++ b/files/assets/css/TheMotte.css @@ -120,10 +120,23 @@ pre { blockquote { color: var(--gray-400); } - +#account-menu { + left: -6px; +} +#main-navigation { + max-width: 2000px; + margin-left: auto; + margin-right: auto; +} #profilestuff > * { color: var(--gray-400) !important; } +#profilestuff a { + color: var(--primary-light2) !important; +} +#profilestuff h1 { + color: var(--primary-light1) !important; +} div.deleted { background-color: var(--gray-400) !important; } @@ -139,16 +152,24 @@ div.deleted.banned { #frontpage .posts .card, #userpage .posts .card, #search .posts .card { border: none; } +#search .post-info, +#userpage .post-info, #frontpage .post-info { display:flex; } +#search .post-actions, +#userpage .post-actions, #frontpage .post-actions { margin-left:auto; } +#search .post-actions .list-inline, +#userpage .post-actions .list-inline, #frontpage .post-actions .list-inline { align-items: center; height:100%; } +#search .post-title a:hover, +#userpage .post-title a:hover, #frontpage .post-title a:hover { text-decoration: underline; } @@ -164,6 +185,12 @@ a.visited, #search .post-title a:visited { color: var(--primary-dark1); } +.comment .comment-collapse-desktop { + border-left: 2px solid var(--primary-dark1) !important; +} +.comment .comment-collapse-desktop:hover { + border-left: 2px solid var(--primary-light2) !important; +} .usernote-link { color: var(--primary); diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 642264f52..16d4ae2e6 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -283,7 +283,7 @@ mark, .mark { } code { font-size: 87.5%; - color: #e83e8c; + color: var(--primary-dark1); word-wrap: break-word; } a > code { @@ -2151,9 +2151,18 @@ a.bg-light:hover, a.bg-light:focus, button.bg-light:hover, button.bg-light:focus } .shadow-sm { box-shadow: 0 0.1px 3px 0 rgba(0, 0, 0, 0.05), 0 0.1px 2px 0 rgba(0, 0, 0, 0.03) !important; + -webkit-box-shadow: 0 0.1px 3px 0 rgba(0, 0, 0, 0.05), 0 0.1px 2px 0 rgba(0, 0, 0, 0.03) !important; + -moz-box-shadow: 0 0.1px 3px 0 rgba(0, 0, 0, 0.05), 0 0.1px 2px 0 rgba(0, 0, 0, 0.03) !important; +} +.shadow-lg { + box-shadow: -20px 20px 28px -20px rgba(0,0,0,0.51); + -webkit-box-shadow: -20px 20px 28px -20px rgba(0,0,0,0.51); + -moz-box-shadow: -20px 20px 28px -20px rgba(0,0,0,0.51); } .shadow { box-shadow: 0 0.1px 3px rgba(190, 113, 113, 0.05), 0 0 0 0.1px rgba(0, 0, 0, 0.05) !important; + -webkit-box-shadow: 0 0.1px 3px rgba(190, 113, 113, 0.05), 0 0 0 0.1px rgba(0, 0, 0, 0.05) !important; + -moz-box-shadow: 0 0.1px 3px rgba(190, 113, 113, 0.05), 0 0 0 0.1px rgba(0, 0, 0, 0.05) !important; } .shadow-none { box-shadow: none !important; diff --git a/files/assets/js/marked.custom.js b/files/assets/js/marked.custom.js index 3b0ea8e12..228c15755 100644 --- a/files/assets/js/marked.custom.js +++ b/files/assets/js/marked.custom.js @@ -188,15 +188,13 @@ function safeMarkdown(input) { setTimeout(() => markdown('post-text','preview'), 200); function markdown(first, second) { - var input = document.getElementById(first).value; + var input = document.getElementById(first); var dest = document.getElementById(second); - if(input && dest){ + if(dest && input && input.value.trim() !== ''){ for (var i = 0; i < dest.children.length; i++) { dest.removeChild(dest.children[i]); } - document - .getElementById(second) - .appendChild(safeMarkdown(input)); + dest.appendChild(safeMarkdown(input.value)); } } diff --git a/files/routes/front.py b/files/routes/front.py index 4d9612cf0..1f7d620c5 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -392,8 +392,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false" @app.get("/changelog") @auth_required def changelog(v): - - try: page = max(int(request.values.get("page", 1)), 1) except: page = 1 diff --git a/files/routes/static.py b/files/routes/static.py index f174e50c5..65227250e 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -287,10 +287,14 @@ def contact(v): @auth_required def submit_contact(v): body = request.values.get("message") + email = request.values.get("email") if not body: abort(400) + if not email: email = None - body = f'This message has been sent automatically to all admins via [/contact](/contact)\n\nMessage:\n\n' + body - body_html = sanitize(body) + header = "This message has been sent automatically to all admins via [/contact](/contact)\n" + email = f"Email: {email}\n" + message = f"Message:\n{body}\n\n" + html = sanitize(f"{header}\n{email}\n{message}") if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": file=request.files["file"] @@ -298,7 +302,7 @@ def submit_contact(v): name = f'/images/{time.time()}'.replace('.','') + '.webp' file.save(name) url = process_image(name) - body_html += f'' + html += f'' elif file.content_type.startswith('video/'): file.save("video.mp4") with open("video.mp4", 'rb') as f: @@ -310,15 +314,13 @@ def submit_contact(v): if error == 'File exceeds max duration': error += ' (60 seconds)' return {"error": error}, 400 if url.endswith('.'): url += 'mp4' - body_html += f"

{url}

" + html += f"

{url}

" else: return {"error": "Image/Video files only"}, 400 - - new_comment = Comment(author_id=v.id, parent_submission=None, level=1, - body_html=body_html, + body_html=html, sentto=2 ) g.db.add(new_comment) diff --git a/files/routes/users.py b/files/routes/users.py index f9e8e28d2..f592a7d69 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -275,7 +275,7 @@ def upvoters(v, username): pos = (pos+1, users[pos][1]) except: pos = (len(users)+1, 0) - return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Up', name2=f'@{username} biggest simps') + return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Up', name2=f'Who upvotes @{username}') @@ -301,7 +301,7 @@ def downvoters(v, username): pos = (pos+1, users[pos][1]) except: pos = (len(users)+1, 0) - return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Down', name2=f'@{username} biggest haters') + return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Down', name2=f'Who downvotes @{username}') @app.get("/@/upvoting") @auth_required @@ -325,7 +325,7 @@ def upvoting(v, username): pos = (pos+1, users[pos][1]) except: pos = (len(users)+1, 0) - return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Up', name2=f'Who @{username} simps for') + return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Up', name2=f'Who @{username} upvotes') @app.get("/@/downvoting") @auth_required @@ -349,7 +349,7 @@ def downvoting(v, username): pos = (pos+1, users[pos][1]) except: pos = (len(users)+1, 0) - return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Down', name2=f'Who @{username} hates') + return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Down', name2=f'Who @{username} downvotes') diff --git a/files/templates/comments.html b/files/templates/comments.html index e3be39872..e65443c1c 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -61,7 +61,7 @@ {% if (c.is_banned or c.deleted_utc or c.is_blocking) and not (v and v.admin_level > 1) and not (v and v.id==c.author_id) %}
- +
@@ -158,7 +158,7 @@
{% if not isreply %} - + {% endif %}
diff --git a/files/templates/contact.html b/files/templates/contact.html index 2a3deb039..0ec838d5f 100644 --- a/files/templates/contact.html +++ b/files/templates/contact.html @@ -22,12 +22,13 @@

Contact {{SITE_NAME}} Admins

Use this form to contact {{SITE_NAME}} Admins.

- - - -
- + + {% if v and v.email %} + + {% else %} + + {% endif %} diff --git a/files/templates/header.html b/files/templates/header.html index 2db39a90d..7a6b76d67 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -1,5 +1,5 @@ -