Fix: CW toggle
This commit is contained in:
parent
0014890881
commit
7822b2c740
|
@ -96,9 +96,9 @@ function cw() {
|
|||
}
|
||||
}
|
||||
//TLでコンテントワーニングを表示トグル
|
||||
function cw_show(id) {
|
||||
$('.cw_hide_' + id).toggleClass('cw')
|
||||
$('.cw-long-' + id).toggleClass('hide')
|
||||
function cw_show(e) {
|
||||
$(e).parent().parent().find('.cw_hide').toggleClass('cw')
|
||||
$(e).parent().find('.cw_long').toggleClass('hide')
|
||||
}
|
||||
$(function() {
|
||||
$('#cw-text').on('change', function(event) {
|
||||
|
|
|
@ -360,22 +360,20 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
|||
if ((toot.cw || toot.cw == "") && cw) {
|
||||
var content = escapeHTML(toot.text);
|
||||
var spoil = escapeHTMLtemp(toot.cw);
|
||||
var spoiler = "cw cw_hide_" + toot.id;
|
||||
var spoiler = "cw cw_hide";
|
||||
var api_spoil = "gray";
|
||||
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
|
||||
'\')" class="nex parsed cw_btn">' + lang.lang_parse_cwshow + '</a><br>';
|
||||
var spoiler_show = '<a href="#" onclick="cw_show(this)" class="nex parsed cw_btn">' + lang.lang_parse_cwshow + '</a><br>';
|
||||
} else {
|
||||
var ct1 = nl2br(toot.text).split('<br />').length - 2;
|
||||
var ct2 = nl2br(toot.text).split('<br>').length - 2;
|
||||
if (ct1 > ct2) { var ct = ct1; } else { var ct = ct2; }
|
||||
if ((sent < ct && $.mb_strlen($.strip_tagstemp(toot.text)) > 5) || ($.strip_tagstemp(toot.text).length > ltr && $.mb_strlen($.strip_tagstemp(toot.text)) > 5)) {
|
||||
var content = '<span class="gray">' + lang.lang_parse_fulltext + '</span><br>' + escapeHTMLtemp(toot.text)
|
||||
var spoil = '<span class="cw-long-' + toot.id + '">' + $.mb_substr($.strip_tagstemp(
|
||||
var spoil = '<span class="cw_long">' + $.mb_substr($.strip_tagstemp(
|
||||
toot.text), 0, 100) +
|
||||
'</span><span class="gray">' + lang.lang_parse_autofold + '</span>';
|
||||
var spoiler = "cw cw_hide_" + toot.id;
|
||||
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
|
||||
'\')" class="nex parsed cw_btn">' + lang.lang_parse_more + '</a><br>';
|
||||
var spoiler = "cw cw_hide";
|
||||
var spoiler_show = '<a href="#" onclick="cw_show(this)" class="nex parsed cw_btn">' + lang.lang_parse_more + '</a><br>';
|
||||
} else {
|
||||
var content = escapeHTMLtemp(toot.text);
|
||||
if (toot.cw) {
|
||||
|
|
|
@ -516,9 +516,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
|||
}
|
||||
if (toot.spoiler_text && cw) {
|
||||
var spoil = escapeHTML(toot.spoiler_text)
|
||||
var spoiler = 'cw cw_hide_' + toot.id
|
||||
var spoiler = 'cw cw_hide'
|
||||
var api_spoil = 'gray'
|
||||
var spoiler_show = `<a href="#" onclick="cw_show('${toot.id}')" class="nex parsed cw_btn">${lang.lang_parse_cwshow}</a><br>`
|
||||
var spoiler_show = `<a href="#" onclick="cw_show(this)" class="nex parsed cw_btn">${lang.lang_parse_cwshow}</a><br>`
|
||||
} else {
|
||||
if (content) {
|
||||
var ct1 = content.split('</p>').length + content.split('<br />').length - 2
|
||||
|
@ -538,14 +538,14 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
|||
($.mb_strlen($.strip_tags(content)) > ltr && $.mb_strlen($.strip_tags(content)) > 5)
|
||||
) {
|
||||
var content = `<span class="gray">${lang.lang_parse_fulltext}</span><br>` + content
|
||||
var spoil = `<span class="cw-long-${toot.id}">${$.mb_substr(
|
||||
var spoil = `<span class="cw_long">${$.mb_substr(
|
||||
$.strip_tags(content),
|
||||
0,
|
||||
100
|
||||
)}</span>
|
||||
<span class="gray">${lang.lang_parse_autofold}</span>`
|
||||
var spoiler = 'cw cw_hide_' + toot.id
|
||||
var spoiler_show = `<a href="#" onclick="cw_show('${toot.id}')" class="nex parsed cw_btn">
|
||||
var spoiler = 'cw cw_hide'
|
||||
var spoiler_show = `<a href="#" onclick="cw_show(this)" class="nex parsed cw_btn">
|
||||
${lang.lang_parse_more}
|
||||
</a><br>`
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user