Entries from March 2006 ↓
March 24th, 2006 — Code, JavaScript
Behaviour, great bit of JavaScript!
While using it lately I came across a small bug in the code it’s based-on, Simon Willison’s getElementsBySelector(), when you use a selector that references an invalid ID paired with a tag name (e.g. body#profile, when #profile doesn’t exist), a script error occurs; yet using #profile alone works fine.
After a little bit of digging I found a solution, the source of the error is line 89:
if (tagName && element.nodeName.toLowerCase() != tagName) {
It’s finding the tagName (body), but element is undefined due to the ID being invalid. A slight change to the above if statement fixes the problem.
if (!element || (tagName && element.nodeName.toLowerCase() != tagName)) {
Maybe somebody will find that useful, I’ve posted it on Simons blog, but incase he doesn’t accept the change you can download the modified version here.
Note: If you’re using Behaviour, as opposed to just getElementsBySelector(), you’ll need to paste the contents of the above file into the bottom of your behaviour.js file, overwriting everything after the Behaviour.start(); line.
March 8th, 2006 — Accessibility, Web Design
As reported by BBC News, a new set of accessibility guidelines have been developed for UK websites.
Although this certainly isn’t anything new — being as a law was passed in 1999 for compliance — and it isn’t even legally binding, it may be used in court if a case arises. This is just one more little pebble added to the mounting landslide that will occur when a disabled user finally does the american thing and sues a company for not providing sufficient means to access their website.
March 7th, 2006 — Nuggets
This was a task and a half! As I mentioned earlier I somehow managed to get my Trust Wireless Scroll Tablet working on a dual monitor system, mapped to only the primary monitor; so here’s my little guide on how I managed it.
As far as I am aware there isn’t an option in the trust software to allow you to map to a specific monitor, only to restrict the area on the tablet (which isn’t at all helpful). So what I’ve figured out is purely a work around, and it isn’t great either1. This is mainly for my reference, but someone else might find it useful, so here we go:
- Open up Display Properties and disable (“un-attach”) your secondary monitor.
- Open the Trust Control Panel from the icon in your system tray.
- Re-enable your second monitor.
- Click ok in your Trust Control Panel.
From there on out your tablet should only be mapped to the monitor that stayed enabled the whole time, that is until you re-open the Trust Control Panel. I didn’t say it was pretty!
What I can gather is that after disabling your monitor, when you open up the control panel it maps the overall screen size so it can apply that to the tablet, but when you click OK after re-enabling the monitor it doesn’t refresh with the screen change and so uses the single monitor values.
1 Also note that I have only tested this on my system.
March 7th, 2006 — Personal
After being inspired by Kevin Cornell at Bearskinrug I finally decided to try a drawing tablet, one of those magical designer tools. I bought a Trust 1200-V2 Wireless Scroll Tablet from Amazon for a fairly reasonable £40, which was an absolute breeze to set up, windows picked it up without the need to install the drivers, which is always nice.
My main complaint with it is that I was unable to (logically) get the tablet to map to anything less than both of my monitors, which was rubbish because that meant the tablet was being stretched horizontally; so you couldn’t trace anything without it becoming distorted. I say logically, because last thing yesterday I somehow managed it, so my tablet maps to my primary monitor and my mouse continues to work across both - it’ll take me a bit of time to get used to swapping but it’s definitely worth it. I will try and figure out how I managed to get it working, so I can at least make a note of it for next time.
Now all I need to do is learn how to draw… I’m currently at Rory’s standard of drawing, which of course is amazing!
March 7th, 2006 — CSS, JavaScript, Personal
Recently, while working on my website I’ve become exposed to the Behaviour JavaScript library, which I may say is absolutely wonderful. Very simple and straight forward, completely removes the need for those cursed script tags appended to the bottom of a page; something which I’ve never liked doing but became a bit of a necessary burdon! In short it allows you to execute arbitrary code on elements in the DOM using CSS selectors; so, for example, you can apply a onclick event only to elements which match form fieldset div#items a.add1, very handy indeed!Outside of the web I got my hands on a copy of Star Wars: Empire at War, which is easily the best Star Wars RTS game I’ve played (which isn’t hard). Very entertaining, if a little samey after a while. Definitely worth playing though.
Even further outside of the web — in the real world — Sara and I got tickets for the Foo Fighters, Queens of the Stone Age and Motörhead show in Hyde Park, London. That should be an entertaining night and it’s a very good excuse to get ourselfs down to London again, a city we really enjoyed last time.
1 Any anchors with a class of “add”, within a div with an ID of “items” that itself is within a fieldset in a form tag.