Template:DateALive:Toggle

From Baka-Tsuki
Revision as of 04:49, 26 May 2014 by AKAAkira (talk | contribs) (Put in a (invisible) table so it ''should'' wrap when it bumps into the cover's image.)
Jump to navigation Jump to search

Here's a template used on the main page of Date A Live project.

Big thanks to OH&S for his Toaru template. This template (the DAL's one) is largely based on his work.

Code

The Table of Contents may not redirect you unless you expand its section by clicking one of the boxes below.

Click here to OPEN or CLOSE all sections
Date A Live - Main story
Date A Live - Side stories


How to use it

Click one of the boxes to hide or unhide the section it names. Click again to undo the process.

For the purposes of this kind of toggle, it doesn't matter where the trigger is placed on the page.

Add an arc

To make a new hide/unhide trigger, wrap these pieces of code around whatever's supposed to be clicked: <div class="mw-customtoggle-ArcX mw-customtoggle-ArcXClose mw-customtoggle-ArcXOpen" style="background:#9e6c38;cursor:pointer;height:20px;padding-top:3px" align="center"> and </div>. The ArcX is the declared name of the object, and should be replaced with whatever's most appropriate ("Arc10", "Comiket", etc.).

Then, add the piece of string referring to the new arc (mw-customtoggle-ArcX mw-customtoggle-ArcXClose mw-customtoggle-ArcXOpen) to the master toggle on this page, twice in total: once after the <div class=" for the all-sections-toggle trigger and once after the <div class=" for the main-story- or side-stories-sections-toggle trigger. Remember to replace the all six ArcX in here too.

Finally, wrap <div class="mw-collapsible" style="text-align:left;margin:5px5pxclear:both;font-size:100%;background:transparent;width:100%;" id="mw-customcollapsible-ArcX"> and <br style="clear:both"/> around the stuff you want to hide and unhide. Again, that little text ArcX is the name you're assigning for the purpose of customtoggle.

For example:

<div class="mw-customtoggle-ArcX mw-customtoggle-ArcXClose mw-customtoggle-ArcXOpen" style="background:#9e6c38;cursor:pointer;height:20px;padding-top:3px" align="center"><big>'''Volume X'''</big></div>

<div class="mw-collapsible" style="text-align:left;margin:5px5pxclear:both;font-size:100%;background:transparent;width:100%;"
id="mw-customcollapsible-ArcX">
[[File:DAL_v01_cover.jpg|thumb|x180px]]
===Volume X - Dead End Tohka===
::*[[Date A Live:Volume 1 Illustrations|Novel Illustrations]]
::*[[Date A Live:Volume 1 Prologue|Prologue: Chance Meeting -restart-]]
::*[[Date A Live:Volume 1 Chapter 1|Chapter 1: The Nameless Girl]]
::*[[Date A Live:Volume 1 Chapter 2|Chapter 2: {{Furigana|Training|Game}} Start]]
::*[[Date A Live:Volume 1 Chapter 3|Chapter 3: Your Name Is......]]
::*[[Date A Live:Volume 1 Chapter 4|Chapter 4: Surprise Date]]
::*[[Date A Live:Volume 1 Chapter 5|Chapter 5: Ruthless {{Furigana|Slaughterer|Sandalphon}}]]
::*[[Date A Live:Volume 1 Epilogue|Epilogue: Life With a Spirit]]
::*[[Date A Live:Volume 1 Afterword|Afterword]]
<br style="clear:both"/>
</div>


Tip: If you add mw-collapsed in the class of the second div (after mw-collapsible), you'll make the open/hide trigger closed by default.

For example:

<div class="mw-customtoggle-ArcX mw-customtoggle-ArcXClose mw-customtoggle-ArcXOpen" style="background:#9e6c38;cursor:pointer;height:20px;padding-top:3px" align="center"><big>'''Volume X'''</big></div>

<div class="mw-collapsible mw-collapsed" style="text-align:left;margin:5px5pxclear:both;font-size:100%;background:transparent;width:100%;"
id="mw-customcollapsible-ArcX">
[[File:DAL_v01_cover.jpg|thumb|x180px]]
===Volume X - Dead End Tohka===
::*[[Date A Live:Volume 1 Illustrations|Novel Illustrations]]
::*[[Date A Live:Volume 1 Prologue|Prologue: Chance Meeting -restart-]]
::*[[Date A Live:Volume 1 Chapter 1|Chapter 1: The Nameless Girl]]
::*[[Date A Live:Volume 1 Chapter 2|Chapter 2: {{Furigana|Training|Game}} Start]]
::*[[Date A Live:Volume 1 Chapter 3|Chapter 3: Your Name Is......]]
::*[[Date A Live:Volume 1 Chapter 4|Chapter 4: Surprise Date]]
::*[[Date A Live:Volume 1 Chapter 5|Chapter 5: Ruthless {{Furigana|Slaughterer|Sandalphon}}]]
::*[[Date A Live:Volume 1 Epilogue|Epilogue: Life With a Spirit]]
::*[[Date A Live:Volume 1 Afterword|Afterword]]
<br style="clear:both"/>
</div>

(Note: the <br style="clear:both"/> shouldn't be that important - it's only giving a type of line break, I think, which shouldn't actually be part of the hiding process. On the other hand, I have no idea where the user's manual for the customtoggle is so for all I know it's a mandatory part of the function. Unless someone who knows for sure comes along and deletes my comment, include it just to be on the safe side.)

Delete an arc

Remove the codes given in the section above.

However, the only time you'll need to delete an arc is probably if for some reason the entire novel has to be removed, and the extra piece of code in the master toggle won't do anything if the declared name doesn't exist. So you can just delete the section needed to be deleted and leave it at that. Probably.

'Things to do' list

  • Fix the ToC bugs
  • That's all, I guess...