web technology is a way of life
I’ve always found that it is easier to drop the query string into an object similar to the $_GET object in PHP. This allows you to grab any query variable by it’s name by simply calling window.query.name or window.query['name'] as well as getting the number of query vars available via window.query.length to simply check if any exist. For the hash, I like to use it as a breadcrumb style path separated by slashes, so here I’ve split it into an array that can be accessed via window.hash[2] and accurately report the number of parts with window.hash.length that reports an empty ‘#’ as 0.
// Query | Hash Globals
window.query = new Object();
window.hash = new Array();
// Populate Query String Object, iterate over each name-value pair
window.query.length = 0;
window.location.search.replace(
new RegExp('([^?=&]+)=([^&]*)?', 'g'),
// populate the object with the values by name
function($0, $1, $2) { window.query[$1] = $2; window.query.length++; }
);
// Split the hash into sections by / or any other char
window.hash = window.location.hash.slice(1).split('/');
window.hash.length = window.hash.length == 1 && window.hash[0] == ''? 0: window.hash.length;
The Livescribe Pulse smartpen gets an app store. This little pen is quite amazing, and it just shows that the business model of an app store is already changing the market for every type of electronic device. So when does my…
The Ghostwire (DSiWare) game looks great and reminds me a lot of Fatal Frame.
FloorPlanner is an interesting bit of software built in Flash that allows you design your home in 2D and view in 3D.
The new Stargate Universe [Philosphocal] teaser looks awesome. I stopped watching Atlantis a bit ago because it got boring, I hope this pumps up the energy as BSG did. It has Lou Diamond Philips and Ming-Na in it, that could make…
Here’s a plethora of well designed RSS Feed icons for free!