1 2function limitWords(paragraphClass, maxWords, articleUrl) { 3 const paragraphs = document.querySelectorAll('.' + paragraphClass); 4 const readMoreLinks = document.querySelectorAll('.' + paragraphClass + ' .Read-MoreArticle a'); 5 6 paragraphs.forEach((paragraph, index) => { 7 if (paragraph.innerText) { 8 const words = paragraph.innerText.split(' '); 9 10 if (words.length > maxWords) { 11 const truncatedText = words.slice(0, maxWords).join(' '); 12 paragraph.innerHTML = truncatedText + ' <span class="Read-MoreArticle">' + readMoreLinks[index].outerHTML + '</span>'; 13 } 14 } 15 }); 16 17 readMoreLinks.forEach(link => { 18 link.href = articleUrl; // Replace 'articleUrl' with the actual URL for the corresponding article 19 }); 20 } 21 22limitWords('Article-SnippetText', 15, '{url}play'); 23limitWords('Article-SnippetText-xs', 15, '{url}play'); 24 25 26 27 28
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.