WordPress.org

Support

Support » Plugins and Hacks » WP 1.5: Spoiler hack needed.

WP 1.5: Spoiler hack needed.

Viewing 15 replies - 1 through 15 (of 24 total)
  • Mark (podz)
    Support Maven

    @podz

    I know what a spoiler for a car is, but for a blog ?

    podz… it allows you to write text that needs to behighlighted in order to view it.

    A lot of sites dedicated to tv shows have spoiler text.. (text goes to same color as background; generally shown as Spoiler Text:[XXXXXXXXXXXXXXXXXXXXXXXXX]
    with inbetween brackets not shown until highlighted

    And yeah, probably needed for those with fan/tv show blogs. I would actually like this myself for some things

    Mark (podz)
    Support Maven

    @podz

    In that case, just create the right css class and use either a span or a div for that.

    I still wouldnt even know how to do that, but thanks.. will see if Lisa Explains has some tips on doing that

    NuclearMoose
    Member

    @nuclearmoose

    Add this to your style sheet:

    .spoiler {
    background-colour: white;
    colour: white;
    }

    Use this in your post:

    <span class="spoiler">This is spoiler text.</span>
    <div class="spoiler">This is a div with nothing but spoiler text.</div>

    That should work!

    Mark (podz)
    Support Maven

    @podz

    In css:
    .spoiler {
    color: #000;
    }

    In an entry:
    <div class=”spoiler”>Hidden characters here I hope</div>

    It does work:
    http://www.tamba2.org.uk/T2/archives/2005/01/15/bits-and-bobs/

    and you might want to add ‘display:inline;’ to that if you are going to plant it inside paragraphs.

    Mark (podz)
    Support Maven

    @podz

    NM :p

    🙂

    NuclearMoose
    Member

    @nuclearmoose

    HA! Some of your own medicine for a change, Podzie! 😛

    Going to try now :P. Thanks.

    Ok. But:

    I want it to show:

    Click here for spoiler!

    and when they click it, On the bottom, the spoiler will appear.

    Ok someone whos familiar with javascript, more so then me, finish this 🙂

    I have to leave or I would but it’s giving me an error

    <style id="spoiler"><!--
    .spoiler {
    visibility: hidden;
    }
    --></style>
    <scrpt language="JavaScript" type="text/javascript"><!--
    function showSpoilers()
    {
    object = document.getElementById("spoiler");
    object.disabled = true;
    }
    --></script>
    <span onclick="showSpoilers();" onmouseover="this.style.cursor="hand";">Show Spoilers</span>
    Spoiler: <span class="spoiler">Spoiler would go here</span>

    Spoiler: <span class="spoiler">Spoiler2 would go here</span>

    — Also seems i broke bbPress 🙂

    Its giving you a error because you got a typo =P.

    <scrpt language=”JavaScript” should be <script language=”JavaScript”.

    Where do I insert that code..

    oh if it works after that, you put the javascript and style info in the “Header Template” or whatever, then just put the <span onclick> on any page where you plan on using spoilers (or youc ould add it to some Post template im not sure how those work, so it adds it on every page), and then just <span class=”spoiler”> where you want spoilers

    Ok well the bbPress bugs the code a bit but ya

    dcramer[at]gmail.com is my msn, or email, contact me and ill help ya set it up.

    If you email me include what version of wordpress, ill also send you updated code

    Actually, a pure CSS way to do this would be to have .spoiler class as above but to also add:

    .spoiler:hover
    {
    color: red;
    }

    Which would make the text red when the pointer is over the span.

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘WP 1.5: Spoiler hack needed.’ is closed to new replies.