diff --git a/files/assets/js/core.js b/files/assets/js/core.js index ea9b10a3a..f13b11ee6 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -260,7 +260,11 @@ function changename(s1,s2) { } function showmore(t) { - const div = t.parentElement.nextElementSibling + let div = t + while (!(div.id && div.id.startsWith('comment-text-'))){ + div = div.parentElement + } + div = div.getElementsByTagName('d')[0] div.classList.toggle('d-none') if (div.classList.contains('d-none')) t.innerHTML = 'SHOW MORE' diff --git a/files/helpers/regex.py b/files/helpers/regex.py index e29278533..8a8358c52 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -106,7 +106,7 @@ color_regex = re.compile("[a-f0-9]{6}", flags=re.A) # lazy match on the .*?, only match if there is trailing stuff # Specifically match Snappy's way of formatting, this might break some losers' comments. -showmore_regex = re.compile(r"^(.*?

(?:)?)(\s*

.*)", flags=re.A|re.DOTALL) +showmore_regex = re.compile(r"^(.*?<\/[a-z]+>(?:<\/li><\/ul>)?)(\s*<[a-z]+>.*)", flags=re.A|re.DOTALL) search_token_regex = re.compile('"([^"]*)"|(\S+)', flags=re.A) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 7316023e5..5821a83cf 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -537,14 +537,14 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys CHARLIMIT = 3000 pos = 0 for _ in range(20): - pos = sanitized.find('

', pos + 4) + pos = sanitized.find('>', pos + 4) if pos < 0: break if (pos < 0 and len(sanitized) > CHARLIMIT) or pos > CHARLIMIT: pos = CHARLIMIT - 500 if pos >= 0: sanitized = (sanitized[:pos] + - showmore_regex.sub(r'\1

\2', + showmore_regex.sub(r'\1

\2', sanitized[pos:], count=1)) return sanitized.strip()