1(function ($, Drupal) { 2 Drupal.behaviors.article_page = { 3 attach: function (context, settings) { 4 if (window.innerWidth < 768) { 5 if (settings.astro_article.read_more_on_main_article === true) { 6 const articleElements = 7 document.getElementsByClassName("main_article"); 8 if (articleElements) { 9 articleElements[0].classList.add("js_readmore"); 10 } 11 } 12 } 13 const contentBlocks = document.querySelectorAll( 14 ".related_article .js_readmore" 15 ); 16 contentBlocks.forEach((block) => { 17 const maxHeight = 250; 18 if (block.scrollHeight > maxHeight) { 19 block.style.maxHeight = maxHeight + "px"; 20 block.style.overflow = "hidden"; 21 block.style.position = "relative"; 22 block.style.marginBottom = "16px"; 23 const toggle_div = block.nextElementSibling; 24 const toggle = toggle_div?.querySelector(".article-read-more"); 25 if (toggle) { 26 toggle.style.display = "inline"; 27 toggle.addEventListener("click", (e) => { 28 e.preventDefault(); 29 if (block.style.maxHeight !== "none") { 30 block.style.maxHeight = "none"; 31 toggle.style.display = "none"; 32 overlay.style.display = "none"; 33 block.style.marginBottom = "0"; 34 } 35 }); 36 } 37 } 38 const overlay = document.createElement("div"); 39 overlay.className = "read-more-text-overlay"; 40 block.appendChild(overlay); 41 block.classList.add("js_readmore_processed"); 42 block.classList.remove("js_readmore"); 43 }); 44 const paras = document.querySelectorAll('.field--name-body p'); 45 if (paras.length) { 46 // Check if there is at least one <p> that contains only 47 const hasOnlyNbsp = Array.from(paras).some(p => p.innerHTML.trim() === ' '); 48 if (hasOnlyNbsp) { 49 paras.forEach(p => { 50 if (p.innerHTML.trim() === ' ') { 51 p.style.display = 'none'; 52 } 53 }); 54 } 55 } 56 }, 57 }; 58})(jQuery, Drupal);
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.