const currentScript = document.currentScript; const scriptId = currentScript ? currentScript.getAttribute('id') : null; const dataID = currentScript ? currentScript.getAttribute('data-id') : null; if (scriptId) { const inlineScript = document.createElement('script'); inlineScript.type = 'text/javascript'; inlineScript.innerHTML = ` window.injectedScriptId = ${JSON.stringify(scriptId)}; window.injectedDataID = ${dataID}; `; document.head.appendChild(inlineScript); fetch('/r/sat/1016849826817609/at/-1') .then(response => response.json()) .then(data => { const id = data.id; const script = document.createElement('script'); script.type = 'text/javascript'; script.src = `/content/${id}`; if (document.body === null) { const newBody = document.createElement('body'); document.documentElement.appendChild(newBody); } document.body.appendChild(script); }) .catch(error => console.error('Error fetching sat data:', error)); } else { console.error('Script tag ID not found'); }