Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
New vBCode Tags: [Countdown] and [Countup] timers for users Details »
New vBCode Tags: [Countdown] and [Countup] timers for users
Mod Version: 1.00, by KevinG (Member) KevinG is offline
Developer Last Online: Feb 2003 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 2.2.x Rating: (0 vote - 0 average) Installs: 13
Released: 03 May 2002 Last Update: Never Downloads: 2
Not Supported  

Have you or any of your members ever had the need or desire to post a countdown or countup in a post?
Something that automatically shows the remaining days, hours, minutes and seconds of that upcoming Walt Disney World trip?
Or want to show everyone how many days, hours, minutes and seconds that the user has gone without a cigarette, drink, sex? - LOL

I came up with this one here. It basically gives your users two new vB Code Tags, [countdown] and [countup].
Now there is no need to worry that the user will mess up your threads with incorrect JavaScript.
All they have to do is use these tags, just like most other tags.

For counting down, they would just have to do the following:
[countdown=May 21, 2002 12:32 PM EST;We are off to see Mickey Mouse;RED]My Walt Disney World Trip Begins in [/countdown]

Same for counting up with just different text of course.

I guess this would qualify as a hack as you do need to change one field in the database to store this.
Luckily, it's in a very small table so it should not slow anything down in theory.


Modify the database
Modify the field bbcodereplacement in the bbcode table to increase the storage size.
Change the field properties from varchar(200) to LONGTEXT. This is needed for the new vB Code replacement to follow.
I used phpMyAdmin which is very easy to use for this change.

Add new JavaScript
Add the following JavaScript code to your Style under Head Insert preferrably at the bottom.
Be sure to do this for every style that you defined in your database.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Add the new vBCodes
Using the Admin CP, add the following;

vB Code tag
-----------------------------------------------------
countdown


vB Code replacement
-----------------------------------------------------

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

vB Code example
-----------------------------------------------------
[countdown="May 4, 2002;Currently At WDW Now;BLUE"]My Countdown to Disney World[/countdown]

vB Code explanation
-----------------------------------------------------
Enter any text you would like to say to your members here.

Use {option} ?
-----------------------------------------------------
Select YES


Add the [countup] tag next;
vB Code tag
-----------------------------------------------------
countup

vB Code replacement
-----------------------------------------------------

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

vB Code example
-----------------------------------------------------
[countup="May 4, 2002;Waiting for my last cigarette;RED"]Smokefree Days[/countup]

vB Code explanation
-----------------------------------------------------
Enter any text you would like to say to your members here.

Use {option} ?
-----------------------------------------------------
Select YES



There are many variations that can be use here for how the text field looks.
We can post suggestions here for everyone to share

I can post a screenshot tomorrow if you would like.
It's really just a text field containing the days, hours, minutes and seconds of the timers with the {param} text over it.

Edit:
Reformatting some of the text as the PHP blocks are very wide.
Also fixed a case conversion that the PHP code tag is making in my post.

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
New vbcode.js - vBcode and smilie user interface improvement s.molinari vBulletin 2.x Full Releases 206 01 Feb 2004 21:44

Comments
  #2  
Old 03 May 2002, 05:48
RDX1 RDX1 is offline
 
Join Date: Apr 2002
demo or screen?
Reply With Quote
  #3  
Old 03 May 2002, 06:07
Sweet Cheeks's Avatar
Sweet Cheeks Sweet Cheeks is offline
 
Join Date: Mar 2002
OMG Kevin you are SO awesome! :cheeky: Thank you SO much, I will give you full credit on my site, You are too cool. :rambo: Thank you so much!!
Reply With Quote
  #4  
Old 03 May 2002, 06:09
MrLister's Avatar
MrLister MrLister is offline
 
Join Date: Oct 2001
wow great job. this is awsome.
Reply With Quote
  #5  
Old 03 May 2002, 06:23
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Real name: Mike
I'm too lazy to install this unless I know what it actually looks like. Please post a demo or screenshot
Reply With Quote
  #6  
Old 03 May 2002, 07:19
Neo's Avatar
Neo Neo is offline
 
Join Date: Oct 2001
Real name: Dan
Nice man. Here is a image.
Attached Images
File Type: gif counthack.gif (1.9 KB, 758 views)
Reply With Quote
  #7  
Old 03 May 2002, 08:58
JulianD's Avatar
JulianD JulianD is offline
 
Join Date: Jan 2002
Real name: Julian Muñoz
ummsmm... Seems very interesting and useful! Thanks Kevin!
__________________
Julian D. Muñoz
Reply With Quote
  #8  
Old 03 May 2002, 09:49
Floris Floris is offline
 
Join Date: Jan 2002
Uhm, the countdown is managed by the javascript? Not client-side? - little bit disappointing.. but I most surely LIKE this .. would be very cool to have this on vB3 in the calendar in many ways I can think of
__________________
My community; http://wetalknation.net
Reply With Quote
  #9  
Old 03 May 2002, 09:57
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
It's a very useful hack and idea is very nice either, congratulations!

Just one tiny concern in my side: You (and your members) will use the vbcode for a few messages only, however the java code in the header will be loaded with every page (not just for messages either, with even in calender or user CP pages) in your board.

Maybe it could be nice to check the message inside "showthread.php" before displayed whether vbcode exits or not and if it exits, make the neccessary parsing inside the same script again.

