1var linkLogo = '<span class="icon-menu-arrow" style="background-image: none;"><svg role="presentation" width="10" height="15" viewBox="0 0 10 15" version="1.1" xmlns="http://www.w3.org/2000/svg" focusable="false"><title>Arrow icon</title><g id="C01.02_Navigation_&_Search" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="C01.02_Navigation_Search_Mobile" transform="translate(-281 -169)" fill="#262626"><g id="C01.02_Navigation_Secondary_Links" transform="translate(0 60)"><g id="Nav_item_1" transform="translate(20 91)"><path d="M259.071 20.071h9v2h-8v8h-2v-10h1z" id="Icon_arrow" transform="rotate(135 263.071 25.071)"></path></g></g></g></g></svg></span>'; 2 3// Here, we add a class to the links so they look like the "secondary" links from our main website. Sadly couldn't make it work directly in the block. 4 5document.addEventListener("DOMContentLoaded", function(event) { 6 if (document.querySelector('.wp-block-brc-related-links-card')){ 7 var lists = document.querySelectorAll('.wp-block-brc-related-links-card'); 8 9 for (let i = 0; i < lists.length; i++) { 10 var listItemsLink = lists[i].querySelectorAll('.related-links-card--link a'); 11 12 // Add secondary class on all links 13 for (let j = 0; j < listItemsLink.length; j++) { 14 var k = listItemsLink[j].innerHTML 15 listItemsLink[j].classList.add('secondary'); 16 listItemsLink[j].innerHTML = linkLogo + k; 17 } 18 } 19 }; 20 21 let resources = document.querySelectorAll('.related-links-card--wrapper.js-listing-result'); 22 23 for (let i = 0; i < resources.length; i++) { 24 const element = resources[i]; 25 26 if (element.querySelector('a')) { 27 element.addEventListener('click', function(e){ 28 let link = e.currentTarget.querySelector('a'); 29 30 link.click(); 31 }) 32 } 33 } 34});
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.