Monday, October 12, 2009

A blogger gadget for Ironman

So, since my badge is now working, I thought it would be a good idea to add my badge to my blog. It turned out to be fairly simple, and if you are using blogger, you can just reuse my work. All you need to do is
  1. Click "Customize"
  2. Click "Add a Gadget"
  3. Click "Add your own"
  4. enter the URL http://wonkden.net/ironman_perl_gadget.xml
  5. Click "ADD BY URL"
  6. Set the background color
  7. Set the name you registered with the Ironman competition
  8. Set the sex of your badge
  9. And, finally, click "Save"
Just for the record, here is the XML used to create the gadget:
<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
<ModulePrefs
title = "Ironman Perl Gadget"
title_url = "http://wonkden.net/ironman_perl_gadget.xml"
height = "80"
author = "Chas. Owens"
author_email = "chas.owens@gmail.com"
/>
<UserPref
name = "bg"
display_name = "Background Color"
datatype = "string"
required = "true"
/>
<UserPref
name = "ironman-name"
display_name = "Ironman Perl name"
datatype = "string"
required = "true"
/>
<UserPref
name = "ironman-sex"
display_name = "Sex"
datatype = "enum"
required = "true"
>
<EnumValue value="male" display_value="Male"/>
<EnumValue value="female" display_value="Female"/>
</UserPref>

<Content type="html">
<![CDATA[
<script type="text/javascript">
var prefs = new _IG_Prefs();
var name = prefs.getString("ironman-name");
var sex = prefs.getString("ironman-sex");
var color = prefs.getString("bg");
var html = '<div align="center" style="background-color: ' + color + '"><img src="http://ironman.enlightenedperl.org/munger/mybadge/' + sex + '/' + name + '.png" alt="Ironman Perl badge for ' + name + '"></div>'

document.write(html);
</script>
]]>
</Content>
</Module>

No comments:

Post a Comment

Some limited HTML markup is allowed by blogger: strong, b, i, and a. You may also use em, but I have repurposed it through the magic of CSS to be behave very much like <tt><code></code></tt>.