Fix: if toot content is blank
This commit is contained in:
parent
6fdbf0b48e
commit
84328bf693
|
@ -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;
|
var id = toot.id;
|
||||||
if (mix == "home") {
|
if (mix == "home") {
|
||||||
var home = ""
|
var home = ""
|
||||||
|
@ -468,31 +473,29 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
||||||
boostback = "emphasized";
|
boostback = "emphasized";
|
||||||
}
|
}
|
||||||
if (toot.spoiler_text && cw) {
|
if (toot.spoiler_text && cw) {
|
||||||
var content = toot.content;
|
|
||||||
var spoil = escapeHTML(toot.spoiler_text);
|
var spoil = escapeHTML(toot.spoiler_text);
|
||||||
var spoiler = "cw cw_hide_" + toot.id;
|
var spoiler = "cw cw_hide_" + toot.id;
|
||||||
var api_spoil = "gray";
|
var api_spoil = "gray";
|
||||||
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
|
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
|
||||||
'\')" class="nex parsed cw_btn">' + lang.lang_parse_cwshow + '</a><br>';
|
'\')" class="nex parsed cw_btn">' + lang.lang_parse_cwshow + '</a><br>';
|
||||||
} else {
|
} else {
|
||||||
if (toot.content) {
|
if (content) {
|
||||||
var ct1 = toot.content.split('</p>').length + toot.content.split('<br />').length - 2;
|
var ct1 = content.split('</p>').length + content.split('<br />').length - 2;
|
||||||
var ct2 = toot.content.split('</p>').length + toot.content.split('<br>').length - 2;
|
var ct2 = content.split('</p>').length + content.split('<br>').length - 2;
|
||||||
} else {
|
} else {
|
||||||
var ct1 = 100;
|
var ct1 = 100;
|
||||||
var ct2 = 100;
|
var ct2 = 100;
|
||||||
}
|
}
|
||||||
if (ct1 > ct2) { var ct = ct1; } else { var ct = ct2; }
|
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)) {
|
if ((sent < ct && $.mb_strlen($.strip_tags(content)) > 5) || ($.strip_tags(content).length > ltr && $.mb_strlen($.strip_tags(content)) > 5)) {
|
||||||
var content = '<span class="gray">' + lang.lang_parse_fulltext + '</span><br>' + toot.content
|
var content = '<span class="gray">' + lang.lang_parse_fulltext + '</span><br>' + content
|
||||||
var spoil = '<span class="cw-long-' + toot.id + '">' + $.mb_substr($.strip_tags(
|
var spoil = '<span class="cw-long-' + toot.id + '">' + $.mb_substr($.strip_tags(
|
||||||
toot.content), 0, 100) +
|
content), 0, 100) +
|
||||||
'</span><span class="gray">' + lang.lang_parse_autofold + '</span>';
|
'</span><span class="gray">' + lang.lang_parse_autofold + '</span>';
|
||||||
var spoiler = "cw cw_hide_" + toot.id;
|
var spoiler = "cw cw_hide_" + toot.id;
|
||||||
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
|
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
|
||||||
'\')" class="nex parsed cw_btn">' + lang.lang_parse_more + '</a><br>';
|
'\')" class="nex parsed cw_btn">' + lang.lang_parse_more + '</a><br>';
|
||||||
} else {
|
} else {
|
||||||
var content = toot.content;
|
|
||||||
var spoil = escapeHTML(toot.spoiler_text);
|
var spoil = escapeHTML(toot.spoiler_text);
|
||||||
var spoiler = "";
|
var spoiler = "";
|
||||||
var spoiler_show = "";
|
var spoiler_show = "";
|
||||||
|
@ -650,7 +653,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
||||||
if (tagck) {
|
if (tagck) {
|
||||||
Object.keys(toot.tags).forEach(function (key4) {
|
Object.keys(toot.tags).forEach(function (key4) {
|
||||||
var tag = toot.tags[key4];
|
var tag = toot.tags[key4];
|
||||||
var featured = ' <a onclick="tagFeature(\'' + tag.name + '\',' + acct_id +')" class="pointer" title="add it to Featured tags">Feature</a> '
|
var featured = ' <a onclick="tagFeature(\'' + tag.name + '\',' + acct_id + ')" class="pointer" title="add it to Featured tags">Feature</a> '
|
||||||
tags = tags + '<span class="hide" data-tag="' + tag.name + '">#' + tag.name + ':<a onclick="tl(\'tag\',\'' + tag.name + '\',' + acct_id +
|
tags = tags + '<span class="hide" data-tag="' + tag.name + '">#' + tag.name + ':<a onclick="tl(\'tag\',\'' + tag.name + '\',' + acct_id +
|
||||||
',\'add\')" class="pointer" title="' + lang.lang_parse_tagTL.replace("{{tag}}", '#' + tag.name) + '">TL</a> <a onclick="brInsert(\'#' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", '#' + tag.name) + '">Toot</a> ' +
|
',\'add\')" class="pointer" title="' + lang.lang_parse_tagTL.replace("{{tag}}", '#' + tag.name) + '">TL</a> <a onclick="brInsert(\'#' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", '#' + tag.name) + '">Toot</a> ' +
|
||||||
'<a onclick="tagPin(\'' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagpin.replace("{{tag}}", '#' + tag.name) + '">Pin</a>' + featured + '</span> ';
|
'<a onclick="tagPin(\'' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagpin.replace("{{tag}}", '#' + tag.name) + '">Pin</a>' + featured + '</span> ';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user