ProBoards® Support
« [RD] Advent Calendar help - reset? »

Welcome Guest. Please Login or Register.
Nov 24, 2009, 4:29am



Code Requests
Important Rules
  1. No bumping within 24 hours
  2. No double posting
  3. Maximum of 3 requests per week
  4. Descriptive topic titles
Before Posting Read These
Quick Links & Info


ProBoards® Support :: General :: Coding and Design Boards :: Code Requests & Support :: [RD] Advent Calendar help - reset?
   [Search This Thread][Send Topic To Friend] [Print]
 AuthorTopic: [RD] Advent Calendar help - reset? (Read 91 times)
dramsay7s
New Member
*
member is offline

[avatar]



Joined: Jul 2009
Posts: 29
 [RD] Advent Calendar help - reset?
« Thread Started on Nov 7, 2009, 3:38am »

I made this advent calendar (http://support.proboards.com/index.cgi?board=codedatabase&action=display&thread=298537) but it let me click on the dates for Next month even though it's only November, so now I have the first 7 boxes open already. It says it uses cookies to remember which ones are already open, is there any way to reset it??


Code:
<script type="text/javascript">
<!--
/* ADVENT CALENDAR - by Wormopolis
Do not repost - keep header intact
[url]wormocodes.proboards.com[/url]
v 1.1
*/

//edit year and month for calander, (jan=1 ... dec=12)
var chosenMonth = 12;

var hideImage='http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449922.jpg'; //image before reveal

var images = [
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449755.jpg'], // 1
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449758.jpg'], // 2
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449769.jpg'], // 3
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449775.jpg'], // 4
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449788.jpg'], // 5
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449793.jpg'], // 6
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449794.jpg'], // 7
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449806.jpg'], // 8
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449809.jpg'], // 9
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449812.jpg'], // 10
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449814.jpg'], // 11
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449816.jpg'], // 12
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449832.jpg'], // 13
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449837.jpg'], // 14
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449841.jpg'], // 15
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449844.jpg'], // 16
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449856.jpg'], // 17
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449866.jpg'], // 18
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449872.jpg'], // 19
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449879.jpg'], // 20
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449884.jpg'], // 21
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377450319.jpg'], // 22
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449908.jpg'], // 23
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449900.jpg'], // 24
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449904.jpg'], // 25
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449889.jpg'], // 26
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449909.jpg'], // 27
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449913.jpg'], // 28
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449915.jpg'], // 29
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449918.jpg'], // 30
['http://pic60.picturetrail.com/VOL1740/12310469/22691424/377449920.jpg'] // 31
];


// DONT EDIT BELOW HERE

function XBrowserAddHandler(target,eventName,handlerName) {
if ( target.addEventListener ) {
target.addEventListener(eventName, function(e){target[handlerName](e);}, false);
} else if ( target.attachEvent ) {
target.attachEvent("on" + eventName, function(e){target[handlerName](e);});
}
}


if (location.href.match(/ion=calendar/)) {
nwDate=new Date();
// check URL.. no "month" assume current month
if (location.href.match(/month=(\d+)/)) {
var calMonth=RegExp.$1;

} else {
calMonth=nwDate.getMonth()+1;
}
if (chosenMonth==calMonth || (document.cookie.match('adv'+calMonth))) {
tds=document.getElementsByTagName('td');
var place=0;
for (i=0; i<tds.length; i++) {
if ((tds[i].className=="windowbg2" || tds[i].className=="windowbg") && tds[i].vAlign=="top" && (tds[i].width=="14%" || tds[i].width=="15%") && tds[i].firstChild && tds[i].firstChild.nodeName=='TABLE') {

rgxp = new RegExp("adv"+calMonth+"=(\\d+)");
if (document.cookie.match(rgxp)){
bef=RegExp.$1;
} else {
bef="0000000000000000000000000000000";
}

dv=tds[i].getElementsByTagName('div')[0];
ig=document.createElement('img');
newpic=images[place++];
with (ig) {
if (bef.charAt(place-1)!="1") {
src=hideImage;
} else {
src=newpic;
}
width=100;
height=80;
border=0;
style.borderColor=tds[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.bgColor;
}


function swapPic(e) {
this.src=this.storesrc;
//000 0000 0000 0000 0000 0000 0000 0000
rgxp = new RegExp("adv"+calMonth+"=(\\d+)");
if (document.cookie.match(rgxp)){
bef=RegExp.$1;
} else {
bef="0000000000000000000000000000000";
}
bef=bef.substring(0,this.keepnum-1)+"1"+bef.substring(this.keepnum,bef.length)
tmpDate=new Date();
if (tmpDate.getMonth()<10) {
tmpDate.setMonth(tmpDate.getMonth()+3);
} else {
tmpDate.setMonth(tmpDate.getMonth()-9);
tmpDate.setYear(tmpDate.getFullYear()+1);
}
document.cookie="adv"+calMonth +"="+bef+"; expires="+tmpDate;
}

calDay=dv.firstChild.firstChild.innerHTML;

ig.storesrc=newpic;
ig.cHandler=swapPic;
ig.keepnum=place;


if (calDay<=nwDate.getDate() || calDay=="TODAY") {
ig.border=2;
XBrowserAddHandler(ig,"click","cHandler");

}
dv.parentNode.insertBefore(ig, dv.nextSibling);
}
}
}

}


// -->
</script>
« Last Edit: Nov 14, 2009, 1:24pm by dramsay7s »Link to Post - Back to Top  IP: Logged
Todge
Moderator
*****
Official Code Helper
member is offline

[avatar]

**



Joined: Jan 2004
Gender: Male
Posts: 5,517
Location: *Shrug*
 Re: Advent Calendar help - reset?
« Reply #1 on Nov 7, 2009, 7:29am »

Delete the cookies..

:)
Link to Post - Back to Top  IP: Logged

[image]
Wormopolis
Pro Member
*****
member is offline

[avatar]

AKA SK-Bundy

[yim]
[homepage]

Joined: Jun 2008
Gender: Male
Posts: 3,171
Location: Las Vegas
 Re: Advent Calendar help - reset?
« Reply #2 on Nov 7, 2009, 7:48am »

did it put the pictures in November or December?
Link to Post - Back to Top  IP: Logged

[image]

dramsay7s
New Member
*
member is offline

[avatar]



Joined: Jul 2009
Posts: 29
 Re: Advent Calendar help - reset?
« Reply #3 on Nov 7, 2009, 9:46am »

it put the picture in December, but some of them had a border so I clicked on them to see if it worked, and all of the numbers of the month that had passed were clickable, despite it being the wrong month.

I don't know how to delete the cookies lol... maybe hubby does, will ask him! :P
Link to Post - Back to Top  IP: Logged
dramsay7s
New Member
*
member is offline

[avatar]



Joined: Jul 2009
Posts: 29
 Re: Advent Calendar help - reset?
« Reply #4 on Nov 7, 2009, 9:55am »

lol managed to delete the cookies, sorry about stupid post ::) lol!
Link to Post - Back to Top  IP: Logged
Wormopolis
Pro Member
*****
member is offline

