function params(str) { var res = {}; (str || location.search).replace(/^\?/, "").split("&").forEach(function(str) { str = str.split("="); res[str[0].toLowerCase()] = str[1] || true; }); return res; }