Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Christmas Countdown

edited December 2007 in Vanilla 1.0 Help
If anyone is interested in adding a Christmas countdown to their forum, check out my forum. Here is what you have to do:

1. You need the Nuggets add-on installed.
2. Create a Nugget and put it above the banner (or wherever) and add the code:
<script language="javascript" type="text/javascript"><!-- //<![CDATA[ var startPosition=0; function Xmascountdown() { var XmasDay = "December 25," var today = new Date() var thisYear = today.getFullYear() var XmasDate = new Date(XmasDay + thisYear) var diff = XmasDate.getTime() - today.getTime(); var days = Math.floor(diff / (1000 * 60 * 60 * 24)); if ((days < 0) && (days >= -1)) { var mainMessage =" M E R R Y C H R I S T M A S F R O M T H E E L V E S !!! ... "; var speed=175; var scrollingRegion=100; var tempLoc=(scrollingRegion*3/mainMessage.length)+1; if (tempLoc<1) {tempLoc=1} var aut="emsanta" var counter; for(counter=0;counter<=tempLoc;counter++); mainMessage+=mainMessage; document.clock.Xmascountdown.value =mainMessage.substring(startPosition,startPosition+scrollingRegion); startPosition++; if(startPosition>scrollingRegion) startPosition=0; setTimeout("Xmascountdown()",speed); } else { if (days >= 0) { var theDay = XmasDate; } else { var theDay = new Date(XmasDate.getYear()+1,XmasDate.getMonth(),XmasDate.getDate()); } var second = Math.floor((theDay.getTime() - today.getTime())/1000); var minute = Math.floor(second/60); var hour = Math.floor(minute/60); var day = Math.floor(hour/24); CDay= day; CHour= hour % 24; CMinute= minute % 60; CSecond= second % 60; var DayTill = CDay + " days, " + CHour + " hours, " + CMinute + " minutes and " + CSecond + " seconds"; document.clock.Xmascountdown.value = DayTill; var counter = setTimeout("Xmascountdown()", 1000); } } //]]> //--> </script> <font color="green" size="4" face="papyrus"> <center><br/> <form name="clock"> There is only <p><input name="Xmascountdown" size="45" style="background-color:lightgreen; text-align:center; font-size:22px;"></p> until Christmas! </form> <p>Wishing you the happiest of holidays</p><p>Merry Christmas and Happy New Year!</p> </center> </font>
3. Make a copy of the head.php and put it in the theme folder you are using. Change the line:
<body'.$BodyId.' '.$this->Context->BodyAttributes.'> to
<body'.$BodyId.' '.$this->Context->BodyAttributes.' onload="Xmascountdown();">
This loads the javascript function that updates the clock.

Comments

  • Options
    BenBen
    edited December 2007
    To which I respond, http://isitchristmas.com :)
This discussion has been closed.