From fac56d7f876d6958a6e6fd954008f70e34e7b0dc Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Fri, 8 Jan 2021 21:57:36 -0800 Subject: [PATCH] Markdown spoilers and post footers on videos --- src/user.rs | 4 ++-- static/style.css | 15 +++++++++++++-- templates/post.html | 3 ++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/user.rs b/src/user.rs index c7552ce..8dd6c4f 100644 --- a/src/user.rs +++ b/src/user.rs @@ -25,13 +25,13 @@ pub async fn profile(req: HttpRequest) -> HttpResponse { let username = req.match_info().get("username").unwrap_or("").to_string(); // Request user profile data and user posts/comments from Reddit - let user = user(&username).await; + let user = user(&username).await.unwrap_or_default(); let posts = fetch_posts(&path, "Comment".to_string()).await; match posts { Ok((posts, after)) => { let s = UserTemplate { - user: user.unwrap_or_default(), + user, posts, sort: (sort, param(&path, "t")), ends: (param(&path, "after"), after), diff --git a/static/style.css b/static/style.css index 5da54a6..42de255 100644 --- a/static/style.css +++ b/static/style.css @@ -16,7 +16,8 @@ background: var(--accent); } -* { +html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, blockquote, +pre, form, fieldset, table, th, td, select, input { margin: 0; color: var(--text); font-family: sans-serif; @@ -698,10 +699,20 @@ input[type="submit"] { border-left: 4px solid var(--highlighted); } -.md a { +.md a, .md a * { color: var(--accent); } +.md .md-spoiler-text { + background: var(--highlighted); + color: transparent; +} + +.md .md-spoiler-text:hover { + background: var(--foreground); + color: var(--text); +} + .md li { margin: 10px 0; } .toc_child { list-style: none; } diff --git a/templates/post.html b/templates/post.html index 8efd898..f5f92fe 100644 --- a/templates/post.html +++ b/templates/post.html @@ -67,7 +67,7 @@ {% if post.post_type == "image" %} {% else if post.post_type == "video" %} -