PageSourceSearch

https://www.euronews.com/build-external/external-partner-module-in…?ver=45e8ac727680c0d80407a74c8de7fbdf

js euronews.com collected 2026-09-24 06:03:29 UTC 2,715 bytes, 5 lines download raw bytes

1function e(e){return e.nodeName===`LINK`}var t=class{constructor({node:e,baseDomain:t}){this.baseDomain=t,this.headerEndpoint=`${this.baseDomain}/api/partners/header`,console.debug(`Euronews Header Config:`,{baseDomain:this.baseDomain,headerEndpoint:this.headerEndpoint}),this.shadowRoot=e.attachShadow({mode:`open`})}async loadHeader(){try{let e=await this.fetchHeader();await this.processHeader(e)}catch(e){console.error(`Error loading header:`,e),this.showErrorState()}}async fetchHeader(){let e=await fetch(this.headerEndpoint);return console.debug(`Euronews Header Response:`,e),await e.text()}async processHeader(e){let t=new DOMParser().parseFromString(e,`text/html`);this.fixRelativeUrls(t);let n=Array.from(t.querySelectorAll(`style, link[rel="stylesheet"]`));n.forEach(e=>e.remove());let r=Array.from(t.querySelectorAll(`script`));r.forEach(e=>e.remove());let i=Array.from(t.head.querySelectorAll(`meta`));i.forEach(e=>e.remove());let a=Array.from(t.body.children);a.forEach(e=>e.remove()),await this.injectStyles(n,this.shadowRoot),this.injectNodes(i,document.head),this.injectNodes(a,this.shadowRoot),this.injectScriptNodes(r,this.shadowRoot)}fixRelativeUrls(e){Array.from(e.querySelectorAll(`[href]`)).filter(e=>{let t=e.getAttribute(`href`);return!/^(https?:)?\/\//.test(t)}).forEach(e=>e.setAttribute(`href`,`${this.baseDomain}${e.getAttribute(`href`)}`)),Array.from(e.querySelectorAll(`[src]`)).filter(e=>{let t=e.getAttribute(`src`);return!/^(https?:)?\/\//.test(t)}).forEach(e=>e.setAttribute(`src`,`${this.baseDomain}${e.getAttribute(`src`)}`))}async injectStyles(t,n){let r=Array.from(t).map(async t=>{let r=document.createElement(`style`);e(t)?(r.textContent=await(await fetch(t.href)).text(),n.appendChild(r)):(r.textContent=t.textContent,n.appendChild(r)),r.textContent?.includes(`@font-face`)&&r.textContent.includes(`url(`)&&document.head.appendChild(r.cloneNode(!0))});await Promise.allSettled(r)}injectNodes(e,t){for(let n of e){let e=n.cloneNode(!0);t.appendChild(e)}}injectScriptNodes(e,t){for(let n of e){let e=document.createElement(`script`);n.src?e.src=n.src:e.textContent=n.textContent,t.appendChild(e)}}showErrorState(){this.shadowRoot.innerHTML=`
2      <a style="text-align: center; width: 100%" href="euronews.com">
3        Euronews
4      </a>
5    `}};function n(e){document.readyState===`complete`?e():document.addEventListener(`DOMContentLoaded`,e)}function r(){try{let e=document.currentScript?.getAttribute(`src`);return new URL(e??`https://www.euronews.com`).origin}catch{return`https://www.euronews.com`}}var i=r();n(()=>{let e=document.getElementById(`euronews-header`);if(!e)throw Error(`No #euronews-header container found`);new t({node:e,baseDomain:i}).loadHeader()});

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.