Monday 6 July 2009

Moccle's birthday

This morning I did some more work on the slideshow for my photo website. For Moccle's birthday present, I got him Sims 3 jointly with L.

I had coded it so when the page is loaded, I load up an animated 'loading' gif and some text saying 'loading image' until the first photo is downloaded and ready to be displayed.

However, I found that in IE7, after the loading GIF was loaded, the page would fill up with the 'loading image' text. Looking into this, I found that that IE triggers the image onload function every time the animated GIF sequence restarts. It seems that IE8 isn't affected by this bug, and I'm not currently intending to use the slideshow in IE6, so I just changed my code for the loading image to the below:
//Create the loading image
var img = new Image();
//IE7 fires the image onload event every time the animation sequence of an animated gif restarts, so we need to use onreadystatechange for IE instead
if(IE7)
{
img.onreadystatechange = function()
{
if(this.readyState == 'complete')
{
createLoadingGIF();
}
}
}
else
{
img.onload = function(){
createLoadingGIF();
}
}
function createLoadingGIF(){
slideshow.loading = $('<span><br /><br />LOADING IMAGE</span>');
slideshow.loading.prepend(img);
slideshow.loading.appendTo('#slideShowContainer');
}
img.src = STATIC1+'/images/LoadingGif.gif';


In the evening I watched Moonwalker with Moccle, which was quite weird and good. Kind of like a David Lynch film, but not dark, and with Michael Jackson.

After that I did some more website stuff. I kept getting Out of Memory errors in Firefox like
Error: uncaught exception: [Exception... "Out of Memory" nsresult: "0x8007000e (NS_ERROR_OUT_OF_MEMORY)" location: "JS frame :: http://static1.photosite.com/js.js :: anonymous :: line 33" data: no]
But despite commenting out various bits I couldn't find out what was causing this error.

The weather was mostly cloudy today and it rained quite a bit, with a few very heavy showers.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: Slice of roast beef with sliced vine tomato, mustard and iceberg lettuce sandwich; grapes; caramel Rocky; cup o' tea.
Dinner: Lasagne; mixed veg. Pudding was 1½ slices of Moccle's chocolate birthday cake that Clare made him with squirty cream. Coffee.
Supper: Cheapo shortbread finger; Hob-nob; coffee.

No comments: