Merged bema/ref/tools_urls to master
This commit is contained in:
		| @@ -32,7 +32,7 @@ function init() { | ||||
|     changeActiveTools('XML'); | ||||
|     var toolUrl = window.location.search.substring(1); | ||||
|     if (tools.has(toolUrl)) | ||||
|         changeTool(toolUrl); | ||||
|         changeTool(toolUrl, false); | ||||
|     else | ||||
|         loadLastPage(); | ||||
|      | ||||
| @@ -73,20 +73,34 @@ function changeActiveTools(activeCategoryButton) { | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Function that changes active tool | ||||
|  * This function changes active tool. | ||||
|  * Optional updateURL can be set to false to stop changing URL.  | ||||
|  * This helps avoiding endless reload loop when loading page. | ||||
|  *  | ||||
|  * @function | ||||
|  * @name changeTool | ||||
|  * @kind function | ||||
|  * @param {any} tool | ||||
|  * @param {boolean} updateURL? | ||||
|  * @returns {void} | ||||
|  */ | ||||
|  | ||||
| function changeTool(tool) { | ||||
|     if (! tools.has(tool)) return; | ||||
|      | ||||
|     const url = tools.get(tool); | ||||
|     localStorage.setItem("lastPage", tool); | ||||
|      | ||||
|      | ||||
|                  | ||||
|  | ||||
| function changeTool(tool, updateURL = true) { | ||||
|     if (! tools.has(tool)) return; | ||||
|     const url = tools.get(tool); | ||||
|     if (updateURL) document.location.search = tool; | ||||
|      | ||||
|  | ||||
|     switch (tool) { // XML category is default. | ||||
|         case "jsonform": | ||||
|             changeActiveTools('JSON'); | ||||
| @@ -94,10 +108,11 @@ function changeTool(tool) { | ||||
|         case "mock": | ||||
|             changeActiveTools('REST'); | ||||
|             break; | ||||
|                  | ||||
|     } | ||||
|     document.location.search = tool; | ||||
|  | ||||
|     localStorage.setItem("lastPage", tool); | ||||
|     document.getElementById("iframe").src = url; | ||||
|  | ||||
| } | ||||
|  | ||||
| /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user