about summary refs log tree commit diff
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-03-31 13:54:36 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-03-31 13:54:36 +0200
commit5e26295e061b653d0134caf0b54447a3683aecba (patch)
tree648b64b15af846d1b32316bee4d638213817e814 /app/assets/javascripts
parent188cddefe90c550227ea8bbd842a7c6ed3615eab (diff)
Fix #700 - hide spoilers on static pages
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/extras.jsx13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/assets/javascripts/extras.jsx b/app/assets/javascripts/extras.jsx
index 5738863dd..c13feceff 100644
--- a/app/assets/javascripts/extras.jsx
+++ b/app/assets/javascripts/extras.jsx
@@ -24,4 +24,17 @@ $(() => {
       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);
+    }
+  });
 });