Ajax Spoiler Plugin


There’s a new plugin for wordpress 2.7 or greater.

This page is for people who cannot understand Korean. Please let me know about any mistakes in grammar or expression:)

Based On

Install

  • Upload aj-spoiler folder extracted from downloaded file below(wp-aj-spoiler.zip) to wp-contnet/plugins
  • Open aj-spoiler.php and edit options and re-upload it.(see ‘Config’ below)
  • Go to Wp-Admin > Plugins panel and Activate Ajax-Spoiler.
  • That’s all.

Config

  • $feed_visibility: (‘show‘ or ‘hide‘) Define visibility for feed subscribers. If ‘hide’, feed subscribers must visit the page on blog to check those hidden contnets.

    aj-spoiler-feed-visibility.jpg

  • $use_html_tagset: (true or false) Set this true if you want to use tag. Default is [spoiler][/spoiler] only
  • $js_library: (‘mootools’ or ‘prototype’) You cannot use both library once.
    • If you already loaded ‘prototype.js’ and ‘effects.js’ with current theme or activated plugins, set this to ‘prototype’.
    • In case of ‘mootools’ with Wp-Scripts, select ‘mootools’ on ‘Base’ and Fxpack.js, Fxutils.js, Fxtransitions.js also on wp-scripts option panel.

      aj-spoiler-mootools.jpg

    • In case of ‘prototype’ with Wp-Scripts, select ‘prototype’ on Base and effects.js also on wp-scripts option panel.

      aj-spoiler-prototype.jpg

  • $default_effect: Select ‘default effect’ for ajax-spoiler plugin. You can use 'appear', 'blind', 'apblind', 'phase', 'slide', 'simple' effects.

Use

  • Enclose your post text, images.. or something within [spoiler] [/spoiler] that’s all.
  • You can also change ‘show text’, ‘hide text’, and ‘effect type’
  • [spoiler 'effect type''show text''hide text'][/spoiler] or [spoiler 'show text''hide text'][/spoiler]
  • [spoiler ‘appear”show appear example”hide this example’]

    Spoiler subject changed to ‘hide this example.
    Click again to hide this.
    [spoiler ‘apblind”show apblind example”hide this example’]
    This is how apblind effect works.

    imac3

    [/spoiler][/spoiler]
    [spoiler ‘blind”show blind example”hide this example’]
    This is how blind effect works.

    imac3

    [spoiler ‘phase”show phase example”hide this example’]
    This is how phase effect works.

    imac3

    [/spoiler][/spoiler]
    [spoiler ‘slide”show slide example”hide this example’]
    This is how slide effect works.

    imac3

    [spoiler ‘simple”show simple example”hide this example’]
    This is how simple effect works.

    imac3

    [/spoiler][/spoiler]

  • This code is used on expample 2nd.
    imac3

    [spoiler 'phase''show phase example''hide this example'] This is how phase effect works.

    imac3

    [/spoiler] [/spoiler]
  • You can define show/hide speed by append number(between 2~9) to values.
    [spoiler 'blind''show this''hide this''4'][/spoiler]
    ‘2’ is faster than ‘9’
  • When you use spoiler tag nested, be sure to close spoiler tag on correct position.
  • Spoilers will be showed first and hid after window loading. If you want to hide contnet by default, append ‘_hidden’ to effet name.
    [spoiler 'blind_hidden''show this''hide this'][/spoiler]
    This will be useful for contents related to slow down window loading such as wmv movie tags.

Style

  • Edit aj-spoiler.css in plugins/aj-spoiler/css folder.
  • a.spoiler-tgl, a:hover.spoiler-tgl, a.spoiler-tgl.collapsed is spoiler link style and div.spoiler-body is content wrapper style.

Adapt Ajax-Spoiler effects

Please check other informations or updates for this plugin.

You better ‘Refresh’ browser or ’empty’ browser cache after upgrade this plugin.

Current version: 0.9


