From 2bae09e018228139f6bb2a071d5fa9a9d4a060f1 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Mon, 12 Mar 2018 18:36:08 -0500 Subject: [PATCH] Add option to hide all reddit comments --- src/views/watch.ecr | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/views/watch.ecr b/src/views/watch.ecr index e70e4029..461627be 100644 --- a/src/views/watch.ecr +++ b/src/views/watch.ecr @@ -71,7 +71,18 @@ function toggle(target) { target.innerHTML = '[ - ]'; body.style.display = ''; } +}; + +function toggle_comments(target) { + body = target.parentNode.parentNode.parentNode.children[1]; + if (body.style.display === null || body.style.display === '') { + target.innerHTML = '[ + ]'; + body.style.display = 'none'; + } else { + target.innerHTML = '[ - ]'; + body.style.display = ''; } +};
@@ -116,13 +127,20 @@ function toggle(target) {

<% if reddit_thread && !reddit_html.empty? %> +
-

<%= reddit_thread.data.title %>

+

+ [ - ] + <%= reddit_thread.data.title %> +

View more comments on Reddit +
+
<%= reddit_html %>
+
<% end %>