Wiki Spoiler Code

  • I just finished this up today, and it isn't MU* code -- so it didn't seem to fit there.

    Anyway, these are pretty easy. Note: the text will hop around a little when these expand, but life goes on; you'll have an automatically expanding/collapsing section (default collapsed) with the potential spoiler content hidden. (It may flash visible for a fraction of a second, but that's javascript for you.)

    Add to the bottom of Mediawiki:Common.css:

    .spoiler .mw-collapsible-toggle,
    .mw-content-ltr .spoiler .mw-collapsible-toggle {
    	float: left !important;
    	padding-right: 8px;

    Create a new page, titled Template:Spoiler

    Paste in the following, and save the page.

    <includeonly><div class="spoiler mw-collapsible mw-collapsed" data-expandtext="View Potential Spoilers" data-collapsetext="Hide Potential Spoilers"><div class="mw-collapsible-content"><br>

    To use the template on any given page:


    Text: enter whatever text you want here, can be multiple paragraphs, but cannot include = signs or | symbols.

    If you need to use a pipe symbol (for a link or similar stuff), create a pipe template if you don't have one already. That one's easier -- create a page called Template:!

    The only text on the page should be a single pipe symbol:


    ^ Yep, just like that. Save it and you're done. Then if you need a pipe symbol anywhere in your spoiler template (or any other templates on your wiki), you can pull it up with this: {{!}}

    A lot of wikis have this set up due to other code requirements, but just in case yours doesn't, that's how to do it, and what that thing is. :D

    Hopefully this helps somebody out.

  • Thank you for this. I am trying to teach myself how to make wiki magic and stuff like this really, really helps me out!

    Kudos to you on your awesome.


Looks like your connection to MU Soapbox was lost, please wait while we try to reconnect.