Forum:How to add spoilers to a page?

How do I add spoilers to a wikia? I'm wondering using something like the translation templates from wiktionary (Wiktionary templates).--Koppa Dasao frelangi kazelangin na 15:39, December 26, 2010 (UTC)


 * I assume you're talking about the show/hide link. You can do that with the following, taken from here:

Which yields:

Actually, it appears to not work, and I don't know why. That's kind of creepy. Probably a CSS thing.


 * Actually, no. Collapsible tables like that is my backup plan if nothing else works. It doesn't work here, but I already has those implemented on Delang wiki (as a number of templates, see Table templates), this is for my new Alchemy Elements wiki. There I need to be able to add spoilers to the spoiler list, just as one can add translations to a translation list on wiktionary.--Koppa Dasao frelangi kazelangin na 16:04, December 26, 2010 (UTC)


 * Still not quite sure what you mean. Do you mean a master list of spoilers you want to put on every page? You should be able to do that just by adding them to a template, and using it on all the pages you want it on. Or do you want it to go on every page automatically? Because you should be able to add a preload to Special:CreatePage that automatically puts the template on a page when you want to create a new page.
 * A little of both. Two lists of spoilers on each page, based upon the Wiktionary translation templates, which has a button to add new items to the list. And of course I want to preload them. However I can get the preload to work on my own. But I do not know how to get the trans-top template to work in Wikia. --Koppa Dasao frelangi kazelangin na 17:19, December 26, 2010 (UTC)
 * Ah, I get it now. You could copy the source, unfortunately, it uses special CSS classes. This is the source I took from the page:


 * You would need to do something about the classes NavFrame, NavHead, NavContent, and translations. I would suggest perusing around Wiktionary for the CSS file that controls that template, copying it to your MediaWiki:Common.css, and editing it to fit your needs.
 * Whoops, I almost forgot - the Oasis skin neglects Common.css, so you have to import it to MediaWiki:Wikia.css.
 * Ok.... I've added pieces from Wiktionary:MediaWiki:common.css into alchemygame:MediaWiki:Wikia.css and common.js into alchemygame:MediaWiki:Wikia.js, imported editor.js into same, and copied the 3 templates directly.
 * However, the page Earth Element doesn't seem to work properly...
 * What's wrong? Did I miss anything? I'm just trying to recreate the function as it is on Wiktionary at the moment. When the function is working identically, I'll modify it for spoiler list usage.--Koppa Dasao frelangi kazelangin na 19:35, December 26, 2010 (UTC)
 * Ok.... Added api.js to alchemygame:MediaWiki:Wikia.js without any effect...--Koppa Dasao frelangi kazelangin na 19:46, December 26, 2010 (UTC)

