This extension has not worked for the past years, please retire or adapt it to current mw installations!
Extension talk:Spoilers
Appearance
Hey there!
Firstly, this is a super great extension and I can't wait to use it on the wiki!
I wanted to know if there was a way to translate it into a template so that the show message, hide message, and spoiler text could function as customizable parameters?
Thanks a ton!
I would like to use this extension on my own wiki, but I'd prefer to put the spoiler warning inline. Unfortunately, I am not a Javascript programmer. I tried changing the return part of spoilerMagicTag to
return $parser->insertStripItem( $output, $parser->mStripState );
as suggested in
Manual:Parser functions#Controlling the parsing of output
but this did not work and all of the output was still in separate paragraphs, including two lines that I was separating with a <br /> tag at first.
How do I keep the parser from adding <p></p> containers around every line of output? :(.
Thanks for any hints
The adding of <p> and </p> to every line in the text also stops me from starting a spoiler area with lists (start with * and #) and indented lines (start with:). Not as flexible as I had hoped :(.
Actually, the bug seems to be that the <spoiler> tag assumes to end at the end of the line in wiki-format, if you are in a list. So
<spoiler>text
*more text</spoiler>
will work, but
*text <spoiler> :more text</spoiler>
does not.
That's an (unfortunate) consequence of how wikitext lists are constructed and the improper nesting of tags that results in the generated HTML.
Your first example works because the unordered list is properly and entirely within the spoiler tags, and the "*" indicating a list is at the start of the line.
Your non-working example fails because the unordered list, and first list item too, are opened outside the spoiler tag, but become closed inside it.
Good point, I hadn't thought of the tag nesting going wrong, thanks!. Any idea on how to remove the
tags? The extension code is here: https://github.com/Telshin/Spoilers/blob/master/SpoilersHooks.php
I don't think that would be easy. The spoiler region is identified by wrapping it in a tag (actually a nest of tags), and it is hard to ensure that is properly nested when you have only indirect control over the list tag construction. I suppose you could use explicit list html syntax to give some manual control, such as:
<ul><li>text <spoiler> :more text</spoiler></li><li>outer list continues</li></ul>
or
*text <spoiler><dl><dd>more text</dd></dl></spoiler> *outer list continues
Oh, that's a good idea. I will ask the good old Buoysel (talk | contribs) from PokéWiki to upload the extension to MediaWiki.org, but you can ask as well (in English or German; email-confirmed account required to edit pages there). I checked that on this special page that Buoysel is indeed the author of the extension. This doesn't work now, even with the right code because there is no specified JavaScript for this on this site.
If there is a spoiler extension that can work through tags, I would be very interested :)
There is a copy&paste error in the SpoilersHooks.php on line 83, this should be $hideText=… instead of $showText=…
confirmed
Hi there,
It looks like the Spoiler extension is running into some sort of bug on 1.30, wherein the text in the spoiler tags also appears at the top of the screen, overflowing the username, notifications button, contributions link, etc.
Would it be possible to fix this?
Thanks!
I've also installed this extension on MW 1.30 and, when used on a page, one message line "Array ( [show] => see details [hide] => hide details [text] => '"`UNIQ--DPL-00000001-QINU`"' )" is displayed on upper side.
Could it be fixed ? Thks, Jean
I tried the extension on mediawiki 1.19 and really liked it. But after upgrading to 1.24.1 it does not work anymore. I know, that somebody already hast told you about this. But I wanted to give some more information - since i would really appreciate, if we could use it furthermore with mediawiki 1.24.1. As mentionend in the titel, the spoiler button can be seen for a split second when loading the page, but it disappears instantly. Another aspect I recognized is that on the special:version site, your extension is only mentioned in "extensions \ special pages", but not in "extensions \ parserhooks". Is that correct or does it probably give some hint about the problem - keeping in mind, that the <spoiler>-tag is in fact mentioned under "parser extension tags"?
I had not heard about the instant disappearing. I'll take a look at it and update the extension. Thanks!
Same problem here, mediawiki version 1.24.2. Here's how my html tree looks like using <spoiler show="show_message" hide="hide_message">spoiler_text</spoiler>. Setting .spoilers-button { display:inline; }
by hand the button is visible but nothing happens clicking on it.
<div class="spoilers">
<div class="spoilers-button-container">
<p>
<span class="spoilers-button" style="display: none;">
<span class="spoilers-show">show_message</span>
<span class="spoilers-hide" style="display: none;">hide_message</span>
</span>
</p>
</div>
<div class="spoilers-body" style="display: none;">spoiler_text</div>
</div>
Got the exact same problem. You can actually see the button "shrink" and then disappear in a split second. Any chance you can make this extension work again for 1.24.x?
You should no longer have that problem.
I think I have same problem with MediaWiki 1.24.2. There is something like a spoiler for a moment but then it disappears.
Using it like this
<spoiler>spoiler_text</spoiler>
also causes these errors:Notice: Undefined index: show in /var/www/html/extensions/Spoilers/Spoilers.hooks.php on line 42
Notice: Undefined index: hide in /var/www/html/extensions/Spoilers/Spoilers.hooks.php on line 43
while using
<spoiler show="show_message" hide="hide_message">spoiler_text</spoiler>
just shows nothing.
Please update extension OR release status, because it is probably not stable with modern versions.
Extension has been updated and fixed for modern versions!
Still not working for me with MW 1.24.2.
<spoiler show="show_message" hide="hide_message">spoiler_text</spoiler> looks like show_message text, not a spoiler.
Also, ran it against 1.24.2+, 1.25.2 as well. Everything looks good. If you don't mind putting sending over some screenshots, I may be able to help you further.
Show Message is the button name for when a person click on it. Spoiler_text is the actual spoiler piece.
Released the new version today. https://github.com/Telshin/Spoilers/releases/tag/1.3
I'm updating the extension this week and plan a release by Friday at the latest!
I have just updated to MediaWiki 1.26 and at first I thought everything was OK with Spoilers 1.3 because it works when the page first loads, but when I refresh the page the button disappears and all I can see is the name of the button - no actual button and no ability to see the hidden text. So once again I have restored Spoilers 1.0 and MediaWiki 1.23.6 because my project really needs spoiler buttons!
Hey Greylin! I'll take a look at it versus 1.26. Thanks for the information.
1.4 has been released to work with 1.26.
Thank you, thank you! It's working perfectly. :)
Awesome! Thanks, for the update.
same here. lame code skills
This extension is indispensable to my project and I have been very grateful for the work that went into it. Any chance of an update please so that we can use it with MediaWiki 1.26?
Yep, I will look into it!
New release is out!
I've decided to start a separate topic, although this may also be related to the previous one ("Spoiler-Button instantly disappears (although it is shown for a spöit second)"). The difference is that I do not see the button while viewing a page normally at all, only text "Show spoiler".
The following two points are new in my case:
- There is a fully functional button in edit preview
- Interestingly,
touch LocalSettings.php
or any other changes to the file fixes it until I edit any page in the wiki and save the changes
I use MySQL+PHP as shipped with Ubuntu 14.04.2 with Mediawiki 1.25.2 and Spoilers extension v.1.3. I've been able to reproduce the steps above on Bitnami Mediawiki Virtual Machine in Virtualbox. We might use it as a reference environment, too.
The problem is repoducible in both Firefox 40 and Google Chrome 44.0.2403.155.
Im having the same Problem with 1.25.1
Same
It could be nice to add a sentence to specify if the content in spoiler will be loaded together with the whole page content or only upon expanding the spoiler. Thanks!
Sure, I'll update the extension notes :)
Fixed in version 1.3 - https://github.com/Telshin/Spoilers/releases/tag/1.3
This is a great little extension, absolutely invaluable to my wiki project, but sadly it doesn't seem to work with 1.24.1. I have restored 1.23.6 for now.
I will have to look into the compatibility for 1.24.x. Thanks for letting me know.
Fixed in version 1.3 - https://github.com/Telshin/Spoilers/releases/tag/1.3