Moved scripts from .html files to seperate js .files #191
							
								
								
									
										35
									
								
								Frontend/assets/scripts/tools/xsd.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Frontend/assets/scripts/tools/xsd.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
function init() {
 | 
			
		||||
    // Make sure that only plain text is pasted
 | 
			
		||||
    configurePastingInElement("xmlArea");
 | 
			
		||||
    configurePastingInElement("transformArea");
 | 
			
		||||
 | 
			
		||||
    //Handle clicks in whole form and set info in tooltip
 | 
			
		||||
    setDefaultContent(document.getElementById("xmlArea"), 'Insert XML here');
 | 
			
		||||
    setDefaultContent(document.getElementById("transformArea"), 'Insert XSD here');
 | 
			
		||||
    
 | 
			
		||||
    // refreshTooltip();
 | 
			
		||||
    processTooltip();
 | 
			
		||||
    tool.addEventListener('click', event => {
 | 
			
		||||
        //Check if script was called from textarea or selector
 | 
			
		||||
        var targetID = event.target.getAttribute('id');
 | 
			
		||||
        if (targetID !== "processors" && targetID !== "xmlArea" && targetID !== "transformArea" && targetID !== "versions") {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        processTooltip();
 | 
			
		||||
        
 | 
			
		||||
    })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function processTooltip() {
 | 
			
		||||
 | 
			
		||||
    if (getProcessor() == "xalan") {
 | 
			
		||||
        document.getElementById("tooltipFunctionInfo").innerText = "XSLT 1.0 functions";
 | 
			
		||||
        document.getElementById("processorTooltipInfo").innerText = "Supports XSLT 1.0";
 | 
			
		||||
        hideList(document.getElementsByName("collapse30"));
 | 
			
		||||
    } else {
 | 
			
		||||
        document.getElementById("tooltipFunctionInfo").innerText = "XSLT 1.0, 2.0 & 3.0 functions";
 | 
			
		||||
        document.getElementById("processorTooltipInfo").innerText = "Supports XSLT up to 3.0";
 | 
			
		||||
        showList(document.getElementsByName("collapse30"));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -6,6 +6,7 @@
 | 
			
		||||
    <link rel="stylesheet" href="../assets/css/tools/r11form.css">
 | 
			
		||||
    <link rel="stylesheet" href="../assets/css/highlight.css">
 | 
			
		||||
    <script src="../assets/scripts/common/hljs.min.js"></script>
 | 
			
		||||
    <script src="../assets/scripts/tools/xsd.js"></script>
 | 
			
		||||
    <script src="../assets/scripts/tools/scripts.js"></script>
 | 
			
		||||
    <script src="../assets/scripts/tools/highlight.js"></script>
 | 
			
		||||
    <script>hljs.highlightAll();</script>
 | 
			
		||||
@@ -79,45 +80,6 @@
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <script>
 | 
			
		||||
        function init() {
 | 
			
		||||
            // Make sure that only plain text is pasted
 | 
			
		||||
            configurePastingInElement("xmlArea");
 | 
			
		||||
            configurePastingInElement("transformArea");
 | 
			
		||||
 | 
			
		||||
            //Handle clicks in whole form and set info in tooltip
 | 
			
		||||
            setDefaultContent(document.getElementById("xmlArea"), 'Insert XML here');
 | 
			
		||||
            setDefaultContent(document.getElementById("transformArea"), 'Insert XSD here');
 | 
			
		||||
            
 | 
			
		||||
            // refreshTooltip();
 | 
			
		||||
            processTooltip();
 | 
			
		||||
            tool.addEventListener('click', event => {
 | 
			
		||||
                //Check if script was called from textarea or selector
 | 
			
		||||
                var targetID = event.target.getAttribute('id');
 | 
			
		||||
                if (targetID !== "processors" && targetID !== "xmlArea" && targetID !== "transformArea" && targetID !== "versions") {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                processTooltip();
 | 
			
		||||
                
 | 
			
		||||
            })
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function processTooltip() {
 | 
			
		||||
 | 
			
		||||
            if (getProcessor() == "xalan") {
 | 
			
		||||
                document.getElementById("tooltipFunctionInfo").innerText = "XSLT 1.0 functions";
 | 
			
		||||
                document.getElementById("processorTooltipInfo").innerText = "Supports XSLT 1.0";
 | 
			
		||||
                hideList(document.getElementsByName("collapse30"));
 | 
			
		||||
            } else {
 | 
			
		||||
                document.getElementById("tooltipFunctionInfo").innerText = "XSLT 1.0, 2.0 & 3.0 functions";
 | 
			
		||||
                document.getElementById("processorTooltipInfo").innerText = "Supports XSLT up to 3.0";
 | 
			
		||||
                showList(document.getElementsByName("collapse30"));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    </script>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user