From c12f8220f445ea611b1220e09d4ecce0d41705f5 Mon Sep 17 00:00:00 2001 From: "Max L." Date: Sat, 25 Nov 2023 01:08:41 +0100 Subject: [PATCH 1/5] Improve font sizes --- styles.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/styles.css b/styles.css index 3291ebf..463fdc9 100644 --- a/styles.css +++ b/styles.css @@ -51,7 +51,7 @@ } .carousel .card-text { - font-size: 1.4em; + font-size: 1.6em; overflow: hidden; max-height: 60vh; } @@ -208,7 +208,7 @@ body { .text-muted { color:#6c757d !important; - font-size: 1.2em; + font-size: 1em; text-align: right; } From 8efbafef3cff1f71406c28e26a61acc53c16c339 Mon Sep 17 00:00:00 2001 From: "Max L." Date: Sat, 25 Nov 2023 01:13:05 +0100 Subject: [PATCH 2/5] Directly show new posts in carousel --- script.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/script.js b/script.js index fa94ffb..afa5fca 100644 --- a/script.js +++ b/script.js @@ -341,9 +341,7 @@ $(document).ready(async function() { const newPosts = await Promise.all(hashtagsArray.map(hashtag => fetchPosts(serverUrl, hashtag))); let updated = updateWall(newPosts.flat()); if ( updated > 0 ) { - hideCarousel() updateCarousel(slides, newPosts.flat()); - setTimeout(async function() { showCarousel(); }, duration) } }, refresh); } else { From 7acd5f4e3833d7d7a0d89f6dfaa4446b34775470 Mon Sep 17 00:00:00 2001 From: "Max L." Date: Sat, 25 Nov 2023 01:48:53 +0100 Subject: [PATCH 3/5] Improve long post handling --- script.js | 2 +- styles.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index afa5fca..1b25f7b 100644 --- a/script.js +++ b/script.js @@ -194,7 +194,7 @@ const updateCarousel = function(slides, posts) {
-
800 ? `style="font-size: 0.9em;"`: ``}>${postContent}
+
700 ? `style="font-size: ${strip(postContent).length > 1000 ? `0.5`:`0.9`}em;"`: ``}>${postContent}
${post.media_attachments[0] ? `
` : ''}

diff --git a/styles.css b/styles.css index 463fdc9..013fb4b 100644 --- a/styles.css +++ b/styles.css @@ -53,7 +53,7 @@ .carousel .card-text { font-size: 1.6em; overflow: hidden; - max-height: 60vh; + max-height: 50vh; } .card { From 004c92b3922ba35665a2f618bd93ec87ca1fa7e8 Mon Sep 17 00:00:00 2001 From: "Max L." Date: Sat, 25 Nov 2023 02:18:39 +0100 Subject: [PATCH 4/5] Add emoji support --- script.js | 16 ++++++++++++---- styles.css | 4 ++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/script.js b/script.js index 1b25f7b..6009dcb 100644 --- a/script.js +++ b/script.js @@ -104,6 +104,14 @@ const updateTimesOnPage = function() { }); }; +// replace certain emojies in some text with images +const replaceEmojies = (text, emojis) => { + emojis.forEach(emoji => { + text = text.replaceAll(`:${emoji.shortcode}:`, ``); + }); + return text; +}; + // displayPost creates and displays a post const displayPost = function(post) { if (existingPosts.includes(post.id) || (!includeReplies && post.in_reply_to_id !== null)) return 0; @@ -115,10 +123,10 @@ const displayPost = function(post) {
-

${DOMPurify.sanitize(post.account.display_name)} @${DOMPurify.sanitize(post.account.acct)}

+

${replaceEmojies(DOMPurify.sanitize(post.account.display_name), post.account.emojis)} @${DOMPurify.sanitize(post.account.acct)}

${post.media_attachments[0] ? `` : ''} -

${DOMPurify.sanitize(post.content)}

+

${replaceEmojies(DOMPurify.sanitize(post.content), post.emojis)}

${post.spoiler_text ? `

${DOMPurify.sanitize(post.spoiler_text)}

` : ''}

${timeAgo(secondsAgo(new Date(post.created_at)))}

@@ -185,12 +193,12 @@ const updateCarousel = function(slides, posts) { else { newHTML += `