mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 09:37:17 +00:00
14 lines
474 B
JavaScript
14 lines
474 B
JavaScript
function anchorArgument(argument, defaultValue) {
|
|
args = [];
|
|
pairs = window.location.hash.slice(1).split("&");
|
|
for (var i = 0, len = pairs.length; i < len; i++) {
|
|
pair = pairs[i];
|
|
eq = pair.indexOf("=");
|
|
if(eq) {
|
|
key = decodeURIComponent(pair.slice(0, eq));
|
|
value = decodeURIComponent(pair.slice(eq + 1));
|
|
args[key] = value;
|
|
}
|
|
}
|
|
return args[argument] ? args[argument] : defaultValue;
|
|
}
|