The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
New vBCode Tags: [Countdown] and [Countup] timers for users Details »» | |||||||||||||||||||||||||||
New vBCode Tags: [Countdown] and [Countup] timers for users
Developer Last Online: Feb 2003
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. PHP Code:
Using the Admin CP, add the following; vB Code tag ----------------------------------------------------- countdown vB Code replacement ----------------------------------------------------- PHP Code:
----------------------------------------------------- [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 ----------------------------------------------------- PHP Code:
----------------------------------------------------- [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. Show Your Support
|
Comments |
#12
|
|||
|
|||
I meant server-side.
I hate client-side stuff. It gives complaints, because every system if different. |
#13
|
||||
|
||||
@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 Quote:
Code:
<script type="text/javascript"> because I get errors in my IE5.5.... |
#14
|
|||
|
|||
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.
Quote:
Quote:
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 Quote:
Kevin |
#15
|
||||
|
||||
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. |
#16
|
|||
|
|||
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. |
#17
|
|||
|
|||
After trying it out on your site, I found a small typo in your script. I then checked this with what I posted and it seems that it got changed (not sure how as I copy/pasted this from my AdminCP).
The typo is the second line of both countdown and countup function. The line that fails is PHP Code:
This is part of the code that goes into your Head Insert section. Below is the correct line for both functions. I will fix the first post here. Maybe PHP tag is doing this ??? Edit: I just tried the [ code ] tag to post the correct line and it did it again Both PHP and CODE tags are making this line appear incorrect. y2k = new Date(date); Admins/Mods, I'm not sure how I can fix this so the members can see the code. Help Please. Kevin |
#18
|
|||
|
|||
The first post is all fixed now. I separated the date parameter in
y2k = new Date(date); into y2k = new Date( date ); so PHP does not change it to y2k = new date(date); |
#19
|
|||
|
|||
Here's a style that removes the input box look.
Change the line for the input field to; document.writeln("<input type=text value='' size=40 name='countdown' border-style='none' style='border-bottom: 0px solid; border-left: 0px solid;border-right: 0px solid;border-top: 0px solid'>"); |
#20
|
|||
|
|||
Here another one, transparent background instead of the white box.
Change the line for the input field to; document.writeln("<input type=text value='' size=40 name='countdown' border-style='none' style='background-color:transparent; border-bottom: 0px solid; border-left: 0px solid;border-right: 0px solid;border-top: 0px solid'>"); |
#21
|
|||
|
|||
KevinG... very nice hack
i'm thinking to use this as a gradutation count down.... users can choose the year from a drop down menu during registration then the count down appears in their profile is this possible to hack it even more for that purpose ? thanks |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|