By now all three of you have probably realized that I like things to change every once in a while: random wallpaper in GNOME or FVWM, random quotations in the Blog, etc. Heck, if I can figure out how to do it, eventually this blog will have a rotating template as well.
The latest bout with randomness is the tagline at the top of the blog. It was inspired by this hack from Stéphane Hamel. I couldn't get that version to run here, possibly because Blogger has changed a bit since the beta version, but I was able to lift Blog U's random quote generator to get the same effect.
So here's the final version of the hack:
- Log onto the Blogger Dashboard
- Select Layout => Template => Edit HTML
- Download the full template: Because you will frak it up.
- Click the box that says “Expand Widget Templates”
- Look for the second invocation of the string <data:description> — at least that's what I had to do.
- Replace the line
by the following
//store the quotations in arrays
quotes = new Array(5);
quotes = "First Quote";
quotes = "Second Quote";
quotes = "And So On&quot;;
quotes = "Changing the number in Array to match the number of quotes";
quotes = "and noticing that the array starts with ";
//calculate a random index
index = Math.floor(Math.random() * quotes.length);
//display the quotation
- Save everything
Note that I've never been able to get this script to accept more that 10 quotations. If someone can tell me why, or how to get around that, I'd be grateful.