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 |
#22
|
||||
|
||||
Kevin I installed the hack on my site, everyone LOVES it!! I was wondering if you had a site link or something we could give your credit for? Thank you!
|
#23
|
|||
|
|||
Quote:
We can discuss via PM here to get your version. Sound good? (or do others want this as well?) Quote:
If my wife is expecting again ( oh I hope not ), we'll stop by. Deal? |
#24
|
||||
|
||||
Kevin, nice hack, but I really suggest you turn it into a Showthread hack. As it is, being put in the head of _all_ pages on the board, it's quite a bandwidth-impact for no reason. The part for in <head> is, imo, rather huge, and loading that when it's not necessary is just diminishing your bandwidth for nothing.
showthread.php hack shouldn't be too hard... |
#25
|
|||
|
|||
Thanks KuraFire.
I'll check that out. I would also have to modify newreply.php as well then. Also, the PM display code in private.php as these can also be used in sigs. Thanks for the suggestion. |
#26
|
||||
|
||||
Congratulations on the baby coming Kevin! Thanks again for everythign!! Woohoo!
|
#27
|
|||
|
|||
How can we make the changes in our board so that the button that we make for it will give you the correct java script pop up to insert all the right stuff in the correct places because it isnt a simple [countdown] hey [/countdown] thing. You need to add like font color and all the type of stuff. Is there anyone here with this type of knowledge to tell us how we can do this. Thanks you so much.
|
#28
|
|||
|
|||
bump
|
#29
|
|||
|
|||
Maybe you can try something like this?
Add this to the vbcode.js file in your forum directory Code:
// ************************************ function countdownup(theform,thetype) { // inserts countdown or countup maintext = prompt("Enter Top Message for " + thetype,""); coloredtext = prompt("Enter the color to use for the Top Message","BLUE"); datetext = prompt("Enter Date for " + thetype,""); var prompttext; if (thetype == "countdown") { prompt_text = "Enter text to display when Countdown reaches zero"; } else { prompt_text = "Enter text to display before Countup starts (future date)"; } expiredtext = prompt(prompt_text,""); if ((datetext != null) && (datetext != "")) { cdcode = ""; if ((maintext == null) || (maintext == "")) { if (thetype == "countdown") { maintext = "My Countdown"; } else { maintext = "My Countup"; } } if ((coloredtext == null) || (coloredtext == "")) coloredtext = "BLUE"; if ((expiredtext == null) || (expiredtext == "")) { if (thetype == "countdown") { expiredtext = "Blast Off!"; } else { expiredtext = "Waiting to Start"; } } theform.message.value += "["+thetype+"="+datetext+";"+expiredtext+";"+coloredtext+"]"+maintext+"[/"+thetype+"] "; } theform.message.focus(); } // ************************************* My template looks like this after adding them after the "quote" button. This was added after the <BR> tag which puts them on the third line of buttons. Code:
<input type="button" class="bginput" value="countdown" title="Insert Countdown" onclick="countdownup(this.form,'countdown')" > <input type="button" class="bginput" value="countup" title="Insert Countdown" onclick="countdownup(this.form,'countup')" ><br> |
#30
|
|||
|
|||
Great looking hack will do good on my Disney Page! thanks!
Ryan C. |
#31
|
|||
|
|||
One Question, How do you Modify the database.
Can someone walk me through this? I have phpmyadmin. . . Thanks |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|