https://www.scienzanuovainstitute.it/wp-content/plugins/events-block/assets/js/frontend.js?ver=1.0.9
1/** 2 * Frontend JavaScript for Events Block 3 * Removes empty elements from the DOM 4 */ 5(function () { 6 'use strict'; 7 8 // Wait for DOM to be ready 9 if (document.readyState === 'loading') { 10 document.addEventListener('DOMContentLoaded', removeEmptyElements); 11 } else { 12 removeEmptyElements(); 13 } 14 15 function removeEmptyElements() { 16 // Select all event blocks 17 const eventBlocks = document.querySelectorAll('.evtb-front-view .evtb-event-details-inner'); 18 19 eventBlocks.forEach(function (block) { 20 // Find all paragraphs and headings with specific classes 21 const selectors = [ 22 'p.evtb-event-description', 23 'p.evtb-event-location', 24 'p.evtb-event-price', 25 'p.evtb-event-time', 26 'h1.evtb-event-title', 27 'h2.evtb-event-title', 28 'h3.evtb-event-title', 29 'h4.evtb-event-title', 30 'h5.evtb-event-title', 31 'h6.evtb-event-title' 32 ]; 33 34 selectors.forEach(function (selector) { 35 const elements = block.querySelectorAll(selector); 36 elements.forEach(function (element) { 37 // Check if element is truly empty (no text content after trimming) 38 if (!element.textContent.trim()) { 39 // Remove the element completely from the DOM 40 element.remove(); 41 } 42 }); 43 }); 44 45 // Remove Read More buttons with empty or invalid hrefs 46 const readMoreButtons = block.querySelectorAll('.evtb-event-read-more a'); 47 readMoreButtons.forEach(function (button) { 48 const href = button.getAttribute('href'); 49 if (!href || href === '' || href === '#') { 50 // Remove the entire button wrapper 51 const buttonWrapper = button.closest('.wp-block-button'); 52 if (buttonWrapper) { 53 buttonWrapper.remove(); 54 } 55 } 56 }); 57 58 // Remove empty wrapper divs after cleaning up their children 59 const wrapperSelectors = [ 60 '.evtb-price-read-more', 61 '.evtb-event-detail', 62 '.wp-block-buttons' 63 ]; 64 65 wrapperSelectors.forEach(function (selector) { 66 const wrappers = block.querySelectorAll(selector); 67 wrappers.forEach(function (wrapper) { 68 // Check if wrapper has no visible content after cleanup 69 if (!wrapper.textContent.trim() && wrapper.children.length === 0) { 70 wrapper.remove(); 71 } 72 }); 73 }); 74 }); 75 } 76})();
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.