From 8fd28aef3160f00032647515ab9ca9b7fab1bc41 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 24 Jan 2025 13:04:45 +0000 Subject: add info to subs on visit, do not persist sort --- src/mixins/header.pug | 11 +++++------ src/mixins/post.pug | 2 +- src/public/styles.css | 41 +++++++++-------------------------------- src/utils.pug | 7 ++++++- src/views/comments.pug | 2 +- src/views/index.pug | 6 ++++++ 6 files changed, 28 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/mixins/header.pug b/src/mixins/header.pug index 7d56ff5..16ab459 100644 --- a/src/mixins/header.pug +++ b/src/mixins/header.pug @@ -1,18 +1,17 @@ mixin header(user) - var viewQuery = 'view=' + (query && query.view ? query.view : 'compact') - - var sortQuery = 'sort=' + (query ? (query.sort ? query.sort + (query.t ? '&t=' + query.t : '') : 'hot') : 'hot') div.header div.header-item - a(href=`/?${sortQuery}&${viewQuery}`) home + a(href=`/?${viewQuery}`) home div.header-item - a(href=`/r/all?${sortQuery}&${viewQuery}`) all + a(href=`/r/all?${viewQuery}`) all div.header-item - a(href=`/search?${sortQuery}&${viewQuery}`) search + a(href=`/search?${viewQuery}`) search div.header-item - a(href=`/subs?${sortQuery}&${viewQuery}`) subs + a(href=`/subs?${viewQuery}`) subs if user div.header-item - a(href=`/dashboard?${sortQuery}&${viewQuery}`) #{user.username} + a(href=`/dashboard${viewQuery}`) #{user.username} |  a(href='/logout') (logout) else diff --git a/src/mixins/post.pug b/src/mixins/post.pug index f4b6c4f..81b1124 100644 --- a/src/mixins/post.pug +++ b/src/mixins/post.pug @@ -25,7 +25,7 @@ mixin post(p, currentUrl) |  ·  | #{timeDifference(Date.now(), p.created * 1000)} |  ·  - a(href=`/r/${p.subreddit}`) r/#{p.subreddit} + a(href=`/r/${p.subreddit}?view=${viewQuery}`) r/#{p.subreddit} |  ·  a(href=`/comments/${p.id}?from=${from}`) #{fmtnum (p.num_comments)} ↩ if (query.view == "card" && !isPostMedia(p) && p.selftext_html) diff --git a/src/public/styles.css b/src/public/styles.css index 580dbf9..6acf6af 100644 --- a/src/public/styles.css +++ b/src/public/styles.css @@ -11,9 +11,9 @@ --link-visited-color: #999; --accent: var(--link-color); --error-text-color: red; - --border-radius-card: 2vmin; - --border-radius-media: 1.5vmin; - --border-radius-preview: 1vmin; + --border-radius-card: 0.5vmin; + --border-radius-media: 0.5vmin; + --border-radius-preview: 0.3vmin; font-family: Inter, sans-serif; font-feature-settings: 'ss01' 1, 'kern' 1, 'liga' 1, 'cv05' 1, 'dlig' 1, 'ss01' 1, 'ss07' 1, 'ss08' 1; @@ -203,7 +203,6 @@ nav { .image-viewer { position: relative; - margin: 0.9rem; } .image-viewer > img { @@ -306,24 +305,12 @@ summary::before { max-height: 70vh; } -.image-viewer.main-content a { - margin: unset; -} - .image-viewer a:has(img) { font-size: 0rem; padding: unset; margin: unset; } -.media-preview a, -.image-viewer a { - font-size: 1.5rem; - text-decoration: none; - padding: unset; - margin: 1rem; -} - .media-maximized { max-width: 100vw; max-height: 100vh; @@ -363,9 +350,9 @@ form { @media (min-width: 768px) { :root { - --border-radius-card: 1vmin; - --border-radius-media: 1vmin; - --border-radius-preview: 0.5vmin; + --border-radius-card: 0.5vmin; + --border-radius-media: 0.5vmin; + --border-radius-preview: 0.3vmin; } .post, .comments-container, .hero, .header, .footer { flex: 1 1 90%; @@ -380,12 +367,7 @@ form { .image-viewer img, .image-viewer video { - max-height: 45vh; - } - .image-viewer a { - font-size: 1rem; - margin: 0.7rem; - padding: initial; + max-height: 50vh; } .post-text.card { max-width: 100%; @@ -429,17 +411,12 @@ form { .image-viewer img, .image-viewer video { - max-height: 35vh; + max-height: 45vh; } .media-preview a { font-size: 2rem; padding: 2rem; } - .image-viewer a { - font-size: 1rem; - margin: 1rem; - padding: initial; - } .self-text.card { -webkit-line-clamp: 4; line-clamp: 4; @@ -824,7 +801,7 @@ select { .sticky { background-color: var(--sticky-color); - border-radius: 2px; + border-radius: var(--border-radius-card); border: 4px solid var(--sticky-color); } diff --git a/src/utils.pug b/src/utils.pug index 17d1763..82876de 100644 --- a/src/utils.pug +++ b/src/utils.pug @@ -1,4 +1,9 @@ -- var fmtnum = (n)=>n>=1000?(n/1000).toFixed(1)+'k':n; +- + function fmtnum(n) { + return n >= 1e6 ? (n / 1e6).toFixed(1) + 'mil' : + n >= 1e3 ? (n / 1e3).toFixed(1) + 'k' : + n; + } - var fmttxt = (n,t)=>`${t}${n==1?'':'s'}` - var stripPrefix = (s, p) => s.startsWith(p) ? s.slice(p.length) : s; - diff --git a/src/views/comments.pug b/src/views/comments.pug index 1265609..b96953d 100644 --- a/src/views/comments.pug +++ b/src/views/comments.pug @@ -64,7 +64,7 @@ html video(controls data-dashjs-player src=`${url}`).post-media else if isPostLink(post) a(href=post.url) - | #{post.domain} ↗ + | #{post.url} if post.selftext_html div.self-text diff --git a/src/views/index.pug b/src/views/index.pug index a35837b..52b8753 100644 --- a/src/views/index.pug +++ b/src/views/index.pug @@ -33,6 +33,12 @@ html | consider donating to  a(href="https://donate.stripe.com/dR62bTaZH1295Da4gg") oppiliappan |, author of lurker + if about && !isMulti + div.info-container + p + | #{fmtnum(about.accounts_active)} active + |  ·  + | #{fmtnum(about.subscribers)} subscribers hr details.sort-details summary.sorting sorting by #{query.sort + (query.t?' '+query.t:'')} -- cgit v1.2.3