From 737c49f15eb5adb5423e7fccd15c516ab5ed24a8 Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 19 Sep 2025 15:15:43 +0200 Subject: [PATCH 1/7] Misc: panelWizard.js Quality * Removed the 22 quality "blocker" issues by declaring the javascript variables properly. * Removed easy to remove high->low quality issues. 8 issues left (XWiki.widgets.Notification unused instantiations and Cognitive Complexity) --- .../js/xwiki/panelwizard/panelWizard.js | 276 ++++++++---------- 1 file changed, 128 insertions(+), 148 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js index 32ac33fb502..9741dc04348 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js @@ -18,12 +18,12 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ function computeBounds() { - leftPanelsLeft = getX(leftPanels); - leftPanelsRight = leftPanelsLeft + leftPanels.offsetWidth; - rightPanelsLeft = getX(rightPanels); - rightPanelsRight = rightPanelsLeft + rightPanels.offsetWidth; - allpanelsLeft = getX(allPanels); - allpanelsTop = getY(allPanels); + window.leftPanelsLeft = getX(leftPanels); + window.leftPanelsRight = leftPanelsLeft + leftPanels.offsetWidth; + window.rightPanelsLeft = getX(rightPanels); + window.rightPanelsRight = rightPanelsLeft + rightPanels.offsetWidth; + window.allpanelsLeft = getX(allPanels); + window.allpanelsTop = getY(allPanels); } function debugwrite(sometext) { @@ -42,12 +42,10 @@ function getX(el) { } else { return el.offsetLeft + getX(el.offsetParent) + (el.scrollWidth - el.clientWidth); } + } else if (el.x) { + return el.x; } else { - if (el.x) { - return el.x; - } else { - return 0; - } + return 0; } } @@ -58,20 +56,18 @@ function getY(el) { } else { return el.offsetTop + getY(el.offsetParent) + (el.scrollHeight - el.clientHeight); } + } else if (el.y) { + return el.y; } else { - if (el.y) { - return el.y; - } else { - return 0; - } + return 0; } } function getBlocList(el) { - var list = []; - var nb = el.childNodes.length; - for (var i = 0; i < nb; ++i) { - var el2 = el.childNodes[i]; + let list = []; + let nb = el.childNodes.length; + for (let i = 0; i < nb; ++i) { + let el2 = el.childNodes[i]; if (isPanel(el2)) { if (!el2.isDragging) { list.push(el2); @@ -82,24 +78,24 @@ function getBlocList(el) { } function getDragBoxPos(list, y) { - var nb = list.length; - if (nb == 0) { + let nb = list.length; + if (nb === 0) { return 0; } - for (var i = 0; i < nb; ++i) { - if (list[i] == dragel) + for (let i = 0; i < nb; ++i) { + if (list[i] === dragel) return i; } return -1; } function getAllPanels(el){ - var list = []; - var divs = el.getElementsByTagName("div"); - var j = 0; - for (var i = 0; i < divs.length; ++i) { - if (isPanel(divs[i])) { - list[j] = divs[i]; + let list = []; + const divs = el.getElementsByTagName("div"); + let j = 0; + for (let div of divs) { + if (isPanel(div)) { + list[j] = div; j++; } } @@ -107,10 +103,10 @@ function getAllPanels(el){ } function getClosestDropTarget(x, y, w, h) { - if (window.showLeftColumn == 1 && (x <= leftPanelsRight && (x + w) >= leftPanelsLeft)) { + if (window.showLeftColumn === 1 && (x <= leftPanelsRight && (x + w) >= leftPanelsLeft)) { return leftPanels; } - if (window.showRightColumn == 1 && ((x + w) >= rightPanelsLeft && x <= rightPanelsRight )) { + if (window.showRightColumn === 1 && ((x + w) >= rightPanelsLeft && x <= rightPanelsRight )) { return rightPanels; } return allPanels; @@ -122,29 +118,29 @@ function onDragStart(el, x, y) { } hideTip(); window.isDraggingPanel = true; - if (enabletip==true) { + if (enabletip) { hideTip(); } - realParent = el.parentNode; - parentNode = el.parentNode; - var isAdded = (realParent != leftPanels && realParent != rightPanels); - var coords = Position.cumulativeOffset(el); - var coords2 = Position.realOffset(el); - var x = coords[0]; - var y = coords[1] - coords2[1] + (document.documentElement.scrollTop - 0 + document.body.scrollTop - 0); + const realParent = el.parentNode; + window.parentNode = el.parentNode; + let isAdded = (realParent !== leftPanels && realParent !== rightPanels); + let coords = Position.cumulativeOffset(el); + let coords2 = Position.realOffset(el); + let newX = coords[0]; + let newY = coords[1] - coords2[1] + (document.documentElement.scrollTop - 0 + document.body.scrollTop - 0); if (window.ActiveXObject) { dragel.style.height = (el.offsetHeight ? (el.offsetHeight) : el.displayHeight) + "px"; } else { - dragel.style.height = (el.offsetHeight ? (el.offsetHeight-2) : el.displayHeight) + "px"; + dragel.style.height = (el.offsetHeight ? (el.offsetHeight - 2) : el.displayHeight) + "px"; } dragel.style.display = "block"; // Make the current absolute - el.style.left = x + "px"; - el.style.top = y + "px"; + el.style.left = newX + "px"; + el.style.top = newY + "px"; el.style.zIndex = "10"; if (isAdded) { - parentNode = allPanels; + window.parentNode = allPanels; el.placeholder = document.createElement("div"); el.placeholder.className="placeholder"; if (window.ActiveXObject) { @@ -162,46 +158,44 @@ function onDragStart(el, x, y) { el.style.position = "absolute"; document.body.appendChild(el); el.isDragging = true; - prevcolumn = parentNode; + window.prevcolumn = parentNode; } function onDrag(el, x, y) { - if (enabletip==true) { + if (enabletip) { hideTip(); } - parentNode = getClosestDropTarget(x,y, el.offsetWidth, el.offsetHeight); - if (parentNode != prevcolumn) { - if (prevcolumn != allPanels) { + window.parentNode = getClosestDropTarget(x,y, el.offsetWidth, el.offsetHeight); + if (parentNode !== prevcolumn) { + if (prevcolumn !== allPanels) { prevcolumn.removeChild(dragel); } - if (parentNode != allPanels) { + if (parentNode !== allPanels) { parentNode.appendChild(dragel); rmClass(allPanels, "dropTarget"); } else{ addClass(allPanels, "dropTarget"); } } - prevcolumn = parentNode; - var list = getBlocList(parentNode); - var pos = getDragBoxPos(list, y); - if (pos == -1) { + window.prevcolumn = parentNode; + let list = getBlocList(parentNode); + let pos = getDragBoxPos(list, y); + if (pos === -1) { return; } - if (list.length == 0) { - if (parentNode != allPanels) { + if (list.length === 0) { + if (parentNode !== allPanels) { parentNode.appendChild(dragel); } - } else if (pos != 0 && y <= getY(list[pos-1])) { + } else if (pos !== 0 && y <= getY(list[pos-1])) { parentNode.insertBefore(dragel, list[pos-1]); - } else if (pos != (list.length-1) && y >= getY(list[pos+1])) { + } else if (pos !== (list.length-1) && y >= getY(list[pos+1])) { if (list[pos+2]) { parentNode.insertBefore(dragel, list[pos+2]); + } else if (parentNode !== allPanels) { + parentNode.appendChild( dragel); } else { - if (parentNode != allPanels) { - parentNode.appendChild( dragel); - } else { - dragel.parentNode.removeChild(dragel); - } + dragel.parentNode.removeChild(dragel); } } } @@ -210,7 +204,7 @@ function onDragEnd(el, x, y) { el.isDragging = false; window.isDraggingPanel = false; el.style.position = "static"; - if (parentNode == allPanels) { + if (parentNode === allPanels) { el.placeholder.parentNode.replaceChild(el, el.placeholder); el.placeholder = undefined; rmClass(allPanels, "dropTarget"); @@ -221,7 +215,7 @@ function onDragEnd(el, x, y) { updatePanelLayout(); } -var updatePanelLayout = function() { +function updatePanelLayout() { if (leftPanelsInput && !leftPanelsInput.disabled) { leftPanelsInput.value = getBlocNameList(leftPanels); } @@ -233,13 +227,17 @@ var updatePanelLayout = function() { //------------------ // threadsafe asynchronous XMLHTTPRequest code function executeCommand(url, callback) { + // use a local variable to hold our request and callback until the inner function is called... + let ajaxRequest = null; + let ajaxCallback = callback; + // we use a javascript feature here called "inner functions" // using these means the local variables retain their values after the outer function // has returned. this is useful for thread safety, so // reassigning the onreadystatechange function doesn't stomp over earlier requests. function ajaxBindCallback() { - if (ajaxRequest.readyState == 4) { - if (ajaxRequest.status == 200) { + if (ajaxRequest.readyState === 4) { + if (ajaxRequest.status === 200) { if (ajaxCallback) { ajaxCallback(ajaxRequest.responseText); } else { @@ -251,9 +249,6 @@ function executeCommand(url, callback) { } } } - // use a local variable to hold our request and callback until the inner function is called... - var ajaxRequest = null; - var ajaxCallback = callback; // bind our callback then hit the server... if (window.XMLHttpRequest) { @@ -274,9 +269,9 @@ function executeCommand(url, callback) { } function start1() { - var i, pos, el; + let i, pos, el; //attaching events to all panels - var divs = document.getElementsByTagName("div"); + const divs = document.getElementsByTagName("div"); for (i = 0; i < divs.length; ++i) { el = divs[i]; if (isPanel(el)) { @@ -290,7 +285,7 @@ function start1() { // for (i = 0; i < panelsInList.length; ++i){ pos = window.allPanelsPlace[i]['left']; - if (pos != -1) { + if (pos !== -1) { el = panelsOnLeft[pos]; if (el) { el.fullname = window.allPanelsPlace[i].fullname; @@ -307,7 +302,7 @@ function start1() { } } pos = window.allPanelsPlace[i]['right']; - if (pos != -1) { + if (pos !== -1) { el = panelsOnRight[pos]; if (el) { el.fullname = window.allPanelsPlace[i].fullname; @@ -338,7 +333,7 @@ function start1() { if (!rightPanels.isVisible) { rightPanels.panels = getBlocList(rightPanels); } - layoutMaquettes = $('PageLayoutSection').select('.pagelayoutoption'); + window.layoutMaquettes = $('PageLayoutSection').select('.pagelayoutoption'); } function attachDragHandler(el) { @@ -356,21 +351,17 @@ function attachDragHandler(el) { } function isAttachedPanel(element) { - if (element.ondblclick) { - return true; - } - - return false; + return element.ondblclick; } function getBlocNameList(el) { - var list = ""; - var nb = el.childNodes.length; - for (var i = 0; i < nb; ++i) { - var el2 = el.childNodes[i]; + let list = ""; + let nb = el.childNodes.length; + for (let i = 0; i < nb; ++i) { + let el2 = el.childNodes[i]; if (isPanel(el2)) { if (!el2.isDragging) { - if (list != "") { + if (list !== "") { list += ","; } list += el2.fullname; @@ -381,16 +372,16 @@ function getBlocNameList(el) { } function save() { - var url = window.ajaxurl; + let url = window.ajaxurl; url += "&showLeftPanels=" + window.showLeftColumn; url += "&showRightPanels=" + window.showRightColumn; if (window.showLeftColumn) { - var leftPanelsList = leftPanelsInput ? leftPanelsInput.value : getBlocNameList(leftPanels); + let leftPanelsList = leftPanelsInput ? leftPanelsInput.value : getBlocNameList(leftPanels); url += "&leftPanels=" + encodeURIComponent(leftPanelsList); url += "&leftPanelsWidth=" + leftPanelsWidthInput.value; } if (window.showRightColumn) { - var rightPanelsList = rightPanelsInput ? rightPanelsInput.value : getBlocNameList(rightPanels); + let rightPanelsList = rightPanelsInput ? rightPanelsInput.value : getBlocNameList(rightPanels); url += "&rightPanels=" + encodeURIComponent(rightPanelsList); url += "&rightPanelsWidth=" + rightPanelsWidthInput.value; } @@ -398,7 +389,7 @@ function save() { } function saveResult(html) { - if (html=="SUCCESS") { + if (html === "SUCCESS") { new XWiki.widgets.Notification(window.panelsavesuccess, 'done'); // this is for the "revert" button: leftPanels.savedPanelList = getBlocList(leftPanels); @@ -414,8 +405,8 @@ function saveResult(html) { function releasePanels(column) { column.panels = getBlocList(column); - for (var i = 0; i < column.panels.length; ++i) { - releasePanel(column.panels[i]); + for (let panel of column.panels) { + releasePanel(panel); } } @@ -426,17 +417,17 @@ function releasePanel(el) { } function restorePanels(column) { - for (var i = 0; i < column.panels.length; ++i) { - if (!column.panels[i].placeholder) { - restorePanel(column.panels[i], column); + for (let panel of column.panels) { + if (!panel.placeholder) { + restorePanel(panel, column); } } column.panels = undefined; } function revertPanels(column) { - for (var i = 0; i < column.savedPanelList.length; ++i) { - restorePanel(column.savedPanelList[i], column); + for (let panel of column.savedPanelList) { + restorePanel(panel, column); } } @@ -463,81 +454,78 @@ function changePreviewLayout(element, code) { switch (code) { case 0: //hide left; hide right; - if (window.showLeftColumn == 1) { + if (window.showLeftColumn === 1) { window.showLeftColumn = 0; leftPanels.style.display = "none"; releasePanels(leftPanels); } - if (window.showRightColumn == 1) { + if (window.showRightColumn === 1) { window.showRightColumn = 0; rightPanels.style.display = "none"; releasePanels(rightPanels); } - // mainContainer.className = "contenthidelefthideright"; mainContainer.addClassName("hidelefthideright"); document.body.style.removeProperty('--panel-column-left-width'); document.body.style.removeProperty('--panel-column-right-width'); - leftPanelsInput && leftPanelsInput.disable(); + leftPanelsInput?.disable(); leftPanelsWidthInput.disable(); - rightPanelsInput && rightPanelsInput.disable(); + rightPanelsInput?.disable(); rightPanelsWidthInput.disable(); break; case 1: //show left; hide right; - if (window.showLeftColumn == 0) { + if (window.showLeftColumn === 0) { window.showLeftColumn = 1; leftPanels.style.display = "block"; restorePanels(leftPanels); } - if (window.showRightColumn == 1) { + if (window.showRightColumn === 1) { window.showRightColumn = 0; rightPanels.style.display = "none"; releasePanels(rightPanels); } - // mainContainer.className = "contenthideright"; mainContainer.addClassName("hideright"); document.body.style.removeProperty('--panel-column-right-width'); - leftPanelsInput && leftPanelsInput.enable(); + leftPanelsInput?.enable(); leftPanelsWidthInput.enable(); - rightPanelsInput && rightPanelsInput.disable(); + rightPanelsInput?.disable(); rightPanelsWidthInput.disable(); break; case 2: //hide left; show right; - if (window.showLeftColumn == 1) { + if (window.showLeftColumn === 1) { window.showLeftColumn = 0; leftPanels.style.display = "none"; releasePanels(leftPanels); } - if (window.showRightColumn == 0) { + if (window.showRightColumn === 0) { window.showRightColumn = 1; rightPanels.style.display = "block"; restorePanels(rightPanels); } - // mainContainer.className = "contenthideleft"; mainContainer.addClassName("hideleft"); document.body.style.removeProperty('--panel-column-left-width'); - leftPanelsInput && leftPanelsInput.disable(); + leftPanelsInput?.disable(); leftPanelsWidthInput.disable(); - rightPanelsInput && rightPanelsInput.enable(); + rightPanelsInput?.enable(); rightPanelsWidthInput.enable(); break; case 3: //show left; show right; - if (window.showLeftColumn == 0) { + if (window.showLeftColumn === 0) { window.showLeftColumn = 1; leftPanels.style.display = "block"; restorePanels(leftPanels); } - if (window.showRightColumn == 0) { + if (window.showRightColumn === 0) { window.showRightColumn = 1; rightPanels.style.display = "block"; restorePanels(rightPanels); } mainContainer.addClassName("content"); - leftPanelsInput && leftPanelsInput.enable(); + leftPanelsInput?.enable(); leftPanelsWidthInput.enable(); - rightPanelsInput && rightPanelsInput.enable(); + rightPanelsInput?.enable(); rightPanelsWidthInput.enable(); break; default: @@ -552,7 +540,7 @@ function revert() { releasePanels(rightPanels); revertPanels(leftPanels); revertPanels(rightPanels); - var layoutCode = 0; + let layoutCode = 0; if (leftPanels.isVisible) { layoutCode += 1; } @@ -567,16 +555,15 @@ function revert() { //---------------------------------------------------------------- function setPanelWidth() { - var availableClasses = ['Small', 'Medium', 'Large']; - for (var i=0; i= 0) { leftPanelsWidth = leftPanelsWidthInput.value; } @@ -590,39 +577,32 @@ function setPanelWidth() { } //---------------------------------------------------------------- - +// We define all of these clearly globally +const allPanels = $("allviewpanels"); +const mainContainer = $("body"); +const leftPanelsInput = $("XWiki.XWikiPreferences_0_leftPanels"); +const leftPanelsWidthInput = $("XWiki.XWikiPreferences_0_leftPanelsWidth"); +const rightPanelsInput = $("XWiki.XWikiPreferences_0_rightPanels"); +const rightPanelsWidthInput = $("XWiki.XWikiPreferences_0_rightPanelsWidth"); +const selectedLayout = $('selectedoption'); function panelEditorInit() { - tipobj = $("dhtmltooltip"); - - parentNode = null; - realParent = null; - dragel = new Element("div", {'id' : 'dragbox', 'class' : 'panel'}); - dragWidth = 0; - nb = 0; - - layoutMaquetes = null; window.leftPanels = $("leftPanels"); window.rightPanels = $("rightPanels"); - allPanels = $("allviewpanels"); - mainContent = $("contentcolumn"); - // mainContainer = document.getElementById("contentcontainer"); - mainContainer = $("body"); - leftPanelsLeft = getX(leftPanels); - leftPanelsRight = leftPanelsLeft + leftPanels.offsetWidth; - rightPanelsLeft = getX(rightPanels); - rightPanelsRight = rightPanelsLeft + rightPanels.offsetWidth; - allpanelsLeft = getX(allPanels); - allpanelsTop = getY(allPanels); - leftPanelsInput = $("XWiki.XWikiPreferences_0_leftPanels"); - leftPanelsWidthInput = $("XWiki.XWikiPreferences_0_leftPanelsWidth"); - rightPanelsInput = $("XWiki.XWikiPreferences_0_rightPanels"); - rightPanelsWidthInput = $("XWiki.XWikiPreferences_0_rightPanelsWidth"); + window.leftPanelsLeft = getX(leftPanels); + window.leftPanelsRight = leftPanelsLeft + leftPanels.offsetWidth; + window.rightPanelsLeft = getX(rightPanels); + window.rightPanelsRight = rightPanelsLeft + rightPanels.offsetWidth; + window.allpanelsLeft = getX(allPanels); + window.allpanelsTop = getY(allPanels); + window.prevcolumn = allPanels; + window.layoutMaquettes = null; + window.tipobj = $("dhtmltooltip"); + window.dragel = new Element("div", {'id' : 'dragbox', 'class' : 'panel'}); + window.parentNode = null; leftPanelsWidthInput.observe('change', setPanelWidth); rightPanelsWidthInput.observe('change', setPanelWidth); - prevcolumn = allPanels; - // Those properties do not interact well with live changes of the layout (hiding columns). // If we want to make them work even here, we'd need to reset the values and set them back with // a function similar to `applyLocalStorageValues` from flamingo.js every time the hiding classes are updated... @@ -632,7 +612,7 @@ function panelEditorInit() { start1(); // Update the enabled/disable state of the left/right panel inputs. - var selectedLayout = $('selectedoption'); + changePreviewLayout(selectedLayout, selectedLayout.previousSiblings().length); } From 565b2692bd0dc72f1a472a3086fbefd939e0bb96 Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 10 Oct 2025 17:08:16 +0200 Subject: [PATCH 2/7] Misc: panelWizard.js Quality * Updated `let` assignments to be `const` Co-authored-by: Marius Dumitru Florea --- .../main/webapp/resources/js/xwiki/panelwizard/panelWizard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js index 9741dc04348..44771b5e861 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js @@ -64,8 +64,8 @@ function getY(el) { } function getBlocList(el) { - let list = []; - let nb = el.childNodes.length; + const list = []; + const nb = el.childNodes.length; for (let i = 0; i < nb; ++i) { let el2 = el.childNodes[i]; if (isPanel(el2)) { From 18eb036bfb6e055aad8fa3953735b23c4acc39e5 Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 10 Oct 2025 17:08:43 +0200 Subject: [PATCH 3/7] Misc: panelWizard.js Quality * Updated `let` assignments to be `const` Co-authored-by: Marius Dumitru Florea --- .../main/webapp/resources/js/xwiki/panelwizard/panelWizard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js index 44771b5e861..d1260ee7a64 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js @@ -67,7 +67,7 @@ function getBlocList(el) { const list = []; const nb = el.childNodes.length; for (let i = 0; i < nb; ++i) { - let el2 = el.childNodes[i]; + const el2 = el.childNodes[i]; if (isPanel(el2)) { if (!el2.isDragging) { list.push(el2); From 8220919a9b0834f57f37b26e92cd67ce0b5b09fe Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 10 Oct 2025 17:08:58 +0200 Subject: [PATCH 4/7] Misc: panelWizard.js Quality * Updated `let` assignments to be `const` Co-authored-by: Marius Dumitru Florea --- .../main/webapp/resources/js/xwiki/panelwizard/panelWizard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js index d1260ee7a64..8d7f27a6f6a 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js @@ -78,7 +78,7 @@ function getBlocList(el) { } function getDragBoxPos(list, y) { - let nb = list.length; + const nb = list.length; if (nb === 0) { return 0; } From 6c953fee80970a7552d0fa4376319988329c00f9 Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 10 Oct 2025 17:09:41 +0200 Subject: [PATCH 5/7] Misc: panelWizard.js Quality * Updated `let` assignments to be `const` Co-authored-by: Marius Dumitru Florea --- .../main/webapp/resources/js/xwiki/panelwizard/panelWizard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js index 8d7f27a6f6a..db1c803308c 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js @@ -90,7 +90,7 @@ function getDragBoxPos(list, y) { } function getAllPanels(el){ - let list = []; + const list = []; const divs = el.getElementsByTagName("div"); let j = 0; for (let div of divs) { From 745bbf0e2287a30fc1f7be7a50e0a46020c65c2a Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 10 Oct 2025 17:11:18 +0200 Subject: [PATCH 6/7] Misc: panelWizard.js Quality * Updated syntax Co-authored-by: Marius Dumitru Florea --- .../main/webapp/resources/js/xwiki/panelwizard/panelWizard.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js index db1c803308c..2c6a92b78f6 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js @@ -95,8 +95,7 @@ function getAllPanels(el){ let j = 0; for (let div of divs) { if (isPanel(div)) { - list[j] = div; - j++; + list.push(div); } } return list; From ffd2aba7f24d0e9a237e79a8cf545ea80d981a24 Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 10 Oct 2025 17:14:44 +0200 Subject: [PATCH 7/7] Misc: panelWizard.js Quality * Removed unused variable assignment --- .../main/webapp/resources/js/xwiki/panelwizard/panelWizard.js | 1 - 1 file changed, 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js index 2c6a92b78f6..9e294437812 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/panelwizard/panelWizard.js @@ -92,7 +92,6 @@ function getDragBoxPos(list, y) { function getAllPanels(el){ const list = []; const divs = el.getElementsByTagName("div"); - let j = 0; for (let div of divs) { if (isPanel(div)) { list.push(div);