From 84328bf693e8e4284305d62290a089c76b9aa70e Mon Sep 17 00:00:00 2001 From: Cutls Date: Sat, 14 Sep 2019 02:18:33 +0900 Subject: [PATCH] Fix: if toot content is blank --- app/js/tl/parse.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 2b0da425..14e84343 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -426,7 +426,12 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { } } } - if (toot.content) { + if (toot.content == "") { + var content = " " + } else { + var content = toot.content + } + if (content) { var id = toot.id; if (mix == "home") { var home = "" @@ -468,31 +473,29 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { boostback = "emphasized"; } if (toot.spoiler_text && cw) { - var content = toot.content; var spoil = escapeHTML(toot.spoiler_text); var spoiler = "cw cw_hide_" + toot.id; var api_spoil = "gray"; var spoiler_show = '' + lang.lang_parse_cwshow + '
'; } else { - if (toot.content) { - var ct1 = toot.content.split('

').length + toot.content.split('
').length - 2; - var ct2 = toot.content.split('

').length + toot.content.split('
').length - 2; + if (content) { + var ct1 = content.split('

').length + content.split('
').length - 2; + var ct2 = content.split('

').length + content.split('
').length - 2; } else { var ct1 = 100; var ct2 = 100; } if (ct1 > ct2) { var ct = ct1; } else { var ct = ct2; } - if ((sent < ct && $.mb_strlen($.strip_tags(toot.content)) > 5) || ($.strip_tags(toot.content).length > ltr && $.mb_strlen($.strip_tags(toot.content)) > 5)) { - var content = '' + lang.lang_parse_fulltext + '
' + toot.content + if ((sent < ct && $.mb_strlen($.strip_tags(content)) > 5) || ($.strip_tags(content).length > ltr && $.mb_strlen($.strip_tags(content)) > 5)) { + var content = '' + lang.lang_parse_fulltext + '
' + content var spoil = '' + $.mb_substr($.strip_tags( - toot.content), 0, 100) + + content), 0, 100) + '' + lang.lang_parse_autofold + ''; var spoiler = "cw cw_hide_" + toot.id; var spoiler_show = '' + lang.lang_parse_more + '
'; } else { - var content = toot.content; var spoil = escapeHTML(toot.spoiler_text); var spoiler = ""; var spoiler_show = ""; @@ -650,7 +653,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { if (tagck) { Object.keys(toot.tags).forEach(function (key4) { var tag = toot.tags[key4]; - var featured = ' Feature ' + var featured = ' Feature ' tags = tags + '#' + tag.name + ':TL Toot ' + 'Pin' + featured + ' ';