Added docs in js files and fixed some minor visual bugs #118
@@ -1,3 +1,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Function that updates list of tools depending on chosen category
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name changeActiveTools
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} activeClass class of elements that have to be shown
 | 
				
			||||||
 | 
					 * @param {any} activeCategoryButton class of category button that has to be active
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function changeActiveTools(activeClass, activeCategoryButton) {
 | 
					function changeActiveTools(activeClass, activeCategoryButton) {
 | 
				
			||||||
    let tools = document.getElementById("toolList").children
 | 
					    let tools = document.getElementById("toolList").children
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,16 @@ var defaultStrings = [];
 | 
				
			|||||||
const color_grey = "#6b6b6b";
 | 
					const color_grey = "#6b6b6b";
 | 
				
			||||||
const color_red = "#ff8f8f";
 | 
					const color_red = "#ff8f8f";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Remove default text and set color to black
 | 
					/**
 | 
				
			||||||
 | 
					 * It clears default content of the element and sets it's color to black.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name clearDefaultContent
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} element to set
 | 
				
			||||||
 | 
					 * @param {any} text to set
 | 
				
			||||||
 | 
					 * @returns {void}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function clearDefaultContent(element, text) {
 | 
					function clearDefaultContent(element, text) {
 | 
				
			||||||
    if (element.value == text) {
 | 
					    if (element.value == text) {
 | 
				
			||||||
        element.value = "";
 | 
					        element.value = "";
 | 
				
			||||||
@@ -11,6 +20,13 @@ function clearDefaultContent(element, text) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * It clears all data fields.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name clearDataField
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function clearDataField(){
 | 
					function clearDataField(){
 | 
				
			||||||
    document.getElementById("xmlArea").value = "";
 | 
					    document.getElementById("xmlArea").value = "";
 | 
				
			||||||
    document.getElementById("xmlArea").style.color = null;
 | 
					    document.getElementById("xmlArea").style.color = null;
 | 
				
			||||||
@@ -34,8 +50,16 @@ function fillDefaultXML(element) {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Set default text in grey
 | 
					/**
 | 
				
			||||||
function setDefaultContent(element, text) {6543
 | 
					 * It sets default content for the element an changes it's color to grey
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name setDefaultContent
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} element to set
 | 
				
			||||||
 | 
					 * @param {any} text to set
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					function setDefaultContent(element, text) {
 | 
				
			||||||
    if (element.value == "") {
 | 
					    if (element.value == "") {
 | 
				
			||||||
        var id = element.getAttribute('id');
 | 
					        var id = element.getAttribute('id');
 | 
				
			||||||
        if (!defaultStrings.includes(text)) {
 | 
					        if (!defaultStrings.includes(text)) {
 | 
				
			||||||
@@ -56,6 +80,15 @@ function setDefaultContent(element, text) {6543
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * It hides list for specified version of XPath
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name hideList
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} collList class name of list to hide
 | 
				
			||||||
 | 
					 * @returns {void}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function hideList(collList) {
 | 
					function hideList(collList) {
 | 
				
			||||||
    for (i = 0; i < collList.length; i++) {
 | 
					    for (i = 0; i < collList.length; i++) {
 | 
				
			||||||
        if (collList[i].nextElementSibling !== null) {
 | 
					        if (collList[i].nextElementSibling !== null) {
 | 
				
			||||||
@@ -67,16 +100,45 @@ function hideList(collList) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * It checks if the text is a default text.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name checkDefault
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} text
 | 
				
			||||||
 | 
					 * @returns {boolean}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function checkDefault(text){
 | 
					function checkDefault(text){
 | 
				
			||||||
    return defaultStrings.includes(text);
 | 
					    return defaultStrings.includes(text);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * It show list for specified version of XPath
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name showList
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} collList class name of list to hide
 | 
				
			||||||
 | 
					 * @returns {void}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function showList(collList) {
 | 
					function showList(collList) {
 | 
				
			||||||
    for (i = 0; i < collList.length; i++) {
 | 
					    for (i = 0; i < collList.length; i++) {
 | 
				
			||||||
        collList[i].style.display = 'block';
 | 
					        collList[i].style.display = 'block';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * A function that is used to fold/unfold collapsible elements.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name smoothFoldElement
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} element
 | 
				
			||||||
 | 
					 * @param {any} toogleState
 | 
				
			||||||
 | 
					 * @param {any} toggleParrent
 | 
				
			||||||
 | 
					 * @returns {void}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function smoothFoldElement(element, toogleState, toggleParrent){
 | 
					function smoothFoldElement(element, toogleState, toggleParrent){
 | 
				
			||||||
    if (toogleState) {
 | 
					    if (toogleState) {
 | 
				
			||||||
        console.log("DUPA");
 | 
					        console.log("DUPA");
 | 
				
			||||||
@@ -98,7 +160,14 @@ function smoothFoldElement(element, toogleState, toggleParrent){
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Set tooltip info, function is called by onClick handlers
 | 
					/**
 | 
				
			||||||
 | 
					 * Set tooltip info, function is called by onClick handlers
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name refreshTooltip
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @returns {void}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function refreshTooltip() {
 | 
					function refreshTooltip() {
 | 
				
			||||||
    var resizeList = document.getElementsByClassName("collapsibleData");
 | 
					    var resizeList = document.getElementsByClassName("collapsibleData");
 | 
				
			||||||
    console.log("collDataList: " + resizeList.length)
 | 
					    console.log("collDataList: " + resizeList.length)
 | 
				
			||||||
@@ -108,6 +177,17 @@ function refreshTooltip() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * A function that performs a request to the server.
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name performRequest
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} endpoint of target service
 | 
				
			||||||
 | 
					 * @param {any} checkXML enable checking for empty XML
 | 
				
			||||||
 | 
					 * @param {any} checkTransform enable checking for empty transform data
 | 
				
			||||||
 | 
					 * @returns {false | undefined}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function performRequest(endpoint, checkXML, checkTransform){
 | 
					function performRequest(endpoint, checkXML, checkTransform){
 | 
				
			||||||
    const sourceId = "xmlArea";
 | 
					    const sourceId = "xmlArea";
 | 
				
			||||||
    const transformId = "transformArea";
 | 
					    const transformId = "transformArea";
 | 
				
			||||||
@@ -147,6 +227,18 @@ function performRequest(endpoint, checkXML, checkTransform){
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Function that prepares data to send and handles response
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name performFormatRequest
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} endpoint of target service
 | 
				
			||||||
 | 
					 * @param {any} checkXML enable checking for empty XML
 | 
				
			||||||
 | 
					 * @param {any} sourceId ID of element to get XML from
 | 
				
			||||||
 | 
					 * @param {any} targetId ID of element to write formatted XML
 | 
				
			||||||
 | 
					 * @returns {void}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
function performFormatRequest(endpoint, checkXML, sourceId, targetId){
 | 
					function performFormatRequest(endpoint, checkXML, sourceId, targetId){
 | 
				
			||||||
    const sourceElement = document.getElementById(sourceId);
 | 
					    const sourceElement = document.getElementById(sourceId);
 | 
				
			||||||
    const targetElement = document.getElementById(targetId);
 | 
					    const targetElement = document.getElementById(targetId);
 | 
				
			||||||
@@ -182,7 +274,19 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Form REST request, send and return received data
 | 
					/**
 | 
				
			||||||
 | 
					 * Form REST request, send and return received data
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @async
 | 
				
			||||||
 | 
					 * @function
 | 
				
			||||||
 | 
					 * @name restRequest
 | 
				
			||||||
 | 
					 * @kind function
 | 
				
			||||||
 | 
					 * @param {any} port of target service
 | 
				
			||||||
 | 
					 * @param {any} endpoint of target service
 | 
				
			||||||
 | 
					 * @param {any} xmlData XML that will be sent
 | 
				
			||||||
 | 
					 * @param {any} transformData data used to transform given XML
 | 
				
			||||||
 | 
					 * @returns {Promise<any>}
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
async function restRequest(port, endpoint, xmlData, transformData) {
 | 
					async function restRequest(port, endpoint, xmlData, transformData) {
 | 
				
			||||||
    const escapeChar = "specialEscapeChar";
 | 
					    const escapeChar = "specialEscapeChar";
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user