Refactor javascript

move repeating javascript code to scripts.js file
This commit is contained in:
2023-03-22 14:22:09 +01:00
parent cfe5eb3b88
commit 52ca53adb6
6 changed files with 231 additions and 227 deletions

View File

@@ -18,12 +18,12 @@
</div>
<div class="display-space-between">
<div style="text-align: center;">
<label for="processors">Select XSLT processor:</label>
<select name="processors" id="processors">
<option value="saxon">Saxon</option>
<option value="xalan">Xalan</option>
<option value="libxml">libXML</option>
</select>
<label for="processors">Select XSLT processor:</label>
<select name="processors" id="processors">
<option value="saxon">Saxon</option>
<option value="xalan">Xalan</option>
<option value="libxml">libXML</option>
</select>
</div>
<div>
<button class="action-button active" id="clearXMLButton" style="padding: 3px 10px;"
@@ -57,7 +57,8 @@
<label for="resultArea"><b>Transform result:<span id="procinfo"></span></b></label>
<textarea disabled id="resultArea" name="resultArea" rows="10"
class="textarea-300 bordered-field vertically-resizeable max-width" style="margin-bottom: 50px;" ></textarea>
class="textarea-300 bordered-field vertically-resizeable max-width"
style="margin-bottom: 50px;"></textarea>
</div>
</div>
@@ -1135,17 +1136,10 @@
</div>
<!-- <script>
function getVersion() {
return document.getElementById("versions").value;
}
</script> -->
<script>
function processTooltip() {
console.log("processTooltip");
if (getProcInfo() == "xalan" || getProcInfo() == "libxml") {
if (getProcessor() == "xalan" || getProcessor() == "libxml") {
document.getElementById("tooltipFunctionInfo").innerText = "XSLT 1.0 functions";
document.getElementById("processorTooltipInfo").innerText = "Supports XSLT 1.0";
hideList(document.getElementsByName("collapse30"));
@@ -1155,29 +1149,7 @@
showList(document.getElementsByName("collapse30"));
}
}
</script>
<script>
function getProcessor() {
return document.getElementById("processors").value;
}
</script>
<script>
function getVersion() {
if (getProcInfo() == "xalan") {
return "1.0";
} else {
return "3.0";
}
}
</script>
<script>
function getProcInfo() {
var processVariables = document.getElementById("processors").value;// + "&version=" + document.getElementById("versions").value;
return processVariables;
}
</script>
<script>
var triggerList = document.getElementsByClassName("collapseTrigger");
for (i = 0; i < triggerList.length; i++) {
console.log("trigger connected");
@@ -1214,9 +1186,7 @@
}
});
}
</script>
<script>
function init() {
//Handle clicks in whole form and set info in tooltip
setDefaultContent(document.getElementById("xmlArea"), 'Insert XML here');
@@ -1248,4 +1218,4 @@
</body>
</html>
</html>