From 342b9f1c4241a862f05caeacfdf5f2157b4b1620 Mon Sep 17 00:00:00 2001 From: Akshay Date: Thu, 23 Jan 2025 10:17:04 +0000 Subject: minor fixes - avoid extra sort & view options on /comments - avoid extra sort & view options on /r/sub in post card --- src/mixins/post.pug | 4 ++-- src/mixins/postUtils.pug | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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) |  ·  | #{timeDifference(Date.now(), p.created * 1000)} |  ·  - a(href=`/r/${p.subreddit}?sort=${sortQuery}&view=${viewQuery}`) r/#{p.subreddit} + a(href=`/r/${p.subreddit}`) r/#{p.subreddit} |  ·  - a(href=`/comments/${p.id}?from=${from}&sort=${sortQuery}&view=${viewQuery}`) #{fmtnum (p.num_comments)} ↩ + a(href=`/comments/${p.id}?from=${from}`) #{fmtnum (p.num_comments)} ↩ if (query.view == "card" && !isPostMedia(p) && p.selftext_html) div.self-text-overflow.card 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 @@ // Find all anchors that href to preview.redd.it, i.redd.it, i.imgur.com // and contain just a link to the same href const expression = /\1?<\/a>/g; - const matches = html.matchAll(expression); + const matches = Array.from(html.matchAll(expression)); var result = html; matches.forEach((match) => { // Replace each occurrence with an actual img tag @@ -85,4 +85,4 @@ var poster_url = p.preview && p.preview.images ? p.preview.images[0].source.url.replace(expression, '&') : ''; return [hls_url, dash_url, fallback_url, scrubber_url, poster_url]; - } \ No newline at end of file + } -- cgit v1.2.3