News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Spoiler

Started by Bugo, April 24, 2023, 09:12:24 PM

Previous topic - Next topic

Bugo

Link to the mod

This spoiler uses a native HTML5 tag - details

FAQ

* Does this mod have any settings?
Not yet.

* How to add any title to spoilers?
Use this code: [spoiler="my title"]content[/spoiler].

* How to change spoiler colors?
Edit /Themes/default/css/spoiler.css (see .bbc_spoiler and .spoiler_content classes).

* How to translate the mod strings?
Create /Themes/default/languages/Spoiler/.{your_lang}.php file.

* How to change the bbc icon of this mod?
Replace /Themes/default/images/bbc/spoiler.png

Steve

I'm assuming this is quite different than your other spoiler mod?
DO NOT pm me for support!

Bugo

Yes, it has no customization and is better integrated with the SCEditor.

Steve

Thanks Bugo. Will give this one a go.  ;D
DO NOT pm me for support!

Darknico

Thanks Bugo

Added Italian translation ;)
Italian SMF - Supporto Italiano per la board SMF - Ci trovate tutti li!! :)


Darknico

Hi @Bugo

I found an issue with Chrome
Don't work text selection and copy

With firefox, no problem.
Italian SMF - Supporto Italiano per la board SMF - Ci trovate tutti li!! :)


Bugo

Change rule for .bbc_spoiler in the file /Themes/default/css/spoiler.css in this way:
Code (css) Select
.bbc_spoiler {
    display: block;
    box-sizing: border-box;
    /* user-select: none; */
    overflow: hidden;
    background: #cfc;
    color: #000;
    border-radius: 6px;
    box-shadow: 0 1px 5px 2px rgba(34, 60, 80, 0.2);
    margin-bottom: 4px;
    padding: 6px 12px;
}

Darknico

The fix work!
Thanks :)
Italian SMF - Supporto Italiano per la board SMF - Ci trovate tutti li!! :)


Julius_2000

Thanks for this new and sleeker spoiler, @Bugo!

One thing I get, though, is an error message every now and then pointing to a "Cron" error. I believe I also got that the first time after installing the mod today.

/usr/home/myforum/data/Sources/Class-Spoiler.php (Line 122)
You cannot view this attachment.

You cannot view this attachment.

What's also weird is that the log always shows this error in connection with just one user (the one in my attachment). I went through the posts (not that many) and I couldn't spot any spoilers which the user might have used to cause this. Also, I think I just got this error after me posting and using a quote, without using a spoiler though. At least my error log was empty until I posted..

Julius_2000

Here is the backtrace code I got when I first installed it on our test forum.

QuoteType of error
    Undefined_vars
Error message
    2: Undefined array key "spoiler"
File
   /usr/home/myForum/data2/Sources/Class-Spoiler.php

Line
   122

URL of page causing the error
   https://test.myforum.com/index.php?action=admin;area=packages;sa=install2;package=spoiler_0.3_smf21.zip;pid=0


    #0: smf_error_handler()
    Called from /usr/home/myForum/data2/Sources/Class-Spoiler.php on line 122

    #1: bbcCodes()
    Called from /usr/home/myForum/data2/Sources/Subs.php on line 5791

    #2: call_integration_hook()
    Called from /usr/home/myForum/data2/Sources/Subs.php on line 2483

    #3: parse_bbc()
    Called from /usr/home/myForum/data2/Sources/Subs.php on line 4323

    #4: setupThemeContext()
    Called from /usr/home/myForum/data2/Sources/Subs.php on line 4529

    #5: template_header()
    Called from /usr/home/myForum/data2/Sources/Subs.php on line 4172

    #6: obExit()
    Called from /usr/home/myForum/data2/index.php on line 187


Bugo

I have already fixed this problem, the update will be after the release of SMF 2.1.4

Julius_2000

Great! Thanks for your support, Bugo! It also good to know that's nothing to do with my theme edits.

Julius_2000

@Bugo

I don't know whether your fix already addresses this but I might have found a correlation for another issue I had after installing your mod.
Like I described above, I would get the "undefined key 'Spoiler' " error message after installing and also every once in a while associated with certain users. All of a sudden I was also unable for these users to access the Track Activity tab which produced a Cron error. I went ahead an added $txt['spoiler'] to the index.English.php and both the "undefined" and "cron" error vanished.
=> the https://www.simplemachines.org/community/index.php?msg=4152938

Seems like the $txt['spoiler'] code does not get pulled from the Spoiler folder in Default.

filippo

@Bugo
I have this problem after the installation

filippo

Quote from: Bugo on May 23, 2023, 04:52:02 AMI have already fixed this problem, the update will be after the release of SMF 2.1.4

please, when will you release the update?

Julius_2000

Quote from: filippo on June 26, 2023, 09:57:27 AM
Quote from: Bugo on May 23, 2023, 04:52:02 AMI have already fixed this problem, the update will be after the release of SMF 2.1.4

please, when will you release the update?

@filippo: Try my approach:

In Themes/default/languages open index.english.php. At the bottom add the following before ?>
$txt['spoiler'] = 'Spoiler';

Should look like this after addition:

// Separators used to build lists in a sentence
$txt['sentence_list_separator'] = ', ';
$txt['sentence_list_separator_alt'] = '; ';

$txt['spoiler'] = 'Spoiler';

?>

filippo

Seems to work fine, Thanks

Lucarella

#17
Hi, I use this mod and it works well, but I noticed a problem...
On my forum I use these mods in combination
https://custom.simplemachines.org/index.php?mod=4013 (Hide Content)
https://custom.simplemachines.org/index.php?mod=3898 (Say Thanks)
When custom spoiler is used, such as
spoiler=text
and a user thanks to view the content hidden by hide, everything remains unchanged, i.e. the hidden content is not seen.
If I change to spoiler, deleting =text, the hidden content is displayed correctly
For the moment I have only found a temporary solution to the problem for 1 user, but if the problem could be corrected it would be appreciated.

Thank you

Lucarella

No solution for this problem? :'(

Bugo

I was unable to reproduce your case, please provide a more detailed, step-by-step explanation.

Advertisement: