Simple Spoiler

Started by Suki, January 28, 2011, 06:50:55 PM

Previous topic - Next topic

eric1234

#280
Ok, after i uninstall and reinstall again the Spoiler, it seem to be work fine now

Hopefully in future will not have any more problem , because i am still playing and discovering the forum >.<

Thank you so much ^^

Suki

I'm going to re-write this one completely and offer some more options, perhaps a pure css option, a pure JavaScript and a jQuery option.

Perhaps offer a way to customize the look and feel of the spoiler, offer a button or something like that.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

eric1234

Quote from: Suki on March 19, 2012, 03:33:52 PM
I'm going to re-write this one completely and offer some more options, perhaps a pure css option, a pure JavaScript and a jQuery option.

Perhaps offer a way to customize the look and feel of the spoiler, offer a button or something like that.
Whoah, it roughly takes u how long to write it? O.O

Hopefully it will got a more elegent feel ! ^^

Suki

I don't know the exact time it will take to re-write it, it depends on how much free time I will have, currently my work schedule is pretty unstable so I really don't know.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

eric1234

Quote from: Suki on March 19, 2012, 07:00:47 PM
I don't know the exact time it will take to re-write it, it depends on how much free time I will have, currently my work schedule is pretty unstable so I really don't know.
I see. Still , thank you very much ^^

Ashelia

Is there any way to make this work properly in preview too?

Suki

No because this mod doesn't work with the DOM.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

luuuciano

Suki, recently I have updated to php 5.4.3 on a VPS, after that some links on ADK Portal did not work, so I downgraded it to 5.3.11...
In the mean time an user told me that the spoiler  did not work neither... I could not test it (when the system was using php 5.4.3...
But I remember that you said that simple spoiler needed php 5.x... maybe something changed on latest versions of php, breaking something?
No me agradan los foros que no te dejan borrar TU PROPIO usuario, como por ejemplo smfsimple.com.
E incluso te mandan emails no solicitados, de los cuales, quizá, no puedas escapar porque NO te dejan posibilidad a deshabilitarlos (a menos que NO te tengan en su lista negra).

Suki

Well, this mod is very simple, I doubt php 5.4 has anything to do with the mod being broken, perhaps the CDN was down or an issue with multiple JavaScript's scripts.

What was the error exactly?  does the spoiler bbc button didn't appear?
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

androgyn3

Strange.
I think i have the same problem (luuuciano).
I used simple spoiler on my Nginx 1.0.4 + PHP fpm 5.3.6,I have no problem.
I have simple spoiler on another apache server with PHP 5.3.10 with no problem.

Now, I have updated my nginx server to Nginx 1.2.0 + PHP fpm 5.4.1, and the spoiler mod doesn't work anymore.(Like 2 other mod doesn't show some link in admin panel thank-o-tomatic and premium Advanced prefix mod of Nibogo).
These are all mod that use hook integration.

simplespoiler doesn't show any bouton and the BBC code is not parsed, all the files and database data is put, there is only one jquery appel and the javascript code is show on the source page.
Are you sure PH 5.4 branch doesn't cause prob ?
I can give you a admin acces if you want see.

Suki

Yeah, it is indeed an issue with php 5.4 and how it passes values by reference.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Arantor

Possibly, possibly not.

In this mod, and likely others, the function signature itself does not indicate that the value should be received by reference, but it's passed as such and as such in 5.3.x it works.

Now, if you modified the function signatures to expect references, my understanding is that it would no longer be call-time by reference but in fact be passed by reference even in 5.4. I haven't verified this, however, but it would be worth trying.

To try it, for this od, edit Subs-SimpleSpoiler.php:
Code (find) Select
function spoiler_bbc_add_code($codes)

Code (replace) Select
function spoiler_bbc_add_code(&$codes)

and

Code (find) Select
function spoiler_bbc_add_button($buttons)

Code (replace) Select
function spoiler_bbc_add_button(&$buttons)

And AIUI that should fix the problem.

androgyn3

Hi, Arantor

Your tip fix the problem for me. \o/ (I am happy because i do a lot of test with different version of php, without APC, etc and i don't understand this issue)
I don't understand what you say but it's work.

I think there a some mod with the same problem. I'll talk to Nibogo for this Advanced topic prefix (the mod doesn't show the admin panel link).
And thank-o-tomatic don't show thank post in profil and no link in the admin panel. All this issue is since i have update PHP in 5.4 branch.

