Skip to content

Commit

Permalink
[JENKINS-73875] CSP compatibility for NewNodeConsoleNote (#477)
Browse files Browse the repository at this point in the history
Co-authored-by: Basil Crow <[email protected]>
  • Loading branch information
shlomomdahan and basil authored Oct 10, 2024
1 parent a9ea405 commit 559bc71
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ Behaviour.specify("span.pipeline-new-node", 'NewNodeConsoleNote', 0, function(e)
var nodeId = e.getAttribute('nodeId')
var startId = e.getAttribute('startId')
if (startId == null || startId == nodeId) {
e.innerHTML = e.innerHTML.replace(/.+/, '$&<span class="pipeline-show-hide"> (<a href="#" onclick="showHidePipelineSection(this); return false">hide</a>)</span>')
e.innerHTML = e.innerHTML.replace(/.+/, '$&<span class="pipeline-show-hide"> (<a href="#" class="pipeline-toggle">hide</a>)</span>')
const toggles = e.querySelectorAll('.pipeline-show-hide .pipeline-toggle');
const toggle = toggles[toggles.length - 1];
toggle.addEventListener('click', (event) => {
event.preventDefault();
showHidePipelineSection(toggle);
});
// TODO automatically hide second and subsequent branches: namely, in case a node has the same parent as an earlier one
}
// The CSS rule for branch names only needs to be added once per node, so we
Expand Down

0 comments on commit 559bc71

Please sign in to comment.