1const checkIsClientLocal = () => { 2 var host = window.location.host; 3 if (host.toLowerCase() && host.toLowerCase().indexOf('localhost:') !== -1) { 4 return true; 5 } 6 return false; 7}; 8 9const getFilePath = filename => { 10 let url = window.PUBLIC_URL + '/' + window.location.host + `.${filename}`; 11 if (checkIsClientLocal()) { 12 url = window.PUBLIC_URL + '/localhost:3023' + `.${filename}`; 13 } 14 return url; 15}; 16 17const setManifest = () => { 18 let url = getFilePath('manifest.json'); 19 var link = document.createElement('link'); 20 link.href = url; 21 link.rel = 'manifest'; 22 document.getElementsByTagName('head')[0].appendChild(link); 23}; 24 25const setScript = () => { 26 let url = getFilePath('script.js'); 27 var scriptRef = document.createElement('script'); 28 scriptRef.setAttribute('type', 'text/javascript'); 29 scriptRef.setAttribute('src', url); 30 document.getElementsByTagName('head')[0].appendChild(scriptRef); 31}; 32 33const createMetaTag = (key, value) => { 34 var link = document.createElement('meta'); 35 link.setAttribute('property', key); 36 link.content = value; 37 document.getElementsByTagName('head')[0].appendChild(link); 38}; 39 40const setOGInfo = () => { 41 if (window.ogInfo) { 42 const { 43 title: ogTitle, 44 description: ogDescription, 45 url: ogUrl, 46 image: ogImage, 47 } = window.ogInfo; 48 createMetaTag('og:title', ogTitle); 49 createMetaTag('og:description', ogDescription); 50 createMetaTag('og:url', ogUrl); 51 createMetaTag('og:image', ogImage); 52 createMetaTag('og:image:secure_url', ogImage); 53 } 54}; 55 56const setWebsiteInfo = () => { 57 if (window.websiteInfo) { 58 const { title, favicon, appleTouchIcon } = window.websiteInfo; 59 document.title = title; 60 var link = document.querySelector("link[rel*='icon']") || document.createElement('link'); 61 link.type = 'image/x-icon'; 62 link.rel = 'shortcut icon'; 63 link.href = favicon; 64 65 var appleIconlink = document.querySelector("link[rel*='apple-touch-icon']") || document.createElement('link'); 66 appleIconlink.type = 'image/png'; 67 appleIconlink.rel = 'apple-touch-icon'; 68 appleIconlink.href = appleTouchIcon; 69 70 document.getElementsByTagName('head')[0].appendChild(link); 71 document.getElementsByTagName('head')[0].appendChild(appleIconlink); 72 } 73}; 74 75const init = () => { 76 setManifest(); 77 setScript(); 78 setTimeout(() => { 79 setOGInfo(); 80 setWebsiteInfo(); 81 }, 1000); 82}; 83 84init();
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.