vanilla/addons — pull request #129 by bleistivt (2014-09-21 01:03:10+00:00)
Title: Spoilers: support for previews and nested spoilers

- found a much better solution to bind the events which is right when the
spoiler element is created (no need for livequery)
- replaces all occurences of .bind() with .on() (which is the preferred way
as of jQuery 1.7)
- adds support for spoilers in comment previews, but needed a few workarounds
to accomplish this:
- the PreviewLoaded js event is fired before the preview is loaded into the
dom, so I added a 150ms delay to the FindAndReplace() call which should be
enough for every browser to load the DOM
- the AfterCommentPreviewFormat event lacks the ['Object']->Body EventArgument
I created it in the hook so the RenderSpoilers() function doesn't need to be
changed
- tested in Firefox, IE and Chrome