User:AoV2/query string.js

function get_qs(url){ o = {}; if(s = url.split("?")[1]){ p = s.split("&"); for(var i = 0; i < p.length; i++){ lv = p[i].split("="); o[decodeURIComponent(lv[0])] = (lv[1] ? decodeURIComponent(lv[1]) : null); }		}	// let "/wiki/Main_Page" yield { "title" : "Main Page" } for mw sites with standard shorturl if(!o.title && (m = url.match(/\/wiki\/(.+)$/))) o.title = decodeURIComponent(m[1]); if(o.title) o.title = o.title.replace(/_/g, " "); return o;	}

qs = get_qs(location.href);