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 |
#52
|
||||
|
||||
Quote:
|
#53
|
||||
|
||||
OK, the script worked once for me, then never again. I have put the code at the bottom of my header_include and also tried with the code at the top of the body tag, however it shows the text and a blank white box below, what do I do, this is the code it outputs:
<Script language='Javascript'> var rndNum = Math.floor(Math.random() * 10000); var tempString="May 4, 2005;Currently At WDW Now;BLUE"; tempArray=explodeArray(tempString,";"); document.writeln("<form name='form" + rndNum + "' action='javascript<b></b>:void(0);'>"); document.writeln('<font size=2 color="'+tempArray[2]+'">My Countdown to Disney World</font><BR>'); document.writeln("<input type=text value='' size=40 name='countdown'>"); document.writeln("</form>"); countdown(tempArray[0], rndNum, tempArray[1]); </script> |
#54
|
|||
|
|||
Umm, is there a way to add years also???? when you get like 2450 days, it looks alittle weird.
|
#55
|
|||
|
|||
This works for 3.0.7 Kevin you may want to rerelease as such.
|
#56
|
|||
|
|||
Could anyone in the know tell me if i could use this for current vB, as i really want this BBcode, but not sure if it's completely different now?
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|