Post by Rosefriend on Sept 13, 2013 9:12:44 GMT -8
We have been using this Advent Calender since 2008.
Wormopolis changed the code to work on the calender and only open at the 1st December. Unfortunately he has so much to do that he said I should post here.
I would like this to open on a sub (as was originally written) and not on the Calender. Our members prefer by far the sub option.
Would someone be kind enough to take a look please??
Many thanks
RF
+++++++
<script type="text/javascript">
<!--
// 2007 Advent Calendar by Mithras
// modifications by Wormopolis
// Edit this first section.
//edit year and month for calander, (jan=1 ... dec=12)
var chosenYear = 2008;
var chosenMonth = 12;
var images = [
[http://i221./dd161/GWDAdmin1/AdCal12/Day1.jpg''], // 1
[' http://i221./dd161/GWDAdmin1/AdCal12/Day2.jpg'], // 2
[' http://i221./dd161/GWDAdmin1/AdCal12/Day3.jpg'], // 3
[' http://i221./dd161/GWDAdmin1/AdCal12/Day4.jpg'] , // 4
[' http://i221./dd161/GWDAdmin1/AdCal12/Day5.jpg'] , // 5
[' http://i221./dd161/GWDAdmin1/AdCal12/Day6.jpg'] , // 6
['http://i221./dd161/GWDAdmin1/AdCal12/Day7.jpg'], // 7
['http://i221./dd161/GWDAdmin1/AdCal12/Day8.jpg'], // 8
['http://i221./dd161/GWDAdmin1/AdCal12/Day9.jpg'], // 9
['http://i221./dd161/GWDAdmin1/AdCal12/Day10.jpg' ], // 10
['http://i221./dd161/GWDAdmin1/AdCal12/Day11.jpg'], // 11
['http://i221./dd161/GWDAdmin1/AdCal12/Day12.jpg'], // 12
['http://i221./dd161/GWDAdmin1/AdCal12/Day13.jpg'], // 13
['http://i221./dd161/GWDAdmin1/AdCal12/Day14.jpg'], // 14
['http://i221./dd161/GWDAdmin1/AdCal12/Day15.jpg'], // 15
['http://i221./dd161/GWDAdmin1/AdCal12/Day16.jpg'], // 16
['http://i221./dd161/GWDAdmin1/AdCal12/Day17.jpg'], // 17
['http://i221./dd161/GWDAdmin1/AdCal12/Day18.jpg'], // 18
['http://i221./dd161/GWDAdmin1/AdCal12/Day19.jpg' ], // 19
['http://i221./dd161/GWDAdmin1/AdCal12/Day20.jpg'], // 20
['http://i221./dd161/GWDAdmin1/AdCal12/Day21.jpg'], // 21
['http://i221./dd161/GWDAdmin1/AdCal12/Day22.gif'], // 22
['http://i221./dd161/GWDAdmin1/AdCal12/Day23.jpg'], // 23
['http://i221./dd161/GWDAdmin1/AdCal12/Day24.jpg'], // 24
['http://i221./dd161/GWDAdmin1/AdCal12/Day25.jpg'], // 25
['http://i221./dd161/GWDAdmin1/AdCal12/Day26.jpg'], // 26
['http://i221./dd161/GWDAdmin1/AdCal12/Day27.jpg'], // 27
['http://i221./dd161/GWDAdmin1/AdCal12/Day28.jpg'], // 28
['http://i221./dd161/GWDAdmin1/AdCal12/Day29.jpg'], // 29
['http://i221./dd161/GWDAdmin1/AdCal12/Day30.jpg'], // 30
['http://i221./dd161/GWDAdmin1/AdCal12/Day31.jpg'] // 31
];
// DONT EDIT BELOW HERE
var calDate=new Date(chosenYear, chosenMonth-1, 1); // (year, month, 1)
var daysArray=[31,28,31,30,31,30,31,31,30,31,30,31];
var monthArray=["January","February","March","April","May","June","July","August","September","October","November","December"];
daysArray[1]+=((calDate.getFullYear()%4==0 && !calDate.getFullYear()%100==0) || calDate.getFullYear()%400==0)?1:0;
var calMonth=calDate.getMonth();
document.write('<table id="calendar" class="bordercolor" cellspacing="1" cellpadding="4" border="1" align="center">');
document.write('<tr><td width="100%" colspan="7" class="titlebg"><font size="3"><div style="float:left">Advent Calendar</div><div style="float:right">');
document.write(monthArray[calMonth]+" "+calDate.getFullYear());
document.write('</div></font></td></tr>');
document.write('<tr class="calRow">');
temp=new Date(calDate.setDate(1));
spacer=temp.getDay();
if (spacer!=0)document.write('<td class="windowbg" width="100" colspan="'+spacer+'"></td>');
for (i=1; i<=daysArray[calMonth]; i++) {
cls=(i%2==0)?'windowbg':'windowbg2';
document.write('<td class="'+cls+'" width="100" id="cell'+i+'">'+i+'</td>');
if ((i+spacer)%7==0 && i!=daysArray[calMonth]) document.write('</tr><tr class="calRow">');
}
spacer2=(spacer+i-1)%7;
if ((spacer2)!=0) {
document.write('<td class="windowbg" width="100"');
if ((spacer2)<6) document.write(' colspan="'+(7-(spacer2)) +'"');
document.write('></td>');
}
document.write('</tr></table>');
// Cookie functions by Chris of Studio Zero (studiozero.proboards44.com)
function setCookie(_name,_value){
document.cookie = _name+"="+escape(_value)+";expires="+(new Date()).toGMTString().replace(/\d{4}/,"2050");
}
function getCookie(_name){
if(document.cookie.match(new RegExp(_name+"=(.+?)($|","gi")))
return unescape(RegExp.$1);
return null;
}
function processCell(num) {
var cell = document.getElementById('cell' + num);
cell.innerHTML = '<a href="javascript:void(0)" onclick="showImage(' + num + ',\'0\')">' + cell.innerHTML + '</a>';
}
function showImage(day,type) {
var cell = document.getElementById('cell' + day);
cell.innerHTML = '<img src="' + images[day-1] + '" />';
var name = '07dayClicked' + day;
if(type == '0') {
setCookie(name,'yes');
}
}
var date = new Date();
var alreadyShown = new Array();
var someDate = new Date();
for(b=0; b<=daysArray[calMonth]; b++) {
alreadyShown = 0;
}
for(a=1; a<=date.getDate(); a++) {
var cname = '07dayClicked' + a;
if(getCookie(cname) == 'yes') {
showImage(a,'1');
alreadyShown = 1;
}
else if(date.getMonth() == calMonth) {
var day = date.getDate();
for(i=1; i<=daysArray[calMonth]; i++) {
if(i <= day && alreadyShown == 0)
processCell(i);
}
}
}
//-->
</script>
Wormopolis changed the code to work on the calender and only open at the 1st December. Unfortunately he has so much to do that he said I should post here.
I would like this to open on a sub (as was originally written) and not on the Calender. Our members prefer by far the sub option.
Would someone be kind enough to take a look please??
Many thanks
RF
+++++++
<script type="text/javascript">
<!--
// 2007 Advent Calendar by Mithras
// modifications by Wormopolis
// Edit this first section.
//edit year and month for calander, (jan=1 ... dec=12)
var chosenYear = 2008;
var chosenMonth = 12;
var images = [
[http://i221./dd161/GWDAdmin1/AdCal12/Day1.jpg''], // 1
[' http://i221./dd161/GWDAdmin1/AdCal12/Day2.jpg'], // 2
[' http://i221./dd161/GWDAdmin1/AdCal12/Day3.jpg'], // 3
[' http://i221./dd161/GWDAdmin1/AdCal12/Day4.jpg'] , // 4
[' http://i221./dd161/GWDAdmin1/AdCal12/Day5.jpg'] , // 5
[' http://i221./dd161/GWDAdmin1/AdCal12/Day6.jpg'] , // 6
['http://i221./dd161/GWDAdmin1/AdCal12/Day7.jpg'], // 7
['http://i221./dd161/GWDAdmin1/AdCal12/Day8.jpg'], // 8
['http://i221./dd161/GWDAdmin1/AdCal12/Day9.jpg'], // 9
['http://i221./dd161/GWDAdmin1/AdCal12/Day10.jpg' ], // 10
['http://i221./dd161/GWDAdmin1/AdCal12/Day11.jpg'], // 11
['http://i221./dd161/GWDAdmin1/AdCal12/Day12.jpg'], // 12
['http://i221./dd161/GWDAdmin1/AdCal12/Day13.jpg'], // 13
['http://i221./dd161/GWDAdmin1/AdCal12/Day14.jpg'], // 14
['http://i221./dd161/GWDAdmin1/AdCal12/Day15.jpg'], // 15
['http://i221./dd161/GWDAdmin1/AdCal12/Day16.jpg'], // 16
['http://i221./dd161/GWDAdmin1/AdCal12/Day17.jpg'], // 17
['http://i221./dd161/GWDAdmin1/AdCal12/Day18.jpg'], // 18
['http://i221./dd161/GWDAdmin1/AdCal12/Day19.jpg' ], // 19
['http://i221./dd161/GWDAdmin1/AdCal12/Day20.jpg'], // 20
['http://i221./dd161/GWDAdmin1/AdCal12/Day21.jpg'], // 21
['http://i221./dd161/GWDAdmin1/AdCal12/Day22.gif'], // 22
['http://i221./dd161/GWDAdmin1/AdCal12/Day23.jpg'], // 23
['http://i221./dd161/GWDAdmin1/AdCal12/Day24.jpg'], // 24
['http://i221./dd161/GWDAdmin1/AdCal12/Day25.jpg'], // 25
['http://i221./dd161/GWDAdmin1/AdCal12/Day26.jpg'], // 26
['http://i221./dd161/GWDAdmin1/AdCal12/Day27.jpg'], // 27
['http://i221./dd161/GWDAdmin1/AdCal12/Day28.jpg'], // 28
['http://i221./dd161/GWDAdmin1/AdCal12/Day29.jpg'], // 29
['http://i221./dd161/GWDAdmin1/AdCal12/Day30.jpg'], // 30
['http://i221./dd161/GWDAdmin1/AdCal12/Day31.jpg'] // 31
];
// DONT EDIT BELOW HERE
var calDate=new Date(chosenYear, chosenMonth-1, 1); // (year, month, 1)
var daysArray=[31,28,31,30,31,30,31,31,30,31,30,31];
var monthArray=["January","February","March","April","May","June","July","August","September","October","November","December"];
daysArray[1]+=((calDate.getFullYear()%4==0 && !calDate.getFullYear()%100==0) || calDate.getFullYear()%400==0)?1:0;
var calMonth=calDate.getMonth();
document.write('<table id="calendar" class="bordercolor" cellspacing="1" cellpadding="4" border="1" align="center">');
document.write('<tr><td width="100%" colspan="7" class="titlebg"><font size="3"><div style="float:left">Advent Calendar</div><div style="float:right">');
document.write(monthArray[calMonth]+" "+calDate.getFullYear());
document.write('</div></font></td></tr>');
document.write('<tr class="calRow">');
temp=new Date(calDate.setDate(1));
spacer=temp.getDay();
if (spacer!=0)document.write('<td class="windowbg" width="100" colspan="'+spacer+'"></td>');
for (i=1; i<=daysArray[calMonth]; i++) {
cls=(i%2==0)?'windowbg':'windowbg2';
document.write('<td class="'+cls+'" width="100" id="cell'+i+'">'+i+'</td>');
if ((i+spacer)%7==0 && i!=daysArray[calMonth]) document.write('</tr><tr class="calRow">');
}
spacer2=(spacer+i-1)%7;
if ((spacer2)!=0) {
document.write('<td class="windowbg" width="100"');
if ((spacer2)<6) document.write(' colspan="'+(7-(spacer2)) +'"');
document.write('></td>');
}
document.write('</tr></table>');
// Cookie functions by Chris of Studio Zero (studiozero.proboards44.com)
function setCookie(_name,_value){
document.cookie = _name+"="+escape(_value)+";expires="+(new Date()).toGMTString().replace(/\d{4}/,"2050");
}
function getCookie(_name){
if(document.cookie.match(new RegExp(_name+"=(.+?)($|","gi")))
return unescape(RegExp.$1);
return null;
}
function processCell(num) {
var cell = document.getElementById('cell' + num);
cell.innerHTML = '<a href="javascript:void(0)" onclick="showImage(' + num + ',\'0\')">' + cell.innerHTML + '</a>';
}
function showImage(day,type) {
var cell = document.getElementById('cell' + day);
cell.innerHTML = '<img src="' + images[day-1] + '" />';
var name = '07dayClicked' + day;
if(type == '0') {
setCookie(name,'yes');
}
}
var date = new Date();
var alreadyShown = new Array();
var someDate = new Date();
for(b=0; b<=daysArray[calMonth]; b++) {
alreadyShown = 0;
}
for(a=1; a<=date.getDate(); a++) {
var cname = '07dayClicked' + a;
if(getCookie(cname) == 'yes') {
showImage(a,'1');
alreadyShown = 1;
}
else if(date.getMonth() == calMonth) {
var day = date.getDate();
for(i=1; i<=daysArray[calMonth]; i++) {
if(i <= day && alreadyShown == 0)
processCell(i);
}
}
}
//-->
</script>