PDA

View Full Version : New Posting Features - Countdown hack


Kentaurus
12-30-2006, 10:00 PM
Just in time for new year in my forums :)

Tested with vb3.6.4

Description
---------------------------------------------------------------------
This is a countdown hack, a user enters a simple bbcode tag in any post and a counter starts, supported inside a post, for example:

30s

The text that would appear is:
"Apocalypsis is in 30 seconds"
(or 29, 28, seconds... depending on the time that you load the post)

When the counter expires then..
"The counter to Apocalypsis has expired"
will be shown. This phrases are editable.

The counter is live, any time the user refreshes the page the counter is updated. (screenshots below)

The following syntax is supported

1d23h59m59s

That is, EVENT for the event name
then any combination of a number, followed by a "d", for days
a number, followed by an "h", for hours
a number, followed by an "m", for minutes
a number, followed by a "s", for seconds

The order is important, seconds cannot appear before days. You can only include hours and minutes, or days and minutes... or only days. Any combination as long as the order is correct.


How does it work?
---------------------------------------------------------------------

The post's dateline is taken as the date baseline to calculate the time difference, this means that if you edit the post and change the counter, it will always start from the date that the post was published. If you hover over the counter a popup will show when the counter started.

Installation instructions
---------------------------------------------------------------------

1. Login to your admin control panel
2. Go to "Plugins & Products" -> "Manage products"
3. Click on "Add/Import product"
4. Browse for "product-cz_countdown.xml" (included in the zip file), and click "Import"

That's it. You can start using [countdown] bbcode tags in any post


Info for hackers:
---------------------------------------------------------------------
You may modify, improve, upgrade, redistribute this hack, include it
in another hack or yours or translate it provided you do it free of
charge and you distribute it in www.vbulletin.org (http://www.vbulletin.org) at least, there is no
need to pm me asking for permission
Some portions of the code are (c) Jelsoft Enterprises Ltd.

Shazz
12-31-2006, 07:05 PM
Could it be somehow worked into ajax?
Nice mod though

UltimateOreo!
12-31-2006, 07:06 PM
No offense, but if its not ajax, its not really worth installing. This will DEFINATELY be an install if it gets implemented with AJAX. Actually, I think it is, because it has seconds, although, you could make it simpler instead of having users enter a syntax.
Edit- I think the syntax is pretty explainable, just not very professionally done. Make the bb code with the syntax?

projectego
12-31-2006, 08:21 PM
This hack has a lot of potential, but I agree with the previous two posters.

COBRAws
12-31-2006, 08:44 PM
No offense, but if its not ajax, its not really worth installing. This will DEFINATELY be an install if it gets implemented with AJAX. Actually, I think it is, because it has seconds, although, you could make it simpler instead of having users enter a syntax.
same thing

Cornie
12-31-2006, 08:51 PM
the month in this hack is with 30 day´s ???????????????

Kentaurus
12-31-2006, 09:19 PM
No offense, but if its not ajax, its not really worth installing. This will DEFINATELY be an install if it gets implemented with AJAX. Actually, I think it is, because it has seconds, although, you could make it simpler instead of having users enter a syntax.

not really.... it was what I needed, and it was what I installed in my forums :) It's what my members needed. It was worth writing and worth installing for me.

Any suggestions about how the syntax could be easier are welcome. I wanted to attain a flexible to use syntax, yet powerful. I don't find difficult to remember h for hours, m for minutes, s for seconds...... An alternative I ran into was something like giving a fixed date, but that is more complicated and ended up in having the people to make calculations by hand.

I certainly don't see how someone can add AJAX to this hack, for me, it's a strain to the server, and completely unnecessary.

If the behaviour that you want is a live counter, that decreases second by second without reloading the page, that can be done with a very simple javascript client-side (that I may do if my users ask for it). WITHOUT going to the server side for it, ajax is not for everything.

I will simply not do a request to my server every second just to let the server do the parsing for updating a counter. I'd need something more elaborated to justify using ajax for this. I only see ajax added to this hack to check if the user edited the counter and update it afterwards... I don't see anything else changing server side.

Thanks for the comments everyone. Yes, the month is considered 30 days. But that's only for counters greater than 30 days.

smoknz28
01-01-2007, 12:42 AM
Mmmm, guess I'm not fully understanding how to get this to work....as I keep getting "The counter has expired".

I put in 500s

500s

UltimateOreo!
01-01-2007, 03:00 AM
As said before, add the sytnax with the BB code, it will help a lot of users. And just to let you know, other then the syntax, you did a wonderful job.*installs.

Also, could you add a postbit for it?

Ill make an attempt at it, but im usually bad with the postbit :D

Kentaurus
01-01-2007, 06:30 AM
Mmmm, guess I'm not fully understanding how to get this to work....as I keep getting "The counter has expired".

I put in 500s

500s

Um... guess I didn't think about it. It only supports up to 99 seconds.
You can always type 8m20s, though

I'll get that fixed to support any number of seconds/minutes/hours

basilrath
01-01-2007, 01:28 PM
This works pretty good.................on mine nice countdown

http://www.recommenditall.com/thebig/forums/zf.gif (http://www.recommenditall.com/thebig/forums/Countdown.zip)



Upload the Countdown.js to your forum root

just add this code wherever you want the countdown to whatever your counting down to and it will display the message you wish at the end of it ie "happy new year" etc

works well

buileminh
01-01-2007, 05:31 PM
Nice hack! Thank you and installed :)

jluerken
01-07-2007, 03:53 PM
How can I make this working on the vbAdvanced Portal Page?

Kentaurus
01-07-2007, 10:28 PM
How can I make this working on the vbAdvanced Portal Page?

There is no support for vbAdvanced as that is a differente product, you might want to try asking the vbAdvanced developers for help.

heavy1
06-25-2007, 02:26 PM
something is wrong on my forum
i put 50d
and it says 2 weeks 2 days 2 Hours 23 minutes 50 seconds

what is wrong?

//edit
nevermind - i tried to edit old post :) and its taking post date.

PinkDaisy
06-26-2007, 12:08 PM
Does this work for signatures??

Censtudios
07-09-2007, 12:08 PM
I want to change the text. the "minutes" and "seconds" left are annoying and make the text very long... how do I do this? I searched in phrases, couldnt find anything

Fabsboards
07-29-2007, 05:25 AM
I want a countdown timer that will allow you to enter a date of the event, not the time remaining until the event.

Does one exist?

AJAX would be nice too....

rotor
02-19-2008, 03:13 AM
Looked at other countdowns that have more options ... like "Permissions" and date entry etc etc ...

But none of them work ....

At least this works ;)

Thanks for puttin the time in :up:

marked ...

WEBDosser
02-19-2008, 03:51 AM
marked..

Mum
03-23-2008, 01:47 AM
Does this work for signatures??I'm wanting to know the same too.

rotor
03-23-2008, 04:19 AM
mmmm well it wirked for a while and then it when off the deep end with its times :eek: ...... I think I'll do without it ;)


unmarked ..