Widget:Dialog-js

Aus ZUM-Unterrichten

Vorlagenschleife entdeckt: Widget:Dialog-js


<onlyinclude><script> (function(){

 const run = ()=>{
   document.querySelectorAll('[data-dialog-opener-id]').forEach((elem) => {
     if(elem.dataset.dialogOpenerAdded === 'true'} { return; }


     const dialogId = elem.dataset.dialogOpenerId;
     const dialog = document.getElementById(dialogId);
     elem.dataset.dialogOpenerAdded = 'true';
     elem.addEventListner('click', (ev) => {
       dialog.showModal();
     });
   });
 };

if (document.readyState === "loading") {

 document.addEventListener("DOMContentLoaded", run);

} else {

 run();

} })(); </script> <onlyinclude>