1const { runTests, addCheck } = await import('./_run_tests_var.js'); 2/* ============================================================= 3FUNCTION text_make_long_links_wrap() 4 5- Find links with long url text and allow to break 6 7================================================================= */ 8 9export function text_make_long_links_wrap() { 10 var all_links = document.querySelectorAll("#content a"); 11 for (let i = 0; i < all_links.length; i++) { 12 const link = all_links[i]; 13 if (link.text.match("http://") != null || link.text.match("https://") != null) { 14 link.classList.add("long-url"); 15 } 16 } 17 18 // run tests 19 if (runTests) { 20 // Check if any long links don't have the class 21 22 for(var i = 0; i < all_links.length; i++) { 23 var link = all_links[i]; 24 if((link.text.includes("http://") || link.text.includes("https://")) && !link.classList.contains("long-url")) { 25 console.log("Test failed on link: " + link.href); 26 addCheck('longUrls', false); 27 } else if((link.text.includes("http://") || link.text.includes("https://")) && link.classList.contains("long-url")) { 28 addCheck('longUrls'); 29 } 30 } 31 32 } 33}
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.