telebit.js/lib/html/js/app.js

37 lines
686 B
JavaScript
Raw Normal View History

2018-06-08 06:46:07 +00:00
(function () {
'use strict';
document.body.hidden = false;
var hash = window.location.hash.slice(1);
function parseQuery(search) {
var args = search.substring(1).split('&');
var argsParsed = {};
var i, arg, kvp, key, value;
for (i=0; i < args.length; i++) {
arg = args[i];
if (-1 === arg.indexOf('=')) {
argsParsed[decodeURIComponent(arg).trim()] = true;
} else {
kvp = arg.split('=');
key = decodeURIComponent(kvp[0]).trim();
value = decodeURIComponent(kvp[1]).trim();
argsParsed[key] = value;
}
}
return argsParsed;
}
console.log(parseQuery(hash));
}());