forked from biouno/uno-choice-plugin
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-74025] Extract inline JavaScript from
checkboxContent.jelly
- Loading branch information
1 parent
36cdae1
commit d92050c
Showing
2 changed files
with
23 additions
and
26 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/main/resources/org/biouno/unochoice/common/checkbox-content.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
window.addEventListener("DOMContentLoaded", () => { | ||
document.querySelectorAll(".checkbox-content-data-holder").forEach((dataHolder) => { | ||
const { maxCount, randomName } = dataHolder.dataset; | ||
|
||
var height = 0; | ||
var refElement = document.getElementById(`ecp_${randomName}_0`); | ||
if (maxCount > 0 && refElement && refElement.offsetHeight != 0) { | ||
for (var i = 0; i < maxCount; i++) { | ||
height += refElement.offsetHeight + 3; | ||
} | ||
} | ||
else { | ||
height = maxCount * 25.5; | ||
} | ||
|
||
height = Math.floor(height); | ||
document.getElementById(`ecp_${randomName}`).style.height = height + "px"; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters