Last page is now saved
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
|
||||
|
||||
|
||||
const tools = new Map();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This functions imports other js file. I hate this solution, but other didn't work.
|
||||
*
|
||||
@@ -39,8 +33,8 @@ function init() {
|
||||
tools.set("jsonform", "tools/jsonFormatter.html");
|
||||
tools.set("mock", getMockHost());
|
||||
|
||||
loadLastPage();
|
||||
changeActiveTools('xmlTool', 'XML');
|
||||
loadLastPage();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,10 +73,19 @@ function changeActiveTools(activeClass, activeCategoryButton) {
|
||||
function changeTool(tool) {
|
||||
const url = tools.get(tool);
|
||||
localStorage.setItem("lastPage", tool);
|
||||
document.getElementById("iframe").src = tools.get(lastPage);
|
||||
document.getElementById("iframe").src = url;
|
||||
}
|
||||
|
||||
function loadLastPage() {
|
||||
const lastPage = localStorage.getItem("lastPage");
|
||||
switch (lastPage) {
|
||||
case "jsonform":
|
||||
changeActiveTools('jsonTool', 'JSON');
|
||||
break;
|
||||
case "mock":
|
||||
changeActiveTools('restTool', 'REST');
|
||||
break;
|
||||
|
||||
}
|
||||
document.getElementById("iframe").src = tools.get(lastPage);
|
||||
}
|
||||
Reference in New Issue
Block a user