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