From 262514acee5d71cd10272eaafb287d48e861eb2d Mon Sep 17 00:00:00 2001 From: zhaospei Date: Tue, 7 Feb 2023 00:26:04 +0700 Subject: [PATCH] fix pre-expand-blog check always true --- resources/blog.scss | 2 +- templates/comments/feed.html | 14 +++++++------- templates/three-column-content.html | 12 ++++++++++-- templates/ticket/feed.html | 14 +++++++------- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/resources/blog.scss b/resources/blog.scss index 5091076..0e616d5 100644 --- a/resources/blog.scss +++ b/resources/blog.scss @@ -228,6 +228,7 @@ } .show-more { + display: flex; color: black; font-style: italic; font-size: 16px; @@ -237,7 +238,6 @@ position: absolute; inset: 50% 0px 0px; background: linear-gradient(transparent, white); - display: flex; -webkit-box-pack: end; justify-content: flex-end; align-items: flex-end; diff --git a/templates/comments/feed.html b/templates/comments/feed.html index 05a35ed..d22d762 100644 --- a/templates/comments/feed.html +++ b/templates/comments/feed.html @@ -5,15 +5,15 @@ {% with author=comment.author %} - {% if author %} -
- - {{ link_user(author) }} -
- {% endif %} + {% if author %} +
+ + {{ link_user(author) }} +
+ {% endif %} {% endwith %}
{{ comment.body|markdown(lazy_load=True)|reference|str|safe }} -
+
{{_("...More")}}
\ No newline at end of file diff --git a/templates/three-column-content.html b/templates/three-column-content.html index fa72d48..692e4da 100644 --- a/templates/three-column-content.html +++ b/templates/three-column-content.html @@ -42,10 +42,18 @@ $blogbox.removeClass('pre-expand-blog'); $(this).hide(); } - }) + }); + $('.blog-box').each(function () { - if ($(this).prop('scrollHeight') > $(this).height()) { + var $precontent = $(this).children('.blog-description').height(); + var $content = $(this).children().children('.content-description').height(); + if ($content == undefined) { + $content = $(this).children().children('.md-typeset').height() + } + if ($content > $precontent - 30) { $(this).addClass('pre-expand-blog'); + } else { + $(this).children().children('.show-more').hide(); } }); } diff --git a/templates/ticket/feed.html b/templates/ticket/feed.html index 027921e..73364e0 100644 --- a/templates/ticket/feed.html +++ b/templates/ticket/feed.html @@ -8,12 +8,12 @@ {% with author=ticket.user %} - {% if author %} -
- - {{ link_user(author) }} -
- {% endif %} + {% if author %} +
+ + {{ link_user(author) }} +
+ {% endif %} {% endwith %}
@@ -21,6 +21,6 @@
{{ ticket.messages.last().body|markdown(lazy_load=True)|reference|str|safe }} -
+
{{_("...More")}}
\ No newline at end of file