aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2025-01-23 10:17:04 +0000
committerAkshay <[email protected]>2025-01-23 10:17:04 +0000
commit342b9f1c4241a862f05caeacfdf5f2157b4b1620 (patch)
tree6e930da1ec967437b93061f94e87606ae14fd8fa
parent71280f0271b1aea4b1b47bb2619a7766a7747338 (diff)
minor fixes
- avoid extra sort & view options on /comments - avoid extra sort & view options on /r/sub in post card
-rw-r--r--src/mixins/post.pug4
-rw-r--r--src/mixins/postUtils.pug4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/mixins/post.pug b/src/mixins/post.pug
index 9021f93..f4b6c4f 100644
--- a/src/mixins/post.pug
+++ b/src/mixins/post.pug
@@ -25,9 +25,9 @@ mixin post(p, currentUrl)
25 | &nbsp;·&nbsp; 25 | &nbsp;·&nbsp;
26 | #{timeDifference(Date.now(), p.created * 1000)} 26 | #{timeDifference(Date.now(), p.created * 1000)}
27 | &nbsp;·&nbsp; 27 | &nbsp;·&nbsp;
28 a(href=`/r/${p.subreddit}?sort=${sortQuery}&view=${viewQuery}`) r/#{p.subreddit} 28 a(href=`/r/${p.subreddit}`) r/#{p.subreddit}
29 | &nbsp;·&nbsp; 29 | &nbsp;·&nbsp;
30 a(href=`/comments/${p.id}?from=${from}&sort=${sortQuery}&view=${viewQuery}`) #{fmtnum (p.num_comments)} ↩ 30 a(href=`/comments/${p.id}?from=${from}`) #{fmtnum (p.num_comments)} ↩
31 if (query.view == "card" && !isPostMedia(p) && p.selftext_html) 31 if (query.view == "card" && !isPostMedia(p) && p.selftext_html)
32 div.self-text-overflow.card 32 div.self-text-overflow.card
33 if p.spoiler || p.over_18 33 if p.spoiler || p.over_18
diff --git a/src/mixins/postUtils.pug b/src/mixins/postUtils.pug
index 7eef9b2..d0e6400 100644
--- a/src/mixins/postUtils.pug
+++ b/src/mixins/postUtils.pug
@@ -60,7 +60,7 @@
60 // Find all anchors that href to preview.redd.it, i.redd.it, i.imgur.com 60 // Find all anchors that href to preview.redd.it, i.redd.it, i.imgur.com
61 // and contain just a link to the same href 61 // and contain just a link to the same href
62 const expression = /<a href="(http[s]?:\/\/(?:preview\.redd\.it|i\.redd\.it|i\.imgur\.com).*?)">\1?<\/a>/g; 62 const expression = /<a href="(http[s]?:\/\/(?:preview\.redd\.it|i\.redd\.it|i\.imgur\.com).*?)">\1?<\/a>/g;
63 const matches = html.matchAll(expression); 63 const matches = Array.from(html.matchAll(expression));
64 var result = html; 64 var result = html;
65 matches.forEach((match) => { 65 matches.forEach((match) => {
66 // Replace each occurrence with an actual img tag 66 // Replace each occurrence with an actual img tag
@@ -85,4 +85,4 @@
85 var poster_url = p.preview && p.preview.images ? p.preview.images[0].source.url.replace(expression, '&') : ''; 85 var poster_url = p.preview && p.preview.images ? p.preview.images[0].source.url.replace(expression, '&') : '';
86 86
87 return [hls_url, dash_url, fallback_url, scrubber_url, poster_url]; 87 return [hls_url, dash_url, fallback_url, scrubber_url, poster_url];
88 } \ No newline at end of file 88 }