Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Countdown 1.2

2

Comments

  • Options

    Thanks, Caylus.

    Maybe someone else will have the light bulb go off.

    I'm assuming Countdown 1.2 is the only one out there which is done to plug and play with VF.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Looking at your forum I see that you are using ButtonBar and the advanced editor in parallel. I do not think that this is the cause for the problem, but it is not needed and not advisable, since they should do the same (although the advanced editor is newer/nicer).

    I would suggest you deactivate all other plugins except for the Countdown and see if your problem is a general problem or a plugin specific.

  • Options

    I also suggest having a local copy of your forum (with xampp for example https://www.apachefriends.org/index.html) so you can experiment with it and not influence the "real" forum with your experimentation.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited January 2017

    You need to change this

    <script type="text/javascript">
    $(document).ready(function() {
        $('#countdown').countdown({
            image: '$ImgSrc',
            startTime: "$days:$hours:$minutes:$seconds"
        });
    });
    </script>
    

    To this

    <script type="text/javascript">
    jQuery(document).ready(function($) {
        $('#countdown').countdown({
            image: '$ImgSrc',
            startTime: "$days:$hours:$minutes:$seconds"
        });
    });
    </script>
    

    It is possible that is why the jQuery is not working. If you do not define jQuery then $ is undefined.

  • Options

    OK, problem solved--sort of.

    It was a problem with spacing I introduced into the settings entries.

    Now, I'm left with one or two more issues.

    When I use the plugin the first time, all is fine:

  • Options

    Then, when someone wants to use again in another post on the same disucssion, two things happen. First, the new post just has text--date, hours, mintues, etc., but no graphic. Second, the original post suddenly has a "13.x" appended to the right. Here is a screen shot showing two posts in sequence.

    If anyone thinks a fix above will address this, please let me know. But since it's now a different issue, I thought I'd post these first.

  • Options

    Maybe the design of this is intended to be used only once on each discussion.

    Our discussions often get to 10, 20, or 30 pages, and we'd like to see the countdown each time we log on, or at least on the current page. Users would gladly drop it into a post on their own, but as my previous to posts indicate, that's not working.

    The pockets plug in might fix this, I'll search on here to see how these work together.

    If anyone already knows that's a dead end, let me know.

    Thanks to all of you.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited February 2017

    You can also you one of my plugins which adds whatever you want to each comment ... https://open.vanillaforums.com/addon/commentbodyinsert-plugin

    Have you tried to fix the jQuery issue like I mentioned ?

    Maybe you can combine the two an make a better countdown plugin that will show in each comment.

  • Options

    Yeah get a nice combo, should do the trick

  • Options

    I'll get on these two fixes today!

  • Options
    CaylusCaylus ✭✭
    edited February 2017

    This should do what you want (see attachment)

  • Options
    R_JR_J Ex-Fanboy Munich Admin
    $body = 'string to transform';
    
    $pattern = '/\[COUNTDOWN\-((\d+):(\d+):(\d+):(\d+):(\d+))\]/';
    $replace = '<div data-countdown="$1" data-img="\$ImgSrc">';
    
    $newBody = preg_replace($pattern, $replace, $body);
    
  • Options
    CaylusCaylus ✭✭
    edited February 2017

    I don't seem to be able to remove the attachment even though I can edit the post. I get a "Whoops! There was an error." error. Could a mod remove that attachment?

    Anyway, updated it slightly. You can now post for example [COUNTDOWN](01:00:02 21 February 2017) and the stuff within brackets overrides the date you set in the settings (In case you want to countdown to different things).

    Just to be sure: there should be no spaces between [COUNTDOWN] and your first bracket!

  • Options

    Thanks R_J! Didn't see that when I was posting.

    I ended up doing it somewhat differently, in this way you can write a date and it'll work (and if a user puts something between brackets that's not a time it'll simply fail).

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited February 2017

    You don't need the php closing tag in class.countdown.plugin.php

    That messes things up..

    This messes things up when you fire jQuery from other plugins or libraries. I explained that before and you never took that into consideration and you are distributing a plugin with bad code.

    Do not use this

    $(document).ready(function() {

    You need to use this

    jQuery(document).ready(function($) {

    The reason is that not defining the source of the jQuery makes it undefined and it will ruin other jQuery you may have running or not work. If you don't believe , do you the research before you proliferate a plugin with bad code please. I am tired of continually posting the same thing over and over. I had to learn this to fix my ow plugins... ffss!!

  • Options

    OK, you guys got into it as I got home and started trying to figure it out.

    Caylus, your version fixed one glitch--when subsequent posts try to insert a countdown, the first post does not get the odd "13.x" suffix appended to it. But the issue of any subsequent attempts to insert not working remains.

    But progress.

    Vrijvlinder, I am going to try your code suggestion next.

    Nobody get too worked up. I'm not worth it, I assure you!

    I have a meeting tonight, may not get to it until tomorrow.

    Thanks all.

  • Options

    Vrijvlinder, I made the code change to the off-the-shelf download, but it did not help.

    Caylus, as indicated, your kind effort got rid of one bug.

    I suspect there is some conflict with another plugin. I'll disable one at a time to see what happens.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    the only conflicts would be bad php or JS , Maybe Caylus can do all of the suggested changes and upload a new plugin that he can support. Call it VCountdown or something and mention the original author.

    Sometimes people make plugins upload them and never come back. But if the plugin is useful, it can be cloned and renamed and improved.

  • Options

    Hmmmm...
    It seems to work on my end (see screenshot)... Could you open the JS console and take a screenshot of that?

    And Vrijvlinder, thank you for the additional suggestions to improve the code, but I'd appreciate a less annoyed tone in the future.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    Sorry for what you perceive as tone is actually irritation because I have mentioned this same this at least 10 times and not just me, which you have ignored and now passed on a plugin which was not yours and promulgated irregular code.. It irritates me that people ignore my advice. I never ignored your advice if it was good advice and never cared what tone was used to impart it...

    There are certain rules here that I have been made to comply with. Plugins distributed by the community must be uploaded to the addon section. Not shared in discussions. Specially if the author is not around.

    You need to remake the plugin in your name and upload it as a new plugin. New name. You can't distribute someone else's plugin without their approval. You need to take that plugin fix it and only name the original author as the basis for the new plugin at the very least. That is the only way you can legally do it. Otherwise people will get their plugins from discussions instead of where they should , the addons section, Undermining the quality control of plugins.

    I understand your kindness in wanting to help fix a plugin, but please stick to protocol , otherwise things will go down hill and nothing will work.

Sign In or Register to comment.