I have do the same thing in Sub-ThankYou with :
function ThanYou_add_index_actions(&$actionArray)
function ThanYou_add_admin_areas(&$adminAreas)
function ThankYou_add_profile_areas(&$profileAreas)
function ThankYou_add_profile_modify(&$p)

And it's OK now.


IngeJones

Thank you for this mod, Suki, but I had to uninstall it as it was preventing Preview working when editing post, and also was making font size change in different places.  I hope you will be able to fix these issues then I will try again.

Suki

The mod doesn't work on preview but doesn't prevent the preview to work.

The font size change is usually related to a bad edit in some files, this cannot happen with this mod since it doesn't modify any file at all.

Can't really fix something that I don't understand, if you could please provide as much details as possible, such as your smf version, then I can help.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

IngeJones

I have smf 2.0.2 and when you are editing post and click Preview button it just says "Fetching preview..." forever and the preview never displays.  Upon uninstalling this mod, it immediately started working again.  And the font sizes went back to how they were.

BGH

Thank you for this mod, Suki :)

I've tried this mod, played with it, and arrived to the results I was looking for in my localhost config. There were no problems in localhost, but after installing this mod in my remote hosted forum, it presented some issues:

First it didn't work; only showed the supposedly hided content all the time. No language text strings showed, and it seems that it wasn't calling properly to jquery script.

I managed to solve this modifying Subs-SimpleSpoiler.php, but, though it did work, then came a 2nd problem which is something related to what happened to the last user, IngeJones:

The font size changed; it became bigger than what it used to be.

I'm attaching 2 files that I modified: Subs-SimpleSpoiler.php and SimpleSpoiler.english.php

Thanks in advance! I'll really like to keep using this mod!

Suki

What php version are you using?

Try with the new version uploaded a few days ago.

I couldn't reproduce this on any of my local boards with 5.2.x and my server with 5.3.x
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

BGH

#298
Quote from: Suki on June 05, 2012, 08:18:30 AM
What php version are you using?

Try with the new version uploaded a few days ago.

I couldn't reproduce this on any of my local boards with 5.2.x and my server with 5.3.x

5.2.17

Make sure you also download SimpleSpoiler.english.php because it's relevant to the modifications I made for the Subs-SimpleSpoiler.php, if you wanna test it.

Don't know if I'm able to update the PHP version, I'm afraid :-\. I'll ask my hosting service to do it, but it's free of charge, so, you know, maybe they'll ask me to upgrade to a premium plan -.-

I could make it work by replacing the whole spoiler_header() function to this:


function spoiler_header()
{
global $txt, $context;
echo '
<script type="text/javascript">!window.jQuery && document.write(unescape(\'%3Cscript src="http://code.jquery.com/jquery.min.js"%3E%3C/script%3E\'))</script>

<script type="text/javascript"><!-- // --><![CDATA[
jQuery(document).ready(function() {
var is_visible = false;

jQuery(\'.spoiler_toggle\').prev().append(\' <a href="#" class="spoiler_toggle_link" style="text-decoration:none;color:#4E392F;">\' + ' . JavaScriptEscape($txt['spoiler']) . ' + \'</a><em>' . $txt['spoiler_sh'] . '</em>\');
jQuery(\'.spoiler_toggle\').hide();

jQuery(\'a.spoiler_toggle_link\').click(function() {

jQuery(this).html(' . JavaScriptEscape($txt['spoiler']) . ');
jQuery(this).parent().next(\'.spoiler_toggle\').toggle(\'fast\');

return false;
});
});
// ]]></script>';

}


With that modification it seems to work, but then the font size becames bigger in other forum areas, as I said in my previous message.

Also, I forgot to mention that I added the following to index.css:


.spoiler_toggle{border:1px solid #8d7147;padding:4px 8px;margin-top:8px;border-radius:6px;background:url("../images/theme/windowbg3.jpg") repeat 0 0;}
.spoiler_toggle_link{background:#D9C59D;border-radius:12px;cursor:pointer;padding:4px 9px;border:2px solid #8D7147;box-shadow:0 1px 2px rgba(0, 0, 0, 0.25) inset, 0 1px 0 #F4DDB6;font:italic bold 12px/2.1em Arial,sans-serif;margin-right:8px;}


Thanks for your time!

EDIT: Just to add some extra info, I even tried moving the spoiler_header() function to index.template.php, with same results.

BGH

Sorry for double posting, and I'm not trying to be insistent, but do you were able to test the files that I attached, Suki?

Thanks for your time!

Advertisement: