He actualizado el genial plugin Simple Spoiler para hacerlo compatible con el uso del WYSIWYG de WordPress. He añadido la opción de encapsular el código dentro de [ ] en lugar de usar < >. Ahora se pueden usar los dos métodos, sin necesidad de modificar los posts antiguos.
Instalación
Simplemente coloca el archivo enhanced-ss.php en el directorio de plugins de tu instalación de WordPress [normalmente wp-content/plugins/]. ¡Actívalo y comienza a usarlo!
Modo de uso
Si usas el editor visual enriquecido de WordPress [TinyMCE], simplemente tienes que colocar el texto que quieras ocultar entre las etiquetas [
spoiler
]
texto aquí
[
/spoiler
].
Si no usas el editor visual sólo tienes que colocar el texto que quieras ocultar entre las etiquetas [
spoiler
]
texto aquí
[
/spoiler
]
o bien <spoiler> texto aquí </spoiler>
.
Formato
Puedes usar dos palabras o frases que quieras como texto para mostrar u ocultar el contenido. Por ejemplo:
En el editor visual [
spoiler
/dame la verdad/ /no me la enseñes/]
texto aquí [/spoiler]
dará como resultado algo así
La Verdad te hará libre [/spoiler]
Por otra parte, en el editor simple <spoiler 'dame la verdad' 'no me la enseñes'> texto aquí </spoiler>
dará el mismo resultado. Date cuenta que las comillas ‘ ‘ no son compatibles con el editor visual, por lo que la sintaxis es distinta de uno a otro.
Lista de cambios
1.6.2 – Añadido «php» al comienzo del archivo. No sé por qué razón no estaba presente. Gracias Amanda
1.6.1 – Modificada la función yk_callback para hacerla compatible con XHTML 1.0 [espero]. Gracias Marcus
1.6 – Versión inicial, para continuar la numeración de Simple Spoiler.
Nota:
No sé ni PHP ni Javascript ni nada de nada, simplemente he añadido un par de líneas y he cambiado otras simplemente observando y luego usando el método de ensayo-error. No pidas más características para añadir al plugin, se llama Simple por algo 😉
English
I have updated the beautiful Simple Spoiler plugin to make it compatible with WYSIWYG editor embedded in WordPress. I have added the option to use [ ] instead of < >. Now you can use both methods whithout digging into your older posts to modify the code.
Installation
Put enhanced-ss.php file inside plugins directory of your WordPress installation [usually wp-content/plugins/]. Activate it and start using it!
How to use
If you write with the WordPress visual rich editor [TinyMCE], simply put the text you want to hide between [
spoiler
]
text here
[
/spoiler
]
tags.
If you don’t use the visual editor you only have to put the text between [
spoiler
]
text here
[
/spoiler
]
or <spoiler> text here </spoiler>
tags.
Formatting
You can use two words or phrases as text link to show or hide the content. For example:
In visual editor [
spoiler
/give me the truth/ /hide it from me/]
will result as something like this
The Truth will set you free [/spoiler]
By the other hand, in simple editor <spoiler 'give me the truth' 'hide it from me'> text here </spoiler>
will produce the same output. Take in mind that ‘ ‘ are not compatible with visual editor, that’s why the syntax is not the same in both examples.
Changelog
1.6.2 – Added «php» to the beggining of the file. I don’t know why it wasn’t present. Thanks Amanda
1.6.1 – Modified yk_callback function to make it XHTML 1.0 compatible [I hope]. Thanks Marcus
1.6 – Initial release, to continue Simple Spoiler version number.
PS:
I don’t know PHP nor Javascript, I have simply added a pair of lines of code and chaged others by observation and later testing for errors. Please don’t request more features for this plugin, its name is Simple for some reason 😉
Hello, can you help out with one thing? I posted something and it «broke» the Xhtml validation. It is on this line:
Error Line 186, column 56: an attribute specification must start with a name or name token .
…u testar este negócio aqui <a ‘javascript:void(null);’ onclick=»s_togg
An attribute name (and some attribute values) must start with one of a restricted set of characters. This error usually indicates that you have failed to add a closing quotation mark on a previous attribute value (so the attribute value looks like the start of a new attribute) or have used an attribute that is not defined (usually a typo in a common attribute name).
What should i do to fix it?
I have modified yk_callback function to make it XHTML 1.0 compatible [I hope]. Please tell me if it works or not.
PS. Remember I don’t know PHP nor Javascript at all! 😉
It works! \o/
Now the Xhtml freaks can sleep 😉
Thanks for super-fast reply 😀
So it works on comments :p
BTW, if you want another challenge, here it is: When i looked at the post feed on Bloglines, it wasnt covered like in the site, but i could look at the hidden stuff. So if you know how to fix it, i suppose the plugin will be flawless (at least at what i can see, i dont know php either)
I think that challenge is too high for me 😆 That problem comes with the original plugin itself, and I don’t know how to avoid it in feeds. Problem is that plugin’s javascript code doesn’t run on Bloglines because it is embeded into your blog’s header. In feeds there is no way to add it, or I don’t know how to do it, sorry.
Thats ok, the plugin is cool 😉
Hi, I checked your plugin with W3C Xhtml validator and it seems that some are missing, leading to a non validation ?? Any idea ?
Ok. The plugin is just working fine ! I have some issues with my theme, and I guess I’m gonna use a new one !
Thanks !
Hi, I downloaded your plugin but it doesn’t seem to work for me. Does it work with WordPress version 2.0.1? It hides the part of the post I want but it doesn’t show it when I click on the link to «show». Is it because it’s not compatible with WordPress 2.0.1 or is it something that I’m doing wrong?
It should work from WP 1.5 to 2.1-alpha. The only possible reason for your problem is that your browser has disabled javascript or something like this. Check it out.
Gran plugin, uno de los mejores que he visto
Buenismo !!! La modificación resulta muy buena, te felicito !
Hey, I like your Plugin, it ruleeez 😉
But, i want to make something like a double spoiler , something like this:
text
Is that possible?
or could you add such a function?
thx issen1
Well i think i did something wrong or something
i asked if something like this would be possible:
[spoiler*][spoiler*]text[/spoiler*][/spoiler*]
Hi there, is it possible to input pictures instead of the text?
As in buttons or whatsoever, and change the alignment?
Thanks.
Hi
Thanks for that plugin. I want a button to expand all links in page. Is it possible?
Hi, I don’t have enough knowledge to do what you are requesting. I’m sorry about that.
this is a test
Hi, the plugin works fine with my wordpress 2.1.3. But one things does not work: i build a «spoiler»-button in my admin panel, which adds the spoiler-tags. For me as an admin, this works fine. But my co-author can´t use it with his restricted rights as an «author». The spoiler-tags do not work for him. When i set his rights to «publisher», the spoiler-tags work for him, but i don´t want him to be a publisher…so what can i do?
The «Spoiler button» doesn’t work or are the [ ] tags?
Would be nice if this could be added to Wp-Plugins-Db.org 🙂
Isn’t added yet? :whist:
Thanks..
[…] Açıklamalı 232 WordPress eklentisi (Agu. 15, 2007 !!) (WordPress plugin list),[…]
thank you for your work, all works deserves a thank you
Hi guys. Nice to see that someone has enhanced my plugin when I was busy in the past years. To answer some of your questions, the original intention of my plugin is to have a simple spoiler. There are some other spoilers in the past but they are all very complicated.
If you want a button instead of a text link to the spoiler, simple modify the $spoiler_show_text and $spoiler_hide_text and the yk_callback function to return an rather than a <a> link.
On spoilers in feeds, that is simply a limitation on the feed reader which we can do nothing about.
I’m also having trouble getting it to work. The spoiler text goes away and in it’s place it says «Show», but when I click it nothing happens. The sample on your page works, so I have a feeling it’s related to my theme somehow. When I look at the page source after adding spoiler text, here’s what I see:
Show ▼
[The spoiler text]
I do use apostrophe’s within the spoiler text itself, as I use contractions. Are these incompatible with the spoiler tag?
Hola! jejejejeje
sooo, i can’t use ur plugin 🙁
why i dunno, i want use it so much, its will be easy my pages!!!
whould u can help me?
Ann, when i CLICK on the plugin, no ocorre nada!!! PorQUe!!!
preciso de la ayuda tuya!!!
Mira esta pagina como exemplo: http://ecolala.awardspace.com/blog/?page_id=6
gracias pela attencion ^^
thanks a lot…
thanks
thanks..
thanks alot…
thank you my friend this plugin is so nice and usefull.
thanks
EXCELENTE. Muchisimas, muchisimas gracias, lo venia buscando hace tiempo. Muchas gracias.
hi.
I wonder if there are any way to be able to get your own text instead of ‘give me the truth’.
Not by editing the .php file but each time you do the [spolier] you may do something like [spoiler:titel] where title is the text that will be the link to show the hidden content.
I use this not only for spoilers when writing about movies but to put content on my blog that is optional to view =)
Read again the post, please. You can put whatever you want or leave it by default.
ahh, stupid me! thanks!!!
I totaly missed that spoiler /text /text variable =)
thanks alot *feels stupid* 🙂
Just tested this on 2.6 and it seems to be working fine 🙂 Haven’t tried adding the extra variables though… 🙂
Gracias, me ha venido de lujo!
how can i get this to work on the index page?
@kevin – It works on every post or page, even in idex or single.
very simple and good spoiler. thx for the hard work pal 🙂
nice to know this blog
nice plugin.
thank’s bro…
Excellent plugin. I use it on my blog.
Just tested this on 2.6 and it seems to be working fine Haven’t tried adding the extra variables though…
This plugin doesn’t work with WP 2.9 anymore. Each spoiler is interpreted as a link by WP 2.9, which means that if you put on moderation all comments with a link or more, your regular visitors comments are hold for moderation as well!
Is there a way to fix this major ISSUE?
Thanks
Thanks! This is the only plugin that works the way I want it to.. cannot use the wysiwyg editor though .. the [ … ] dont register, however the do, and they do perfectly!! You, my friend, are a king!
Great plugin! Just installed it on WordPress 3.0 and it worked perfect.
Thank a bunch! It works so well in my site.
Hola, excelente, funciona muy bien en 3.01, puedes verlo aqui http://www.casasmenorca.info/bella-sol-casa-de-campo-menorca/ en el cual oculto un calendario de ocupación, una pasada. gracias
[spoiler] hi [/spoiler]
Hi Abraham,
thanks for this plugin, it works perfectly on my site (running with WP 3.0.4)!
Your code even hides a rather long font list (150 lines) that is embedded in a 2-column table. If you would like to see it, you can find it in my post about how to remove Windows 7 non-latin fonts.
I gave some credit and added a link to your plugin in my post.
Thank you very much!¡
Se te agradece la iniciativa del plugin y la oferta desinteresada. Lo voy a probar en varios sitios.
PD: También me ha encantado los tips que le has puesto al sitio.
nice work. thank you so much
Thank a bunch! It works so well in my site.
All of a sudden, this plugin just stopped working for me. I haven’t changed ANYTHING, and I just downloaded & reuploaded it, and still nothing.
Never mind – I had forgotten the closing bracket for my footnotes plugin! Sorry! 😛