Skip to content

Commit

Permalink
Simplified user-defined modal integration. Fixes GH-255
Browse files Browse the repository at this point in the history
  • Loading branch information
Daveiano committed Nov 23, 2024
1 parent a5ad537 commit a687cff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -941,3 +941,4 @@ index 465d4ad..aa8bad6 100644
- Fixed gauge label decoding. GH-271
- Add Moon phases and planet name translations GH-264
- Added option to only color the text in the colored temperatur stat tile GH-243
- Simplified adding of user defined modals GH-255
13 changes: 13 additions & 0 deletions skins/weewx-wdc/includes/footer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,16 @@
</div>
</div>
</div>

<!-- User modal -->
<script type="text/javascript">
document
.querySelectorAll('[id^=user-modal-button]')
.forEach((button) => {
button.addEventListener('click', (event) => {
const modalButton = event.target.closest('[id^=user-modal-button]');
const modalContentId = modalButton.id.replace('button', 'content');
document.getElementById(modalContentId).open = true;
}, true);
});
</script>

0 comments on commit a687cff

Please sign in to comment.