1export default function LoadLiveImages() { 2 3 // If you uploaded your own image to a post to test, add the word "test" to the page title to prevent this script from running 4 if(document.querySelector('.article-header__title') && document.querySelector('.article-header__title').textContent.toLowerCase().includes('test') || document.querySelector('article h3') && document.querySelector('article h3').textContent.toLowerCase().includes('test')) return; 5 6 const url = window.location.href; 7 8 let liveImgURL = ""; 9 let liveSourceURL = ""; 10 11 const allImagesArr = [...document.querySelectorAll("img"), ...document.querySelectorAll("source")] 12 13 allImagesArr.forEach((img) => { 14 if (url.includes("localhost")) 15 liveImgURL = img.src 16 .replace("localhost/", "") 17 .replace("/wp-content", ".com/wp-content"); 18 19 liveSourceURL = img.srcset 20 .replace("localhost/", "") 21 .replace("/wp-content", ".com/wp-content"); 22 23 if ( 24 url.includes("b2b-gdm-figaro1.pantheonsite.io") && 25 !url.includes("fe-testing") && !url.includes("sing-re") 26 ) { 27 liveImgURL = img.src.replace( 28 url.substring(url.indexOf("//") + 2, url.indexOf("-b2b-gdm-figaro1")),`live`); 29 30 liveSourceURL = img.srcset.replace( 31 url.substring(url.indexOf("//") + 2, url.indexOf("-b2b-gdm-figaro1")),`live`); 32 } 33 34 if ( 35 url.includes("b2b-gdm-figaro2.pantheonsite.io") && 36 !url.includes("fe-testing") 37 ) { 38 liveImgURL = img.src.replace( 39 url.substring(url.indexOf("//") + 2, url.indexOf("-b2b-gdm-figaro2")), `live`); 40 41 liveSourceURL = img.srcset.replace( 42 url.substring(url.indexOf("//") + 2, url.indexOf("-b2b-gdm-figaro2")), `live`); 43 } 44 45 liveImgURL !== "" && img.setAttribute("src", liveImgURL); 46 liveSourceURL !== "" && img.setAttribute("srcset", liveSourceURL); 47 }); 48}
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.