Refined code
This commit is contained in:
		@@ -1,10 +0,0 @@
 | 
			
		||||
$(document).ready( function() {
 | 
			
		||||
    document.getElementById("rest-mock").href =
 | 
			
		||||
        window.location.protocol + "//" + window.location.hostname + ":8097";
 | 
			
		||||
    
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function getMockHost() {
 | 
			
		||||
    return window.location.protocol + "//" + window.location.hostname + ":8097";
 | 
			
		||||
}
 | 
			
		||||
@@ -15,6 +15,18 @@ function importScript(url) {
 | 
			
		||||
    document.head.appendChild(script);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get address of Mock Services
 | 
			
		||||
 * 
 | 
			
		||||
 * @function
 | 
			
		||||
 * @name getMockHost
 | 
			
		||||
 * @kind function
 | 
			
		||||
 * @returns {string}
 | 
			
		||||
 */
 | 
			
		||||
function getMockHost() {
 | 
			
		||||
    return window.location.protocol + "//" + window.location.hostname + ":8097";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Function called after page is loaded
 | 
			
		||||
 * 
 | 
			
		||||
@@ -24,7 +36,6 @@ function importScript(url) {
 | 
			
		||||
 * @returns {void}
 | 
			
		||||
 */
 | 
			
		||||
function init() {
 | 
			
		||||
    importScript("/assets/scripts/dyn_host.js");
 | 
			
		||||
    
 | 
			
		||||
    tools.set("xpath", "tools/xpath.html");
 | 
			
		||||
    tools.set("xsd", "tools/xsd.html");
 | 
			
		||||
@@ -70,12 +81,29 @@ function changeActiveTools(activeClass, activeCategoryButton) {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Function that changes active tool
 | 
			
		||||
 * 
 | 
			
		||||
 * @function
 | 
			
		||||
 * @name changeTool
 | 
			
		||||
 * @kind function
 | 
			
		||||
 * @param {any} tool
 | 
			
		||||
 * @returns {void}
 | 
			
		||||
 */
 | 
			
		||||
function changeTool(tool) {
 | 
			
		||||
    const url = tools.get(tool);
 | 
			
		||||
    localStorage.setItem("lastPage", tool);
 | 
			
		||||
    document.getElementById("iframe").src = url;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Function that loads last used tool and sets active category accordingly
 | 
			
		||||
 * 
 | 
			
		||||
 * @function
 | 
			
		||||
 * @name loadLastPage
 | 
			
		||||
 * @kind function
 | 
			
		||||
 * @returns {void}
 | 
			
		||||
 */
 | 
			
		||||
function loadLastPage() {
 | 
			
		||||
    const lastPage = localStorage.getItem("lastPage");
 | 
			
		||||
    switch (lastPage) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user