diff options
Diffstat (limited to 'app/assets/javascripts/extras.jsx')
-rw-r--r-- | app/assets/javascripts/extras.jsx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/assets/javascripts/extras.jsx b/app/assets/javascripts/extras.jsx index 5738863dd..5784d17c2 100644 --- a/app/assets/javascripts/extras.jsx +++ b/app/assets/javascripts/extras.jsx @@ -14,6 +14,16 @@ $(() => { } }); + $.each($('.spoiler'), (_, content) => { + $(content).on('click', e => { + var hasClass = $(content).hasClass('spoiler-on'); + if (hasClass || e.target === content) { + e.preventDefault(); + $(content).siblings(".spoiler").andSelf().toggleClass('spoiler-on', !hasClass); + } + }); + }); + $('.media-spoiler').on('click', e => { $(e.target).hide(); }); |