Tools can be selected through URL (solves #161) (#207)

Co-authored-by: Adam Bem <adam.bem@zoho.eu>
Reviewed-on: #207
Reviewed-by: Mikolaj Widla <widlam@noreply.example.com>
This commit is contained in:
2023-05-24 14:40:07 +02:00
parent ecafb17f05
commit 97042faaa3

View File

@@ -30,7 +30,14 @@ function init() {
tools.set("mock", "tools/mock.html");
changeActiveTools('XML');
var toolUrl = window.location.search.substring(1);
if (toolUrl == "")
loadLastPage();
else if (tools.has(toolUrl))
changeTool(toolUrl);
else
loadLastPage();
}
/**
@@ -81,6 +88,7 @@ function changeTool(tool) {
const url = tools.get(tool);
localStorage.setItem("lastPage", tool);
document.getElementById("iframe").src = url;
document.location.search = tool;
}
/**