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>
const nsfwButton = document.querySelector('#nsfw-toggle');
const nsfwButtonBtns = document.querySelectorAll('.nsfw-toggle');
nsfwButton.addEventListener('click', () => {
const isInHornyJail = storeProxy.getItem('isInHornyJail') === 'true';
const isHorny = storeProxy.getItem('isHorny') === 'true';
nsfwButtonBtns.forEach((btn) =>
btn.addEventListener('click', () => {
const isInHornyJail = storeProxy.getItem('isInHornyJail') === 'true';
const isHorny = storeProxy.getItem('isHorny') === 'true';
if (isInHornyJail) {
storeProxy.setItem('isHorny', !isHorny);
} else {
open();
}
});
if (isInHornyJail) {
storeProxy.setItem('isHorny', !isHorny);
} else {
open();
}
})
);
</script>
<div webc:root="override">
@ -20,7 +22,7 @@
</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
</ref-button>