From ba22df33dff1db5d4c327e1f1f35cde50ec24926 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 11 Mar 2023 01:30:42 +0200 Subject: [PATCH] fix showmore --- files/assets/js/core.js | 2 +- files/helpers/config/const.py | 2 -- files/helpers/sanitize.py | 2 +- files/routes/jinja2.py | 2 +- files/templates/comments.html | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/files/assets/js/core.js b/files/assets/js/core.js index b60fddb11..db1c51bdf 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -236,7 +236,7 @@ function showmore(t) { let text = div.getElementsByTagName('d')[0] if (!text) text = div.getElementsByClassName('showmore-text')[0] - if (!text) text = div.getElementsByClassName('d-none')[0] + if (!text) text = div.querySelector('div.d-none') text.classList.add('showmore-text') diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index 5d15a6149..a95408ffc 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -1056,8 +1056,6 @@ if not IS_LOCALHOST and SECRET_KEY == DEFAULT_CONFIG_VALUE: from warnings import warn warn("Secret key is the default value! Please change it to a secure random number. Thanks <3", RuntimeWarning) -SHOW_MORE = '

' - if AEVANN_ID: GLOBAL = environ.get("GLOBAL", "").strip() else: diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index d0b028318..bfb86f131 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -526,7 +526,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys if (pos < 0 and len(sanitized) > CHARLIMIT) or pos > CHARLIMIT: pos = CHARLIMIT - 500 if pos >= 0: - sanitized = (sanitized[:pos] + showmore_regex.sub(rf'\1{SHOW_MORE}\2', sanitized[pos:], count=1)) + sanitized = (sanitized[:pos] + showmore_regex.sub(r'\1

\2', sanitized[pos:], count=1)) return sanitized.strip() diff --git a/files/routes/jinja2.py b/files/routes/jinja2.py index 609dc1656..0847dc20e 100644 --- a/files/routes/jinja2.py +++ b/files/routes/jinja2.py @@ -119,6 +119,6 @@ def inject_constants(): "PAGE_SIZES":PAGE_SIZES, "THEMES":THEMES, "COMMENT_SORTS":COMMENT_SORTS, "SORTS":SORTS, "TIME_FILTERS":TIME_FILTERS, "HOUSES":HOUSES, "TIERS_ID_TO_NAME":TIERS_ID_TO_NAME, "DEFAULT_CONFIG_VALUE":DEFAULT_CONFIG_VALUE, "IS_LOCALHOST":IS_LOCALHOST, "BACKGROUND_CATEGORIES":BACKGROUND_CATEGORIES, "PAGE_SIZE":PAGE_SIZE, "TAGLINES":TAGLINES, "IS_FISTMAS":IS_FISTMAS, "get_alt_graph":get_alt_graph, "current_registered_users":current_registered_users, - "gitref":git_head(), "SHOW_MORE": SHOW_MORE, + "gitref":git_head(), "BIO_FRIENDS_ENEMIES_LENGTH_LIMIT":BIO_FRIENDS_ENEMIES_LENGTH_LIMIT, } diff --git a/files/templates/comments.html b/files/templates/comments.html index ca67cc18a..733e040fe 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -253,7 +253,7 @@ {% endif %} {% set realbody = c.realbody(v) %} -
+
{{realbody | safe}}
{% if c.parent_submission or c.wall_user_id %}