Last opened page is now stored (solves #166) #178
@@ -41,7 +41,7 @@ div#header {
 | 
				
			|||||||
    grid-column: 1;
 | 
					    grid-column: 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
iframe#frame {
 | 
					iframe#iframe {
 | 
				
			||||||
    flex-grow: 1;
 | 
					    flex-grow: 1;
 | 
				
			||||||
    background-color: #FFFFFF;
 | 
					    background-color: #FFFFFF;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,4 +3,8 @@ $(document).ready( function() {
 | 
				
			|||||||
        window.location.protocol + "//" + window.location.hostname + ":8097";
 | 
					        window.location.protocol + "//" + window.location.hostname + ":8097";
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
        
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getMockHost() {
 | 
				
			||||||
 | 
					    return window.location.protocol + "//" + window.location.hostname + ":8097";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,5 +1,45 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const tools = new Map();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * This functions imports other js file. I hate this solution, but other didn't work.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name importScript
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} url
 | 
				
			||||||
 | 
					 * @returns {void}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					function importScript(url) {
 | 
				
			||||||
 | 
					    var script = document.createElement("script");  // create a script DOM node
 | 
				
			||||||
 | 
					    script.src = url;  // set its src to the provided URL
 | 
				
			||||||
 | 
					    document.head.appendChild(script);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Function called after page is loaded
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name init
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @returns {void}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function init() {
 | 
					function init() {
 | 
				
			||||||
 | 
					    importScript("/assets/scripts/dyn_host.js");
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    tools.set("xpath", "tools/xpath.html");
 | 
				
			||||||
 | 
					    tools.set("xsd", "tools/xsd.html");
 | 
				
			||||||
 | 
					    tools.set("xslt", "tools/xslt.html");
 | 
				
			||||||
 | 
					    tools.set("xmlform", "tools/xmlFormatter.html");
 | 
				
			||||||
 | 
					    tools.set("jsonform", "tools/jsonFormatter.html");
 | 
				
			||||||
 | 
					    tools.set("mock", getMockHost());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    loadLastPage();
 | 
				
			||||||
    changeActiveTools('xmlTool', 'XML');
 | 
					    changeActiveTools('xmlTool', 'XML');
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -34,4 +74,15 @@ function changeActiveTools(activeClass, activeCategoryButton) {
 | 
				
			|||||||
            categories[i].classList.remove("active")
 | 
					            categories[i].classList.remove("active")
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function changeTool(tool) {
 | 
				
			||||||
 | 
					    const url = tools.get(tool);
 | 
				
			||||||
 | 
					    localStorage.setItem("lastPage", tool);
 | 
				
			||||||
 | 
					    document.getElementById("iframe").src = tools.get(lastPage);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function loadLastPage() {
 | 
				
			||||||
 | 
					    const lastPage = localStorage.getItem("lastPage");
 | 
				
			||||||
 | 
					    document.getElementById("iframe").src = tools.get(lastPage);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -4,8 +4,8 @@
 | 
				
			|||||||
<head>
 | 
					<head>
 | 
				
			||||||
    <link rel="stylesheet" href="assets/css/frame.css">
 | 
					    <link rel="stylesheet" href="assets/css/frame.css">
 | 
				
			||||||
    <script src="assets/scripts/common/jquery-3.6.0.slim.min.js"></script>
 | 
					    <script src="assets/scripts/common/jquery-3.6.0.slim.min.js"></script>
 | 
				
			||||||
    <script src="assets/scripts/dyn_host.js"></script>
 | 
					 | 
				
			||||||
    <script src="assets/scripts/frame.js"></script>
 | 
					    <script src="assets/scripts/frame.js"></script>
 | 
				
			||||||
 | 
					    <script src="assets/scripts/dyn_host.js"></script>
 | 
				
			||||||
    <!-- <link rel="stylesheet" href="common.css"> -->
 | 
					    <!-- <link rel="stylesheet" href="common.css"> -->
 | 
				
			||||||
    <link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon"> 
 | 
					    <link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon"> 
 | 
				
			||||||
    <!-- Meta tags for SEO and SEM -->
 | 
					    <!-- Meta tags for SEO and SEM -->
 | 
				
			||||||
@@ -53,7 +53,7 @@
 | 
				
			|||||||
                <a href="mailto:bugs@release11.com">Found a bug?</a>
 | 
					                <a href="mailto:bugs@release11.com">Found a bug?</a>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <iframe id="frame" name="iframe" src="./tools/xpath.html" frameborder="0"></iframe>
 | 
					        <iframe id="iframe" name="iframe" frameborder="0"></iframe>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user