(Un-indent) A tricky way to do spoilers that is easy is to make the spoiler text the same color as the background, so you can only see it when you select it (assuming the user hasn't set some stupid highlight color).
 * ...drag-select in the box to see the spoiler...
 * This is the spoiler text.
 * This is the spoiler text.

The stuff above seems extremely, overly complicated. -- Fandyllic  (talk &middot; contr) 9:39 AM PST 26 Dec 2010
 * That put into a collapsible table is an easy backup solution, but this doesn't work for me, at least not for this project. I need that button to add text to the spoiler. --Koppa Dasao frelangi kazelangin na 17:45, December 26, 2010 (UTC)
 * An "add a spoiler" button could be added that edits the template normally. It isn't as fancy shmancy as the one on wiktionary, but it works.
 * Well... If it changes the template I can't use it. It has to change the implementation of the template. The same template has to be usable on all pages, but each implementation has to be different, and all formerly added spoilers has to remain. The wiktionary trans-top template does this already.--Koppa Dasao frelangi kazelangin na 17:55, December 26, 2010 (UTC)
 * Well, good luck. That template uses a bunch of Javascript that would probably be easy to muck up when trying to modify if you don't understand how it works. In fact, I think it is mostly JS. -- Fandyllic  (talk &middot; contr) 10:03 AM PST 26 Dec 2010
 * If I can only find and pick up all required pieces, the modification isn't too hard.--Koppa Dasao frelangi kazelangin na 18:07, December 26, 2010 (UTC)
 * Noob question: why are parameters not an option here?
 * You mean like inside a template? --Koppa Dasao frelangi kazelangin na 18:20, December 26, 2010 (UTC)

(Unindent again) Yea, just like that. You can easily code a template that takes dozens of parameters and lists them all just the way you want. I did it with some of our article management tags. It takes up to 10 parameters, and puts them in a bulleted list. The same could be applied to your spoiler box, except you would be doing more to the text.
 * Well... As the 3 templates are working almost correctly, I don't think I need such a advanced backup solution. If I can't get the function from wiktionary to work, I can modify the top-template to be a collapsible table.--Koppa Dasao frelangi kazelangin na 20:00, December 26, 2010 (UTC)


 * It's not that advanced at all. It's really just a copy and paste thing. Plus, apparently whoever made that template doesn't want you using it. It says "should not be used for anything else".
 * On Wiktionary, yes. But there is nothing saying it can't be used outside Wiktionary.--Koppa Dasao frelangi kazelangin na 20:45, December 26, 2010 (UTC)


 * This page explaining the Editor.js used in the code on Wikitionary may be of interest to you if you have not seen it, along with the linked 'simple' example. How compatible Wikia's installation of Mediawiki is with Wikitionary & using different functions etc internally could be an issue as both installations may not be on the same version of mediawiki (wikia also use a lot of custom addons & may restrict access to some functionality).


 * If you can crack the 'code' to allow the editing of tables by a simple add entry button to add data to multi-cell rows in a wikitable I'm sure lots of wikia users would be interested. The Translation templates there appear to be linked in with alot of other templates used to 'look up abbreviations' but the 3 Trans-xxx templates are all fairly basic, the complicated bit appears to be that JS that is loaded when the Translation template is used on a page & generates the Add boxs and button etc. After several hours trying to work out what happens were and why I'm giving up as i know very little about JS coding. 'talking' to the author may be an idea, I solved some problems with some complex wikipedia templates I'd copied that way (basically id got extra spaces/returns in the code when i copied it & removed some redundant wikipedia a specific bits & it messed it up) - Good look - 03:36, December 27, 2010 (UTC)

(Unindent) Now I'm really confused... I'm testing out my backup plan (collapsible wikitables), but they won't collapse... I've copied everything from Delang wiki, where it works... I don't get it. Both are the same, but on Alchemy it doesn't work.--Koppa Dasao frelangi kazelangin na 18:00, December 27, 2010 (UTC)


 * I had the same problem. It's because collapsible tables aren't enabled by default, they need js, or an extension a Wikia staff member has to enable. The odd thing is, collapsible tables don't work here on the Community Wiki in Oasis, but they DO in Monobook, likely because they put the code on Common.js or Common.css, which Oasis delightfully ignores, despite Wikia's assertion that Common.css and Common.js apply to all skins. I copied collapsible table code from Wikipedia with no luck, and unfortunately, Wikipedia doesn't have a .js or a .css explanation of the code, so I don't know how to troubleshoot it. Special:Contact may help here.


 * I don't get it. Delang wiki and Alchemy has identical common.js and almost identical wikia.css. How can it then work on one and not the other? Neither should work, or both should work.--Koppa Dasao frelangi kazelangin na 18:33, December 27, 2010 (UTC)


 * Common.js only affects Monobook. If you want it to affect Oasis too, you'll have to import it to MediaWiki:Wikia.js, with this line that goes above everything else:

/* import Common.js so it affects Oasis like it should */ @import url("http://YOURWIKI.wikia.com/index.php?title=MediaWiki:Common.js&usemsgcache=yes&ctype=text/css&smaxage=86400&action=raw&maxage=86400");
 * Doing that may help. If not, Special:Contact and ask about it.
 * That doesn't compute either. I made changes to common.js on Delang wiki, and they was immediately implemented in Oasis. And there is no wikia.js there.--Koppa Dasao frelangi kazelangin na 18:45, December 27, 2010 (UTC)


 * Unlike CSS, both MediaWiki:Common.js and MediaWiki:Wikia.js are loaded. Don't ask me why (ask Wikia), that's just the way it works. MediaWiki:Common.js is for stuff that you want to affect both Monobook and Oasis, but MediaWiki:Wikia.js is Oasis-only. -- Fandyllic  (talk &middot; contr) 1:52 PM PST 27 Dec 2010
 * Sounds good. If anyone are still using the old layout, they'll need to get the collapsible tables too.--Koppa Dasao frelangi kazelangin na 21:55, December 27, 2010 (UTC)