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);
|
||||
}
|
||||
@@ -35,13 +35,15 @@
|
||||
<div id="leftBar">
|
||||
<ul id="toolList">
|
||||
<li class="dynamic restTool toolListRow" style="display: none;">
|
||||
<a id="rest-mock" href="http://tools.zipper.release11.com:8097/" target="iframe">REST Mock</a>
|
||||
<a id="rest-mock" href="#" onclick="changeTool('mock');">REST Mock</a>
|
||||
</li>
|
||||
<li class="toolListRow xmlTool"><a href="#" onclick="changeTool('xpath');">XPath</a></li>
|
||||
<li class="toolListRow xmlTool"><a href="#" onclick="changeTool('xslt');">XSLT</a></li>
|
||||
<li class="toolListRow xmlTool"><a href="#" onclick="changeTool('xsd');">XSD</a></li>
|
||||
<li class="toolListRow xmlTool"><a href="#" onclick="changeTool('xmlform');">XML Formatter</a></li>
|
||||
<li class="toolListRow jsonTool" style="display: none;">
|
||||
<a href="#" onclick="changeTool('jsonform');">JSON Formatter</a>
|
||||
</li>
|
||||
<li class="toolListRow xmlTool"><a href="./tools/xpath.html" target="iframe">XPath</a></li>
|
||||
<li class="toolListRow xmlTool"><a href="./tools/xslt.html" target="iframe">XSLT</a></li>
|
||||
<li class="toolListRow xmlTool"><a href="./tools/xsd.html" target="iframe">XSD</a></li>
|
||||
<li class="toolListRow xmlTool"><a href="tools/xmlFormatter.html" target="iframe">XML Formatter</a></li>
|
||||
<li class="toolListRow jsonTool" style="display: none;"><a href="tools/jsonFormatter.html" target="iframe">JSON Formatter</a></li>
|
||||
</ul>
|
||||
<div id="copyright">
|
||||
Build: [:VERSION:]<br>
|
||||
|
||||
Reference in New Issue
Block a user