forked from MarseyWorld/MarseyWorld
add "show more..." button
parent
8f9d982104
commit
b6a5d010ca
|
@ -94,6 +94,7 @@ reddit_domain_regex = re.compile("(^|\s)https:\/\/(reddit\.com|new\.reddit.com|w
|
|||
|
||||
color_regex = re.compile("[a-z0-9]{6}", flags=re.A)
|
||||
|
||||
showmore_regex = re.compile("(.{3000,40000}?</p>)(<p>.*)", flags=re.A)
|
||||
|
||||
def sub_matcher(match, upper=False):
|
||||
if match.group(0).startswith('<'):
|
||||
|
|
|
@ -335,10 +335,14 @@ def sanitize(sanitized, edit=False):
|
|||
|
||||
if bans: abort(403, description=f"Remove the banned domains {bans} and try again!")
|
||||
|
||||
sanitized = sanitized.replace('\n','')
|
||||
|
||||
if len(sanitized) > 5000:
|
||||
sanitized = showmore_regex.sub(r'\1<p><a onclick="showmore()" role="button">SHOW MORE...</a></p><div class="d-none">\2</div>', sanitized)
|
||||
|
||||
signal.alarm(0)
|
||||
|
||||
return sanitized.replace('\n','')
|
||||
return sanitized
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ set CACHE_VER = {
|
|||
'css/win98.css': 61,
|
||||
|
||||
'js/award_modal.js': 253,
|
||||
'js/bootstrap.js': 268,
|
||||
'js/bootstrap.js': 269,
|
||||
'js/comments+submission_listing.js': 261,
|
||||
'js/submission_listing.js': 261,
|
||||
'js/emoji_modal.js': 297,
|
||||
|
|
Loading…
Reference in New Issue