EDIT: This post was nonsense, I must be tired. Basically I found an odd-looking script, didn't read it carefully enough and assumed it did checks on location.href that were actually done on location.search. Ten seconds after clicking publish I realised that I had misread it and written something stupid. (I know I'm tired – for personal reasons – but surprised to see myself making such silly mistakes..).
I've removed the post content but will paste it in a comment. The reason for doing that is I won't let some snide comments about code that made more sense than I thought remain on the main blog, but I won't airbrush away this stupid incident either :p