PageSourceSearch

https://inkas.org/assets/design/legacy-links.js

js inkas.org collected 2026-10-03 00:52:01 UTC 1,204 bytes, 21 lines download raw bytes

1const domains=['inkas.org','inkas.or.kr','daum.net','facebook.com','fb.com','fb.me'];
2const publicHosts=new Set(['inkas.org','www.inkas.org']);
3const currentPage=/^\/(?:$|(?:en|ko)\/?$|(?:(?:en|ko)\/)?(?:about|news|gallery|post|programs|information|involved|transparency|contact|donate|account|login|privacy|staff)(?:\/|$))/;
4export function isLegacyLink(value){
5  const text=String(value||'').trim();
6  // Relative navigation and ordinary labels are not old source URLs. Resolving
7  // them against location.origin stripped the whole site after domain cutover.
8  if(!/^(?:https?:)?\/\//i.test(text))return false;
9  try{
10    const address=new URL(text,'https://www.inkas.org');
11    if(publicHosts.has(address.hostname)&&currentPage.test(address.pathname))return false;
12    return /^https?:$/.test(address.protocol)&&domains.some(domain=>address.hostname===domain||address.hostname.endsWith('.'+domain));
13  }catch{return false;}
14}
15export function removeLegacyLinks(root){
16  for(const a of root.querySelectorAll('a[href]')){
17    if(!isLegacyLink(a.getAttribute('href')))continue;
18    if(isLegacyLink(a.textContent.trim())&&!a.querySelector('img'))a.remove();
19    else a.replaceWith(...a.childNodes);
20  }
21}

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.