[avatar]

AKA SK-Bundy

[yim]
[homepage]

Joined: Jun 2008
Gender: Male
Posts: 3,171
Location: Las Vegas
 Re: Advent Calendar help - reset?
« Reply #5 on Nov 7, 2009, 10:36am »

did you change your computer date or did it let you click them while still in November?
Link to Post - Back to Top  IP: Logged

[image]

dramsay7s
New Member
*
member is offline

[avatar]



Joined: Jul 2009
Posts: 29
 Re: Advent Calendar help - reset?
« Reply #6 on Nov 7, 2009, 11:37am »

No, it lets me click them while still in November.
Link to Post - Back to Top  IP: Logged
Wormopolis
Pro Member
*****
member is offline

[avatar]

AKA SK-Bundy

[yim]
[homepage]

Joined: Jun 2008
Gender: Male
Posts: 3,171
Location: Las Vegas
 Re: Advent Calendar help - reset?
« Reply #7 on Nov 7, 2009, 11:56am »

hmmm.. I will investigate.
Link to Post - Back to Top  IP: Logged

[image]

dramsay7s
New Member
*
member is offline

[avatar]



Joined: Jul 2009
Posts: 29
 Re: Advent Calendar help - reset?
« Reply #8 on Nov 7, 2009, 12:38pm »

Thanks ;) I have a lot of impatient nosey people on my site who might peek if I put it up too early now! :lol:
Link to Post - Back to Top  IP: Logged
Wormopolis
Pro Member
*****
member is offline

[avatar]

AKA SK-Bundy

[yim]
[homepage]

Joined: Jun 2008
Gender: Male
Posts: 3,171
Location: Las Vegas
 Re: Advent Calendar help - reset?
« Reply #9 on Nov 9, 2009, 8:40am »

http://wormocodes.com/index.cgi?board=codedb&action=display&thread=26&page=1#31


bug fixed that made it where you could view the calander when in a different month. However this will cause problems if someone wants to see a calander AFTER the month has passed.

http://wormocodes.com/index.cgi?board=codedb&action=display&thread=26&page=1#31
Link to Post - Back to Top  IP: Logged

[image]

dramsay7s
New Member
*
member is offline

[avatar]



Joined: Jul 2009
Posts: 29
 Re: Advent Calendar help - reset?
« Reply #10 on Nov 10, 2009, 9:18am »

Fantastic, thank you! :)
Link to Post - Back to Top  IP: Logged
   [Search This Thread][Send Topic To Friend] [Print]


Google
Websupport.proboards.com
Click Here To Make This Board Ad-Free


This Board Hosted For FREE By ProBoards
Get Your Own Free Message Boards & Free Forums!