Skip to content

Instantly share code, notes, and snippets.

@yoko
Created March 1, 2009 09:03
Show Gist options
  • Save yoko/72283 to your computer and use it in GitHub Desktop.
Save yoko/72283 to your computer and use it in GitHub Desktop.
parse = function(hash) {
var ret = {};
var hash = /#(.+)/.exec(hash || location.href); // Can't use the location.hash, Fx decodes automatically.
if (hash)
hash = h[1];
else
return ret;
$.each(queries.split('&'), function() {
if (!this) return;
var p = $.map(this.split('='), function(n) {
var ret = decodeURIComponent(n);
return Number(ret) || ret;
});
ret[p[0]] = p[1];
});
return ret;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment