1jQuery(function ($) { 2 if ($('.bit-modal').length === 0) { 3 return; 4 } 5 6 tryShowBits(); 7 8 function tryShowBits() { 9 const now = Date.now(); 10 const dialogs = []; 11 12 // 1ï¸â£ Dialoge sammeln 13 $('dialog.bit-modal').each(function () { 14 const dlg = this; 15 const bitId = dlg.dataset.bitId || dlg.id || 'default'; 16 const startISO = dlg.dataset.bitStart; 17 const endISO = dlg.dataset.bitEnd; 18 const updatedISO = dlg.dataset.bitUpdated || dlg.dataset.bitStart; 19 const intervalStr = dlg.dataset.bitInterval || '60min'; 20 21 const startTs = startISO ? new Date(startISO).getTime() : 0; 22 const endTs = endISO ? new Date(endISO).getTime() : Infinity; 23 const updatedTs = updatedISO ? new Date(updatedISO).getTime() : 0; 24 25 const intervalNum = parseInt(intervalStr); 26 const intervalMs = intervalNum * 60 * 1000; 27 28 const lastShownKey = 'staude_bit_last_shown_' + bitId; 29 const lastShown = parseInt(localStorage.getItem(lastShownKey) || '0', 10); 30 31 if (updatedTs > lastShown) localStorage.removeItem(lastShownKey); 32 if (now < startTs || now > endTs) return; 33 34 const lastShownAfterReset = parseInt(localStorage.getItem(lastShownKey) || '0', 10); 35 if (now - lastShownAfterReset > intervalMs) { 36 dialogs.push({ dlg, lastShownKey }); 37 } 38 }); 39 40 dialogs.sort((a, b) => { 41 const aOrder = parseInt(a.dlg.dataset.bitOrder || 0, 10); 42 const bOrder = parseInt(b.dlg.dataset.bitOrder || 0, 10); 43 return aOrder - bOrder; 44 }); 45 46 if (dialogs.length === 0) return; 47 48 // 2ï¸â£ Zentraler Queue-Index 49 let currentIndex = 0; 50 51 // 3ï¸â£ Funktion zum Ãffnen 52 function openNextDialog() { 53 if (currentIndex >= dialogs.length) return; 54 const { dlg, lastShownKey } = dialogs[currentIndex]; 55 currentIndex++; 56 57 try { 58 if (typeof dlg.showModal === 'function') dlg.showModal(); 59 else dlg.setAttribute('open', ''); 60 localStorage.setItem(lastShownKey, Date.now().toString()); 61 } catch (err) { 62 console.warn('Fehler beim Ãffnen des Dialogs:', err); 63 openNextDialog(); // zum nächsten 64 return; 65 } 66 67 // SchlieÃen per Button 68 $(dlg).find('.bit-close, .bit-modal-close').off('click').on('click', function (e) { 69 e.preventDefault(); 70 dlg.close(); 71 }); 72 73 // Klick auf Hintergrund 74 dlg.addEventListener('click', function onClick(e) { 75 if (e.target === dlg) dlg.close(); 76 }); 77 78 // ð¦ Nur einmaligen globalen "close"-Listener setzen 79 dlg.addEventListener('close', function onClose() { 80 dlg.removeEventListener('close', onClose); // kein Doppel-Event 81 setTimeout(() => openNextDialog(), 300); 82 }); 83 } 84 85 // 4ï¸â£ Start der Sequenz 86 openNextDialog(); 87 } 88});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.