css solution to the height spam question
parent
08dbc35f34
commit
686f88e9cf
|
@ -7151,9 +7151,9 @@ sub, sup {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.comment-text > p {
|
.comment-text:not(.has_show_more) {
|
||||||
max-height: 100vh;
|
max-height: 100vh;
|
||||||
overflow: auto;
|
overflow: auto !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,6 +264,7 @@ function showmore(t) {
|
||||||
while (!(div.id && (div.id.startsWith('comment-text-') || div.id == 'post-text'))){
|
while (!(div.id && (div.id.startsWith('comment-text-') || div.id == 'post-text'))){
|
||||||
div = div.parentElement
|
div = div.parentElement
|
||||||
}
|
}
|
||||||
|
div = div.parentElement
|
||||||
|
|
||||||
let text = div.getElementsByTagName('d')[0]
|
let text = div.getElementsByTagName('d')[0]
|
||||||
if (!text) text = div.getElementsByClassName('showmore-text')[0]
|
if (!text) text = div.getElementsByClassName('showmore-text')[0]
|
||||||
|
|
|
@ -1042,3 +1042,5 @@ AUDIO_FORMATS = ('mp3','wav','ogg','aac','m4a','flac')
|
||||||
if not IS_LOCALHOST and SECRET_KEY == DEFAULT_CONFIG_VALUE:
|
if not IS_LOCALHOST and SECRET_KEY == DEFAULT_CONFIG_VALUE:
|
||||||
from warnings import warn
|
from warnings import warn
|
||||||
warn("Secret key is the default value! Please change it to a secure random number. Thanks <3", RuntimeWarning)
|
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">'
|
||||||
|
|
|
@ -559,9 +559,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys
|
||||||
if (pos < 0 and len(sanitized) > CHARLIMIT) or pos > CHARLIMIT:
|
if (pos < 0 and len(sanitized) > CHARLIMIT) or pos > CHARLIMIT:
|
||||||
pos = CHARLIMIT - 500
|
pos = CHARLIMIT - 500
|
||||||
if pos >= 0:
|
if pos >= 0:
|
||||||
sanitized = (sanitized[:pos] +
|
sanitized = (sanitized[:pos] + showmore_regex.sub(rf'\1{SHOW_MORE}\2', sanitized[pos:], count=1))
|
||||||
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()
|
return sanitized.strip()
|
||||||
|
|
||||||
|
|
|
@ -118,5 +118,5 @@ def inject_constants():
|
||||||
"HOUSE_JOIN_COST":HOUSE_JOIN_COST, "HOUSE_SWITCH_COST":HOUSE_SWITCH_COST, "IMAGE_FORMATS":','.join(IMAGE_FORMATS),
|
"HOUSE_JOIN_COST":HOUSE_JOIN_COST, "HOUSE_SWITCH_COST":HOUSE_SWITCH_COST, "IMAGE_FORMATS":','.join(IMAGE_FORMATS),
|
||||||
"PAGE_SIZES":PAGE_SIZES, "THEMES":THEMES, "COMMENT_SORTS":COMMENT_SORTS, "SORTS":SORTS,
|
"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,
|
"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()
|
"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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,8 +251,9 @@
|
||||||
<div id="comment-banned-warning" class="comment-text text-removed mb-0">removed by @{{c.ban_reason}} (Admin)</div>
|
<div id="comment-banned-warning" class="comment-text text-removed mb-0">removed by @{{c.ban_reason}} (Admin)</div>
|
||||||
{% endif %}
|
{% 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 %}">
|
{% set realbody = c.realbody(v) %}
|
||||||
{{c.realbody(v) | safe}}
|
<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 %}">
|
||||||
|
{{realbody | safe}}
|
||||||
</div>
|
</div>
|
||||||
{% if c.parent_submission or c.wall_user_id %}
|
{% if c.parent_submission or c.wall_user_id %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue