Spoiler Tag

Started by Anguz, November 13, 2004, 06:56:09 PM

Previous topic - Next topic

Miraenda

Will there be a version for 1.1 Beta 3 for both this mod and fast parsercode one? I had spoiler tag on my site when it was 1.0.5 and then when I upgraded to 1.1 Beta 3, now it isn't working (as would be expected).  A few other mods have been updated even though the 1.1 series is beta as well as most the themes, so just wondered about this mod being updated too for it.

Anguz

#81
I honestly don't think I'll be updating any of my mods to 1.1 until it reaches Final. The parsecode function was re-written and so will my tags need to be to work with it, so I want the code to be as final as possible to avoid unnecessary re-writes. :-\
Cristián Lávaque http://cristianlavaque.com

trenchteam

Does, this only work on InTERnet Explorer?  I see the spoiler in IE but not in Firefox. Please advise..

Anguz

It works fine for me in Firefox.
Cristián Lávaque http://cristianlavaque.com

ArkServer

I know it may sound unfriendly but can ANYONE help me add the spoiler code in my css file?
i tried to fix it but failed several times.  :( its only the css style that i cant fix.

Anguz

You could be a bit more clear about how you want it to look and what is the problem you're having with it?
Cristián Lávaque http://cristianlavaque.com

ArkServer

i cant find the lines i need to edit with the css file.

Anguz

IIRC, I used the same styles as the quote classes, but you can create your own styles using the spoiler classes.
Cristián Lávaque http://cristianlavaque.com

azuregenesis

hey anguz, if you have a minute or so, could you help me fix this one? ;)

i keep getting a lot of the same kind of error. it's this one. i have around 300 pages of it :(

8: Undefined index: spoilerheader
File: Sources/Subs.php(1241) : regexp code
Line: 1

do you know what could be causing it and/or a fix?

thanks in advance! ;)

Anguz

I've looked into this before, IIRC, but haven't figured it out yet, I'm sorry to say. I'll give it another go, maybe now I'll find it. :)
Cristián Lávaque http://cristianlavaque.com

Anguz

I think I found it. You seem to be missing the language line in your custom theme or extra language. Try this: add the following to your Modifications.language.php file


// Spoiler Tag.
$txt['spoilerheader'] = 'Spoiler';
Cristián Lávaque http://cristianlavaque.com

azuregenesis

Quote from: Anguz on August 26, 2005, 03:08:54 PM
I think I found it. You seem to be missing the language line in your custom theme or extra language. Try this: add the following to your Modifications.language.php file


// Spoiler Tag.
$txt['spoilerheader'] = 'Spoiler';


ah. perfect! that's it! one of my themes had it's own modifications.language.php. :)

thank you! :)

Anguz

Cristián Lávaque http://cristianlavaque.com

Yonkey

#93
Hi Anguz and everyone! :D

I'm trying to make a Spoiler Tag mod for 1.1 Beta 3, but I'm stumped on increasing the spoiler ID for each <div>.  Do you know how I can get it to do that in 1.1? ???

Here is my code so far: http://www.simplemachines.org/community/index.php?topic=49556.0

It's kinda messy cuz originally I wasn't planning on making it public.  It also says fade because eventually I want to have the spoilers fade in, rather than just appear/disappear.  8)

Thanks  :)

Anguz

QuoteI'm stumped on increasing the spoiler ID for each <div>

IIRC, I used something like $i++.
Cristián Lávaque http://cristianlavaque.com

AzaToth

Quote from: Yonkey on September 20, 2005, 11:02:26 AM
Hi Anguz and everyone! :D

I'm trying to make a Spoiler Tag mod for 1.1 Beta 3, but I'm stumped on increasing the spoiler ID for each <div>.  Do you know how I can get it to do that in 1.1? ???

Here is my code so far: http://www.simplemachines.org/community/index.php?topic=49556.0

It's kinda messy cuz originally I wasn't planning on making it public.  It also says fade because eventually I want to have the spoilers fade in, rather than just appear/disappear.  8)

Thanks  :)
Hehe, somehow I have alredy made a spoiler tag for 1.1b3  :-[ it's at http://mods.simplemachines.org/index.php?mod=195

Yonkey

#96
Quote from: Anguz on September 20, 2005, 01:02:09 PM
IIRC, I used something like $i++.
Yeah, but 1.1 does its tags kind of weird. :P  They're defined in an array called $codes[], so even though I have a $fseed++; in the before => it seems to never increase the variable, and always keeps it at 0.  :(

Quote from: azatoth on September 20, 2005, 01:15:36 PM
Hehe, somehow I have alredy made a spoiler tag for 1.1b3  :-[ it's at http://mods.simplemachines.org/index.php?mod=195
Cool azatoth! ;D  Does it work with images too, or only text?  ???

EDIT: Azatoth, the download link for it doesn't work. :-\

AzaToth

Quote from: Yonkey on September 20, 2005, 01:17:34 PM
Cool azatoth! ;D  Does it work with images too, or only text?  ???
It's a basic block, so why not? the mod is as follow (if you not want to download the mod  :-X):
<?xml version="1.1"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>azatoth:spoiler</id>


    <file name="$sourcedir/Subs.php">
        <operation>
            <search position="before"><![CDATA[
function parse_bbc($message, $smileys = true, $cache_id = '')
{
global $txt, $scripturl, $context, $modSettings;
static $bbc_codes = array(), $itemcodes = array(), $disabled;
]]></search>
            <add><![CDATA[
global $settings;
]]></add>
        </operation>
        <operation>
            <search position="before"><![CDATA[
array(
'tag' => 'white',
'before' => '<span style="color: white;">',
'after' => '</span>',
),
]]></search>
            <add><![CDATA[
            array(
                'tag'               => 'spoiler',
                'before'            =>  (
                    $settings['spoiler_tag'] == 2 ? '<div class="spoiler"><div class="spoilerheader"><input type="button" class="spoilerbutton" value="Spoiler" onClick="n = this.parentNode.parentNode.lastChild; if(n.style.display == \'none\') { n.style.display = \'block\'; } else { n.style.display = \'none\';} return false;" /> (click to show/hide)</div><div class="spoilerbody" style="display: none">' :  (
                        $settings['spoiler_tag'] == 1 ? '<div class="spoiler"><div class="spoilerheader"><a href="javascript:void(0)" onClick="n = this.parentNode.parentNode.lastChild; if(n.style.display == \'none\') { n.style.display = \'block\'; } else { n.style.display = \'none\';} return false;"> Spoiler</a> (click to show/hide)</div><div class="spoilerbody" style="display: none">' : (
                            '<fieldset class="spoiler" onMouseOver="this.lastChild.style.display = \'block\';" onMouseOut="this.lastChild.style.display=\'none\'"><legend>Spoiler</legend><div class="spoilerbody" style="display: none">'
                        )
                    )
                ),
                'after'             => (
                    $settings['spoiler_tag'] == 2 ? '</div></div>' : (
                        $settings['spoiler_tag'] == 1 ? '</div></div>' : (
                            '</div></fieldset>'
                        )
                    )
                ),
                'disallow_children' => array('spoiler'),
                'block_level'       => true,
            ),
]]></add>
        </operation>
    </file>

<file name="$themedir/style.css">
    <operation>
            <search position="before"><![CDATA[
.signature
{
width: 100%;
overflow: auto;
padding-bottom: 3px;
line-height: 1.3em;
}]]></search>
            <add><![CDATA[
fieldset.spoiler {
    border: 1px dashed gray;               
}

fieldset.spoiler > legend {
    font-size: 1.2em;
}

div.spoilerheader a {
    font-family: sans-serif;
    font-size: 1.1em;
    font-weight: bold;
}

div.spoilerheader input {
    font-family: sans-serif;
    font-size: 1.1em;
    font-weight: bold;

}
div.spoilerbody {
    color: #0f0f0f;
    border: 1px dotted gray;
    padding: 1em;
    margin: 1em;
}

fieldset.spoiler div.spoilerbody {
    border: 0px;
    padding: 0em;
}
]]></add>
</operation>
    </file>
    <file name="$themedir/languages/Themes.english.php">
        <operation>
            <search position="before"><![CDATA[
$txt['themeadmin_edit_preview'] = 'Preview';
]]></search>
            <add><![CDATA[
$txt['spoiler_tag_label'] = 'Spoiler Tag';
$txt['spoiler_tag_desc'] = 'Default is <b>fieldOnHoverShow</b>, undefined themes will get those. Additional is <b>linkOnClickShowHide</b>, wich is a link you click on and <b>buttonOnClickShowHide</b> wich is a button you click on.';
$txt['spoiler_tag_onhoverovershow'] = 'fieldOnHoverShow';
$txt['spoiler_tag_onlinkclickshow'] = 'linkOnClickShowHide';
$txt['spoiler_tag_onbuttonclickshow'] = 'buttonOnClickShowHide';
]]></add>
        </operation>
    </file>
    <file name="$themedir/Settings.template.php">
        <operation>
            <search position="before"><![CDATA[
array(
'id' => 'hide_post_group',
'label' => $txt['hide_post_group'],
'description' => $txt['hide_post_group_desc'],
),
]]></search>
            <add><![CDATA[
        array(
            'id' => 'spoiler_tag',
            'label' => $txt['spoiler_tag_label'],
            'description' => $txt['spoiler_tag_desc'],
            'options' => array(
                0 => $txt['spoiler_tag_onhoverovershow'],
                1 => $txt['spoiler_tag_onlinkclickshow'],
                2 => $txt['spoiler_tag_onbuttonclickshow'],
            ),           
        ),
]]></add>
        </operation>
    </file>
   
</modification>

AzaToth

Quote from: Yonkey on September 20, 2005, 01:17:34 PM
EDIT: Azatoth, the download link for it doesn't work. :-\
Works for me, perhaps because the mod mods havn't confimed it yet...  ??? ??? ???

Yonkey

#99
Thanks!  I'll try it out. :)

EDIT: Ok, rather than installing the whole mod, I just used the code for the onHover, and it rocks! ;D  For those interested, here's it in action: http://www.kqix.com/forum/index.php?topic=2727.msg116647#msg116647

Thanks again, azatoth! :D

Advertisement: