1/* 2================================================== 3popup auf Bildern zeigen Popups [jQuery] 4================================================== 5vgl. BizLiNK 7952ba5d vom 16.6.2023 (+ folgende) für BIZ-295 6*/ 7et.popup = {} 8et.popup.init = function () { 9 $('.has-popup').each(function(){ 10 const h = $(this), 11 popupId = h.attr('id'), 12 autoPopupDays = h.data('autopopupdays'), 13 now = Math.floor(Date.now() / 1000); 14 h.find('.btn-close').click(function(e) { 15 et.popup.hide(h); 16 }); 17 h.find('.btn-open').click(function(e) { 18 et.popup.hide('.has-popup'); 19 et.popup.show(h, popupId, now); 20 }); 21 h.click(function(e){ 22 if ($(e.target).is('.wrap-popup')) { 23 et.popup.hide(h); 24 } 25 }); 26 if(autoPopupDays && et.popup.notBlocked()) { 27 if (autoPopupDays == 'always') { 28 et.popup.show(h, popupId, now); 29 } 30 else if (autoPopupDays == 'session') { 31 if (!sessionStorage.getItem("popup-seen-" + popupId)) { 32 et.popup.show(h, popupId); 33 } 34 } 35 else if (Number(autoPopupDays)) { 36 const lastPopup = localStorage.getItem("popup-seen-" + popupId) || 0, 37 diff = now - lastPopup, 38 diffDays = diff/86400; 39 if (diffDays > Number(autoPopupDays)) { 40 et.popup.show(h, popupId, now); 41 } 42 console.log(diffDays, autoPopupDays); 43 } 44 } 45 }); 46} 47et.popup.show = function (p, popupId, now) { 48 $(p).each(function(){ 49 $(this).find('.wrap-popup').fadeIn().removeAttr('aria-hidden').removeAttr('inert');; 50 $(this).find('.btn-open, .btn-close').attr('aria-expanded', true); 51 }); 52 if (now) { 53 localStorage.setItem("popup-seen-" + popupId, now); 54 } else { 55 sessionStorage.setItem("popup-seen-" + popupId, 1); 56 } 57}; 58et.popup.hide = function (p) { 59 $(p).each(function(){ 60 $(this).find('.wrap-popup').fadeOut().attr('aria-hidden', 'true').attr('inert', ''); 61 $(this).find('.btn-open, .btn-close').attr('aria-expanded', false); 62 }); 63}; 64function cookieExists(cookieName) { 65 const cookies = document.cookie.split(';').map(cookie => cookie.trim()); // Alle Cookies aufteilen und Leerzeichen entfernen 66 return cookies.some(cookie => cookie.startsWith(cookieName + "=")); // Suche das gewünschte Cookie 67} 68 69et.popup.notBlocked = function () { 70 if ($('body').is('.cookiebanner-erzbistum') && !cookieExists('allowedCookies')) { 71 return false; 72 } 73 if ($('body').is('.cookiebanner-subsite') && !cookieExists('allowedCookiesSub')) { 74 return false; 75 } 76 return true; 77} 78$(document).ready(function () { 79 et.popup.init(); 80});
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.