February 02, 2007

Adding a Grazr Widget to a Moodle Journal Page

Whilst the Moodle environment lets users add simple HTML within personal journal or blog pages, it is typically locked down to the extent that users cannot add javascript or iframes within the HTML; nor can users avail themselves of personally included javascript embedded within the href attribute of an anchor tag.

So here's a bookmarklet workaround, in the first instance to let you add a Grazr widget to a Moodle journal page. The hack is to add an anchor named in a particular way:

anchorHack.png

When the page is saved, the URL appears in the page, but hidden in the HTML code that is used to display the text the anchor has the attribute name="ousefulHack"

embedded.png

Clicking on the bookmarklet loads a Grazr browser with the URL used to create the anchor:

moodlegrazr1.png

Grazr actually supports autodiscovery of web feeds. In the above case, I gave the URL to the OUseful blog, and Grazr has autodetected its RSS feed, allowing me to view the feed in the Grazr widget that is now embedded in the Moodle journal page:

moodlegrazr2.png

At the moment, the bookmarklet will only embed a single Grazr widget. Potential extensions to the script would include autodetection of things like YouTube URLs (in which case, a corresponding YouTube movie player could perhaps be embedded in the page rather than a Grazr widget?) as well as the embedding of all appropriately named anchors present in the page.

If you want to try the bookmrklet out, here it is: Moodle Grazr ousefulHack (only tested in Firefox...)

Embedding the bookmarklet code in a Greasemonkey script or browser extension would allow Grazr widgets to be automatically embedded within Moodle journal or blog pages wherever the ousefulHack name is used as an anchor attribute.

Posted by ajh59 at February 2, 2007 01:18 AM
Comments