fix showmore

pull/139/head
Aevann 2023-03-11 01:30:42 +02:00
parent 8737881927
commit ba22df33df
5 changed files with 4 additions and 6 deletions

View File

@ -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')

View File

@ -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 = '<p><button class="showmore">SHOW MORE</button></p></div><div class="d-none">'
if AEVANN_ID:
GLOBAL = environ.get("GLOBAL", "").strip()
else:

View File

@ -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<p><button class="showmore">SHOW MORE</button></p><d class="d-none">\2</d>', sanitized[pos:], count=1))
return sanitized.strip()

View File

@ -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,
}

View File

@ -253,7 +253,7 @@
{% endif %}
{% set realbody = c.realbody(v) %}
<div id="comment-text-{{c.id}}" class="comment-text {% if SHOW_MORE in realbody %}has_show_more{% endif %} mb-0 {% if c.author.agendaposter and not (c.parent_submission and c.post.sub == 'chudrama') %}agendaposter{% endif %} {% if c.author.rainbow %}rainbow-text{% endif %}">
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.author.agendaposter and not (c.parent_submission and c.post.sub == 'chudrama') %}agendaposter{% endif %} {% if c.author.rainbow %}rainbow-text{% endif %}">
{{realbody | safe}}
</div>
{% if c.parent_submission or c.wall_user_id %}