mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-23 05:37:47 +00:00
Fix “Show more” not switching to “Show less” on public pages (#13174)
* Fix “Show more” not switching to “Show less” on public pages Fixes #13169 * Fix initial text of CW button on public pages when CW are unfolded by default
This commit is contained in:
parent
e96146e320
commit
eea0cd8fad
|
@ -118,15 +118,6 @@ function main() {
|
||||||
|
|
||||||
delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original'));
|
delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original'));
|
||||||
delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static'));
|
delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static'));
|
||||||
});
|
|
||||||
|
|
||||||
delegate(document, '.webapp-btn', 'click', ({ target, button }) => {
|
|
||||||
if (button !== 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
window.location.href = target.href;
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
delegate(document, '.status__content__spoiler-link', 'click', function() {
|
delegate(document, '.status__content__spoiler-link', 'click', function() {
|
||||||
const contentEl = this.parentNode.parentNode.querySelector('.e-content');
|
const contentEl = this.parentNode.parentNode.querySelector('.e-content');
|
||||||
|
@ -134,14 +125,31 @@ function main() {
|
||||||
if (contentEl.style.display === 'block') {
|
if (contentEl.style.display === 'block') {
|
||||||
contentEl.style.display = 'none';
|
contentEl.style.display = 'none';
|
||||||
this.parentNode.style.marginBottom = 0;
|
this.parentNode.style.marginBottom = 0;
|
||||||
|
this.textContent = (new IntlMessageFormat(messages['status.show_more'] || 'Show more', locale)).format();
|
||||||
} else {
|
} else {
|
||||||
contentEl.style.display = 'block';
|
contentEl.style.display = 'block';
|
||||||
this.parentNode.style.marginBottom = null;
|
this.parentNode.style.marginBottom = null;
|
||||||
|
this.textContent = (new IntlMessageFormat(messages['status.show_less'] || 'Show less', locale)).format();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[].forEach.call(document.querySelectorAll('.status__content__spoiler-link'), (spoilerLink) => {
|
||||||
|
const contentEl = spoilerLink.parentNode.parentNode.querySelector('.e-content');
|
||||||
|
const message = (contentEl.style.display === 'block') ? (messages['status.show_less'] || 'Show less') : (messages['status.show_more'] || 'Show more');
|
||||||
|
spoilerLink.textContent = (new IntlMessageFormat(message, locale)).format();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
delegate(document, '.webapp-btn', 'click', ({ target, button }) => {
|
||||||
|
if (button !== 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
window.location.href = target.href;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
delegate(document, '.modal-button', 'click', e => {
|
delegate(document, '.modal-button', 'click', e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue