Skip to content

Commit

Permalink
Making the spoiler revalation even better.
Browse files Browse the repository at this point in the history
Now the link only appears for a list that actually has spoilers.
And clicking it only reveals the spoilers underneath.
  • Loading branch information
ymendel committed Dec 19, 2011
1 parent 3ad8f13 commit 6978877
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tvtropes.org.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$("div#wikitext > ul").before("<a id='show-spoilers'>(reveal spoilers)</a>")
$("a#show-spoilers").click(function(e) {
$("span.spoiler").removeClass("spoiler");
$("ul:has(span.spoiler)").prepend("<a class='show-spoilers'>(reveal spoilers)</a>");
$("a.show-spoilers").click(function(e) {
$(this).parent("ul").find("span.spoiler").removeClass("spoiler");
e.preventDefault();
});

0 comments on commit 6978877

Please sign in to comment.