Fix #700 - hide spoilers on static pages

This commit is contained in:
Eugen Rochko 2017-03-31 13:54:36 +02:00
parent 188cddefe9
commit 5e26295e06
5 changed files with 40 additions and 4 deletions

View File

@ -24,4 +24,17 @@ $(() => {
window.location.href = $(e.target).attr('href'); window.location.href = $(e.target).attr('href');
} }
}); });
$('.status__content__spoiler-link').on('click', e => {
e.preventDefault();
const contentEl = $(e.target).parent().parent().find('div');
if (contentEl.is(':visible')) {
contentEl.hide();
$(e.target).parent().attr('style', 'margin-bottom: 0');
} else {
contentEl.show();
$(e.target).parent().attr('style', null);
}
});
}); });

View File

@ -97,6 +97,15 @@
a { a {
color: $color4; color: $color4;
} }
a.status__content__spoiler-link {
color: $color5;
background: $color3;
&:hover {
background: lighten($color3, 8%);
}
}
} }
.status__attachments { .status__attachments {
@ -163,6 +172,15 @@
a { a {
color: $color4; color: $color4;
} }
a.status__content__spoiler-link {
color: $color5;
background: $color3;
&:hover {
background: lighten($color3, 8%);
}
}
} }
.detailed-status__meta { .detailed-status__meta {

View File

@ -9,8 +9,10 @@
.status__content.e-content.p-name.emojify< .status__content.e-content.p-name.emojify<
- unless status.spoiler_text.blank? - unless status.spoiler_text.blank?
%p= status.spoiler_text %p{ style: 'margin-bottom: 0' }<
%div{ style: "direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status) %span>= "#{status.spoiler_text} "
%a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more')
%div{ style: "display: #{status.spoiler_text.blank? ? 'block' : 'none'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
- unless status.media_attachments.empty? - unless status.media_attachments.empty?
- if status.media_attachments.first.video? - if status.media_attachments.first.video?

View File

@ -14,8 +14,10 @@
.status__content.e-content.p-name.emojify< .status__content.e-content.p-name.emojify<
- unless status.spoiler_text.blank? - unless status.spoiler_text.blank?
%p= status.spoiler_text %p{ style: 'margin-bottom: 0' }<
%div{ style: "direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status) %span>= "#{status.spoiler_text} "
%a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more')
%div{ style: "display: #{status.spoiler_text.blank? ? 'block' : 'none'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
- unless status.media_attachments.empty? - unless status.media_attachments.empty?
.status__attachments .status__attachments

View File

@ -138,6 +138,7 @@ en:
statuses: statuses:
open_in_web: Open in web open_in_web: Open in web
over_character_limit: character limit of %{max} exceeded over_character_limit: character limit of %{max} exceeded
show_more: Show more
visibilities: visibilities:
private: Only show to followers private: Only show to followers
public: Public public: Public