MU Soapbox

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Muxify
    • Mustard

    Wiki Spoiler Code

    How-Tos
    2
    2
    1569
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • surreality
      surreality last edited by

      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>
      {{{text|{{{1}}}}}}
      </div></div></includeonly>
      

      To use the template on any given page:

      {{Spoiler|text}}
      

      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. 😄

      Hopefully this helps somebody out.

      Oh fucking well.

      1 Reply Last reply Reply Quote 2
      • Zobi
        Zobi last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post