diff --git a/core/src/main/resources/hudson/PluginManager/_table.js b/core/src/main/resources/hudson/PluginManager/_table.js index 8f32bb57273f..b681448b9594 100644 --- a/core/src/main/resources/hudson/PluginManager/_table.js +++ b/core/src/main/resources/hudson/PluginManager/_table.js @@ -403,8 +403,8 @@ Behaviour.specify("#filter-box", '_table', 0, function(e) { } } - for (var i = 0; i < pluginTRs.length; i++) { - initPluginRowHandling(pluginTRs[i]); + for (let j = 0; j < pluginTRs.length; j++) { + initPluginRowHandling(pluginTRs[j]); } setEnableWidgetStates(); diff --git a/core/src/main/resources/hudson/model/BuildTimelineWidget/build-timeline-widget.js b/core/src/main/resources/hudson/model/BuildTimelineWidget/build-timeline-widget.js index 30d465f43f6b..cfc59add831f 100644 --- a/core/src/main/resources/hudson/model/BuildTimelineWidget/build-timeline-widget.js +++ b/core/src/main/resources/hudson/model/BuildTimelineWidget/build-timeline-widget.js @@ -1,3 +1,5 @@ +/* global Timeline */ + var targetDiv = document.querySelector('#build-timeline-div'); var tz = targetDiv.getAttribute('data-hour-local-timezone'); var tl = null; @@ -96,7 +98,7 @@ function doLoad() { window.onresize = doResize; } -}; +} if (window.addEventListener) { window.addEventListener("load", doLoad, false); @@ -108,13 +110,10 @@ if (window.addEventListener) { //add resize handle (function () { - var Dom = YAHOO.util.Dom, - Event = YAHOO.util.Event; - var resize = new YAHOO.util.Resize('resizeContainer', { handles: 'b', minHeight: 300 // this should be the same as the height of the container div, - // to fix a issue when it's resized to be smaller than the original height + // to fix an issue when it's resized to be smaller than the original height }); //update timeline after resizing diff --git a/core/src/main/resources/hudson/model/Job/buildTimeTrend_resources.js b/core/src/main/resources/hudson/model/Job/buildTimeTrend_resources.js index a5feb6e9bc45..d6aec6d548c4 100644 --- a/core/src/main/resources/hudson/model/Job/buildTimeTrend_resources.js +++ b/core/src/main/resources/hudson/model/Job/buildTimeTrend_resources.js @@ -1,11 +1,11 @@ /** * Public method to be called by progressiveRendering's callback */ -function buildTimeTrend_displayBuilds(data) { +window.buildTimeTrend_displayBuilds = function(data) { var p = document.getElementById('trend'); var isDistributedBuildsEnabled = 'true' === p.getAttribute("data-is-distributed-build-enabled"); var rootURL = document.head.getAttribute('data-rooturl'); - + for (var x = 0; data.length > x; x++) { var e = data[x]; var tr = new Element('tr'); @@ -91,4 +91,4 @@ function generateSVGIcon(iconName, iconSizeClass) { insert(svg2); return span; -} \ No newline at end of file +} diff --git a/core/src/main/resources/hudson/model/UpdateCenter/update-center.js b/core/src/main/resources/hudson/model/UpdateCenter/update-center.js index acb0e8ee559a..97030b3b6993 100644 --- a/core/src/main/resources/hudson/model/UpdateCenter/update-center.js +++ b/core/src/main/resources/hudson/model/UpdateCenter/update-center.js @@ -1,4 +1,4 @@ -function submitScheduleForm(el) { +window.submitScheduleForm = function(el) { var form = document.getElementById("scheduleRestart"); form.action = el.checked ? "safeRestart" : "cancelRestart"; crumb.appendToForm(form); @@ -35,4 +35,4 @@ function refresh() { }, 5000); } window.scrollTo(0,10000); -refresh(); \ No newline at end of file +refresh(); diff --git a/core/src/main/resources/hudson/model/View/AsynchPeople/people-resources.js b/core/src/main/resources/hudson/model/View/AsynchPeople/people-resources.js index 742edca86429..1c90863337df 100644 --- a/core/src/main/resources/hudson/model/View/AsynchPeople/people-resources.js +++ b/core/src/main/resources/hudson/model/View/AsynchPeople/people-resources.js @@ -1,4 +1,4 @@ -function display(data) { +window.display = function(data) { var p = document.getElementById('people'); p.show(); var rootURL = document.head.getAttribute('data-rooturl'); diff --git a/core/src/main/resources/hudson/views/BuildButtonColumn/icon.js b/core/src/main/resources/hudson/views/BuildButtonColumn/icon.js index 58d836b6f2af..8e60d6e5330e 100644 --- a/core/src/main/resources/hudson/views/BuildButtonColumn/icon.js +++ b/core/src/main/resources/hudson/views/BuildButtonColumn/icon.js @@ -4,7 +4,7 @@ Behaviour.specify(".build-button-column-icon-reference-holder", 'build-button-co var id = e.getAttribute('data-id'); var icon = document.getElementById(id); - icon.onclick = function(el) { + icon.onclick = function() { new Ajax.Request(url); hoverNotification(message, this, -100); return false; diff --git a/core/src/main/resources/jenkins/diagnostics/URICheckEncodingMonitor/adjunct.js b/core/src/main/resources/jenkins/diagnostics/URICheckEncodingMonitor/adjunct.js index 2d06c512ee86..173e587ec592 100644 --- a/core/src/main/resources/jenkins/diagnostics/URICheckEncodingMonitor/adjunct.js +++ b/core/src/main/resources/jenkins/diagnostics/URICheckEncodingMonitor/adjunct.js @@ -1,7 +1,7 @@ Behaviour.specify('#URICheckEncodingMonitor-message', 'URICheckEncodingMonitor', 0, function(element) { var url = element.getAttribute('data-url'); var params = {value : '\u57f7\u4e8b'}; - var checkAjax = new Ajax.Updater( + new Ajax.Updater( 'URICheckEncodingMonitor-message', url, { method: 'get', parameters: params diff --git a/core/src/main/resources/jenkins/formelementpath/form-element-path.js b/core/src/main/resources/jenkins/formelementpath/form-element-path.js index 6c512faeea86..42f793039f9e 100644 --- a/core/src/main/resources/jenkins/formelementpath/form-element-path.js +++ b/core/src/main/resources/jenkins/formelementpath/form-element-path.js @@ -16,8 +16,10 @@ document.addEventListener("DOMContentLoaded", function(){ function addProperty(parent, name, value) { name = shortenName(name); if (parent[name] != null) { - if (parent[name].push == null) // is this array? - parent[name] = [parent[name]]; + // is this array? + if (parent[name].push == null) { + parent[name] = [parent[name]]; + } parent[name].push(value); } else { parent[name] = value; @@ -28,7 +30,9 @@ document.addEventListener("DOMContentLoaded", function(){ // then return the corresponding object in the map function findParent(e) { var p = findFormParent(e, form); - if (p == null) return {}; + if (p == null) { + return {}; + } var m = p.formDom; if (m == null) { @@ -40,16 +44,14 @@ document.addEventListener("DOMContentLoaded", function(){ return m; } - var jsonElement = null; - - for (var i = 0; i < form.elements.length; i++) { + for (let i = 0; i < form.elements.length; i++) { var e = form.elements[i]; if (e.name == "json") { - jsonElement = e; continue; } - if (e.tagName == "FIELDSET") + if (e.tagName == "FIELDSET") { continue; + } if (e.tagName == "SELECT" && e.multiple) { addProperty(findParent(e), e.name, e); continue; @@ -57,7 +59,9 @@ document.addEventListener("DOMContentLoaded", function(){ var p; var type = e.getAttribute("type"); - if (type == null) type = ""; + if (type == null) { + type = ""; + } switch (type.toLowerCase()) { case "button": var element @@ -124,37 +128,43 @@ document.addEventListener("DOMContentLoaded", function(){ function annotate(e, path) { e.setAttribute("path", path); var o = e.formDom || {}; - for (var key in o) { - var v = o[key]; - function child(v, i) { - var suffix = null; - var newKey = key; - if (v.parentNode.className && v.parentNode.className.indexOf("one-each") > -1 && v.parentNode.className.indexOf("honor-order") > -1) { - suffix = v.getAttribute("descriptorId").split(".").pop() - } else if (v.getAttribute("type") == "radio") { - suffix = v.value - while (newKey.substring(0, 8) == 'removeme') - newKey = newKey.substring(newKey.indexOf('_', 8) + 1); - } else if (v.getAttribute("suffix") != null) { - suffix = v.getAttribute("suffix") - } else { - if (i > 0) - suffix = i; - } - if (suffix == null) suffix = ""; - else suffix = '[' + suffix + ']'; + function child(v, i, key) { + var suffix = null; + var newKey = key; + if (v.parentNode.className && v.parentNode.className.indexOf("one-each") > -1 && v.parentNode.className.indexOf("honor-order") > -1) { + suffix = v.getAttribute("descriptorId").split(".").pop() + } else if (v.getAttribute("type") == "radio") { + suffix = v.value + while (newKey.substring(0, 8) == "removeme") { + newKey = newKey.substring(newKey.indexOf("_", 8) + 1); + } + } else if (v.getAttribute("suffix") != null) { + suffix = v.getAttribute("suffix") + } else { + if (i > 0) { + suffix = i; + } + } + if (suffix == null) { + suffix = ""; + } else { + suffix = "[" + suffix + "]"; + } - annotate(v, path + "/" + newKey + suffix); - } + annotate(v, path + "/" + newKey + suffix); + } + + for (let key in o) { + var v = o[key]; if (v instanceof Array) { var i = 0; v.forEach(function (v) { - child(v, i++) + child(v, i++, key) }) } else { - child(v, 0) + child(v, 0, key) } } @@ -163,8 +173,9 @@ document.addEventListener("DOMContentLoaded", function(){ annotate(form, ""); // clean up - for (i = 0; i < doms.length; i++) - doms[i].formDom = null; + for (let i = 0; i < doms.length; i++) { + doms[i].formDom = null; + } return true; } diff --git a/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.js b/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.js index 352bb40fad73..3a7b3d338823 100644 --- a/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.js +++ b/core/src/main/resources/jenkins/management/AdministrativeMonitorsDecorator/resources.js @@ -2,7 +2,9 @@ function initializeAmMonitor(amMonitorRoot, options) { var button = amMonitorRoot.querySelector('.am-button'); var amList = amMonitorRoot.querySelector('.am-list'); - if (button === null || amList === null) return null; + if (button === null || amList === null) { + return null; + } var url = button.getAttribute('data-href'); @@ -25,7 +27,9 @@ } function show() { - if (options.closeAll) options.closeAll(); + if (options.closeAll) { + options.closeAll(); + } new Ajax.Request(url, { method: "GET", diff --git a/core/src/main/resources/jenkins/security/ApiTokenProperty/resources.js b/core/src/main/resources/jenkins/security/ApiTokenProperty/resources.js index 8f5664040741..4346d4740b2f 100644 --- a/core/src/main/resources/jenkins/security/ApiTokenProperty/resources.js +++ b/core/src/main/resources/jenkins/security/ApiTokenProperty/resources.js @@ -21,12 +21,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -function revokeToken(anchorRevoke){ +window.revokeToken = function(anchorRevoke){ var repeatedChunk = anchorRevoke.up('.repeated-chunk'); var tokenList = repeatedChunk.up('.token-list'); var confirmMessage = anchorRevoke.getAttribute('data-confirm'); var targetUrl = anchorRevoke.getAttribute('data-target-url'); - + var inputUuid = repeatedChunk.querySelector('input.token-uuid-input'); var tokenUuid = inputUuid.value; @@ -34,17 +34,17 @@ function revokeToken(anchorRevoke){ new Ajax.Request(targetUrl, { method: "post", parameters: {tokenUuid: tokenUuid}, - onSuccess: function(rsp,_) { + onSuccess: function() { if(repeatedChunk.querySelectorAll('.legacy-token').length > 0){ // we are revoking the legacy token var messageIfLegacyRevoked = anchorRevoke.getAttribute('data-message-if-legacy-revoked'); - + var legacyInput = document.getElementById('apiToken'); legacyInput.value = messageIfLegacyRevoked; } repeatedChunk.remove(); adjustTokenEmptyListMessage(tokenList); - + } }); } @@ -52,7 +52,7 @@ function revokeToken(anchorRevoke){ return false; } -function saveApiToken(button){ +window.saveApiToken = function(button){ if(button.hasClassName('request-pending')){ // avoid multiple requests to be sent if user is clicking multiple times return; @@ -63,11 +63,11 @@ function saveApiToken(button){ var tokenList = repeatedChunk.up('.token-list'); var nameInput = repeatedChunk.querySelector('[name="tokenName"]'); var tokenName = nameInput.value; - + new Ajax.Request(targetUrl, { method: "post", parameters: {"newTokenName": tokenName}, - onSuccess: function(rsp,_) { + onSuccess: function(rsp) { var json = rsp.responseJSON; var errorSpan = repeatedChunk.querySelector('.error'); if(json.status === 'error'){ @@ -77,11 +77,11 @@ function saveApiToken(button){ button.removeClassName('request-pending'); }else{ errorSpan.removeClassName('visible'); - + var tokenName = json.data.tokenName; // in case the name was empty, the application will propose a default one nameInput.value = tokenName; - + var tokenValue = json.data.tokenValue; var tokenValueSpan = repeatedChunk.querySelector('.new-token-value'); tokenValueSpan.innerText = tokenValue; @@ -101,15 +101,15 @@ function saveApiToken(button){ // we do not want to allow user to create twice a token using same name by mistake button.remove(); - + var revokeButton = repeatedChunk.querySelector('.token-revoke'); revokeButton.removeClassName('hidden-button'); - + var cancelButton = repeatedChunk.querySelector('.token-cancel'); cancelButton.addClassName('hidden-button') - + repeatedChunk.addClassName('token-list-fresh-item'); - + adjustTokenEmptyListMessage(tokenList); } } diff --git a/core/src/main/resources/jenkins/security/apitoken/LegacyApiTokenAdministrativeMonitor/resources.js b/core/src/main/resources/jenkins/security/apitoken/LegacyApiTokenAdministrativeMonitor/resources.js index 31cedefeba1f..a6aae92e7736 100644 --- a/core/src/main/resources/jenkins/security/apitoken/LegacyApiTokenAdministrativeMonitor/resources.js +++ b/core/src/main/resources/jenkins/security/apitoken/LegacyApiTokenAdministrativeMonitor/resources.js @@ -21,67 +21,67 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -function selectAll(anchor){ +window.selectAll = function(anchor){ var parent = anchor.up('.legacy-token-usage'); var allCheckBoxes = parent.querySelectorAll('.token-to-revoke'); var concernedCheckBoxes = allCheckBoxes; - + checkTheDesiredOne(allCheckBoxes, concernedCheckBoxes); } -function selectFresh(anchor){ +window.selectFresh = function(anchor){ var parent = anchor.up('.legacy-token-usage'); var allCheckBoxes = parent.querySelectorAll('.token-to-revoke'); var concernedCheckBoxes = parent.querySelectorAll('.token-to-revoke.fresh-token'); - + checkTheDesiredOne(allCheckBoxes, concernedCheckBoxes); } -function selectRecent(anchor){ +window.selectRecent = function(anchor){ var parent = anchor.up('.legacy-token-usage'); var allCheckBoxes = parent.querySelectorAll('.token-to-revoke'); var concernedCheckBoxes = parent.querySelectorAll('.token-to-revoke.recent-token'); - + checkTheDesiredOne(allCheckBoxes, concernedCheckBoxes); } function checkTheDesiredOne(allCheckBoxes, concernedCheckBoxes){ var mustCheck = false; - for(var i = 0; i < concernedCheckBoxes.length && !mustCheck ; i++){ - var checkBox = concernedCheckBoxes[i]; + for(let i = 0; i < concernedCheckBoxes.length && !mustCheck ; i++){ + let checkBox = concernedCheckBoxes[i]; if(!checkBox.checked){ mustCheck = true; } } - - for(var i = 0; i < allCheckBoxes.length ; i++){ - var checkBox = allCheckBoxes[i]; + + for(let i = 0; i < allCheckBoxes.length ; i++){ + let checkBox = allCheckBoxes[i]; checkBox.checked = false; } - - for(var i = 0; i < concernedCheckBoxes.length ; i++){ - var checkBox = concernedCheckBoxes[i]; + + for(let i = 0; i < concernedCheckBoxes.length ; i++){ + let checkBox = concernedCheckBoxes[i]; checkBox.checked = mustCheck; } - - for(var i = 0; i < allCheckBoxes.length ; i++){ - var checkBox = allCheckBoxes[i]; + + for(let i = 0; i < allCheckBoxes.length ; i++){ + let checkBox = allCheckBoxes[i]; onCheckChanged(checkBox); } } -function confirmAndRevokeAllSelected(button){ +window.confirmAndRevokeAllSelected = function(button){ var parent = button.up('.legacy-token-usage'); var allCheckBoxes = parent.querySelectorAll('.token-to-revoke'); var allCheckedCheckBoxes = []; - for(var i = 0; i < allCheckBoxes.length ; i++){ - var checkBox = allCheckBoxes[i]; + for(let i = 0; i < allCheckBoxes.length ; i++){ + let checkBox = allCheckBoxes[i]; if(checkBox.checked){ allCheckedCheckBoxes.push(checkBox); } } - - if(allCheckedCheckBoxes.length == 0){ + + if(allCheckedCheckBoxes.length === 0){ var nothingSelected = button.getAttribute('data-nothing-selected'); alert(nothingSelected); }else{ @@ -90,20 +90,20 @@ function confirmAndRevokeAllSelected(button){ if(confirm(confirmMessage)){ var url = button.getAttribute('data-url'); var selectedValues = []; - + for(var i = 0; i < allCheckedCheckBoxes.length ; i++){ var checkBox = allCheckedCheckBoxes[i]; var userId = checkBox.getAttribute('data-user-id'); var uuid = checkBox.getAttribute('data-uuid'); selectedValues.push({userId: userId, uuid: uuid}); } - + var params = {values: selectedValues} new Ajax.Request(url, { postBody: Object.toJSON(params), contentType:"application/json", encoding:"UTF-8", - onComplete: function(rsp) { + onComplete: function() { window.location.reload(); } }); @@ -134,16 +134,16 @@ function onCheckChanged(checkBox){ (function(){ document.addEventListener("DOMContentLoaded", function() { var allLines = document.querySelectorAll('.legacy-token-usage table tr'); - for(var i = 0; i < allLines.length; i++){ - var line = allLines[i]; + for(let i = 0; i < allLines.length; i++){ + let line = allLines[i]; if(!line.hasClassName('no-token-line')){ line.onclick = onLineClicked; } } - + var allCheckBoxes = document.querySelectorAll('.token-to-revoke'); - for(var i = 0; i < allCheckBoxes.length; i++){ - var checkBox = allCheckBoxes[i]; + for(let i = 0; i < allCheckBoxes.length; i++){ + let checkBox = allCheckBoxes[i]; checkBox.onchange = function(){ onCheckChanged(this); }; } }); diff --git a/core/src/main/resources/jenkins/security/seed/UserSeedProperty/resources.js b/core/src/main/resources/jenkins/security/seed/UserSeedProperty/resources.js index 1a6b59acd320..c580dc1af8ff 100644 --- a/core/src/main/resources/jenkins/security/seed/UserSeedProperty/resources.js +++ b/core/src/main/resources/jenkins/security/seed/UserSeedProperty/resources.js @@ -21,21 +21,21 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -function resetSeed(button){ +window.resetSeed = function(button) { var userSeedPanel = button.up('.user-seed-panel'); var confirmMessage = button.getAttribute('data-confirm'); var targetUrl = button.getAttribute('data-target-url'); var redirectAfterClick = button.getAttribute('data-redirect-url'); - + var warningMessage = userSeedPanel.querySelector('.display-after-reset'); if (warningMessage.hasClassName('visible')) { warningMessage.removeClassName('visible'); } - + if (confirm(confirmMessage)) { new Ajax.Request(targetUrl, { method: "post", - onSuccess: function(rsp, _) { + onSuccess: function() { if (redirectAfterClick) { window.location.href = redirectAfterClick; } else { diff --git a/core/src/main/resources/lib/form/advanced/advanced.js b/core/src/main/resources/lib/form/advanced/advanced.js index 69725eb886d1..e4ccc443e746 100644 --- a/core/src/main/resources/lib/form/advanced/advanced.js +++ b/core/src/main/resources/lib/form/advanced/advanced.js @@ -17,8 +17,10 @@ Behaviour.specify("INPUT.advanced-button", 'advanced', 0, function(e) { var nameRef = tr.getAttribute("nameref"); while (container.lastElementChild != null) { var row = container.lastElementChild; - if(nameRef!=null && row.getAttribute("nameref")==null) - row.setAttribute("nameref",nameRef); // to handle inner rowSets, don't override existing values + // to handle inner rowSets, don't override existing values + if (nameRef != null && row.getAttribute("nameref") == null) { + row.setAttribute("nameref", nameRef); + } $(row).setOpacity(0); tr.parentNode.insertBefore(row, $(tr).next()); diff --git a/core/src/main/resources/lib/form/apply/apply.js b/core/src/main/resources/lib/form/apply/apply.js index d06911af4f32..bfcfab7456d5 100644 --- a/core/src/main/resources/lib/form/apply/apply.js +++ b/core/src/main/resources/lib/form/apply/apply.js @@ -51,7 +51,8 @@ Behaviour.specify("INPUT.apply-button", 'apply', 0, function (e) { contentWidth = r.width*3/4; } - if (oldError = $('error-description')) { + let oldError = $('error-description') + if (oldError) { // Remove old error if there is any $(containerId).removeChild(oldError); } diff --git a/core/src/main/resources/lib/form/breadcrumb-config-outline/init.js b/core/src/main/resources/lib/form/breadcrumb-config-outline/init.js index 6a74045ea3ff..d525c9ab0eed 100644 --- a/core/src/main/resources/lib/form/breadcrumb-config-outline/init.js +++ b/core/src/main/resources/lib/form/breadcrumb-config-outline/init.js @@ -9,8 +9,9 @@ Event.observe(window, "load", function () { if (cur != null) { id = cur.id; caption = caption.substring(caption.indexOf("</a>") + 4); - } else - $(e.section).insert({top:"#"}); + } else { + $(e.section).insert({top:"#"}); + } menu.add('#' + id, null, caption); }); var inpageNav = document.getElementById("inpage-nav") diff --git a/core/src/main/resources/lib/form/combobox/combobox.js b/core/src/main/resources/lib/form/combobox/combobox.js index c06b4f940049..22dd66a7c2e9 100644 --- a/core/src/main/resources/lib/form/combobox/combobox.js +++ b/core/src/main/resources/lib/form/combobox/combobox.js @@ -1,12 +1,14 @@ Behaviour.specify("INPUT.combobox2", 'combobox', 100, function(e) { var items = []; - var c = new ComboBox(e,function(value) { + new ComboBox(e,function(value) { var candidates = []; for (var i=0; i20) break; + if (candidates.length > 20) { + break; + } } } return candidates; diff --git a/core/src/main/resources/lib/form/confirm.js b/core/src/main/resources/lib/form/confirm.js index fe830207a1f2..0ed0a6450f5d 100644 --- a/core/src/main/resources/lib/form/confirm.js +++ b/core/src/main/resources/lib/form/confirm.js @@ -15,7 +15,7 @@ return errorMessage; } } - + function isIgnoringConfirm(element){ if(element.hasClassName('force-dirty')){ return false; @@ -25,19 +25,19 @@ } // to allow sub-section of the form to ignore confirm // especially useful for "pure" JavaScript area - // we try to gather the first parent with a marker, + // we try to gather the first parent with a marker, var dirtyPanel = element.up('.ignore-dirty-panel,.force-dirty-panel'); if(!dirtyPanel){ return false; } - + if(dirtyPanel.hasClassName('force-dirty-panel')){ return false; } if(dirtyPanel.hasClassName('ignore-dirty-panel')){ return true; } - + return false; } @@ -52,7 +52,7 @@ // don't consider 'advanced' buttons return false; } - + if(isIgnoringConfirm(btn)){ return false; } @@ -69,11 +69,11 @@ configForm = document.getElementsByName("viewConfig")[0]; } - YAHOO.util.Event.on($(configForm), "submit", clearConfirm, this); + YAHOO.util.Event.on($(configForm), "submit", clearConfirm, this); var buttons = configForm.getElementsByTagName("button"); var name; - for ( var i = 0; i < buttons.length; i++) { + for (let i = 0; i < buttons.length; i++) { var button = buttons[i]; name = button.parentNode.parentNode.getAttribute('name'); if (name == "Submit" || name == "Apply" || name == "OK") { @@ -88,7 +88,7 @@ } var inputs = configForm.getElementsByTagName("input"); - for ( var i = 0; i < inputs.length; i++) { + for (let i = 0; i < inputs.length; i++) { var input = inputs[i]; if(!isIgnoringConfirm(input)){ if (input.type == 'checkbox' || input.type == 'radio') { @@ -100,16 +100,16 @@ } inputs = configForm.getElementsByTagName("select"); - for ( var i = 0; i < inputs.length; i++) { - var input = inputs[i]; + for (let i = 0; i < inputs.length; i++) { + let input = inputs[i]; if(!isIgnoringConfirm(input)){ $(input).on('change', confirm); } } inputs = configForm.getElementsByTagName("textarea"); - for ( var i = 0; i < inputs.length; i++) { - var input = inputs[i]; + for (let i = 0; i < inputs.length; i++) { + let input = inputs[i]; if(!isIgnoringConfirm(input)){ $(input).on('input', confirm); } diff --git a/core/src/main/resources/lib/form/filter-menu-button/filter-menu-button.js b/core/src/main/resources/lib/form/filter-menu-button/filter-menu-button.js index fc6cc0dce2c7..d1df4da0beac 100644 --- a/core/src/main/resources/lib/form/filter-menu-button/filter-menu-button.js +++ b/core/src/main/resources/lib/form/filter-menu-button/filter-menu-button.js @@ -1,4 +1,4 @@ -function createFilterMenuButton(button, menu, menuAlignment, menuMinScrollHeight) { +window.createFilterMenuButton = function(button, menu, menuAlignment, menuMinScrollHeight) { var MIN_NUM_OPTIONS = 5; var menuButton = new YAHOO.widget.Button(button, { type: "menu", diff --git a/core/src/main/resources/lib/form/hetero-list/hetero-list.js b/core/src/main/resources/lib/form/hetero-list/hetero-list.js index 11a98c532daa..1b38b3d15738 100644 --- a/core/src/main/resources/lib/form/hetero-list/hetero-list.js +++ b/core/src/main/resources/lib/form/hetero-list/hetero-list.js @@ -4,7 +4,9 @@ // other behavior rules change them (like YUI buttons.) Behaviour.specify("DIV.hetero-list-container", 'hetero-list', -100, function(e) { e=$(e); - if(isInsideRemovable(e)) return; + if (isInsideRemovable(e)) { + return; + } // components for the add button var menu = document.createElement("SELECT"); @@ -16,8 +18,9 @@ Behaviour.specify("DIV.hetero-list-container", 'hetero-list', -100, function(e) YAHOO.util.Dom.insertAfter(menu,btn); var prototypes = $(e.lastElementChild); - while(!prototypes.hasClassName("prototypes")) - prototypes = prototypes.previous(); + while (!prototypes.hasClassName("prototypes")) { + prototypes = prototypes.previous(); + } var insertionPoint = prototypes.previous(); // this is where the new item is inserted. // extract templates @@ -45,9 +48,11 @@ Behaviour.specify("DIV.hetero-list-container", 'hetero-list', -100, function(e) var menuButton = createFilterMenuButton(btn, menu, menuAlign.split("-"), 250); $(menuButton._button).addClassName(btn.className); // copy class names $(menuButton._button).setAttribute("suffix",btn.getAttribute("suffix")); - menuButton.getMenu().clickEvent.subscribe(function(type,args,value) { + menuButton.getMenu().clickEvent.subscribe(function(type,args) { var item = args[1]; - if (item.cfg.getProperty("disabled")) return; + if (item.cfg.getProperty("disabled")) { + return; + } var t = templates[parseInt(item.value)]; var nc = document.createElement("div"); @@ -57,8 +62,6 @@ Behaviour.specify("DIV.hetero-list-container", 'hetero-list', -100, function(e) nc.innerHTML = t.html; $(nc).setOpacity(0); - var scroll = document.body.scrollTop; - renderOnDemand(findElementsBySelector(nc,"div.config-page")[0],function() { function findInsertionPoint() { // given the element to be inserted 'prospect', @@ -70,8 +73,9 @@ Behaviour.specify("DIV.hetero-list-container", 'hetero-list', -100, function(e) function desirability(pos) { var count=0; for (var i=0; i0) { - e = $(e).next(); - if (Element.hasClassName(e,"radio-block-start")) - cnt++; - if (Element.hasClassName(e,"radio-block-end")) - cnt--; + e = $(e).next(); + if (Element.hasClassName(e, "radio-block-start")) { + cnt++; + } + if (Element.hasClassName(e, "radio-block-end")) { + cnt--; + } } return e; })(); diff --git a/core/src/main/resources/lib/form/repeatable/repeatable.js b/core/src/main/resources/lib/form/repeatable/repeatable.js index e30e636c3820..eaa3bb78db96 100644 --- a/core/src/main/resources/lib/form/repeatable/repeatable.js +++ b/core/src/main/resources/lib/form/repeatable/repeatable.js @@ -57,7 +57,9 @@ var repeatableSupport = { this.container.insertBefore(nc, children[0]); } // Initialize drag & drop for this element - if (this.withDragDrop) registerSortableDragDrop(nc); + if (this.withDragDrop) { + registerSortableDragDrop(nc); + } new YAHOO.util.Anim(nc, { opacity: { to:1 } @@ -85,13 +87,13 @@ var repeatableSupport = { } } else { if (children.length == 1) { - var addButtonElements = $(this.container).childElements().findAll(function (b) { + addButtonElements = $(this.container).childElements().findAll(function (b) { return b.hasClassName("repeatable-add"); }); if (addButtonElements.length == 1 && this.enableTopButton) { - var buttonElement = addButtonElements[0]; - var parentOfButton = buttonElement.parentNode; + buttonElement = addButtonElements[0]; + parentOfButton = buttonElement.parentNode; var addTopButton = document.createElement('input'); addTopButton.type = 'button'; addTopButton.value = buttonElement.textContent || buttonElement.innerText; @@ -102,8 +104,9 @@ var repeatableSupport = { children[0].className = "repeated-chunk first last only"; } else { children[0].className = "repeated-chunk first"; - for (var i = 1; i < children.length - 1; i++) - children[i].className = "repeated-chunk middle"; + for (var i = 1; i < children.length - 1; i++) { + children[i].className = "repeated-chunk middle"; + } children[children.length - 1].className = "repeated-chunk last"; } } @@ -155,12 +158,15 @@ var repeatableSupport = { // do the ones that extract innerHTML so that they can get their original HTML before // other behavior rules change them (like YUI buttons.) Behaviour.specify("DIV.repeated-container", 'repeatable', -100, function(e) { - if(isInsideRemovable(e)) return; + if (isInsideRemovable(e)) { + return; + } // compute the insertion point var ip = $(e.lastElementChild); - while (!ip.hasClassName("repeatable-insertion-point")) - ip = ip.previous(); + while (!ip.hasClassName("repeatable-insertion-point")) { + ip = ip.previous(); + } // set up the logic object(repeatableSupport).init(e, e.firstChild, ip); }); @@ -215,7 +221,9 @@ Behaviour.specify("DIV.repeated-chunk", 'repeatable', -200, function(d) { } inputs[i].name = prefix + inputs[i].name; // Reselect anything unselected by browser before names uniquified: - if (inputs[i].defaultChecked) inputs[i].checked = true; + if (inputs[i].defaultChecked) { + inputs[i].checked = true; + } } } }); diff --git a/core/src/main/resources/lib/form/secretTextarea/secret.js b/core/src/main/resources/lib/form/secretTextarea/secret.js index d46feabab6c4..123ff62c20b3 100644 --- a/core/src/main/resources/lib/form/secretTextarea/secret.js +++ b/core/src/main/resources/lib/form/secretTextarea/secret.js @@ -24,7 +24,9 @@ Behaviour.specify('.secret', 'secret-button', 0, function (e) { var secretUpdateBtn = e.querySelector('.secret-update-btn'); - if (secretUpdateBtn === null) return; + if (secretUpdateBtn === null) { + return; + } var id = 'secret-' + (iota++); var name = e.getAttribute('data-name'); diff --git a/core/src/main/resources/lib/form/section_.js b/core/src/main/resources/lib/form/section_.js index a0c177c24726..c67f47012d83 100644 --- a/core/src/main/resources/lib/form/section_.js +++ b/core/src/main/resources/lib/form/section_.js @@ -1,4 +1,4 @@ -var section = (function (){ +window.section = (function (){ var SectionNode = function(e) { this.section = e; @@ -71,4 +71,4 @@ var section = (function (){ return top; } }; -})(); \ No newline at end of file +})(); diff --git a/core/src/main/resources/lib/form/select/select.js b/core/src/main/resources/lib/form/select/select.js index e4dfd20ab168..3b6348a9b80b 100644 --- a/core/src/main/resources/lib/form/select/select.js +++ b/core/src/main/resources/lib/form/select/select.js @@ -41,7 +41,9 @@ function updateListBox(listBox,url,config) { var currentSelection = l.value; // clear the contents - while(l.length>0) l.options[0] = null; + while (l.length > 0) { + l.options[0] = null; + } var selectionSet = false; // is the selection forced by the server? var possibleIndex = null; // if there's a new option that matches the current value, remember its index @@ -52,16 +54,18 @@ function updateListBox(listBox,url,config) { l.selectedIndex = i; selectionSet = true; } - if (opts[i].value==currentSelection) - possibleIndex = i; + if (opts[i].value == currentSelection) { + possibleIndex = i; + } } // if no value is explicitly selected by the server, try to select the same value if (!selectionSet && possibleIndex!=null) - l.selectedIndex = possibleIndex; + {l.selectedIndex = possibleIndex;} - if (originalOnSuccess!=undefined) - originalOnSuccess(rsp); + if (originalOnSuccess !== undefined) { + originalOnSuccess(rsp); + } }; config.onFailure = function (rsp) { l.removeClassName("select-ajax-pending"); @@ -74,7 +78,9 @@ function updateListBox(listBox,url,config) { var header = rsp.getResponseHeader('X-Jenkins-Select-Error'); if (header && "clear" === header.toLowerCase()) { // clear the contents - while (l.length > 0) l.options[0] = null; + while (l.length > 0) { + l.options[0] = null; + } } }; @@ -87,8 +93,9 @@ Behaviour.specify("SELECT.select", 'select', 1000, function(e) { function hasChanged(selectEl, originalValue) { // seems like a race condition allows this to fire before the 'selectEl' is defined. If that happens, exit.. - if(!selectEl || !selectEl.options || !selectEl.options.length > 0) + if (!selectEl || !selectEl.options || !selectEl.options.length > 0) { return false; + } var firstValue = selectEl.options[0].value; var selectedValue = selectEl.value; if (originalValue == "" && selectedValue == firstValue) { @@ -98,7 +105,7 @@ Behaviour.specify("SELECT.select", 'select', 1000, function(e) { } else { return originalValue != selectedValue; } - }; + } // controls that this SELECT box depends on refillOnChange(e,function(params) { @@ -112,7 +119,10 @@ Behaviour.specify("SELECT.select", 'select', 1000, function(e) { var v = e.getAttribute("value"); if (v) { e.value = v; - if (e.value==v) e.removeAttribute("value"); // we were able to apply our initial value + // we were able to apply our initial value + if (e.value == v) { + e.removeAttribute("value"); + } } } diff --git a/core/src/main/resources/lib/hudson/build-caption.js b/core/src/main/resources/lib/hudson/build-caption.js index 31534e6e789c..67bef633e53f 100644 --- a/core/src/main/resources/lib/hudson/build-caption.js +++ b/core/src/main/resources/lib/hudson/build-caption.js @@ -2,7 +2,7 @@ function updateBuildCaptionIcon(){ new Ajax.Request("statusIcon",{ method: "get", - onComplete: function(rsp,_) { + onComplete: function(rsp) { var isBuilding = rsp.getResponseHeader("X-Building"); if (isBuilding == "true") { setTimeout(updateBuildCaptionIcon, 5000) diff --git a/core/src/main/resources/lib/hudson/newFromList/validation.js b/core/src/main/resources/lib/hudson/newFromList/validation.js index fc93c2532e95..a6bddd00d8a0 100644 --- a/core/src/main/resources/lib/hudson/newFromList/validation.js +++ b/core/src/main/resources/lib/hudson/newFromList/validation.js @@ -13,7 +13,7 @@ function updateOk() { return true; } - for (i = 0; i < radios.length; i++) { + for (let i = 0; i < radios.length; i++) { if (radios[i].checked) { return false; } diff --git a/core/src/main/resources/lib/hudson/progressive-text.js b/core/src/main/resources/lib/hudson/progressive-text.js index 52541248ebd8..f3edc1926ab1 100644 --- a/core/src/main/resources/lib/hudson/progressive-text.js +++ b/core/src/main/resources/lib/hudson/progressive-text.js @@ -15,14 +15,15 @@ Behaviour.specify('.progressiveText-holder', 'progressive-text', 0, function (ho */ function fetchNext(e,href,onFinishEvent) { var headers = {}; - if (e.consoleAnnotator!=undefined) + if (e.consoleAnnotator !== undefined) { headers["X-ConsoleAnnotator"] = e.consoleAnnotator; + } new Ajax.Request(href,{ method: "post", parameters: {"start":e.fetchedBytes}, requestHeaders: headers, - onComplete: function(rsp,_) { + onComplete: function(rsp) { /* append text and do autoscroll if applicable */ var stickToBottom = scroller.isSticking(); var text = rsp.responseText; @@ -31,7 +32,9 @@ Behaviour.specify('.progressiveText-holder', 'progressive-text', 0, function (ho e.appendChild(p); // Needs to be first for IE p.innerHTML = text; Behaviour.applySubtree(p); - if(stickToBottom) scroller.scrollToBottom(); + if (stickToBottom) { + scroller.scrollToBottom(); + } } e.fetchedBytes = rsp.getResponseHeader("X-Text-Size"); diff --git a/core/src/main/resources/lib/hudson/projectViewNested.js b/core/src/main/resources/lib/hudson/projectViewNested.js index 0f358ecfdbc5..c0f6876ac686 100644 --- a/core/src/main/resources/lib/hudson/projectViewNested.js +++ b/core/src/main/resources/lib/hudson/projectViewNested.js @@ -1,18 +1,18 @@ /* * The MIT License - * + * * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -28,8 +28,9 @@ Behaviour.specify("IMG.treeview-fold-control", 'projectViewNested', 0, function( var tail = tr.nextSibling; img.oncollapsed = function() { - while (tr.nextSibling != tail) - tr.nextSibling.remove(); + while (tr.nextSibling != tail) { + tr.nextSibling.remove(); + } }; // fetch the nested view and load it when it's ready diff --git a/core/src/main/resources/lib/layout/breadcrumbs.js b/core/src/main/resources/lib/layout/breadcrumbs.js index c30107a7a7b3..a98f70d09a0b 100644 --- a/core/src/main/resources/lib/layout/breadcrumbs.js +++ b/core/src/main/resources/lib/layout/breadcrumbs.js @@ -1,6 +1,4 @@ -var breadcrumbs = (function() { - var Dom = YAHOO.util.Dom; - +window.breadcrumbs = (function() { /** * This component actually renders the menu. * @@ -18,6 +16,7 @@ var breadcrumbs = (function() { * * @type {YAHOO.util.Point} */ + // eslint-disable-next-line no-unused-vars var mouse; var logger = function() {}; @@ -30,7 +29,9 @@ var breadcrumbs = (function() { return iconXml + displaynameSpan; } - if (icon === null) return "" + displaynameSpan; + if (icon === null) { + return "" + displaynameSpan; + } // TODO: move this to the API response in a clean way var isSvgSprite = icon.toLowerCase().indexOf('svg#') !== -1; @@ -50,17 +51,25 @@ var breadcrumbs = (function() { mouse = new YAHOO.util.Point(ev.pageX,ev.pageY); }); - function combinePath(a,b) { - var qs; - var i = a.indexOf('?'); - if (i>=0) { qs=a.substring(i); a=a.substring(0,i); } - else qs=""; - - i=a.indexOf('#'); - if (i>=0) a=a.substring(0,i); - - if (a.endsWith('/')) return a+b+qs; - return a+'/'+b+qs; + function combinePath(a, b) { + var qs; + var i = a.indexOf("?"); + if (i >= 0) { + qs = a.substring(i); + a = a.substring(0, i); + } else { + qs = ""; + } + + i = a.indexOf("#"); + if (i >= 0) { + a = a.substring(0, i); + } + + if (a.endsWith("/")) { + return a + b + qs; + } + return a + "/" + b + qs; } function postRequest(action, event, url) { @@ -86,6 +95,8 @@ var breadcrumbs = (function() { /** * Wraps a delayed action and its cancellation. */ + // unsure if used in plugins + // eslint-disable-next-line no-unused-vars function Delayed(action, timeout) { this.schedule = function () { this.cancel(); @@ -120,7 +131,9 @@ var breadcrumbs = (function() { function showMenu(items) { menu.hide(); var pos = [e, "tl", "bl"]; - if ($(e).hasClassName("tl-tr")) pos = [e,"tl","tr"]; + if ($(e).hasClassName("tl-tr")) { + pos = [e, "tl", "tr"]; + } menu.cfg.setProperty("context", pos); menu.clearContent(); menu.addItems(items); @@ -128,9 +141,11 @@ var breadcrumbs = (function() { menu.show(); } - if (xhr) - xhr.options.onComplete = function () { - }; // ignore the currently pending call + // ignore the currently pending call + if (xhr) { + xhr.options.onComplete = function() { + }; + } if (e.items) {// use what's already loaded showMenu(e.items()); @@ -149,8 +164,9 @@ var breadcrumbs = (function() { } else { e.text = makeMenuHtml(e.icon, e.iconXml, e.displayName); } - if (e.subMenu!=null) - e.subMenu = {id:"submenu"+(iota++), itemdata:e.subMenu.items.each(fillMenuItem)}; + if (e.subMenu != null) { + e.subMenu = { id: "submenu" + (iota++), itemdata: e.subMenu.items.each(fillMenuItem) }; + } if (e.requiresConfirmation) { e.onclick = {fn: requireConfirmation, obj: {url: e.url, displayName: e.displayName, post: e.post}}; delete e.url; diff --git a/core/src/main/resources/lib/layout/confirmationLink/adjunct.js b/core/src/main/resources/lib/layout/confirmationLink/adjunct.js index 687b3b13285d..e8084b6640ca 100644 --- a/core/src/main/resources/lib/layout/confirmationLink/adjunct.js +++ b/core/src/main/resources/lib/layout/confirmationLink/adjunct.js @@ -1,5 +1,5 @@ Behaviour.specify("A.confirmation-link", 'confirmation-link', 0, function (element) { - element.onclick = function(event) { + element.onclick = function() { var post = element.getAttribute('data-post'); var href = element.getAttribute('data-url'); var message = element.getAttribute('data-message'); diff --git a/core/src/main/resources/lib/layout/progressiveRendering/progressiveRendering.js b/core/src/main/resources/lib/layout/progressiveRendering/progressiveRendering.js index 90507eb1ad77..a935cac52e17 100644 --- a/core/src/main/resources/lib/layout/progressiveRendering/progressiveRendering.js +++ b/core/src/main/resources/lib/layout/progressiveRendering/progressiveRendering.js @@ -47,7 +47,7 @@ function progressivelyRender(handler, callback, statusId) { handler.news(checkNews); }, timeout); } - handler.start(function(response) { + handler.start(function() { checkNewsLater(0); }); } diff --git a/war/.eslintrc.js b/war/.eslintrc.js index fce2602aacf4..b074152d92ae 100644 --- a/war/.eslintrc.js +++ b/war/.eslintrc.js @@ -2,28 +2,67 @@ module.exports = { env: { browser: true, - es2022: true + es2022: true, }, // Uses eslint default ruleset extends: ["eslint:recommended", "prettier"], parserOptions: { - sourceType: "module" + sourceType: "module", + ecmaVersion: 2022, + }, + rules: { + curly: "error", }, globals: { $: "readonly", + $$: "readonly", + $A: "readonly", + applyTooltip: "readonly", Ajax: "readonly", Atomics: "readonly", + AutoScroller: "readonly", Behaviour: "readonly", + breadcrumbs: "readonly", + buildFormTree: "readonly", + CodeMirror: "readonly", + ComboBox: "readonly", + createFilterMenuButton: "readonly", + createSearchBox: "readonly", + crumb: "readonly", + ensureVisible: "readonly", + findAncestor: "readonly", + findAncestorClass: "readonly", + findElementsBySelector: "readonly", + findFormParent: "readonly", + fireEvent: "readonly", getElementOverflowParams: "readonly", global: "readonly", Hash: "readonly", + hoverNotification: "readonly", + iota: "writeable", + isInsideRemovable: "readonly", isPageVisible: "readonly", isRunAsTest: "readonly", layoutUpdateCallback: "readonly", + loadScript: "readonly", + makeButton: "readonly", + object: "readonly", onSetupWizardInitialized: "readonly", + Prototype: "readonly", + refillOnChange: "readonly", + refreshPart: "readonly", + registerSortableDragDrop: "readonly", + renderOnDemand: "readonly", + rootURL: "readonly", + safeValidateButton: "readonly", + section: "readonly", setupWizardExtensions: "readonly", SharedArrayBuffer: "readonly", + shortenName: "readonly", toQueryString: "readonly", + ts_refresh: "readonly", + updateOptionalBlock: "readonly", + YAHOO: "readonly", '__dirname': false, diff --git a/war/package.json b/war/package.json index fa955462b9dd..755be7140b37 100644 --- a/war/package.json +++ b/war/package.json @@ -14,12 +14,12 @@ "prod": "webpack --config webpack.config.js --mode=production", "build": "yarn prod", "start": "yarn dev --watch", - "lint:js": "eslint . --ext js && prettier --check ../", - "lint:js-ci": "eslint . --ext js -f checkstyle -o target/eslint-warnings.xml && prettier --check ../", + "lint:js": "eslint --config .eslintrc.js ../ --ext js && prettier --check ../", + "lint:js-ci": "eslint --config .eslintrc.js ../ --ext js -f checkstyle -o target/eslint-warnings.xml && prettier --check ../", "lint:css": "stylelint src/main/less", "lint:css-ci": "stylelint src/main/less --custom-formatter stylelint-formatter.js -o target/stylelint-warnings.xml", "lint:ci": "yarn lint:js-ci && yarn lint:css-ci", - "lint:fix": "prettier --write ../ && stylelint src/main/less --fix", + "lint:fix": "prettier --write ../ && stylelint src/main/less --fix && eslint --config .eslintrc.js --fix ../", "lint": "yarn lint:js && yarn lint:css" }, "devDependencies": { diff --git a/war/src/main/js/filter-build-history.js b/war/src/main/js/filter-build-history.js index 3d66db26a344..f2d5e806c532 100644 --- a/war/src/main/js/filter-build-history.js +++ b/war/src/main/js/filter-build-history.js @@ -465,7 +465,9 @@ document.addEventListener("DOMContentLoaded", function () { debouncedFilter(); }) - if(isRunAsTest) return; + if (isRunAsTest) { + return; + } // If the build history pane is collapsed, just return immediately and don't set up // the build history refresh. diff --git a/war/src/main/js/sortable-drag-drop.js b/war/src/main/js/sortable-drag-drop.js index a98710c7528e..b6d3cf304bcf 100644 --- a/war/src/main/js/sortable-drag-drop.js +++ b/war/src/main/js/sortable-drag-drop.js @@ -13,10 +13,11 @@ import Sortable, { AutoScroll } from 'sortablejs/modular/sortable.core.esm.js'; Sortable.mount(new AutoScroll()); function registerSortableDragDrop(e) { - if (!e || !e.classList.contains('with-drag-drop')) return false; + if (!e || !e.classList.contains("with-drag-drop")) { + return false; + } - // eslint-disable-next-line no-unused-vars - const sortableElement = new Sortable(e, { + new Sortable(e, { draggable: '.repeated-chunk', handle: '.dd-handle', ghostClass: 'repeated-chunk--sortable-ghost',