I've seen spoilers presented a number of ways, and wanted to hear others' opinions on the various ways. Something like this: <font color=white>...</font> fails with themes with non-white background.

Even setting the foreground and background at once:

<table bgcolor="#000000"><tr><td><font color="#000000"> ... </font></table>
some browsers will be set to ignore color selections, or make links visible.

There's an interesting technique here: putting the hidden text in a code tag in an HTML comment, and adding a link to a displaytype=code version of the page. I don't know how you would do that without creating the page first and then adding in the link via update, though. And because it is in <code></code> you don't get to have html in the spoiler. Perhaps just a <readmore> section would be preferable.

Some of the answers at How's your perl? are base64 encoded, but that's pretty troublesome to unhide.

Any others? Is there a generic WTDI that would work for all situations that could be documented?

Replies are listed 'Best First'.
Re: formatting spoilers
by TomDLux (Vicar) on Mar 22, 2004 at 01:01 UTC

    Nothing is perfect ...

    --
    TTTATCGGTCGTTATATAGATGTTTGCA

      Yep, nothing is perfect. Readmore has several problems: You get 'spoiled' without warning if you select the node from Newest Nodes, it is slow and painful to reveal multiple spoilers in a thread full of them, some people have 'readmore' disabled, ...

      Note that putting CODE tags inside of an HTML comment will cause the 'download code' link to appear automatically, so you don't *have to* put in your own link. But that solution for spoilers isn't perfect either.

      I recently discussed this and realized that the black-on-black or white-on-white method doesn't work for everyone. So I think we should just support <spoiler> and </spoiler> that would just get replaced with the *viewer's* choice of spoiler method. In user settings you could pick between a few methods including at least HTML comments, 'readmore' tags, black-on-black, or act like readmore but provide a link to the node with ;spoil=1 or such added to the URL.

      - tye        

Re: formatting spoilers
by Jaap (Curate) on Mar 22, 2004 at 01:01 UTC
    I assume you mean spoilers on perlmonks, or do you mean in general?
    If you can use Javascript, it's easy to make a
    <button onClick='alert("This'll spoil your day!");'>
    Or using CSS, you might make a
    <style> .spoiler:hover { visibility: visible; } .spoiler { visibility: hidden; } </style> ... <span class="spoiler">This'll spoil your week!</span>
    </code>
      small point, but visibility:hidden is quirky on Netscape 4 - sometimes it shows content when it shouldn't.
      Yes, I meant on perlmonks. Thanks.
Re: formatting spoilers
by Abigail-II (Bishop) on Mar 22, 2004 at 09:35 UTC
    The typical HTML/HTTP solution is:
    <a href = "spoiler.html">Spoiler</a>
    The typical Usenet solution is ^L, for which there is no HTML equivalent. The other Usenet solution is a bunch of blank lines, which in HTML is easily simulated with a large, blank, <pre> section.

    Personally, I think all this "spoiler" business is a nuisance. If I don't want to read the spoiler, I don't.

    Abigail

Re: formatting spoilers
by b10m (Vicar) on Mar 22, 2004 at 11:37 UTC

    A method that could work, but would be slightly annoying is something like: "See source for Spoiler:" and than add a comment to your post:

    <!-- Spoiler: yada yada yada -->
    --
    b10m

    All code is usually tested, but rarely trusted.
      The unfortunate thing with this solution is if we were taking a quick look at the site at sowhere, like the public library, where the the network has the view source option disabled. Also, it seems like a lot of trouble to look over a source to find a spoiler. It's a good idea, but it seems like a hassle.
        The unfortunate thing with this solution is if we were taking a quick look at the site at sowhere, like the public library, where the the network has the view source option disabled.

        I'm talking about spoilers here. If you're at a public library (and even "view-source:http://url" ain't working in your browser's location bar), you have ample time to think about the solution on your way home or work, or wherever you usually read Perlmonks :) If, by then, you still don't have a clue, you can look up the spoiler.

        it seems like a lot of trouble to look over a source to find a spoiler.

        That's why I suggested the usage of "Spoiler:" in front of the actual text. If your source viewer doesn't have search function, get a different one ;) But, as I also stated, it "would be slightly annoying". For every way you can think of arguments against it... I guess ;) Then again, shouldn't a spoiler always involve a little hassle to actually read it?

        --
        b10m

        All code is usually tested, but rarely trusted.
Re: formatting spoilers
by castaway (Parson) on Mar 23, 2004 at 06:35 UTC
    See also RFC: Spoiler tags for some other suggestions, even from pmdev, looks like what we need is an implementation..

    C.

Re: formatting spoilers
by QM (Parson) on Mar 22, 2004 at 04:53 UTC
    Can you put your spoiler on your scratch pad, and provide a link to it in your reply?

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      Linking to spoilers on the scratch pad doesn't work too well because our scratch pads are really designed to be temporary. We want the nodes to be generating content as permanent as possible in the Internet--for our posterity, you know... ;)

      --
      Allolex

      Yes, so right.

      Then perhaps we should start a node called Spoilers, and just post our spoilers there as a reply, and link to it in the original thread.

      Maybe we should have another section added, called Spoilers, but not easy to get to.

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

        Allolex suggested I share this with the group:

        If there is a root node called Spoilers, where all spoilers live separate from the original thread, each spoiler "answer" can have comments and replies, which will not show up in the original thread. This keeps all spoiler related discussion tucked neatly away behind links.

        Allolex points out that this departs from the SOP where one root node "contains" the entire discussion. I assume this comes from some ideal of displaying the root node and reading the entire discussion just with a mouse-wheel -- of somehow encapsulating a discussion into a glass box for all to see at a glance.

        I would counter that many threads have links outside the original thread. In fact, in a heavy response thread, beyond some threshold responses are hidden behind links anyway.

        <tongue-in-cheek>What are browsers for?</tongue-in-cheek> :)

        -QM
        --
        Quantum Mechanics: The dreams stuff is made of

Re: formatting spoilers
by Vautrin (Hermit) on Mar 23, 2004 at 01:35 UTC

    I think the only real way to ensure that a spoiler is spoiler safe is a modification to Perlmonks.org. What if a <spoiler> tag were added to Perl Monks, which would result in a button being displayed. Clicking the button would do a javascript document.write to place the spoiler below the button. Of course, this has it's problems because:

    a. this solution involves hacking Perlmonks -- which takes up precious developer time.
    b. people aren't always receptive to improvements. I am sure there are people who will think a spoiler button is a bad idea.
    c. not everyone has javascript enabled


    Want to support the EFF and FSF by buying cool stuff? Click here.