Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Update for critical security issue in PHPMailer included in release Vanilla 2.3.1

Initial state of button is "Show" while the "hidden" text itself is revealed

This discussion is related to the Spoilers addon.
rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one"NJ ✭✭✭
edited July 2015 in Feedback

Running V 2.1.11 VBS3 theme on a private forum. Downloaded the latest from Github (Version 1.2). Running Wysihtml5 editor so I don't get the button, but I don't care, I manually enter "[spoiIer]" and it seems to work, mostly... Here is what happens (and it is clear enough not to need a screen shots):
1. The first time the discussion is shown, the text that is supposed to be hidden is visible. The button itself says "show"
2. After clicking on the button the text is becomes hidden and the button remains "show".
3. After clicking on the button the text becomes visible and the button changes to "hide".
4. From #2 above onward the button behaves as expected. In all cases the button is preceded by the text "Spoiler:".

My initial thoughts were that somehow the setting are incorrectly initialized. I see some code that is supposed to take care of that, but that is the extent of my understanding.

A side note on the description text in the plugin definition - it says:

Description' => "Users may prevent accidental spoiler by wrapping text in [spoiIer] tags. This requires the text to be clicked in order to read it."

But there is no need for wrapping the text, just preceding it. In fact, wrapping it caused the second [spoiIer] tag to create another button...

