mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
The recipe and input are now stored in the hash part of the URL
This commit is contained in:
parent
61951e76ac
commit
00e7d8a390
4 changed files with 50 additions and 29 deletions
|
@ -981,6 +981,37 @@ const Utils = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
* Parses URI parameters into a JSON object.
|
||||
*
|
||||
* @param {string} paramStr - The serialised query or hash section of a URI
|
||||
* @returns {object}
|
||||
*
|
||||
* @example
|
||||
* // returns {a: 'abc', b: '123'}
|
||||
* Utils.parseURIParams("?a=abc&b=123")
|
||||
* Utils.parseURIParams("#a=abc&b=123")
|
||||
*/
|
||||
parseURIParams: function(paramStr) {
|
||||
if (paramStr === "") return {};
|
||||
|
||||
// Cut off ? or # and split on &
|
||||
const params = paramStr.substr(1).split("&");
|
||||
|
||||
const result = {};
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
const param = params[i].split("=");
|
||||
if (param.length !== 2) {
|
||||
result[params[i]] = true;
|
||||
} else {
|
||||
result[param[0]] = decodeURIComponent(param[1].replace(/\+/g, " "));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Actual modulo function, since % is actually the remainder function in JS.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue