1class SitewideElementsLoader{static setChildPath(path){this.childPath=path} 2static getSitewideElementBlocks(){const blocks=this.data;return[...blocks]} 3static initLoad(url='/site_wide_elements.json'){url=this.childPath+url;return new Promise((resolve,reject)=>{fetch(url).then(response=>response.json()).then(data=>{this.data=[...data];resolve()}).catch(error=>{reject(error)})})} 4static async replaceBlocks(){const promises=[];for(const uuid of this.getSitewideElementBlocks()){const blocks=document.querySelectorAll(`[uuid='${uuid}']`);if(blocks&&blocks.length){let contentUrl=`swe_templates/${uuid}.html`;if(!contentUrl.startsWith('/')){contentUrl=`/${contentUrl}`} 5contentUrl=this.childPath+contentUrl;const promise=fetch(contentUrl).then(response=>response.text()).then(content=>{blocks.forEach(block=>{block.innerHTML=content})});promises.push(promise)}} 6await Promise.all(promises);const event=new Event('DOMContentLoaded',{bubbles:!0,cancelable:!0,});document.dispatchEvent(event)} 7static init(){if(this.initialized===!0){return} 8this.initialized=!0;this.initLoad().then(async()=>{await this.replaceBlocks()})}} 9window.sitewideElementsLoader=SitewideElementsLoader
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.