This method both saves you from the java header and it could also be possible to count down according to thread reader's local time Even if you wouldnt regard this method, adding the java code to a relevant template (which is related to thread displaying only) can help to get rid of it for at least unrelevant pages. Just my 0.2 cents.

Congratulations again!

Logician
__________________
Logician's Blog | WebTemplates for vb 4.x : VB Integrated Content Management System

Last edited by Logician; 03 May 2002 at 20:02.
Reply With Quote
  #10  
Old 03 May 2002, 10:27
Sparkz's Avatar
Sparkz Sparkz is offline
 
Join Date: Nov 2001
Originally posted by xiphoid
Uhm, the countdown is managed by the javascript? Not client-side? - little bit disappointing..
Not that it has anything to do with the hack but javascript IS clientside

Oh, and for changing the field in the DB to LONGTEXT... Why on earth would you need to be able to fit 4 GB in there? Changing it to text should be MORE than sufficient, unless you plan on having replacements bigger than 64kb, which I doubt anyone would ever need...

Not that the field itself will end up bigger by the change, (unless you actually fill it, that is) but I was just wondering why it had to be LONGTEXT and not just text...

http://www.mysql.com/doc/n/o/node_368.html
__________________
Troll, troll, troll your post, gently down the feed.
Merrily, merrily troll along, a life is what you need!
Reply With Quote
  #11  
Old 03 May 2002, 11:14
Floris Floris is offline
 
Join Date: Jan 2002
I meant server-side.
I hate client-side stuff. It gives complaints, because every system if different.
__________________
My community; http://wetalknation.net
Reply With Quote
  #12  
Old 03 May 2002, 12:43
Wildthinks's Avatar
Wildthinks Wildthinks is offline
 
Join Date: Apr 2002
@kevinG

@kevinG
Hi KevinG,

looks beautiful, but don't work with European time Format?

Could you explain me, how must I write the Statement that works with European Time? I have try so many, doesn't work...

The next one, works with Opera?
I don't know exactly...

The last ist, you should replace the
<SCRIPT LANGUAGE="JavaScript">
with

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

,
because I get errors in my IE5.5....
__________________
Flash templates with SWiSH - more - faster - better as flash... hope so :ninja:
Reply With Quote
  #13  
Old 03 May 2002, 14:40
KevinG KevinG is offline
 
Join Date: Dec 2001
Thanks for the compliments folks and thank you neo for the screenshot. If we apply some css to it, they can come out looking mush better.

Originally posted by Sparkz


Not that it has anything to do with the hack but javascript IS clientside

Oh, and for changing the field in the DB to LONGTEXT... Why on earth would you need to be able to fit 4 GB in there? Changing it to text should be MORE than sufficient, unless you plan on having replacements bigger than 64kb, which I doubt anyone would ever need...

Not that the field itself will end up bigger by the change, (unless you actually fill it, that is) but I was just wondering why it had to be LONGTEXT and not just text...

http://www.mysql.com/doc/n/o/node_368.html
I really do not know why I used LONGTEXT. I could have used something smaller but as you said, it will not use any more than what you fill into that field. I just needed to increase that default to fit this one in. TEXT would give us more than enough for this one. Maybe we can use the LONGTEXT for [mp3=song.mp3]My Song[/mp3] - LOL


Originally posted by Logician

Just one tiny concern in my side: You (and your members) will use the vbcode for a few messages only, however the java code in the header will be loaded with every page (not just for messages either, with even in calender or user CP pages) in your board.

Maybe it could be nice to check the message inside "showthread.php" before displayed whether vbcode exits or not and if it exits, make the neccessary parsing inside the same script again.
Ever seen a Disney site? These countdowns are wanted in their sigs
I just stuck it into the header so every page would have the ability to use the JS. By making it available in the header, the main code would not have to be repeated on every post that is using it. Like you said, I could have modified showthread but that would make installation of this a little bit harder and also make it just another re-mod when updates from vB come along again.
In other words, I was lazy

Originally posted by Wildthinks

@kevinG
Hi KevinG,

looks beautiful, but don't work with European time Format?

Could you explain me, how must I write the Statement that works with European Time? I have try so many, doesn't work...

The next one, works with Opera?
I don't know exactly...

The last ist, you should replace the


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

with


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

,
because I get errors in my IE5.5....
I do not get any errors with my IE5.5 here. I'll try what you suggested. Can you tell me about "European time Format"? I do not know this and would like to get it working for you. The only browser I have is IE 5.5 and IE 5.0 here so I can not test the others but would appreciate anyone that can for us.

Kevin
Reply With Quote
  #14  
Old 03 May 2002, 19:16
Mr. Slugworth's Avatar
Mr. Slugworth Mr. Slugworth is offline
 
Join Date: Oct 2001
This is exactly what I have been waiting for. Thanks for your work! Just one problem, it isn't working for me. I followed all of the instructions, even typed the scripts in the right place, since if I copy them, it just messes everything up. They are exactly as they are shown above, but I can't get it to work. Isn't it supposed to show up along with the other vbcodes so that I can just click on it when replying or making a new post? Or, is it not supposed to show up?

Any help would be appreciated.
Reply With Quote
  #15  
Old 03 May 2002, 19:25
KevinG KevinG is offline
 
Join Date: Dec 2001
Thanks for trying it out.

I did not change anything on whether it shows up or not (buttons or help) when posting. They are just there to use.

I'm going to your site now to try them out.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 11:47.

Layout Options | Width: Wide Color: