Sunday, April 19, 2009

JQuery is Easier Than it Looks

As an unrequested favour to my new host, I decided to move the link list on the site over to JQuery. Originally the link list was an aggregate of at least 10+ php files that were then hidden by scriptaculous. And the mark up to get the hiding to work was pretty ugly. I've now switched to dynamically pulling in the link lists for a nicer page loading experience and for less demand on the server's cpu. And the script to pull this off is quite small:

// hide all divs
// Accordion toggle categories and ajax load empty categories
function toggleContent(id) {
// id also serves as a file path for the file to be loaded
var div_id = "#"+id.substr(id.lastIndexOf('/')+1);
var jdiv = $(div_id);
// if div contains a noscript item, load content from id
if(jdiv.children("noscript").length > 0){
jdiv.slideDown("normal", function(){
jdiv.load(id+".php", function(){
// capture inner html and switcheroo with loaded text
var html = $(div_id).html();
jdiv.slideUp("normal", function(){
// hide all subcategories
$("div", div_id).each(function(){
// otherwise just slide the div open and closed
} else {

Not to mention that it took very little time to learn, despite JQuery syntax looking fairly scary.

Saturday, April 04, 2009

I'm Back

After being royally raped by a Chinese virus I've moved hosting to Huevia and put everything back online. I'm leaving comments off because the blog was the first part of the site to get affected, and also I'm not uploading any cgi scripts until I'm certain it's safe to do so and I'm doing it right.

I would normally post some links as well, but I'm thinking using my regex powers to make a proper indexed page of links with a smart search box on the side. This is because Blogger's search tool is a bag of bollocks.

Also you'll notice that comments are off. I'd rather not have that avenue open to attack my site. If you want to nudge me then my email is:

Yes it would be nice if it were clickable. No junk mail in my inbox would be even better.