This commit is contained in:
2023-05-15 11:42:23 +02:00
parent 52c1620552
commit 8af82e3558
5 changed files with 135 additions and 46 deletions

View File

@@ -146,7 +146,13 @@ const mergeHTMLPlugin = (function () {
}());
/**
* This function is executed after the page is loaded.
*
* @function
* @name init
* @kind function
*/
function init() {
// Make sure that only plain text is pasted
configurePastingInElement("jsonBlock");

View File

@@ -1,11 +1,34 @@
/**
* This function is executed after the page is loaded.
*
* @function
* @name init
* @kind function
*/
function init() {
configurePastingInElement("xmlArea");
}
/**
* Function returns processor that will be used to transform XML.
* This solution allows to use one function for sending request from every tool
*
* @function
* @name getProcessor
* @kind function
*/
function getProcessor() {
return "libxml";
}
/**
* Function returns version of XML processor that will be used to transform XML.
* This solution allows to use one function for sending request from every tool
*
* @function
* @name getVersion
* @kind function
*/
function getVersion() {
return "1.0"
}
function init() {
configurePastingInElement("xmlArea");
}

View File

@@ -1,4 +1,13 @@
/**
* The `processVersionSelector()` function is responsible for updating the display of the web page
* based on the selected processor and version.
*
* @function
* @name processVersionSelector
* @kind function
* @returns {void}
*/
function processVersionSelector() {
var processor = getProcessor();
var hideableOptions = document.getElementsByClassName("hideable");
@@ -24,6 +33,15 @@ function processVersionSelector() {
}
/**
* The `processTooltip()` function is responsible for updating the display of the tooltip based on the selected version of the processor.
* It shows or hides different sections of the tooltip based on the selected version.
* It also handles the click event on the form and updates the tooltip accordingly.
*
* @function
* @name processTooltip
* @kind function
*/
function processTooltip() {
var filter = "collapse" + getVersion();
var collList;
@@ -58,6 +76,58 @@ function processTooltip() {
}
}
/**
* This function is executed after the page is loaded.
*
* @function
* @name init
* @kind function
*/
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 XPath expression here');
processVersionSelector();
processTooltip();
tool.addEventListener('change', event => {
//Check if script was called from textarea or selector
var targetID = event.target.getAttribute('id');
if (targetID == "processors") {
processVersionSelector();
processTooltip();
}
else if (targetID == "versions") {
processTooltip();
}
})
tool.addEventListener('click', event => {
//Check if script was called from textarea or selector
var targetID = event.target.getAttribute('id');
if (targetID !== "xmlArea" && targetID !== "transformArea") {
return;
}
processTooltip();
})
tool.addEventListener('change', event => {
//Check if script was called from textarea or selector
var targetID = event.target.getAttribute('id');
if (targetID !== "xmlArea" && targetID !== "transformArea") {
return;
}
processTooltip();
})
var triggerList = document.getElementsByClassName("collapseTrigger");
for (i = 0; i < triggerList.length; i++) {
@@ -100,48 +170,5 @@ for (i = 0; i < triggerList.length; i++) {
}
});
}
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 XPath expression here');
processVersionSelector();
processTooltip();
tool.addEventListener('change', event => {
//Check if script was called from textarea or selector
var targetID = event.target.getAttribute('id');
if (targetID == "processors") {
processVersionSelector();
processTooltip();
}
else if (targetID == "versions") {
processTooltip();
}
})
tool.addEventListener('click', event => {
//Check if script was called from textarea or selector
var targetID = event.target.getAttribute('id');
if (targetID !== "xmlArea" && targetID !== "transformArea") {
return;
}
processTooltip();
})
tool.addEventListener('change', event => {
//Check if script was called from textarea or selector
var targetID = event.target.getAttribute('id');
if (targetID !== "xmlArea" && targetID !== "transformArea") {
return;
}
processTooltip();
})
}

View File

@@ -1,3 +1,10 @@
/**
* This function is executed after the page is loaded.
*
* @function
* @name init
* @kind function
*/
function init() {
// Make sure that only plain text is pasted
configurePastingInElement("xmlArea");
@@ -21,6 +28,15 @@ function init() {
})
}
/**
* The `processTooltip()` function is responsible for updating the display of the tooltip based on the selected version of the processor.
* It shows or hides different sections of the tooltip based on the selected version.
* It also handles the click event on the form and updates the tooltip accordingly.
*
* @function
* @name processTooltip
* @kind function
*/
function processTooltip() {
if (getProcessor() == "xalan") {

View File

@@ -1,3 +1,12 @@
/**
* The `processTooltip()` function is responsible for updating the display of the tooltip based on the selected version of the processor.
* It shows or hides different sections of the tooltip based on the selected version.
* It also handles the click event on the form and updates the tooltip accordingly.
*
* @function
* @name processTooltip
* @kind function
*/
function processTooltip() {
if (getProcessor() == "xalan" || getProcessor() == "libxml") {
@@ -48,6 +57,14 @@ for (i = 0; i < triggerList.length; i++) {
});
}
/**
* This function is executed after the page is loaded.
*
* @function
* @name init
* @kind function
*/
function init() {
// Make sure that only plain text is pasted
configurePastingInElement("xmlArea");