FIX: allows clicking links in a spoiler block (#34)

FIX: allows clicking links in a spoiler block (#34)

diff --git a/assets/javascripts/spoiler.js b/assets/javascripts/spoiler.js
index 67d6ed5..43c7a05 100644
--- a/assets/javascripts/spoiler.js
+++ b/assets/javascripts/spoiler.js
@@ -98,11 +98,14 @@
         if ($spoiler.data("spoiler-state") === "blurred") {
           $spoiler.data("spoiler-state", "revealed").css("cursor", "auto");
           applyBlur($spoiler, noBlur);
+          e.preventDefault();
         } else {
-          $spoiler.data("spoiler-state", "blurred").css("cursor", "pointer");
-          applyBlur($spoiler, partialBlur);
+          if (e.target && e.target.tagName !== "A") {
+            $spoiler.data("spoiler-state", "blurred").css("cursor", "pointer");
+            applyBlur($spoiler, partialBlur);
+            e.preventDefault();
+          }
         }
-        e.preventDefault();
       });
   };

GitHub sha: 0344f2cf

1 Like