59 responses to “Ajax Spoiler Plugin”

  1. Hi !

    I’m currently using the plugin on my blog ( running on wordpress 2.3.1 ) and it goes perfectly well !!!

    Thank you very much !!! :boogie:

  2. amy//
    [spoiler] tag works on Page as well as on Post.

    Try ‘blind’ instead of ‘blind_hidden’ and see if it does hide the text.(maybe it doesn’t…)

    I think you didn’t loaded base javascript library(prototyp.js) yet.
    If your WP version is greater than 2.1, try V1.0 test version and v1.0 will automatically load prototyp.js with script-loader which is included since WP 2.1

  3. This is exactly what I was looking for but have not been able to get it to work. Does it work on a static WP page? I am using [spoiler 'blind_hidden''show this''hide this']...[/spoiler] and it does hide the text that is wrapped, but nothing happens when I cick on “show this.” It does not expand as I hoped. Any suggestions? (The entire aj-spoiler folder is in the plug-in directory.)

  4. shawf//
    It’s a nice fix:-)

    Since I added _reset() feature for ‘Permalink’ of spoiler ID, I’ll apply a little different fix to next version.

    It’ll be…
    [code lang=”php”]
    $id = “SID”.$post->ID.”_”.$this->counts;
    global $comment;
    if(isset($comment->comment_ID)) {// comment list loop
    $id .= “c”;
    }[/code]

    Thanks for your nice suggestion.

  5. I have done a small fix. If spoiler tag is used in posts and comments, they may conflict. So i have made a fix that does not reset counter.

    Just i have added if block around

    #before
    $this->counts = 0;

    #after
    if ( !isset( $this->counts ) ) {
    $this->counts = 0;
    }

  6. Fred//
    Soryy for my late response^^;

    You can borrow init_Spoiler function.

    In case your base library is prototype,

    [code lang=”javascript”]function expand_Spoilers() {
    $$(‘a.spoiler-tgl’).each(function(tgl) {
    var el = tgl.id.replace(‘_tgl’, ”);
    el = $(el);
    if(el.style.display == ‘none’) {
    el.style.display = ”;
    }
    });
    }

    function print_with_spoilers() {
    var expand_all = expand_Spoilers();
    window.setTimeout(function(){window.print();}, 300);
    }[/code]

    use print_with_spoilers() instead of window.print()

  7. First thanks a lot for this very usefull plugin :)
    I want to have a page with a link to get a print version of the content.
    For that, we must before to call window.print() function activate a method to expand all hidden content.
    Do you know a simple way to get it ?

  8. Great great great !

    How possible I couldn’t think such a simple bug.;)

    Thank you, saved my whole day !!!

  9. Ahh… that’s not for your comment, but for shadow, upper your comment;-)

    BTW, I checked my plugin again and I found the problem, it was my mistake.

    Open aj-spoiler.php and replace to on top of the file, or download the file again.

    Sorry for my such a fool mistake and thanks for your report :-)

  10. 082//

    Thank you for your answers but I know to use [spoiler] firstly and after clickable text [/spoiler].

    But my problem is different, when I activate plug-in, admin panel looks like http://firat.4shared.com/ Two png file describe my problem very well. One is plug-in page, one is corruptted post page.

    As you told I downloaded again. But nothing changed. I think it is a problem for 2.2.1. However I tried it with 2.1.3 it was the same. Does anyone who has this problem witth 2.2.1 ?

    Thank you for your key pushes ;)

  11. shadow//
    Sorry for my too late answer.

    I think you did not use spoiler tag correctly, closing tag([/spoiler]) should be after starting tag([spoiler])

  12. Firat//
    No, it’s not about javascript trouble. Seems like your downloaded file is corrupt, try re-download the file.

    The error messages you post were so long, so I cut it off;-)

  13. Hi,

    I am using 2.2.1 When I activateajax Spoiler Plug-in, at the top of the admin panel lots of characters appear. I have already post it but it seems moderator did not approve those characters.

    May it be about mootools or some other pug-in that I haven’t install ?

    Best regards.

  14. Hello,

    When I activate plug-in, at the top of the control panel page below text appears.

    Secondly, do I have to install ‘mootools’ or ‘prototype’ ? What are they & how could I install them ?

    Thanks in advance.

    Simple Spoiler. Show or hide contents wrapped by spoiler tag([spoiler][/spoiler]) Version: 0.9 Author: Choen, Young-Min Author URI: http://082net.com/ */ /* Copyright 2006
    …………………………
    AjSpoiler::get_instance(); ?>

  15. nevermind my prvious post above. i figured it out, i just didn’t know i had to install wp-scripts for this plugin to work.

    all is good now and thank you for sharing your work! 8)

  16. seems like a great plugin, but the $js_library – where do i find the options panel as seen in pictures aj-spoiler-mootools.jpg and aj-spoiler-prototype.jpg??

  17. Hi, I have this problem with plugin…

    Warning: array_pop() [function.array-pop]: The argument should be an array in elkiwi.com/wp-content/plugins/aj-spoiler/aj-spoiler.php on line 104

    I installed WP-Scripts and configured it.

    Thanks. :cry:

  18. Yogie, tigoo// Could you tell me more about your problem?

    Xi// This plugin would not work when pages are loaded with Rolling Archives.
    Adding some lines to “k2/js/rollingarchives.js.php” file can fix this.

    About line 142 (find /* Support for Lightbox */)
    /* Support for Lightbox */
    if (window.initLightbox)
    initLightbox();
    if (window.init_Spoiler)
    init_Spoiler();

  19. @@ron//
    Last part of your comment has gone away when you submitted, I think… And I modified the line you mentioned. Was that correct:?

    Thanks:-)

  20. Firstly, thanks for your efforts :)

    Just a courtesy reminder for you, there is a typo in the last point under the section titled with ‘Use’:

    “Spoilers will be showed first and be hid after window load. If you hide contnet(

  21. […] 082Net Based on a previously available plugin, this update add some AJAXy goodness by giving the user multiple options for hiding and displaying the “spoiler” in a post. Examples of display options with easy to follow instructions available on the author’s site. […]

  22. Thanks. But I am not sure how to put it in. What would be the entire code to insert for that to work (I use prototype).

  23. Arizona// I’ve included ‘.Collapse’ method to apply similar skill on blog. In case of using ‘prototype’ it will be Effect.Collapse else Spoiler.Collapse with ‘mootools'(Demo : check my sidebar). I’m preparing for English doc about this(Korean doc is already available).