BTW, I was originally planning to take the plugin and change it to a "More..." plugin -- namely to change the words Spoiler to More to mimic some of the behavior frequently seen on wordpress sites. But first I need it to work...

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Is the CSS file /plugins/Spoilers/design/spoilers.css being loaded?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    rbrahmson
  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NJ ✭✭✭
    edited July 2015

    It is in the folder structure. How do I check that it is loaded?
    But would I see the correct effects of pressing the button (step 2, 3, etc.) if it were not?

  • peregrineperegrine MVP
    edited July 2015

    How do I check that it is loaded?

    check with a web developer tool.

    But would I see the correct effects of pressing the button (step 2, 3, etc.) if it were not?

    you could make an assumption.

    but you would know for sure if you use a tool.

    assumptions vs. knowing are two different things. when you know how to use a tool you can avoid assumptions and know for sure.

    you could also use the js console to test things.

    BTW, I loaded the same editor theme spoiler plugin and vanilla version as you and can't see any problem
    so you may have a conflicting plugin, corruption,,,,,, see troubleshooting below.

    • creating a public clone test site with exactly the same plugins themes and versions would go a long way in allowing people to help you

    the key to alot of questions is

    • patience.
    • experimentation
    • learning via tutorials and experimenting on a test forum.

    if you have the patience to go through some of the links provided within these 2 discussion links below about css, firebug, and web developer tools, and php, jquery, and firebug tutorials.
    It will help you for the next 100 questions you might have.

    click here for FAQ http://vanillaforums.org/discussion/28420/faq/p1

    click here for http://vanillaforums.org/discussion/20231/how-to-become-somewhat-adept-at-modifying-vanilla-to-meet-your-needs-for-free

    also see how to troubleshoot mysterious problems in the "How to become adept...". link

    BTW, I loaded the same editor theme spoiler plugin and vanilla version as you and can't see any problem, so you should troubleshoot through simplification and reduction.

    http://vanillaforums.org/discussion/comment/199091/#Comment_199091

    e.g. see if problem occurs on bittersweet theme with different editor. etc etc.

    http://vanillaforums.org/discussion/comment/199091/#Comment_199091

    In some respects it might be more advantageous in the long run learning more in depth and going through tutorials instead of feature addition

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    rbrahmson
  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NJ ✭✭✭
    edited July 2015

    Thanks again @peregrine , great pointers. Turns out @hgtonight was right.

    So I after reading some of the links you provided decided to use CSSEDIT to manually load the CSS file and see if the Spoiler plugin works as expected, and it did. That lead me to the conclusion that the CSS file was not loaded. That was also confirmed using the Chrome inspector.
    Looking again at the question @hgtonight asked I noticed that the CSS in my installation is in a css subfolder. I then went into the plugin code and changed line 35 to:

    $Sender->AddCssFile('spoilers.css', 'plugins/Spoilers/css');

    and it worked. I suspect that when you wrote that you tried it and it worked for you, you were using a different version (I got mine from Github and it is marked Ver 1.2). If that is not the case then I wonder why it worked for you. If it didn't work for you I'd have thought that I uncovered a bug...

    I'm learning;-)

  • peregrineperegrine MVP
    edited July 2015

    @rbrahmson said:
    Thanks again peregrine , great pointers. Turns out hgtonight was right.

    So I after reading some of the links you provided decided to use CSSEDIT to manually load the CSS file and see if the Spoiler plugin works as expected, and it did. That lead me to the conclusion that the CSS file was not loaded. That was also confirmed using the Chrome inspector.
    Looking again at the question hgtonight asked I noticed that the CSS in my installation is in a css subfolder. I then went into the plugin code and changed line 35 to:

    $Sender->AddCssFile('spoilers.css', 'plugins/Spoilers/css');

    and it worked. I suspect that when you wrote that you tried it and it worked for you, you were using a different version (I got mine from Github and it is marked Ver 1.2). If that is not the case then I wonder why it worked for you. If it didn't work for you I'd have thought that I uncovered a bug...

    I'm learning;-)

    I think you made an assumption!!!! but you are learning, yes.

    version 1.2 has the css in the design folder. there is no css folder. so your problem was "corruption in the plugin" since it obviously was reading or not reading css from a folder that doesn't exist or previously existed. In any event it should be design folder and no change is necessary in plugin unless you want to perpetuate issue further next time ....

    Sometimes, it is not a bug in the plugin, but a bug in assumption or installation.

    you said you loaded spoilers 1.2 from github. Clearly on githib the css is in the design folder. (which is no different than the spoiler addon of the same version number in the add-ons.)

    https://github.com/vanilla/addons/tree/master/plugins/Spoilers

    If it were me, and I wanted to do things correctly, I would disable the spoilers plugin, delete the spoilers folder and re-install spoilers plugin and re-enable. then you don't have to fix what you broke :)

    implied here....

    http://vanillaforums.org/discussion/comment/199091/#Comment_199091

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    rbrahmson
  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NJ ✭✭✭
    edited July 2015

    Hi @Peregrine, you are correct again. I figured out how I messed up the folder structure. What happened is that I downloaded an old version a while long ago with an older folder structure. Recently I went to Github to pick up the recent version (based on a comment in one of the discussion that Github has the latest Spoiler plugin). I couldn't find a way to download just that plugin (I found a link to download everything which I didn't want to do-too much), so what I did was to open the existing files one by one in an editor and paste the files I browsed in Github, not realizing the folder structure had changed. So I am the one who introduced the error.
    I am happy I qualified my previous statement "I'd have thought that I uncovered a bug" rather than stating that I did find a bug. Not blaming anyone but myself. Though it would have been nice if Github would have an independent download option for each plugin...

    Now that this problem is solved, I am ready to use the plugin as a basis for my "More..." plugin. I am pretty confident I can do it with two types of changes - changing the plugin & script references to "Spoiler" to "More", and then changing the CSS file to get the appearance I want (which is much simpler than the current CSS). I plan to have a look & feel of many WordPress blogs I've seen.

    If I'm successful I'm debating whether I should keep it for myself or upload it and offer to the community (of course with credit to the original author) - it's a delicate balance between trying to give back to the open community that helped me get here and not cluttering the forum with something that nobody may want.

  • peregrineperegrine MVP
    edited July 2015

    no need to create a new plugin and upload that does the same functionality, in my opinion.

    however,

    I like the idea of posting code snippets of changes rather than zipping up the whole plugin for two reasons.

    1) people can see what you changed and learn a bit by copying and pasting.
    2) you don't zip up whole plugin so author can guage accurate downloads of their plugin
    3) and you don't "pirate their plugin" for a few cosmetic changes or simple changes.

    e.g. if you wanted to propose changes. you could post code changes like this.

    change

    add this to conf/locale.php (to get rid of spoiler labeliing)

    $Definition['Spoiler: %s'] = "";

    change in spoiler.js to replace word show with ... or whatever you want. or more

    from
    SpoilerButton.val('Show');
    

    to

    SpoilerButton.val('...');

    you could change the 'Hide" in same js file to " " or leave as hide or less

    I wouldn't recommend changing the word [ spoiler ] just because it is used by other editors and plugins.

    also you wondered.

    rbrahmson said:

    Description' => "Users may prevent accidental spoiler by wrapping text in [spoiIer] tags. This requires the text to be clicked in order to read it."

    But there is no need for wrapping the text, just preceding it. In fact, wrapping it caused the second [spoiIer] tag to create another button...

    wrapping follows the same form that html has.

         [ spoiler ]  opening tag
    
        this is hidden
    
        [ /spoiler ]   closing tag with slash
    
    
        unhidden text
    
    
         [ spoiler ]  opening tag
    
        a second piece hidden
    
        [ /spoiler ]   closing tag
    
    
        unhidden text 2
    

    e.g.

    opening tag

    this is hidden

    closing tag

    unhidden text

    opening tag

    a second piece hidden

    closing tag

    unhidden text 2

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NJ ✭✭✭
    edited July 2015

    Thanks @peregrine for your guidance and advice. I heeded to your advice and went back and restored the [spoiIer] tags to be compatible with other plugins. I will post the change information under a separate title to make it easier to fine (the current title doesn't apply any more).

    The only thing I am not convinced of is the issue of posting the modded plugin. I understand that for the developer and other experienced modders it is preferable to see the changes posted (and explained) in this discussion. But I see so many newbies (like me) who are not yet programmers and who would find benefit from ready-to-use modifications.

    That said, not to upset anyone I will be posting the changes and screen shots but not the modified plugin

Sign In or Register to comment.