diff options
author | Akshay <[email protected]> | 2024-12-29 10:49:18 +0000 |
---|---|---|
committer | PortableProgrammer <[email protected]> | 2024-12-30 21:46:17 +0000 |
commit | 12fba690f13ad288dfd86070e31b97f7e69a2070 (patch) | |
tree | 0bd33378cd368f395aeb045685c86628d2ebbcdd | |
parent | eae5094ea241cc69b38cce328b73e858e6ff63de (diff) |
highlight sticky comments
-rw-r--r-- | src/mixins/comment.pug | 8 | ||||
-rw-r--r-- | src/mixins/post.pug | 2 | ||||
-rw-r--r-- | src/public/styles.css | 13 |
3 files changed, 20 insertions, 3 deletions
diff --git a/src/mixins/comment.pug b/src/mixins/comment.pug index 3eca723..ffd4b5a 100644 --- a/src/mixins/comment.pug +++ b/src/mixins/comment.pug | |||
@@ -1,6 +1,7 @@ | |||
1 | include ../utils | 1 | include ../utils |
2 | 2 | ||
3 | mixin infoContainer(data, next_id, prev_id) | 3 | mixin infoContainer(data, next_id, prev_id) |
4 | - var hats = (data.is_submitter?['op']:[]).concat(data.distinguished=="moderator"?['mod']:[]) | ||
4 | div.comment-info-container | 5 | div.comment-info-container |
5 | p | 6 | p |
6 | | #{fmtnum(data.ups)} ↑ | 7 | | #{fmtnum(data.ups)} ↑ |
@@ -12,7 +13,7 @@ mixin infoContainer(data, next_id, prev_id) | |||
12 | a(href=`#${prev_id}` title="scroll to previous comment").nav-link prev | 13 | a(href=`#${prev_id}` title="scroll to previous comment").nav-link prev |
13 | | · | 14 | | · |
14 | span(class=`${data.is_submitter ? 'op' : ''}`) | 15 | span(class=`${data.is_submitter ? 'op' : ''}`) |
15 | | u/#{data.author} #{data.is_submitter ? '(op)' : ''} | 16 | | u/#{data.author} #{hats.length==0?'':`(${hats.join('|')})`} |
16 | | · | 17 | | · |
17 | if data.collapsed_reason_code == "DELETED" || data.author == "[deleted]" | 18 | if data.collapsed_reason_code == "DELETED" || data.author == "[deleted]" |
18 | a(href=`https://undelete.pullpush.io${data.permalink}`) search on undelete | 19 | a(href=`https://undelete.pullpush.io${data.permalink}`) search on undelete |
@@ -22,6 +23,9 @@ mixin infoContainer(data, next_id, prev_id) | |||
22 | if data.edited !== false | 23 | if data.edited !== false |
23 | | edited #{timeDifference(Date.now(), data.edited * 1000)} ago | 24 | | edited #{timeDifference(Date.now(), data.edited * 1000)} ago |
24 | | · | 25 | | · |
26 | if data.stickied | ||
27 | | stickied | ||
28 | | · | ||
25 | a(href=`https://reddit.com${data.permalink}` title="view on reddit").nav-link open ↗ | 29 | a(href=`https://reddit.com${data.permalink}` title="view on reddit").nav-link open ↗ |
26 | 30 | ||
27 | - | 31 | - |
@@ -38,7 +42,7 @@ mixin comment(com, isfirst, parent_id, next_id, prev_id) | |||
38 | a(href=`/comments/${parent_id}/comment/${data.id}`) | 42 | a(href=`/comments/${parent_id}/comment/${data.id}`) |
39 | | #{data.count} more #{fmttxt(data.count, 'comment')} | 43 | | #{data.count} more #{fmttxt(data.count, 'comment')} |
40 | else | 44 | else |
41 | div(class=`comment ${isfirst ? 'first' : ''}`) | 45 | div(class=`comment ${isfirst ? 'first' : ''} ${data.stickied ? 'sticky' : ''}`) |
42 | details(id=`${data.id}` open="") | 46 | details(id=`${data.id}` open="") |
43 | summary.expand-comments | 47 | summary.expand-comments |
44 | +infoContainer(data, next_id, prev_id) | 48 | +infoContainer(data, next_id, prev_id) |
diff --git a/src/mixins/post.pug b/src/mixins/post.pug index 4022424..26dc976 100644 --- a/src/mixins/post.pug +++ b/src/mixins/post.pug | |||
@@ -4,7 +4,7 @@ mixin post(p, currentUrl) | |||
4 | - var from = encodeURIComponent(currentUrl) | 4 | - var from = encodeURIComponent(currentUrl) |
5 | - var viewQuery = query && query.view ? query.view : 'compact' | 5 | - var viewQuery = query && query.view ? query.view : 'compact' |
6 | - var sortQuery = query && query.sort ? query.sort + (query.t ? '&t=' + query.t : '') : 'hot' | 6 | - var sortQuery = query && query.sort ? query.sort + (query.t ? '&t=' + query.t : '') : 'hot' |
7 | article.post | 7 | article(class=`post ${p.stickied?"sticky":""}`) |
8 | div.post-container(class=`${query.view}`) | 8 | div.post-container(class=`${query.view}`) |
9 | div.post-text(class=`${query.view}`) | 9 | div.post-text(class=`${query.view}`) |
10 | div.title-container(class=`${query.view}`) | 10 | div.title-container(class=`${query.view}`) |
diff --git a/src/public/styles.css b/src/public/styles.css index edf0042..1cd5245 100644 --- a/src/public/styles.css +++ b/src/public/styles.css | |||
@@ -5,6 +5,7 @@ | |||
5 | --text-color: black; | 5 | --text-color: black; |
6 | --text-color-muted: #999; | 6 | --text-color-muted: #999; |
7 | --blockquote-color: green; | 7 | --blockquote-color: green; |
8 | --sticky-color: lightgreen; | ||
8 | --link-color: #29BC9B; | 9 | --link-color: #29BC9B; |
9 | --link-visited-color: #999; | 10 | --link-visited-color: #999; |
10 | --accent: var(--link-color); | 11 | --accent: var(--link-color); |
@@ -22,6 +23,7 @@ | |||
22 | --text-color: white; | 23 | --text-color: white; |
23 | --text-color-muted: #999; | 24 | --text-color-muted: #999; |
24 | --blockquote-color: lightgreen; | 25 | --blockquote-color: lightgreen; |
26 | --sticky-color: #034611; | ||
25 | --link-color: #79ffe1; | 27 | --link-color: #79ffe1; |
26 | --link-visited-color: #999; | 28 | --link-visited-color: #999; |
27 | --accent: var(--link-color); | 29 | --accent: var(--link-color); |
@@ -121,6 +123,10 @@ nav { | |||
121 | align-items: stretch; | 123 | align-items: stretch; |
122 | } | 124 | } |
123 | 125 | ||
126 | .post { | ||
127 | margin-bottom: 5px; | ||
128 | } | ||
129 | |||
124 | .post, .comments-container, .hero, .header, .footer { | 130 | .post, .comments-container, .hero, .header, .footer { |
125 | padding: 0.3rem; | 131 | padding: 0.3rem; |
126 | flex: 1 1 95%; | 132 | flex: 1 1 95%; |
@@ -791,3 +797,10 @@ select { | |||
791 | text-indent: 1px; | 797 | text-indent: 1px; |
792 | text-overflow: ''; | 798 | text-overflow: ''; |
793 | } | 799 | } |
800 | |||
801 | .sticky { | ||
802 | background-color: var(--sticky-color); | ||
803 | border-radius: 2px; | ||
804 | border: 4px solid var(--sticky-color); | ||
805 | } | ||
806 | |||