No, really, I should be posting this in some sort of Javascript help board, but I felt like posting it here....
...
...
...
Yeah.
Now my friend's doing a webcomic and I agreed to help him on the actual website. But I want syndicated weekly content. However, what I got was something that resembled syndicated weekly content:
<script language='javascript'>
<!--
var comicName = 'OnlineComic';
var comicDir = 'weekly/images/';
var noImage = 'images/noupdate.gif'; // Displays if no updates for 2 weeks.
var comicWidth = '652';
var comicHeight = '253';
var comicFormat = 'gif';
function lastComic()
{
var date = new Date(_date-24*60*60*1000*(_date.getDate()%7));
var blah_date = new Date(date-24*60*60*1000*(date.getDate()%7));
var d = blah_date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = blah_date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = blah_date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
// If IMG NAME changes, change next line.
document.images.OnlineComic.src = comicDir + year + month + day + '.' + comicFormat;
}
var _date = new Date();
var date = new Date(_date-24*60*60*1000*(_date.getDate()%7));
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (yy < 1000) ? yy + 1900 : yy;
// IMG NAME below
document.write('<IMG NAME='OnlineComic' ALT='' + comicName + '' BORDER=0 SRC='' + comicDir + year + month
+ day + '.' + comicFormat + '' WIDTH='' + comicWidth + '' HEIGHT='' + comicHeight + '' onError='lastComic()'>');
-->
</script>
Notice the double quotes have been changed to single quotes, which would make understanding some lines extremely hard.
<!-- I wonder if you can write cryptic messages like this... hmm...-->
Anyways, the thing is, this works only for days that are multiples of seven, and the last days of months. That really isn't too much of a problem, but I'd like it if it was actually weekly.
More important, and the problem I need to ask you guys is:
How can I archive this shizzle in Chapters and Pages without having to resort to manually change the archive every single time I have to upload a new page?
Any suggestions for javascript and/or filename format changes?