fix: 🐛 popup modal does not trigger when more than one button on page
This commit is contained in:
parent
1e3566bd95
commit
cbcac29561
1 changed files with 13 additions and 11 deletions
|
@ -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>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue