fix: 🐛 popup modal does not trigger when more than one button on page

This commit is contained in:
Sebin Nyshkim 2025-06-22 01:38:51 +02:00
parent 1e3566bd95
commit cbcac29561

View file

@ -1,16 +1,18 @@
<script> <script>
const nsfwButton = document.querySelector('#nsfw-toggle'); const nsfwButtonBtns = document.querySelectorAll('.nsfw-toggle');
nsfwButton.addEventListener('click', () => { nsfwButtonBtns.forEach((btn) =>
const isInHornyJail = storeProxy.getItem('isInHornyJail') === 'true'; btn.addEventListener('click', () => {
const isHorny = storeProxy.getItem('isHorny') === 'true'; const isInHornyJail = storeProxy.getItem('isInHornyJail') === 'true';
const isHorny = storeProxy.getItem('isHorny') === 'true';
if (isInHornyJail) { if (isInHornyJail) {
storeProxy.setItem('isHorny', !isHorny); storeProxy.setItem('isHorny', !isHorny);
} else { } else {
open(); open();
} }
}); })
);
</script> </script>
<div webc:root="override"> <div webc:root="override">
@ -20,7 +22,7 @@
</div> </div>
</div> </div>
<ref-button id="nsfw-toggle" command="show-modal" commandfor="nsfw-warning"> <ref-button class="nsfw-toggle" command="show-modal" commandfor="nsfw-warning">
Reveal/Hide Reveal/Hide
</ref-button> </ref-button>