{"ScriptPreparationCode":"function getConfigFromUrl(url) {\r\n if(!url) url = location.href;\r\n var question = url.indexOf(\u0022?\u0022);\r\n var hash = url.indexOf(\u0022#\u0022);\r\n if(hash==-1 \u0026\u0026 question==-1) return {};\r\n if(hash==-1) hash = url.length;\r\n var query = question==-1 || hash==question\u002B1 ? url.substring(hash) :\r\n url.substring(question\u002B1,hash);\r\n var result = {};\r\n query.split(\u0022\u0026\u0022).forEach(function(part) {\r\n if(!part) return;\r\n part = part.split(\u0022\u002B\u0022).join(\u0022 \u0022); // replace every \u002B with space, regexp-free version\r\n var eq = part.indexOf(\u0022=\u0022);\r\n var key = eq\u003E-1 ? part.substr(0,eq) : part;\r\n var val = eq\u003E-1 ? decodeURIComponent(part.substr(eq\u002B1)) : \u0022\u0022;\r\n var from = key.indexOf(\u0022[\u0022);\r\n if(from==-1) result[decodeURIComponent(key)] = val;\r\n else {\r\n var to = key.indexOf(\u0022]\u0022,from);\r\n var index = decodeURIComponent(key.substring(from\u002B1,to));\r\n key = decodeURIComponent(key.substring(0,from));\r\n if(!result[key]) result[key] = [];\r\n if(!index) result[key].push(val);\r\n else result[key][index] = val;\r\n }\r\n });\r\n\r\n\r\n\r\n return result[\u0022viewer1.angle\u0022];\r\n }\r\n\r\nfunction regexMatch(url) {\r\n\tconst keys = url.match(/(?\u003C=\\?.*)[A-z]\u002B[A-z0-9]*.[A-z]\u002B[A-z][A-z0-9]*(?=\u0026?)/g);\r\n const vals = url.match(/(?\u003C=[A-z]\u002B[A-z0-9]*.[A-z]\u002B[A-z0-9]*=)[^\u0026]\u002B(?=\u0026?)/g);\r\n \r\n let output = {};\r\n \r\n for (let i=0; i\u003Ckeys.length; i\u002B\u002B) {\r\n output[keys[i]] = vals[i];\r\n }\r\n \r\n return output[\u0022viewer1.angle\u0022];\r\n}\r\n\r\nlet r;","TestCases":[{"Name":"Manual parsing","Code":"r = getConfigFromUrl(\u0022http://localhost:8181/?viewer1.angle=123\u0026viewer1.color=234234\u0026viewer2.angle=123\u0022);","IsDeferred":false},{"Name":"Regex parsing 1","Code":"r = regexMatch(\u0022http://localhost:8181/?viewer1.angle=123\u0026viewer1.color=234234\u0026viewer2.angle=123\u0022);","IsDeferred":false}]}